2018-01-09 16:50:39 +08:00
|
|
|
|
package com.nis.web.controller.configuration;
|
|
|
|
|
|
|
2018-02-25 18:43:20 +08:00
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
2018-02-23 09:54:28 +08:00
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2018-01-09 16:50:39 +08:00
|
|
|
|
import org.springframework.stereotype.Controller;
|
2018-02-23 09:54:28 +08:00
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
2018-02-02 17:58:32 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
2018-02-23 09:54:28 +08:00
|
|
|
|
|
|
|
|
|
|
import com.nis.domain.Page;
|
|
|
|
|
|
import com.nis.domain.ServiceConfigInfo;
|
|
|
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-02-25 18:43:20 +08:00
|
|
|
|
import com.nis.domain.configuration.RequestInfo;
|
|
|
|
|
|
import com.nis.domain.configuration.ServiceDictInfo;
|
|
|
|
|
|
import com.nis.util.Constants;
|
2018-02-23 09:54:28 +08:00
|
|
|
|
import com.nis.web.controller.BaseController;
|
2018-01-09 16:50:39 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* IP相关配置控制类
|
|
|
|
|
|
* @author dell
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Controller
|
2018-02-02 17:58:32 +08:00
|
|
|
|
@RequestMapping("${adminPath}/cfg/ip")
|
2018-02-23 09:54:28 +08:00
|
|
|
|
public class IpCfgController extends BaseController{
|
2018-02-02 17:58:32 +08:00
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = {"ipWhiteList"})
|
2018-02-25 18:43:20 +08:00
|
|
|
|
public String ipWhiteList(Model model,BaseIpCfg baseIpCfg,HttpServletRequest request,HttpServletResponse response) {
|
2018-02-02 17:58:32 +08:00
|
|
|
|
return "/cfg/ipWhiteList";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-09 16:50:39 +08:00
|
|
|
|
|
2018-02-02 17:58:32 +08:00
|
|
|
|
@RequestMapping(value = {"ipWhiteForm"})
|
|
|
|
|
|
public String ipWhiteForm() {
|
|
|
|
|
|
return "/cfg/ipWhiteForm";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-27 15:31:30 +08:00
|
|
|
|
@RequestMapping(value = {"list"})
|
2018-02-25 18:43:20 +08:00
|
|
|
|
public String ipCfgList(Model model,Integer pageNo,Integer pageSize,String cfgName,@ModelAttribute("ipCfg")BaseIpCfg ipCfg,HttpServletRequest request,HttpServletResponse response) {
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
if(ipCfg!=null){
|
|
|
|
|
|
Integer serviceId=ipCfg.getServiceId();
|
|
|
|
|
|
logger.info("servcice id is "+serviceId);
|
2018-02-23 09:54:28 +08:00
|
|
|
|
if(serviceId!=null){
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("serviceId", serviceId);
|
2018-02-23 09:54:28 +08:00
|
|
|
|
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
|
|
|
|
|
if(serviceConfigInfo!=null){
|
|
|
|
|
|
String tableName=serviceConfigInfo.getTableName();
|
|
|
|
|
|
if(!StringUtils.isBlank(tableName)){
|
|
|
|
|
|
logger.info("table name is "+tableName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ipCfg.setTableName(tableName);
|
|
|
|
|
|
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request, response, 1);
|
|
|
|
|
|
if(pageNo!=null) searchPage.setPageNo(pageNo);
|
|
|
|
|
|
if(pageSize!=null) searchPage.setPageSize(pageSize);
|
|
|
|
|
|
if(ipCfg.getPage()!=null){
|
|
|
|
|
|
if(!StringUtils.isBlank(ipCfg.getPage().getOrderBy()));
|
|
|
|
|
|
searchPage.setOrderBy(ipCfg.getPage().getOrderBy());
|
|
|
|
|
|
}
|
|
|
|
|
|
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, ipCfg);
|
2018-02-23 09:54:28 +08:00
|
|
|
|
model.addAttribute("page", page);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
model.addAttribute("action", ipCfg.getAction());
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("tableName", tableName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
|
|
|
|
|
model.addAttribute("requestInfos", requestInfos);
|
2018-03-05 16:30:16 +08:00
|
|
|
|
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
2018-02-25 18:43:20 +08:00
|
|
|
|
model.addAttribute("fls", fls);
|
2018-03-05 16:30:16 +08:00
|
|
|
|
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
2018-02-25 18:43:20 +08:00
|
|
|
|
model.addAttribute("xzs", xzs);
|
2018-03-05 16:30:16 +08:00
|
|
|
|
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
2018-02-25 18:43:20 +08:00
|
|
|
|
model.addAttribute("lables", lables);
|
2018-02-23 09:54:28 +08:00
|
|
|
|
}
|
2018-02-25 18:43:20 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
logger.error("未获取到正确的serviceId");
|
2018-02-23 09:54:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-25 18:43:20 +08:00
|
|
|
|
return "/cfg/ipCfgList";
|
2018-02-02 17:58:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-27 15:31:30 +08:00
|
|
|
|
@RequestMapping(value = {"form"})
|
2018-02-25 18:43:20 +08:00
|
|
|
|
public String ipCfgForm(int action,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
|
|
|
|
|
model.addAttribute("serviceId", serviceId);
|
|
|
|
|
|
model.addAttribute("action", action);
|
2018-02-23 09:54:28 +08:00
|
|
|
|
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=ipCfgService.getClassName(tableName);
|
|
|
|
|
|
logger.info("class name is "+className);
|
|
|
|
|
|
String packageName=BaseIpCfg.class.getPackage().getName();
|
|
|
|
|
|
try {
|
|
|
|
|
|
//通过反射获得BaseIpCfg的子类的实例,并调用子类的initDefaultValue初始化默认值
|
|
|
|
|
|
Class clazz=Class.forName(packageName+"."+className);
|
|
|
|
|
|
BaseIpCfg ipcfg=(BaseIpCfg)clazz.newInstance();
|
|
|
|
|
|
ipcfg.setTableName(tableName);
|
|
|
|
|
|
ipcfg.initDefaultValue();
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ipcfg.setAction(action);
|
|
|
|
|
|
ipcfg.setServiceId(serviceId);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("_cfg", ipcfg);
|
2018-03-05 16:30:16 +08:00
|
|
|
|
long compileId=this.getCompileId();
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("tableName", tableName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
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);
|
2018-02-23 09:54:28 +08:00
|
|
|
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
logger.error("打开新增IP窗口失败",e);
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-02-25 18:43:20 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
logger.error("未获取到正确的serviceId");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return "/cfg/ipCfgForm";
|
|
|
|
|
|
}
|
2018-02-27 15:31:30 +08:00
|
|
|
|
@RequestMapping(value = {"updateForm"})
|
2018-02-25 18:43:20 +08:00
|
|
|
|
public String updateIpCfgForm(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
|
|
|
|
|
model.addAttribute("serviceId", serviceId);
|
|
|
|
|
|
model.addAttribute("action", action);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
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);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("_cfg", ipCfg);
|
|
|
|
|
|
model.addAttribute("tableName", tableName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
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);
|
|
|
|
|
|
BaseIpCfg searchBean=new BaseIpCfg();
|
|
|
|
|
|
searchBean.setCfgId(cfgId);
|
|
|
|
|
|
searchBean.setTableName(tableName);
|
|
|
|
|
|
BaseIpCfg ipCfg=ipCfgService.getIpCfgById(searchBean);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("_cfg", ipCfg);
|
|
|
|
|
|
model.addAttribute("tableName", tableName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
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("未获取到正确的表名");
|
2018-02-23 09:54:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-25 18:43:20 +08:00
|
|
|
|
return "/cfg/ipCfgForm";
|
2018-02-23 09:54:28 +08:00
|
|
|
|
}
|
2018-02-25 18:43:20 +08:00
|
|
|
|
|
2018-02-23 09:54:28 +08:00
|
|
|
|
/**
|
|
|
|
|
|
*
|
2018-02-25 18:43:20 +08:00
|
|
|
|
* addIpCfg(新增IP配置)
|
2018-02-23 09:54:28 +08:00
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*String
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-02-27 15:31:30 +08:00
|
|
|
|
@RequestMapping(value = {"saveOrUpdateCfg"})
|
2018-02-25 18:43:20 +08:00
|
|
|
|
public String saveOrUpdateIpCfg(String cfgName,Model model, BaseIpCfg ipCfg) {
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("cfgName",cfgName);
|
|
|
|
|
|
model.addAttribute("cfgType", "ip");
|
2018-02-25 18:43:20 +08:00
|
|
|
|
logger.info("saveOrUpdateIpCfg loaded");
|
|
|
|
|
|
if(ipCfg==null){
|
|
|
|
|
|
logger.error("无法保存空的配置!");
|
|
|
|
|
|
addMessage(model,"保存失败!");
|
|
|
|
|
|
}else if(!StringUtils.isBlank(ipCfg.getTableName())){
|
|
|
|
|
|
int serviceId=ipCfg.getServiceId();
|
2018-03-05 16:30:16 +08:00
|
|
|
|
long compileId=getCompileId();
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ipCfg.setIsValid(Constants.VALID_NO);
|
|
|
|
|
|
ipCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
|
|
|
|
ipCfg.setCompileId(compileId);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
if(ipCfg.getCfgId()==null){
|
|
|
|
|
|
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setCreateTime(new Date());
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ipCfgService.addIpCfg(ipCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setEditTime(new Date());
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ipCfgService.updateIpCfg(ipCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-02-25 18:43:20 +08:00
|
|
|
|
model.addAttribute("serviceId",serviceId);
|
|
|
|
|
|
model.addAttribute("action",ipCfg.getAction());
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("tableName", ipCfg.getTableName());
|
2018-02-25 18:43:20 +08:00
|
|
|
|
addMessage(model,"保存成功,正在为您跳转页面...");
|
|
|
|
|
|
}else if(ipCfg.getServiceId()!=null){
|
|
|
|
|
|
int serviceId=ipCfg.getServiceId();
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("serviceId",serviceId);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
|
|
|
|
|
if(serviceConfigInfo!=null){
|
|
|
|
|
|
String tableName=serviceConfigInfo.getTableName();
|
|
|
|
|
|
if(!StringUtils.isBlank(tableName)){
|
2018-03-05 16:30:16 +08:00
|
|
|
|
long compileId=getCompileId();
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ipCfg.setTableName(tableName);
|
|
|
|
|
|
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setCreateTime(new Date());
|
|
|
|
|
|
ipCfg.setIsValid(Constants.VALID_NO);
|
|
|
|
|
|
ipCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
|
|
|
|
ipCfg.setCompileId(compileId);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
if(ipCfg.getCfgId()==null){
|
|
|
|
|
|
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setCreateTime(new Date());
|
|
|
|
|
|
}else{
|
|
|
|
|
|
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setEditTime(new Date());
|
2018-02-25 18:43:20 +08:00
|
|
|
|
ipCfgService.updateIpCfg(ipCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-02-25 18:43:20 +08:00
|
|
|
|
model.addAttribute("action",ipCfg.getAction());
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("tableName", ipCfg.getTableName());
|
2018-02-25 18:43:20 +08:00
|
|
|
|
addMessage(model,"保存成功,正在为您跳转页面...");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
addMessage(model,"保存失败!");
|
|
|
|
|
|
logger.error("无法确定IP配置的表名!");
|
2018-02-23 09:54:28 +08:00
|
|
|
|
}
|
2018-02-25 18:43:20 +08:00
|
|
|
|
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+ipCfg.getServiceId()+"&action="+ipCfg.getAction()+"&cfgName="+cfgName);
|
2018-02-02 17:58:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-25 18:43:20 +08:00
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* auditIpCfg(审核IP配置)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*String
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-02-27 15:31:30 +08:00
|
|
|
|
@RequestMapping(value = {"auditCfg"})
|
2018-02-25 18:43:20 +08:00
|
|
|
|
public String auditIpCfg(String cfgName,BaseIpCfg ipCfg,Model model) {
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
if(ipCfg==null){
|
|
|
|
|
|
logger.error("无法审核空的配置!");
|
|
|
|
|
|
}else if(!StringUtils.isBlank(ipCfg.getTableName())){
|
|
|
|
|
|
int audit=ipCfgService.getIsAudit(ipCfg);
|
|
|
|
|
|
if(audit==Constants.AUDIT_YES&&ipCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
|
|
|
|
|
logger.error("审核通过的配置只能取消审核通过!");
|
|
|
|
|
|
}else{
|
|
|
|
|
|
ipCfg.setAuditorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setAuditTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
if(ipCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
|
|
|
|
|
ipCfg.setIsValid(Constants.VALID_NO);
|
|
|
|
|
|
}else if(ipCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
|
|
|
|
|
ipCfg.setIsValid(Constants.VALID_YES);
|
|
|
|
|
|
}
|
|
|
|
|
|
int result=ipCfgService.auditIpCfg(ipCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}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_YES&&ipCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
|
|
|
|
|
logger.error("审核通过的配置只能取消审核通过!");
|
|
|
|
|
|
}else{
|
|
|
|
|
|
ipCfg.setAuditorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setAuditTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
if(ipCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
|
|
|
|
|
ipCfg.setIsValid(Constants.VALID_NO);
|
|
|
|
|
|
}else if(ipCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
|
|
|
|
|
ipCfg.setIsValid(Constants.VALID_YES);
|
|
|
|
|
|
}
|
|
|
|
|
|
int result=ipCfgService.auditIpCfg(ipCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
|
2018-02-25 18:43:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
logger.error("无法确定IP配置的表名!");
|
|
|
|
|
|
}
|
2018-02-27 15:31:30 +08:00
|
|
|
|
return "redirect:" + adminPath + "/cfg/ip/list?serviceId="+ipCfg.getServiceId()+"&action="+ipCfg.getAction()+"&cfgName"+cfgName;
|
2018-02-25 18:43:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* auditIpCfg(删除IP配置,逻辑删除)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*String
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-02-27 15:31:30 +08:00
|
|
|
|
@RequestMapping(value = {"deleteCfg"})
|
2018-02-25 18:43:20 +08:00
|
|
|
|
public String deleteIpCfg(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model) {
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
|
|
|
|
|
model.addAttribute("serviceId", serviceId);
|
|
|
|
|
|
model.addAttribute("action", action);
|
|
|
|
|
|
model.addAttribute("cfgType", "ip");
|
2018-02-25 18:43:20 +08:00
|
|
|
|
if(!StringUtils.isBlank(tableName)){
|
|
|
|
|
|
int audit=ipCfgService.getIsAudit(tableName,cfgId);
|
|
|
|
|
|
//未审核时可删除
|
|
|
|
|
|
if(audit!=Constants.AUDIT_YES){
|
|
|
|
|
|
BaseIpCfg ipCfg=new BaseIpCfg();
|
|
|
|
|
|
ipCfg.setCfgId(cfgId);
|
|
|
|
|
|
ipCfg.setTableName(tableName);
|
|
|
|
|
|
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setEditTime(new Date());
|
|
|
|
|
|
ipCfg.setIsValid(Constants.VALID_DEL);
|
|
|
|
|
|
int result=ipCfgService.deleteIpCfg(ipCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("tableName", tableName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
addMessage(model,"删除成功,正在为您跳转页面...");
|
|
|
|
|
|
}else{
|
|
|
|
|
|
logger.error("通过审核的配置不能删除!");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}else if(serviceId!=null){
|
|
|
|
|
|
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
|
|
|
|
|
if(serviceConfigInfo!=null){
|
|
|
|
|
|
tableName=serviceConfigInfo.getTableName();
|
|
|
|
|
|
if(!StringUtils.isBlank(tableName)){
|
|
|
|
|
|
BaseIpCfg ipCfg=new BaseIpCfg();
|
|
|
|
|
|
ipCfg.setCfgId(cfgId);
|
|
|
|
|
|
ipCfg.setTableName(tableName);
|
|
|
|
|
|
int audit=ipCfgService.getIsAudit(ipCfg);
|
|
|
|
|
|
//未审核时可删除
|
|
|
|
|
|
if(audit!=Constants.AUDIT_YES){
|
|
|
|
|
|
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
|
ipCfg.setEditTime(new Date());
|
|
|
|
|
|
ipCfg.setIsValid(Constants.VALID_DEL);
|
|
|
|
|
|
int result=ipCfgService.deleteIpCfg(ipCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
model.addAttribute("tableName", tableName);
|
2018-02-25 18:43:20 +08:00
|
|
|
|
addMessage(model,"删除成功,正在为您跳转页面...");
|
|
|
|
|
|
}else{
|
|
|
|
|
|
logger.error("通过审核的配置不能删除!");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
logger.error("无法确定IP配置的表名!");
|
|
|
|
|
|
}
|
|
|
|
|
|
return "/cfg/resultPage";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* getCompileId(获取编译ID)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*long
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
protected long getCompileId(){
|
2018-02-25 18:43:20 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2018-01-09 16:50:39 +08:00
|
|
|
|
}
|