(1)提交通用字符串类的配置controller,service,dao,界面
(2)修复通用IP类配置的部分bug (3)调整列表显示顺序,将创建人,创建时间等后移
This commit is contained in:
@@ -41,12 +41,14 @@ public class IpCfgController extends BaseController{
|
||||
return "/cfg/ipWhiteForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"ipCfgList"})
|
||||
@RequestMapping(value = {"list"})
|
||||
public String ipCfgList(Model model,Integer pageNo,Integer pageSize,String cfgName,@ModelAttribute("ipCfg")BaseIpCfg ipCfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
if(ipCfg!=null){
|
||||
Integer serviceId=ipCfg.getServiceId();
|
||||
logger.info("servcice id is "+serviceId);
|
||||
if(serviceId!=null){
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
@@ -62,9 +64,8 @@ public class IpCfgController extends BaseController{
|
||||
}
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, ipCfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", ipCfg.getAction());
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
|
||||
@@ -84,8 +85,11 @@ public class IpCfgController extends BaseController{
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"ipCfgForm"})
|
||||
@RequestMapping(value = {"form"})
|
||||
public String ipCfgForm(int action,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
logger.info("sercice id is "+serviceId);
|
||||
if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
@@ -104,8 +108,8 @@ public class IpCfgController extends BaseController{
|
||||
ipcfg.initDefaultValue();
|
||||
ipcfg.setAction(action);
|
||||
ipcfg.setServiceId(serviceId);
|
||||
model.addAttribute("_ipCfg", ipcfg);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("_cfg", ipcfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
|
||||
@@ -127,16 +131,19 @@ public class IpCfgController extends BaseController{
|
||||
|
||||
return "/cfg/ipCfgForm";
|
||||
}
|
||||
@RequestMapping(value = {"updateIpCfgForm"})
|
||||
@RequestMapping(value = {"updateForm"})
|
||||
public String updateIpCfgForm(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
BaseIpCfg searchBean=new BaseIpCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseIpCfg ipCfg=ipCfgService.getIpCfgById(searchBean);
|
||||
model.addAttribute("_ipCfg", ipCfg);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("_cfg", ipCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
@@ -155,8 +162,8 @@ public class IpCfgController extends BaseController{
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseIpCfg ipCfg=ipCfgService.getIpCfgById(searchBean);
|
||||
model.addAttribute("_ipCfg", ipCfg);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("_cfg", ipCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
@@ -184,8 +191,10 @@ public class IpCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"saveOrUpdateIpCfg"})
|
||||
@RequestMapping(value = {"saveOrUpdateCfg"})
|
||||
public String saveOrUpdateIpCfg(String cfgName,Model model, BaseIpCfg ipCfg) {
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
logger.info("saveOrUpdateIpCfg loaded");
|
||||
if(ipCfg==null){
|
||||
logger.error("无法保存空的配置!");
|
||||
@@ -193,21 +202,25 @@ public class IpCfgController extends BaseController{
|
||||
}else if(!StringUtils.isBlank(ipCfg.getTableName())){
|
||||
int serviceId=ipCfg.getServiceId();
|
||||
long compileId=getCompileId(ipCfg);
|
||||
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setCreateTime(new Date());
|
||||
ipCfg.setIsValid(Constants.VALID_NO);
|
||||
ipCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
ipCfg.setCompileId(compileId);
|
||||
if(ipCfg.getCfgId()==null)
|
||||
if(ipCfg.getCfgId()==null){
|
||||
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setCreateTime(new Date());
|
||||
ipCfgService.addIpCfg(ipCfg);
|
||||
else
|
||||
}else{
|
||||
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg(ipCfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",ipCfg.getAction());
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("tableName", ipCfg.getTableName());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}else if(ipCfg.getServiceId()!=null){
|
||||
int serviceId=ipCfg.getServiceId();
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
@@ -219,13 +232,17 @@ public class IpCfgController extends BaseController{
|
||||
ipCfg.setIsValid(Constants.VALID_NO);
|
||||
ipCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
ipCfg.setCompileId(compileId);
|
||||
if(ipCfg.getCfgId()==null)
|
||||
if(ipCfg.getCfgId()==null){
|
||||
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setCreateTime(new Date());
|
||||
ipCfgService.addIpCfg(ipCfg);
|
||||
else
|
||||
}else{
|
||||
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg(ipCfg);
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
}
|
||||
model.addAttribute("action",ipCfg.getAction());
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("tableName", ipCfg.getTableName());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}
|
||||
}
|
||||
@@ -236,52 +253,6 @@ public class IpCfgController extends BaseController{
|
||||
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+ipCfg.getServiceId()+"&action="+ipCfg.getAction()+"&cfgName="+cfgName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* updateIpCfg(更新IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// @RequestMapping(value = {"updateIpCfg"})
|
||||
// public String updateIpCfg(@ModelAttribute("ipCfg") BaseIpCfg ipCfg) {
|
||||
// if(ipCfg==null){
|
||||
// logger.error("无法修改空的配置!");
|
||||
// }else if(!StringUtils.isBlank(ipCfg.getTableName())){
|
||||
// int audit=ipCfgService.getIsAudit(ipCfg);
|
||||
// //审核未通过方可修改
|
||||
// if(audit==Constants.AUDIT_NO){
|
||||
// ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
// ipCfg.setEditTime(new Date());
|
||||
// int result=ipCfgService.updateIpCfg(ipCfg);
|
||||
// }else{
|
||||
// logger.warn("审核未通过配置方可修改!");
|
||||
// }
|
||||
// }else if(ipCfg.getServiceId()!=null){
|
||||
// int serviceId=ipCfg.getServiceId();
|
||||
// ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
// if(serviceConfigInfo!=null){
|
||||
// String tableName=serviceConfigInfo.getTableName();
|
||||
// if(!StringUtils.isBlank(tableName)){
|
||||
// ipCfg.setTableName(tableName);
|
||||
// int audit=ipCfgService.getIsAudit(ipCfg);
|
||||
// //审核未通过方可修改
|
||||
// if(audit==Constants.AUDIT_NO){
|
||||
// ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
// ipCfg.setEditTime(new Date());
|
||||
// int result=ipCfgService.updateIpCfg(ipCfg);
|
||||
// }else{
|
||||
// logger.warn("审核未通过配置方可修改!");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// logger.error("无法确定IP配置的表名!");
|
||||
// }
|
||||
// return "/cfg/resultPage";
|
||||
// }
|
||||
/**
|
||||
*
|
||||
* auditIpCfg(审核IP配置)
|
||||
@@ -291,8 +262,9 @@ public class IpCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"auditIpCfg"})
|
||||
@RequestMapping(value = {"auditCfg"})
|
||||
public String auditIpCfg(String cfgName,BaseIpCfg ipCfg,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
if(ipCfg==null){
|
||||
logger.error("无法审核空的配置!");
|
||||
}else if(!StringUtils.isBlank(ipCfg.getTableName())){
|
||||
@@ -310,7 +282,6 @@ public class IpCfgController extends BaseController{
|
||||
}
|
||||
int result=ipCfgService.auditIpCfg(ipCfg);
|
||||
}
|
||||
|
||||
}else if(ipCfg.getServiceId()!=null){
|
||||
int serviceId=ipCfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
@@ -331,13 +302,14 @@ public class IpCfgController extends BaseController{
|
||||
ipCfg.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=ipCfgService.auditIpCfg(ipCfg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/ip/ipCfgList?serviceId="+ipCfg.getServiceId()+"&action="+ipCfg.getAction()+"&cfgName"+cfgName;
|
||||
return "redirect:" + adminPath + "/cfg/ip/list?serviceId="+ipCfg.getServiceId()+"&action="+ipCfg.getAction()+"&cfgName"+cfgName;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -348,8 +320,12 @@ public class IpCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"deleteIpCfg"})
|
||||
@RequestMapping(value = {"deleteCfg"})
|
||||
public String deleteIpCfg(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
int audit=ipCfgService.getIsAudit(tableName,cfgId);
|
||||
//未审核时可删除
|
||||
@@ -361,9 +337,7 @@ public class IpCfgController extends BaseController{
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=ipCfgService.deleteIpCfg(ipCfg);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("tableName", tableName);
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
@@ -384,9 +358,7 @@ public class IpCfgController extends BaseController{
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=ipCfgService.deleteIpCfg(ipCfg);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("tableName", tableName);
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
|
||||
@@ -0,0 +1,371 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.ServiceDictInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* 字符串相关配置控制类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/string")
|
||||
public class StringCfgController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"list"})
|
||||
public String stringCfgList(Model model,Integer pageNo,Integer pageSize,String cfgName,@ModelAttribute("cfg")BaseStringCfg stringCfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
if(stringCfg!=null){
|
||||
Integer serviceId=stringCfg.getServiceId();
|
||||
logger.info("servcice id is "+serviceId);
|
||||
if(serviceId!=null){
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
stringCfg.setTableName(tableName);
|
||||
Page<BaseStringCfg> searchPage=new Page<BaseStringCfg>(request, response, 1);
|
||||
if(pageNo!=null) searchPage.setPageNo(pageNo);
|
||||
if(pageSize!=null) searchPage.setPageSize(pageSize);
|
||||
if(stringCfg.getPage()!=null){
|
||||
if(!StringUtils.isBlank(stringCfg.getPage().getOrderBy()));
|
||||
searchPage.setOrderBy(stringCfg.getPage().getOrderBy());
|
||||
}
|
||||
Page<BaseStringCfg> page = stringCfgService.findPage(searchPage, stringCfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("action", stringCfg.getAction());
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的serviceId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "/cfg/stringCfgList";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"form"})
|
||||
public String stringCfgForm(int action,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
logger.info("sercice id is "+serviceId);
|
||||
if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
String className=stringCfgService.getClassName(tableName);
|
||||
logger.info("class name is "+className);
|
||||
String packageName=BaseStringCfg.class.getPackage().getName();
|
||||
try {
|
||||
//通过反射获得BaseStringCfg的子类的实例,并调用子类的initDefaultValue初始化默认值
|
||||
Class clazz=Class.forName(packageName+"."+className);
|
||||
BaseStringCfg stringcfg=(BaseStringCfg)clazz.newInstance();
|
||||
stringcfg.setTableName(tableName);
|
||||
stringcfg.initDefaultValue();
|
||||
stringcfg.setAction(action);
|
||||
stringcfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", stringcfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的serviceId");
|
||||
}
|
||||
|
||||
return "/cfg/stringCfgForm";
|
||||
}
|
||||
@RequestMapping(value = {"updateForm"})
|
||||
public String updateStringCfgForm(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("tableName", tableName);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
BaseStringCfg searchBean=new BaseStringCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseStringCfg stringCfg=stringCfgService.getStringCfgById(searchBean);
|
||||
model.addAttribute("_cfg", stringCfg);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
}else if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
BaseStringCfg searchBean=new BaseStringCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseStringCfg stringCfg=stringCfgService.getStringCfgById(searchBean);
|
||||
model.addAttribute("_cfg", stringCfg);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的表名");
|
||||
}
|
||||
|
||||
return "/cfg/stringCfgForm";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* addStringCfg(新增IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"saveOrUpdateCfg"})
|
||||
public String saveOrUpdateStringCfg(String cfgName,Model model, BaseStringCfg stringCfg) {
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType","string");
|
||||
logger.info("saveOrUpdateStringCfg loaded");
|
||||
if(stringCfg==null){
|
||||
logger.error("无法保存空的配置!");
|
||||
addMessage(model,"保存失败!");
|
||||
}else if(!StringUtils.isBlank(stringCfg.getTableName())){
|
||||
int serviceId=stringCfg.getServiceId();
|
||||
long compileId=getCompileId(stringCfg);
|
||||
stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setCreateTime(new Date());
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
stringCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
stringCfg.setCompileId(compileId);
|
||||
if(stringCfg.getCfgId()==null){
|
||||
stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setCreateTime(new Date());
|
||||
stringCfgService.addStringCfg(stringCfg);
|
||||
}else{
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfgService.updateStringCfg(stringCfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",stringCfg.getAction());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}else if(stringCfg.getServiceId()!=null){
|
||||
int serviceId=stringCfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
long compileId=getCompileId(stringCfg);
|
||||
stringCfg.setTableName(tableName);
|
||||
stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setCreateTime(new Date());
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
stringCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
stringCfg.setCompileId(compileId);
|
||||
if(stringCfg.getCfgId()==null){
|
||||
stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setCreateTime(new Date());
|
||||
stringCfgService.addStringCfg(stringCfg);
|
||||
}else{
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfgService.updateStringCfg(stringCfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",stringCfg.getAction());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
addMessage(model,"保存失败!");
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}
|
||||
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+stringCfg.getServiceId()+"&action="+stringCfg.getAction()+"&cfgName="+cfgName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* auditStringCfg(审核IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"auditCfg"})
|
||||
public String auditStringCfg(String cfgName,BaseStringCfg stringCfg,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
if(stringCfg==null){
|
||||
logger.error("无法审核空的配置!");
|
||||
}else if(!StringUtils.isBlank(stringCfg.getTableName())){
|
||||
int audit=stringCfgService.getIsAudit(stringCfg);
|
||||
if(audit==Constants.AUDIT_YES&&stringCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
stringCfg.setAuditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setAuditTime(new Date());
|
||||
|
||||
if(stringCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
}else if(stringCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
stringCfg.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=stringCfgService.auditStringCfg(stringCfg);
|
||||
}
|
||||
|
||||
}else if(stringCfg.getServiceId()!=null){
|
||||
int serviceId=stringCfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
stringCfg.setTableName(tableName);
|
||||
int audit=stringCfgService.getIsAudit(stringCfg);
|
||||
if(audit==Constants.AUDIT_YES&&stringCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
stringCfg.setAuditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setAuditTime(new Date());
|
||||
|
||||
if(stringCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
}else if(stringCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
stringCfg.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=stringCfgService.auditStringCfg(stringCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/string/list?serviceId="+stringCfg.getServiceId()+"&action="+stringCfg.getAction()+"&cfgName"+cfgName;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditStringCfg(删除IP配置,逻辑删除)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"deleteCfg"})
|
||||
public String deleteStringCfg(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType","string");
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
int audit=stringCfgService.getIsAudit(tableName,cfgId);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
BaseStringCfg stringCfg=new BaseStringCfg();
|
||||
stringCfg.setCfgId(cfgId);
|
||||
stringCfg.setTableName(tableName);
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=stringCfgService.deleteStringCfg(stringCfg);
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
}
|
||||
|
||||
}else if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
BaseStringCfg stringCfg=new BaseStringCfg();
|
||||
stringCfg.setCfgId(cfgId);
|
||||
stringCfg.setTableName(tableName);
|
||||
int audit=stringCfgService.getIsAudit(stringCfg);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=stringCfgService.deleteStringCfg(stringCfg);
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getCompileId(获取编译ID)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*long
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected long getCompileId(BaseCfg cfg){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user