Commit baacc4b1 authored by 莫林毅's avatar 莫林毅

预分析与建模->数据模型管理 ->模型维护 功能 增加 ‘数据编码’字段[! 后台代码代码 不完全改动]

parent 66b8c680
...@@ -28,6 +28,8 @@ public class ModelParameter implements Serializable{ ...@@ -28,6 +28,8 @@ public class ModelParameter implements Serializable{
private Long taskId;//任务表ID private Long taskId;//任务表ID
private Long ifSystemDefault;//是否系统默认 private Long ifSystemDefault;//是否系统默认
private String parameterCode; /// 参数编码 by molinyi
@Id @Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ModelParameterSequence") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ModelParameterSequence")
@SequenceGenerator(name = "ModelParameterSequence", sequenceName = "fxjm_model_parameter_info_t_seq", allocationSize=1) @SequenceGenerator(name = "ModelParameterSequence", sequenceName = "fxjm_model_parameter_info_t_seq", allocationSize=1)
...@@ -73,4 +75,12 @@ public class ModelParameter implements Serializable{ ...@@ -73,4 +75,12 @@ public class ModelParameter implements Serializable{
public void setIfSystemDefault(Long ifSystemDefault) { public void setIfSystemDefault(Long ifSystemDefault) {
this.ifSystemDefault = ifSystemDefault; this.ifSystemDefault = ifSystemDefault;
} }
public String getParameterCode() {
return parameterCode;
}
public void setParameterCode(String parameterCode) {
this.parameterCode = parameterCode;
}
} }
...@@ -27,6 +27,11 @@ public interface ModelParameterDao extends JpaSpecificationExecutor<ModelParamet ...@@ -27,6 +27,11 @@ public interface ModelParameterDao extends JpaSpecificationExecutor<ModelParamet
@Modifying @Modifying
@Query("update ModelParameter mp set mp.parameterName=:parameterName,mp.parameterValue=:parameterValue, mp.parameterDataType=:parameterDataType where mp.parameterId =:parameterId") @Query("update ModelParameter mp set mp.parameterName=:parameterName,mp.parameterValue=:parameterValue, mp.parameterDataType=:parameterDataType where mp.parameterId =:parameterId")
void updateParamByParameterId(@Param("parameterName")String parameterName,@Param("parameterValue")String parameterValue,@Param("parameterDataType")String parameterDataType,@Param("parameterId")Long parameterId); void updateParamByParameterId(@Param("parameterName")String parameterName,@Param("parameterValue")String parameterValue,@Param("parameterDataType")String parameterDataType,@Param("parameterId")Long parameterId);
//根据参数ID更新参数信息 by molinyi
@Modifying
@Query("update ModelParameter mp set mp.parameterName=:parameterName,mp.parameterCode=:parameterCode,mp.parameterValue=:parameterValue, mp.parameterDataType=:parameterDataType where mp.parameterId =:parameterId")
void updateParamByParameterId(@Param("parameterName")String parameterName,@Param("parameterCode")String parameterCode,@Param("parameterValue")String parameterValue,@Param("parameterDataType")String parameterDataType,@Param("parameterId")Long parameterId);
//根据数据模型ID查找参数d //根据数据模型ID查找参数d
List<ModelParameter> findByDataModelId(Long dataModelId); List<ModelParameter> findByDataModelId(Long dataModelId);
......
...@@ -30,6 +30,11 @@ public class ModelParameterService { ...@@ -30,6 +30,11 @@ public class ModelParameterService {
public void updateParameterByParameterId(String parameterName,String parameterValue,String parameterDataType,Long parameterId){ public void updateParameterByParameterId(String parameterName,String parameterValue,String parameterDataType,Long parameterId){
modelParameterDao.updateParamByParameterId(parameterName, parameterValue, parameterDataType, parameterId); modelParameterDao.updateParamByParameterId(parameterName, parameterValue, parameterDataType, parameterId);
} }
//根据参数ID更新参数
@Transactional(readOnly=false)
public void updateParameterByParameterId(String parameterName,String parameterCode,String parameterValue,String parameterDataType,Long parameterId){
modelParameterDao.updateParamByParameterId(parameterName, parameterCode,parameterValue, parameterDataType, parameterId);
}
//根据参数ID删除一条参数信息 //根据参数ID删除一条参数信息
@Transactional(readOnly=false) @Transactional(readOnly=false)
......
...@@ -9,11 +9,7 @@ import java.io.UnsupportedEncodingException; ...@@ -9,11 +9,7 @@ import java.io.UnsupportedEncodingException;
import java.net.SocketException; import java.net.SocketException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -48,250 +44,327 @@ import com.hp.cmsz.web.PageURLController; ...@@ -48,250 +44,327 @@ import com.hp.cmsz.web.PageURLController;
/** /**
* 模型维护的控制类 * 模型维护的控制类
*
* @author Zhang Wei
* *
* @author Zhang Wei
*/ */
@Controller @Controller
@RequestMapping(value="/ModelManage/ModelMaintain") @RequestMapping(value = "/ModelManage/ModelMaintain")
public class ModelMaintainController { public class ModelMaintainController {
@Autowired @Autowired
private DataModelTypeDao dataModelTypeDao; private DataModelTypeDao dataModelTypeDao;
@Autowired @Autowired
private DeployedServerDao deployedServerDao; private DeployedServerDao deployedServerDao;
@Autowired @Autowired
private DataTypeDao dataTypeDao; private DataTypeDao dataTypeDao;
@Autowired @Autowired
private ModelParameterDao modelParameterDao; private ModelParameterDao modelParameterDao;
@Autowired @Autowired
private DataModelDao dataModelDao; private DataModelDao dataModelDao;
@Autowired @Autowired
private ModelParameterService modelParameterService; private ModelParameterService modelParameterService;
@Autowired @Autowired
private SystemParameterDao systemParameterDao; private SystemParameterDao systemParameterDao;
@Autowired @Autowired
private CmszOperationLogService cmszOperationLogService; private CmszOperationLogService cmszOperationLogService;
@RequestMapping(value = "") @RequestMapping(value = "")
public String modelMaintainHome(Map model){ public String modelMaintainHome(Map model) {
List<DataModelType> dataModelTypeList = (List<DataModelType>)dataModelTypeDao.findAll(); List<DataModelType> dataModelTypeList = (List<DataModelType>) dataModelTypeDao.findAll();
List<DeployedServer>deployedServerList = (List<DeployedServer>) deployedServerDao.findAll(); List<DeployedServer> deployedServerList = (List<DeployedServer>) deployedServerDao.findAll();
List<DataType> dataTypeList =(List<DataType>) dataTypeDao.findAll(); List<DataType> dataTypeList = (List<DataType>) dataTypeDao.findAll();
model.put("dataModelTypeList", dataModelTypeList); model.put("dataModelTypeList", dataModelTypeList);
model.put("deployedServerList", deployedServerList); model.put("deployedServerList", deployedServerList);
model.put("dataTypeList", dataTypeList); model.put("dataTypeList", dataTypeList);
return PageURLController.ModelMaintain; return PageURLController.ModelMaintain;
} }
private List<Long> dataModelIdList = new ArrayList<Long>(); // private List<Long> dataModelIdList = new ArrayList<Long>();
//新增模型参数 private List<Long> dataModelIdList = new Vector<Long>();
@RequestMapping(value = "/createModelParam*", method = RequestMethod.GET)
@ResponseBody
public void createModelParam( //新增模型参数
@RequestParam(value="paramName") String paramName, @RequestMapping(value = "/createModelParam", method = RequestMethod.GET)
@RequestParam(value="paramValue") String paramValue, @ResponseBody
@RequestParam(value="paramType") String paramType, public void createModelParam(
HttpServletResponse response,HttpServletRequest request) { @RequestParam(value = "paramName") String paramName,
/*paramName=java.net.URLDecoder.decode(paramName, "UTF-8");//一次解码 @RequestParam(value = "paramValue") String paramValue,
paramValue=java.net.URLDecoder.decode(paramValue, "UTF-8");//一次解码 @RequestParam(value = "paramType") String paramType,
HttpServletResponse response, HttpServletRequest request) {
/*paramName=java.net.URLDecoder.decode(paramName, "UTF-8");//一次解码
paramValue=java.net.URLDecoder.decode(paramValue, "UTF-8");//一次解码
paramType=java.net.URLDecoder.decode(paramType, "UTF-8");//一次解码 paramType=java.net.URLDecoder.decode(paramType, "UTF-8");//一次解码
*/ */
ModelParameter modelParameter = new ModelParameter(); ModelParameter modelParameter = new ModelParameter();
if(!paramName.trim().equals("")){modelParameter.setParameterName(paramName);} if (!paramName.trim().equals("")) {
if(!paramValue.trim().equals("")){modelParameter.setParameterValue(paramValue);} modelParameter.setParameterName(paramName);
if(!paramType.trim().equals("")){modelParameter.setParameterDataType(paramType);} }
modelParameter.setIfSystemDefault(0L); if (!paramValue.trim().equals("")) {
modelParameterDao.save(modelParameter); modelParameter.setParameterValue(paramValue);
Long dataModelId = modelParameter.getParameterId(); }
dataModelIdList.add(dataModelId); if (!paramType.trim().equals("")) {
} modelParameter.setParameterDataType(paramType);
}
//新增数据模型 modelParameter.setIfSystemDefault(0L);
@RequestMapping(value = "/saveModelDataForm", method = RequestMethod.POST) modelParameterDao.save(modelParameter);
public String saveModelDataForm(HttpServletResponse response,HttpServletRequest request) throws ParseException{ Long dataModelId = modelParameter.getParameterId();
String modelSavePath = systemParameterDao.findByParameterName("MODEL_SCRIPT_FILE_DIR").get(0).getParameterValue(); dataModelIdList.add(dataModelId);
String dataModelName = ""; }
String modelDesc = "";
String ruleDefinition = ""; //新增模型参数 by molinyyi
String evaluationMethod = ""; @RequestMapping(value = "/createModelParams", method = RequestMethod.GET)
String evaluationStandard = ""; @ResponseBody
String modelType = ""; public void createModelParams(
String deployedServer = ""; @RequestParam(value = "paramName") String paramName,
String modelStatus = ""; @RequestParam(value = "paramCode") String paramCode,
//String cycleMinutes = ""; @RequestParam(value = "paramValue") String paramValue,
String modelExeScriptName = ""; @RequestParam(value = "paramType") String paramType,
String kpiTypeId = ""; HttpServletResponse response, HttpServletRequest request) {
String businessEndTime = "";
String businessStartTime = "";
Date publishTime = new Date(); System.out.println("paramName " + paramName);
Date updateTime = new Date(); System.out.println("paramCode " + paramCode);
DataModel dataModel = new DataModel(); System.out.println("paramValue " + paramValue);
try{ System.out.println("paramType " + paramType);
if(ServletFileUpload.isMultipartContent(request)){ ModelParameter modelParameter = new ModelParameter();
DiskFileItemFactory disk = new DiskFileItemFactory(); if (!paramName.trim().equals("")) {
disk.setSizeThreshold(20*1024); modelParameter.setParameterName(paramName);
disk.setRepository(disk.getRepository()); }
ServletFileUpload up = new ServletFileUpload(disk); if (!paramCode.trim().equals("")) {
List list = up.parseRequest(request); modelParameter.setParameterCode(paramCode);
Iterator i = list.iterator(); }
while(i.hasNext()){ if (!paramValue.trim().equals("")) {
FileItem fm = (FileItem) i.next(); modelParameter.setParameterValue(paramValue);
if(fm.isFormField()){ }
String formName = fm.getFieldName(); if (!paramType.trim().equals("")) {
String tempName = fm.getString("UTF-8"); modelParameter.setParameterDataType(paramType);
if(formName.equals("dataModelName")){ }
dataModelName = tempName; modelParameter.setIfSystemDefault(0L);
}else if(formName.equals("modelDesc")){ modelParameterDao.save(modelParameter);
modelDesc = tempName; Long dataModelId = modelParameter.getParameterId();
}else if(formName.equals("ruleDefinition")){ dataModelIdList.add(dataModelId);
ruleDefinition = tempName; }
}else if(formName.equals("evaluationMethod")){
evaluationMethod = tempName; //新增数据模型 molinyi had modified
}else if(formName.equals("evaluationStandard")){ @RequestMapping(value = "/saveModelDataForm", method = RequestMethod.POST)
evaluationStandard = tempName; public String saveModelDataForm(HttpServletResponse response, HttpServletRequest request) throws ParseException {
}else if(formName.equals("modelType")){ String modelSavePath = systemParameterDao.findByParameterName("MODEL_SCRIPT_FILE_DIR").get(0).getParameterValue();
modelType = tempName; String dataModelName = "";
}else if(formName.equals("deployedServer")){ String modelDesc = "";
deployedServer = tempName; String ruleDefinition = "";
}else if(formName.equals("modelStatus")){ String evaluationMethod = "";
modelStatus = tempName; String evaluationStandard = "";
}else if(formName.equals("kpiTypeId")){ String modelType = "";
kpiTypeId = tempName; String deployedServer = "";
}/*else if(formName.equals("cycleMinutes")){ String modelStatus = "";
cycleMinutes = tempName; //String cycleMinutes = "";
}*/else if(formName.equals("businessStartTime")){ String modelExeScriptName = "";
businessStartTime = tempName; String kpiTypeId = "";
}else if(formName.equals("businessEndTime")){ String businessEndTime = "";
businessEndTime = tempName; String businessStartTime = "";
} Date publishTime = new Date();
}else{ Date updateTime = new Date();
String fullFilePath = fm.getName(); DataModel dataModel = new DataModel();
int startIndex=fullFilePath.lastIndexOf("\\"); if (ServletFileUpload.isMultipartContent(request)) {
if(startIndex!=-1){ DiskFileItemFactory disk = new DiskFileItemFactory();
modelExeScriptName = fullFilePath.substring(startIndex+1); disk.setSizeThreshold(20 * 1024);
}else{ disk.setRepository(disk.getRepository());
modelExeScriptName = fullFilePath; ServletFileUpload up = new ServletFileUpload(disk);
} try {
if(!modelExeScriptName.trim().equals("")){ List list = up.parseRequest(request);
dataModel.setModelScriptName(modelExeScriptName); Iterator i = list.iterator();
File file = new File(modelSavePath,modelExeScriptName); while (i.hasNext()) {
if(!file.exists()){ FileItem fm = (FileItem) i.next();
fm.write(file); if (fm.isFormField()) {
} String formName = fm.getFieldName();
} String tempName = fm.getString("UTF-8");
} if (formName.equals("dataModelName")) {
} dataModelName = tempName;
} } else if (formName.equals("modelDesc")) {
}catch(Exception e){ modelDesc = tempName;
e.printStackTrace(); } else if (formName.equals("ruleDefinition")) {
} ruleDefinition = tempName;
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); } else if (formName.equals("evaluationMethod")) {
SimpleDateFormat batchFormat = new SimpleDateFormat("yyyyMMdd000001"); evaluationMethod = tempName;
dataModel.setBatchNo(Long.parseLong(batchFormat.format(sd.parse(businessStartTime)))); } else if (formName.equals("evaluationStandard")) {
dataModel.setDataModelName(dataModelName); evaluationStandard = tempName;
if(!modelDesc.trim().equals("")){dataModel.setModelDesc(modelDesc);} } else if (formName.equals("modelType")) {
if(!ruleDefinition.trim().equals("")){dataModel.setRuleDefinition(ruleDefinition);} modelType = tempName;
if(!evaluationMethod.trim().equals("")){dataModel.setEvaluationMethod(evaluationMethod);} } else if (formName.equals("deployedServer")) {
if(!evaluationStandard.trim().equals("")){dataModel.setEvaluationStandard(evaluationStandard);} deployedServer = tempName;
if(!modelType.trim().equals("")){dataModel.setDataModelTypeId(Long.parseLong(modelType));} } else if (formName.equals("modelStatus")) {
if(!deployedServer.trim().equals("")){dataModel.setServerId(Long.parseLong(deployedServer));} modelStatus = tempName;
if(!modelStatus.trim().equals("")){dataModel.setModelStatus(Long.parseLong(modelStatus));} } else if (formName.equals("kpiTypeId")) {
if(!kpiTypeId.trim().equals("")){dataModel.setKpiTypeId(Long.parseLong(kpiTypeId));} kpiTypeId = tempName;
} else if (formName.equals("businessStartTime")) {
businessStartTime = tempName;
} else if (formName.equals("businessEndTime")) {
businessEndTime = tempName;
}
} else {
String fullFilePath = fm.getName();
int startIndex = fullFilePath.lastIndexOf("\\");
if (startIndex != -1) {
modelExeScriptName = fullFilePath.substring(startIndex + 1);
} else {
modelExeScriptName = fullFilePath;
}
if (!modelExeScriptName.trim().equals("")) {
dataModel.setModelScriptName(modelExeScriptName);
//File file = new File(modelSavePath, modelExeScriptName);
modelSavePath = "E:\\files";
modelExeScriptName = System.currentTimeMillis()+"_"+modelExeScriptName;
uploadFile(fm, modelSavePath,modelExeScriptName);
/*if (!file.exists()) {
fm.write(file);
}else {
throw new Exception("文件已存在");
}*/
}
}
}
} catch (Exception e) {
e.printStackTrace();
e.getMessage();
return e.getMessage();
}
}
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat batchFormat = new SimpleDateFormat("yyyyMMdd000001");
dataModel.setBatchNo(Long.parseLong(batchFormat.format(sd.parse(businessStartTime))));
dataModel.setDataModelName(dataModelName);
if (!modelDesc.trim().equals("")) {
dataModel.setModelDesc(modelDesc);
}
if (!ruleDefinition.trim().equals("")) {
dataModel.setRuleDefinition(ruleDefinition);
}
if (!evaluationMethod.trim().equals("")) {
dataModel.setEvaluationMethod(evaluationMethod);
}
if (!evaluationStandard.trim().equals("")) {
dataModel.setEvaluationStandard(evaluationStandard);
}
if (!modelType.trim().equals("")) {
dataModel.setDataModelTypeId(Long.parseLong(modelType));
}
if (!deployedServer.trim().equals("")) {
dataModel.setServerId(Long.parseLong(deployedServer));
}
if (!modelStatus.trim().equals("")) {
dataModel.setModelStatus(Long.parseLong(modelStatus));
}
if (!kpiTypeId.trim().equals("")) {
dataModel.setKpiTypeId(Long.parseLong(kpiTypeId));
}
/*if(!cycleMinutes.trim().equals("")){dataModel.setCycleMinutes(Long.parseLong(cycleMinutes));}*/ /*if(!cycleMinutes.trim().equals("")){dataModel.setCycleMinutes(Long.parseLong(cycleMinutes));}*/
dataModel.setModelPublishTime(publishTime); dataModel.setModelPublishTime(publishTime);
dataModel.setModelUpdateTime(updateTime); dataModel.setModelUpdateTime(updateTime);
dataModel.setBusinessStartTime(sd.parse(businessStartTime)); dataModel.setBusinessStartTime(sd.parse(businessStartTime));
dataModel.setBusinessEndTime(sd.parse(businessEndTime)); dataModel.setBusinessEndTime(sd.parse(businessEndTime));
dataModelDao.save(dataModel); dataModelDao.save(dataModel);
cmszOperationLogService.createLog("增加","新建数据模型","fxjm_data_model_info_t. DATA_MODEL_ID="+dataModel.getDataModelId().toString()); cmszOperationLogService.createLog("增加", "新建数据模型", "fxjm_data_model_info_t. DATA_MODEL_ID=" + dataModel.getDataModelId().toString());
Long dataModelId = dataModel.getDataModelId(); Long dataModelId = dataModel.getDataModelId();
if(!dataModelIdList.isEmpty()){ if (!dataModelIdList.isEmpty()) {
modelParameterService.updateParameterByParameterIds(dataModelId, dataModelIdList); modelParameterService.updateParameterByParameterIds(dataModelId, dataModelIdList);
dataModelIdList.clear(); dataModelIdList.clear();
} }
List<DeployedServer> deployedServerList = deployedServerDao.findByServerId(Long.parseLong(deployedServer)); List<DeployedServer> deployedServerList = deployedServerDao.findByServerId(Long.parseLong(deployedServer));
if(!deployedServerList.isEmpty()){ if (!deployedServerList.isEmpty()) {
if(deployedServerList.get(0).getIfWebserver().equals("0")){ if (deployedServerList.get(0).getIfWebserver().equals("0")) {
String ftpServer = deployedServerList.get(0).getServerIpAddress(); String ftpServer = deployedServerList.get(0).getServerIpAddress();
String ftpUser = deployedServerList.get(0).getFtpUser(); String ftpUser = deployedServerList.get(0).getFtpUser();
String ftpPwd = deployedServerList.get(0).getFtpPassword(); String ftpPwd = deployedServerList.get(0).getFtpPassword();
String ftpFilePath = modelSavePath; String ftpFilePath = modelSavePath;
String ftpFileName = modelExeScriptName; String ftpFileName = modelExeScriptName;
FileInputStream ftpFileInput = null; FileInputStream ftpFileInput = null;
try { try {
ftpFileInput = new FileInputStream(new File(modelSavePath,ftpFileName)); ftpFileInput = new FileInputStream(new File(modelSavePath, ftpFileName));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
//创建FTP //创建FTP
FTPClient ftpClient = new FTPClient(); FTPClient ftpClient = new FTPClient();
ftpClient.setDefaultTimeout(1 * 1000); ftpClient.setDefaultTimeout(1 * 1000);
ftpClient.setDataTimeout(1 * 1000); ftpClient.setDataTimeout(1 * 1000);
try { try {
//连接ftp //连接ftp
ftpClient.connect(ftpServer); ftpClient.connect(ftpServer);
//使用用户名和密码登陆 //使用用户名和密码登陆
if(ftpClient.login(ftpUser, ftpPwd)){ if (ftpClient.login(ftpUser, ftpPwd)) {
//变更到文件存储目录 //变更到文件存储目录
ftpClient.changeWorkingDirectory(ftpFilePath); ftpClient.changeWorkingDirectory(ftpFilePath);
//保存文件 //保存文件
ftpClient.storeFile(ftpFileName, ftpFileInput); ftpClient.storeFile(ftpFileName, ftpFileInput);
} }
//关闭 //关闭
ftpFileInput.close(); ftpFileInput.close();
ftpClient.logout(); ftpClient.logout();
ftpClient.disconnect(); ftpClient.disconnect();
// File oldFile = new File(modelSavePath,ftpFileName); // File oldFile = new File(modelSavePath,ftpFileName);
// if(oldFile.isFile() && oldFile.exists()){ // if(oldFile.isFile() && oldFile.exists()){
// oldFile.delete(); // oldFile.delete();
// } // }
} catch (SocketException e) { } catch (SocketException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
}finally{ } finally {
if(ftpClient.isConnected()){ if (ftpClient.isConnected()) {
try{ try {
ftpClient.disconnect(); ftpClient.disconnect();
}catch(IOException ioe){ } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} }
} }
} }
} }
} }
return "redirect:/ModelManage/ModelResult"; return "redirect:/ModelManage/ModelResult";
} }
//判断模型名称是否已存在 //判断模型名称是否已存在
@RequestMapping(value = "/select_modelName/{modelName}" ,method=RequestMethod.GET) @RequestMapping(value = "/select_modelName/{modelName}", method = RequestMethod.GET)
public void select_modelName(@PathVariable("modelName")String modelName,HttpServletResponse response,HttpServletRequest request) throws UnsupportedEncodingException{ public void select_modelName(@PathVariable("modelName") String modelName, HttpServletResponse response, HttpServletRequest request) throws UnsupportedEncodingException {
Long modelNumber = dataModelDao.getNumOfDataModelByDataModelName(modelName); Long modelNumber = dataModelDao.getNumOfDataModelByDataModelName(modelName);
Gson gson = new Gson(); Gson gson = new Gson();
response.setContentType("text/Xml;chartset=gbk"); response.setContentType("text/Xml;chartset=gbk");
PrintWriter out = null; PrintWriter out = null;
try { try {
out = response.getWriter(); out = response.getWriter();
out.print(gson.toJson(modelNumber)); out.print(gson.toJson(modelNumber));
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
private static void uploadFile(FileItem item, String realPath,String fileName) throws Exception {
try {
/* String fileName = item.getName().trim();
fileName = System.currentTimeMillis() + "_" + fileName;*/
item.write(new File(realPath, fileName));
} catch (Exception e) {
throw new Exception("文件上传失败");
}
}
} }
...@@ -158,7 +158,33 @@ public class ModelParameterConfigurationController { ...@@ -158,7 +158,33 @@ public class ModelParameterConfigurationController {
} }
} }
//修改参数信息 by molinyi
@RequestMapping(value = "/UpdateParameter",method=RequestMethod.GET)
@ResponseBody
public void updateParameters(
@RequestParam(value="paramName",defaultValue="") String paramName,
@RequestParam(value="paramCode",defaultValue="") String paramCode,
@RequestParam(value="paramValue",defaultValue="") String paramValue,
@RequestParam(value="paramType",defaultValue="") String paramType,
@RequestParam(value="paramId",defaultValue="") String paramId,
@RequestParam(value="dataModelId",defaultValue="") String dataModelId){
if(paramId.trim().equals("")){
ModelParameter modelParameter = new ModelParameter();
modelParameter.setDataModelId(Long.parseLong(dataModelId));
modelParameter.setParameterName(paramName);
modelParameter.setParameterCode(paramCode);
modelParameter.setParameterValue(paramValue);
modelParameter.setParameterDataType(paramType);
modelParameterDao.save(modelParameter);
}else{
// modelParameterService.updateParameterByParameterId(paramName, paramValue, paramType, Long.parseLong(paramId.split(":")[1]));
modelParameterService.updateParameterByParameterId(paramName,paramCode, paramValue, paramType, Long.parseLong(paramId.split(":")[1]));
}
}
//修改数据模型 //修改数据模型
@RequestMapping(value = "/updateDataModelForm",method=RequestMethod.POST) @RequestMapping(value = "/updateDataModelForm",method=RequestMethod.POST)
public String updateDataModelForm(HttpServletResponse response,HttpServletRequest request) throws NumberFormatException, ParseException{ public String updateDataModelForm(HttpServletResponse response,HttpServletRequest request) throws NumberFormatException, ParseException{
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<tr><td>已添加参数:</td> <tr><td>已添加参数:</td>
<td><table class="table table-hover table-striped" id="displayParam"> <td><table class="table table-hover table-striped" id="displayParam">
<thead> <thead>
<tr><th>参数名</th><th>参数值</th><th>参数类型</th><th><a href="javascript:deleteAllTr()">删除所有参数</a></th></tr> <tr><th>参数名</th><th>参数编码</th><th>参数</th><th>参数类型</th><th><a href="javascript:deleteAllTr()">删除所有参数</a></th></tr>
</thead> </thead>
<tbody id="addTr"></tbody> <tbody id="addTr"></tbody>
</table></td></tr> </table></td></tr>
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
</c:forEach> </c:forEach>
</select></td></tr> </select></td></tr>
<tr><td>参数名:</td><td><input type="text" class="form-control" name="paramName" id="paramName"/></td></tr> <tr><td>参数名:</td><td><input type="text" class="form-control" name="paramName" id="paramName"/></td></tr>
<tr><td>参数编码:</td><td><input type="text" class="form-control" name="paramCode" id="paramCode"/></td></tr>
<tr><td>参数值:</td><td id="addParamVal"></td></tr> <tr><td>参数值:</td><td id="addParamVal"></td></tr>
<tr><td></td> <tr><td></td>
<td><button type="button" id="addParam" class="btn btn-primary">添加参数</button></td></tr> <td><button type="button" id="addParam" class="btn btn-primary">添加参数</button></td></tr>
...@@ -194,11 +195,13 @@ ...@@ -194,11 +195,13 @@
$("#addTr").find("tr").removeClass("orange-tr"); $("#addTr").find("tr").removeClass("orange-tr");
$(elementTag).parents("tr").eq(0).addClass("orange-tr"); $(elementTag).parents("tr").eq(0).addClass("orange-tr");
var paramName = $(elementTag).parents("tr").find("td").eq(0).html(); var paramName = $(elementTag).parents("tr").find("td").eq(0).html();
var paramValue = $(elementTag).parents("tr").find("td").eq(1).html(); var paramCode = $(elementTag).parents("tr").find("td").eq(1).html();
var paramType = $(elementTag).parents("tr").find("td").eq(2).html(); var paramValue = $(elementTag).parents("tr").find("td").eq(2).html();
var paramType = $(elementTag).parents("tr").find("td").eq(3).html();
$("#paramDataType option[value='"+paramType+"']").attr("selected","selected"); $("#paramDataType option[value='"+paramType+"']").attr("selected","selected");
$("#paramDataType").change(); $("#paramDataType").change();
$("#paramName").val(paramName); $("#paramName").val(paramName);
$("#paramCode").val(paramCode);
$("#paramValue").val(paramValue); $("#paramValue").val(paramValue);
} }
...@@ -207,19 +210,24 @@ ...@@ -207,19 +210,24 @@
var paramDataType = $("#paramDataType").val(); var paramDataType = $("#paramDataType").val();
var paramName = $.trim($("#paramName").val()); var paramName = $.trim($("#paramName").val());
var paramValue = $("#paramValue").val(); var paramValue = $("#paramValue").val();
var paramCode = $.trim($("#paramCode").val());
if(paramName==""){ if(paramName==""){
$.alert("参数名不能为空"); $.alert("参数名不能为空");
}else{ }else if(paramCode == ""){
$.alert("参数编码不能为空");
}else{
if($("#addTr").find("tr.orange-tr").html()==null){ if($("#addTr").find("tr.orange-tr").html()==null){
var addRow = $("<tr><td>"+paramName+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>"); var addRow = $("<tr><td>"+paramName+"</td><td>"+paramCode+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
$("#addTr").append(addRow); $("#addTr").append(addRow);
$("#paramName").attr("value",""); $("#paramName").attr("value","");
$("#paramValue").attr("value",""); $("#paramValue").attr("value","");
$("#paramCode").attr("value","");
}else{ }else{
var findTr = $("#addTr").find("tr.orange-tr"); var findTr = $("#addTr").find("tr.orange-tr");
$(findTr).find("td").eq(0).html(paramName); $(findTr).find("td").eq(0).html(paramName);
$(findTr).find("td").eq(1).html(paramValue); $(findTr).find("td").eq(1).html(paramCode);
$(findTr).find("td").eq(2).html(paramDataType); $(findTr).find("td").eq(2).html(paramValue);
$(findTr).find("td").eq(3).html(paramDataType);
$("#addTr").find("tr").removeClass(); $("#addTr").find("tr").removeClass();
$("#addParam").text("添加参数"); $("#addParam").text("添加参数");
} }
...@@ -247,89 +255,99 @@ ...@@ -247,89 +255,99 @@
}else if($("#businessEndTime").val()==""){ }else if($("#businessEndTime").val()==""){
$.alert("业务结束时间不能为空"); $.alert("业务结束时间不能为空");
}else{ }else{
if($.trim($("#paramName").val())!=""){ if($.trim($("#paramName").val())!=""){
$.dialog({ $.dialog({
title: "提醒", title: "提醒",
content: "有参数尚未添加,确定提交", content: "有参数尚未添加,确定提交",
ok: function(){ ok: function(){
$("#modelSubmit").attr("disabled",true);
$("#modelSubmit").attr("disabled",true); var i = $("#addTr").find("tr").size();
var i = $("#addTr").find("tr").size(); console.log("i "+i);
if(i==0){
if(i==0){ var createForm=$("#modelMaintainForm");
var createForm=$("#modelMaintainForm"); createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm"); createForm.submit();
createForm.submit(); createForm.attr("action","#");
createForm.attr("action","#"); }else{
}else{ $("#addTr").find("tr").each(function(){
$("#addTr").find("tr").each(function(){ //alert($(this).find("td").eq(0).html());
//alert($(this).find("td").eq(0).html()); var paramName = $(this).find("td").eq(0).html();
var paramName = $(this).find("td").eq(0).html(); var paramCode = $(this).find("td").eq(1).html();
var paramValue = $(this).find("td").eq(1).html(); var paramValue = $(this).find("td").eq(2).html();
var paramType = $(this).find("td").eq(2).html(); var paramType = $(this).find("td").eq(3).html();
$.ajax({ console.log("paramName "+paramName);
type : "GET", console.log("paramCode "+paramCode);
contentType : "application/json", $.ajax({
url: "${ctx}/ModelManage/ModelMaintain/createModelParam?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType), type : "GET",
dataType : "text", contentType : "application/json",
async: false, url: "${ctx}/ModelManage/ModelMaintain/createModelParams?paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
beforeSend: function(data) {}, dataType : "text",
success: function(){ async: false,
i--; beforeSend: function(data) {},
if(i==0){ success: function(){
var createForm=$("#modelMaintainForm"); i--;
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm"); if(i==0){
createForm.submit(); var createForm=$("#modelMaintainForm");
createForm.attr("action","#"); createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
} createForm.submit();
} createForm.attr("action","#");
}); }
}); }
} });
}, });
okValue: "确定", }
cancel: function(){}, },
cancelValue: "取消", okValue: "确定",
}); cancel: function(){},
} cancelValue: "取消",
else{ });
$("#modelSubmit").attr("disabled",true); }else{
var i = $("#addTr").find("tr").size();
alert(2);
if(i==0){ $("#modelSubmit").attr("disabled",true);
var createForm=$("#modelMaintainForm"); var i = $("#addTr").find("tr").size();
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm"); alert("i "+i);
createForm.submit();
createForm.attr("action","#"); if(i==0){
}else{ var createForm=$("#modelMaintainForm");
$("#addTr").find("tr").each(function(){ createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
//alert($(this).find("td").eq(0).html()); createForm.submit();
var paramName = $(this).find("td").eq(0).html(); createForm.attr("action","#");
var paramValue = $(this).find("td").eq(1).html(); }else{
var paramType = $(this).find("td").eq(2).html(); $("#addTr").find("tr").each(function(){
$.ajax({ //alert($(this).find("td").eq(0).html());
type : "GET", var paramName = $(this).find("td").eq(0).html();
contentType : "application/json", var paramCode = $(this).find("td").eq(1).html();
url: "${ctx}/ModelManage/ModelMaintain/createModelParam?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType), var paramValue = $(this).find("td").eq(2).html();
dataType : "text", var paramType = $(this).find("td").eq(3).html();
async: false, alert("paramName "+paramName);
beforeSend: function(data) {}, alert("paramCode "+paramCode);
success: function(){ console.log("paramName "+paramName);
i--; console.log("paramCode "+paramCode);
if(i==0){ $.ajax({
var createForm=$("#modelMaintainForm"); type : "GET",
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm"); contentType : "application/json",
createForm.submit(); /*url: "${ctx}/ModelManage/ModelMaintain/createModelParam?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),*/
createForm.attr("action","#"); url: "${ctx}/ModelManage/ModelMaintain/createModelParams?paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
} dataType : "text",
} async: false,
}); beforeSend: function(data) {},
}); success: function(){
} i--;
if(i==0){
var createForm=$("#modelMaintainForm");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
createForm.submit();
createForm.attr("action","#");
}
}
});
});
}
}
} }
} });
});
$("#modelBack").click(function(){ $("#modelBack").click(function(){
location.href="${ctx}/ModelManage/ModelResult"; location.href="${ctx}/ModelManage/ModelResult";
......
...@@ -95,11 +95,16 @@ ...@@ -95,11 +95,16 @@
<tr><td>参数:</td> <tr><td>参数:</td>
<td><table class="table table-hover table-striped" id="displayParam"> <td><table class="table table-hover table-striped" id="displayParam">
<thead> <thead>
<tr><th>参数名</th><th>参数值</th><th>参数类型</th><th><a href="javascript:deleteAllTr()">删除所有参数</a></th></tr> <tr><th>参数名</th><th>参数编码</th><th>参数</th><th>参数类型</th><th><a href="javascript:deleteAllTr()">删除所有参数</a></th></tr>
</thead> </thead>
<tbody id="addTr"> <tbody id="addTr">
<c:forEach var="modelParameterList" items="${modelParameterList}"> <c:forEach var="modelParameterList" items="${modelParameterList}">
<tr><td>${modelParameterList.parameterName}</td><td>${modelParameterList.parameterValue}</td><td>${modelParameterList.parameterDataType}</td><td><a href="javascript:;" title="参数ID:${modelParameterList.parameterId}" onclick="deleteRow(this,'${modelParameterList.parameterId}')">删除</a>&nbsp;&nbsp;<a href="javascript:;" onclick="updateRow(this)">修改</a></td></tr> <tr>
<td>${modelParameterList.parameterCode}</td>
<td>${modelParameterList.parameterName}</td>
<td>${modelParameterList.parameterValue}</td>
<td>${modelParameterList.parameterDataType}</td>
<td><a href="javascript:;" title="参数ID:${modelParameterList.parameterId}" onclick="deleteRow(this,'${modelParameterList.parameterId}')">删除</a>&nbsp;&nbsp;<a href="javascript:;" onclick="updateRow(this)">修改</a></td></tr>
</c:forEach> </c:forEach>
</tbody> </tbody>
</table></td></tr> </table></td></tr>
...@@ -110,6 +115,7 @@ ...@@ -110,6 +115,7 @@
</c:forEach> </c:forEach>
</select></td></tr> </select></td></tr>
<tr><td>参数名:</td><td><input type="text" class="form-control" name="paramName" id="paramName"/></td></tr> <tr><td>参数名:</td><td><input type="text" class="form-control" name="paramName" id="paramName"/></td></tr>
<tr><td>参数编码:</td><td><input type="text" class="form-control" name="paramCode" id="paramCode"/></td></tr>
<tr><td>参数值:</td><td id="addParamVal"><input type="text" class="form-control" name="paramValue" id="paramValue" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)" onblur="this.v();" /></td></tr> <tr><td>参数值:</td><td id="addParamVal"><input type="text" class="form-control" name="paramValue" id="paramValue" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)" onblur="this.v();" /></td></tr>
<tr><td></td><td> <tr><td></td><td>
<button type="button" id="addParam" class="btn btn-primary">添加参数</button></td></tr> <button type="button" id="addParam" class="btn btn-primary">添加参数</button></td></tr>
...@@ -214,11 +220,13 @@ ...@@ -214,11 +220,13 @@
$("#addTr").find("tr").removeClass("orange-tr"); $("#addTr").find("tr").removeClass("orange-tr");
$(elementTag).parents("tr").eq(0).addClass("orange-tr"); $(elementTag).parents("tr").eq(0).addClass("orange-tr");
var paramName = $(elementTag).parents("tr").find("td").eq(0).html(); var paramName = $(elementTag).parents("tr").find("td").eq(0).html();
var paramValue = $(elementTag).parents("tr").find("td").eq(1).html(); var paramCode = $(elementTag).parents("tr").find("td").eq(1).html();
var paramType = $(elementTag).parents("tr").find("td").eq(2).html(); var paramValue = $(elementTag).parents("tr").find("td").eq(2).html();
var paramType = $(elementTag).parents("tr").find("td").eq(3).html();
$("#paramDataType option[value='"+paramType+"']").attr("selected","selected"); $("#paramDataType option[value='"+paramType+"']").attr("selected","selected");
$("#paramDataType").change(); $("#paramDataType").change();
$("#paramName").val(paramName); $("#paramName").val(paramName);
$("#paramCode").val(paramCode);
$("#paramValue").val(paramValue); $("#paramValue").val(paramValue);
} }
...@@ -261,22 +269,28 @@ ...@@ -261,22 +269,28 @@
var paramDataType = $("#paramDataType").val(); var paramDataType = $("#paramDataType").val();
var paramName = $.trim($("#paramName").val()); var paramName = $.trim($("#paramName").val());
var paramValue = $("#paramValue").val(); var paramValue = $("#paramValue").val();
var paramCode = $.trim($("#paramCode").val());
if(paramName==""){ if(paramName==""){
$.alert("参数名不能为空"); $.alert("参数名不能为空");
}else{ }else if(paramCode == ""){
$.alert("参数编码不能为空");
}else{
if($("#addTr").find("tr.orange-tr").html()==null){ if($("#addTr").find("tr.orange-tr").html()==null){
var addRow = $("<tr><td>"+paramName+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this,\"\")'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>"); var addRow = $("<tr><td>"+paramName+"</td><td>"+paramCode+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this,\"\")'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
$("#addTr").append(addRow); $("#addTr").append(addRow);
$("#paramName").attr("value",""); $("#paramName").attr("value","");
$("#paramCode").attr("value","");
$("#paramValue").attr("value",""); $("#paramValue").attr("value","");
}else{ }else{
var findTr = $("#addTr").find("tr.orange-tr"); var findTr = $("#addTr").find("tr.orange-tr");
$(findTr).find("td").eq(0).html(paramName); $(findTr).find("td").eq(0).html(paramName);
$(findTr).find("td").eq(1).html(paramValue); $(findTr).find("td").eq(1).html(paramCode);
$(findTr).find("td").eq(2).html(paramDataType); $(findTr).find("td").eq(2).html(paramValue);
$(findTr).find("td").eq(3).html(paramDataType);
$("#addTr").find("tr").removeClass(); $("#addTr").find("tr").removeClass();
$("#addParam").text("添加参数"); $("#addParam").text("添加参数");
$("#paramName").attr("value",""); $("#paramName").attr("value","");
$("#paramCode").attr("value","");
$("#paramValue").attr("value",""); $("#paramValue").attr("value","");
} }
} }
...@@ -312,14 +326,16 @@ ...@@ -312,14 +326,16 @@
}else{ }else{
$("#addTr").find("tr").each(function(){ $("#addTr").find("tr").each(function(){
var paramName = $(this).find("td").eq(0).html(); var paramName = $(this).find("td").eq(0).html();
var paramValue = $(this).find("td").eq(1).html(); var paramCode = $(this).find("td").eq(1).html();
var paramType = $(this).find("td").eq(2).html(); var paramValue = $(this).find("td").eq(2).html();
var paramType = $(this).find("td").eq(3).html();
var paramId = $(this).find("td").find("a").attr("title"); var paramId = $(this).find("td").find("a").attr("title");
if(paramId!=""){ if(paramId!=""){
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId, //url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
dataType : "text", dataType : "text",
async: false, async: false,
beforeSend: function(data){}, beforeSend: function(data){},
...@@ -333,25 +349,26 @@ ...@@ -333,25 +349,26 @@
} }
} }
}); });
}else{ }else{
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType), //url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
dataType : "text", url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
beforeSend: function(data){ }, dataType : "text",
success:function(){ beforeSend: function(data){ },
i--; success:function(){
if(i==0){ i--;
var form = $("#modelUpdateForm"); if(i==0){
form.attr("action","${ctx}/ModelManage/ModelParameterConfiguration/updateDataModelForm"); var form = $("#modelUpdateForm");
form.attr("action","${ctx}/ModelManage/ModelParameterConfiguration/updateDataModelForm");
form.submit();
form.attr("action","#"); form.submit();
} form.attr("action","#");
} }
}); }
} });
}
}); });
} }
}, },
...@@ -367,16 +384,18 @@ ...@@ -367,16 +384,18 @@
form.submit(); form.submit();
form.attr("action","#"); form.attr("action","#");
}else{ }else{
$("#addTr").find("tr").each(function(){ $("#addTr").find("tr").each(function(){
var paramName = $(this).find("td").eq(0).html(); var paramName = $(this).find("td").eq(0).html();
var paramValue = $(this).find("td").eq(1).html(); var paramCode = $(this).find("td").eq(1).html();
var paramType = $(this).find("td").eq(2).html(); var paramValue = $(this).find("td").eq(2).html();
var paramType = $(this).find("td").eq(3).html();
var paramId = $(this).find("td").find("a").attr("title"); var paramId = $(this).find("td").find("a").attr("title");
if(paramId!=""){ if(paramId!=""){
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId, //url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
dataType : "text", dataType : "text",
async: false, async: false,
beforeSend: function(data){}, beforeSend: function(data){},
...@@ -389,12 +408,13 @@ ...@@ -389,12 +408,13 @@
form.attr("action","#"); form.attr("action","#");
} }
} }
}); });
}else{ }else{
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType), //url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
dataType : "text", dataType : "text",
beforeSend: function(data){ }, beforeSend: function(data){ },
success:function(){ success:function(){
......
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
$.dialog({ $.dialog({
title:"数据模型标题:"+dataModelTitle, title:"数据模型标题:"+dataModelTitle,
content:"<div id='paramList'>"+ content:"<div id='paramList'>"+
"<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'>参数列表</div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width='20%'>参数ID号</th> <th width='35%'>参数名</th> <th width='20%'>参数值</th> <th width='25%'>参数类型</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+ "<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'>参数列表</div><div class='panel-body'> <table class='table table-hover table-striped' width='300'> <thead> <tr> <th width='15%'>参数ID号</th> <th width='35%'>参数名</th><th width='35%'>参数编码</th> <th width='20%'>参数值</th> <th width='25%'>参数类型</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+
"</div>", "</div>",
lock:true, lock:true,
width:800, width:800,
...@@ -290,6 +290,7 @@ ...@@ -290,6 +290,7 @@
data[i].parameterValue=""; data[i].parameterValue="";
} }
paramTbody.append($("<tr></tr>").append("<td>"+data[i].parameterId+"</td>") paramTbody.append($("<tr></tr>").append("<td>"+data[i].parameterId+"</td>")
.append("<td>"+data[i].parameterCode+"</td>")
.append("<td>"+data[i].parameterName+"</td>") .append("<td>"+data[i].parameterName+"</td>")
.append("<td>"+data[i].parameterValue+"</td>") .append("<td>"+data[i].parameterValue+"</td>")
.append("<td>"+data[i].parameterDataType+"</td>")); .append("<td>"+data[i].parameterDataType+"</td>"));
......
...@@ -570,7 +570,7 @@ table_pagging.prototype = { ...@@ -570,7 +570,7 @@ table_pagging.prototype = {
} }
function radioChoose(clickObj){ function radioChoose(clickObj){
alert();
var obj = eval("(" + jsonData + ")"); var obj = eval("(" + jsonData + ")");
//alert(obj); //alert(obj);
if(clickObj.checked){ if(clickObj.checked){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment