删除旧版gwall中的四个Controller
This commit is contained in:
@@ -1,335 +0,0 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
import java.util.ArrayList;
|
||||
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.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* 增强字符串相关配置控制类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/complex")
|
||||
public class ComplexStringCfgController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"list"})
|
||||
@RequiresPermissions(value={"cfg:complex:view"})
|
||||
public String cfgList(Model model,Integer audit,String cfgName,@ModelAttribute("cfg")ComplexkeywordCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", audit);
|
||||
if(cfg!=null){
|
||||
Integer serviceId=cfg.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);
|
||||
cfg.setTableName(tableName);
|
||||
Page<ComplexkeywordCfg> searchPage=new Page<ComplexkeywordCfg>(request,response,"r");
|
||||
String addWhrere=null;
|
||||
if(audit==Constants.CFG_PAGE){//
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_NO+")";
|
||||
}else if(audit==Constants.AUDIT_PAGE){
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_YES+")";
|
||||
}
|
||||
if(addWhrere!=null){
|
||||
if(StringUtils.isNotBlank(searchPage.getWhere())){
|
||||
searchPage.setWhere(searchPage.getWhere()+" AND "+addWhrere);
|
||||
}else{
|
||||
searchPage.setWhere(addWhrere);
|
||||
}
|
||||
}
|
||||
Page<ComplexkeywordCfg> page = complexStringCfgService.findPage(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("action", cfg.getAction());
|
||||
model.addAttribute("tableName", tableName);
|
||||
initPageCondition(model);
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的serviceId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "/cfg/complexCfgList";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"cfg:complex:add"})
|
||||
public String cfgForm(int action,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
logger.info("sercice id is "+serviceId);
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
String className=complexStringCfgService.getClassName(tableName);
|
||||
logger.info("class name is "+className);
|
||||
String packageName=ComplexkeywordCfg.class.getPackage().getName();
|
||||
try {
|
||||
//通过反射获得ComplexkeywordCfg的子类的实例,并调用子类的initDefaultValue初始化默认值
|
||||
Class clazz=Class.forName(packageName+"."+className);
|
||||
ComplexkeywordCfg cfg=(ComplexkeywordCfg)clazz.newInstance();
|
||||
cfg.setTableName(tableName);
|
||||
cfg.initDefaultValue();
|
||||
cfg.setAction(action);
|
||||
//监测缺省不需要区域管控
|
||||
if(action==Constants.ACTION_DJ){
|
||||
cfg.setIsAreaEffective(0);
|
||||
}
|
||||
cfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
initFormCondition(model);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return "/cfg/complexCfgForm";
|
||||
}
|
||||
@RequestMapping(value = {"updateForm"})
|
||||
@RequiresPermissions(value={"cfg:complex:edit"})
|
||||
public String updateStringCfgForm(String tableName,int action,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("tableName", tableName);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
logger.info("table name is "+tableName);
|
||||
ComplexkeywordCfg searchBean=new ComplexkeywordCfg();
|
||||
searchBean.setCompileId(compileId);
|
||||
searchBean.setTableName(tableName);
|
||||
ComplexkeywordCfg cfg=complexStringCfgService.get(searchBean);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
initUpdateFormCondition(model,cfg);
|
||||
}catch(Exception e){
|
||||
logger.error("发生异常", e);
|
||||
}
|
||||
return "/cfg/complexCfgForm";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* addStringCfg(新增IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"saveOrUpdateCfg"})
|
||||
@RequiresPermissions(value={"cfg:complex:add","cfg:complex:edit"},logical=Logical.OR)
|
||||
public String saveOrUpdateStringCfg(String cfgName,Model model, ComplexkeywordCfg cfg,String areaCfgIds) {
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType","complex");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
model.addAttribute("serviceId",cfg.getServiceId());
|
||||
model.addAttribute("action",cfg.getAction());
|
||||
logger.info("saveOrUpdateStringCfg loaded");
|
||||
try {
|
||||
setSaveOrUpdateProps(model,cfg,areaCfgIds);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("保存失败!",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* auditStringCfg(审核IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"cfg:complex:audit"})
|
||||
public String auditStringCfg(String cfgName,int serviceId,int isAudit,int action,String tableName,String ids,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
model.addAttribute("cfgType", "complex");
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
try{
|
||||
String maatTable=null;
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
maatTable=serviceConfigInfo.getMaatTable();
|
||||
}
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
List<ComplexkeywordCfg> beans=complexStringCfgService.getList(tableName,ids);
|
||||
List<ComplexkeywordCfg> auditBeans=new ArrayList<>();
|
||||
List<BaseIpCfg> auditAreaBeans=new ArrayList<>();
|
||||
Date date=new Date();
|
||||
for(ComplexkeywordCfg bean:beans){
|
||||
ComplexkeywordCfg auditBean=new ComplexkeywordCfg();
|
||||
auditBean.setTableName(tableName);
|
||||
auditBean.setCfgId(bean.getCfgId());
|
||||
bean.setTableName(tableName);
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&isAudit!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
addMessage(model, "audit_failed");
|
||||
return "/cfg/resultPage";
|
||||
}else{
|
||||
auditBean.setAuditorId(bean.getCurrentUser().getId());
|
||||
auditBean.setAuditTime(date);
|
||||
auditBean.setIsAudit(isAudit);
|
||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
||||
bean.setAuditTime(date);
|
||||
bean.setIsAudit(isAudit);
|
||||
if(isAudit==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
auditBean.setIsValid(Constants.VALID_NO);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
}else if(isAudit==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
auditBean.setIsValid(Constants.VALID_YES);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(bean.getCompileId());
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
c.setAuditorId(c.getCurrentUser().getId());
|
||||
c.setAuditTime(date);
|
||||
c.setIsAudit(isAudit);
|
||||
if(isAudit==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
c.setIsValid(Constants.VALID_NO);
|
||||
}else if(isAudit==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
c.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
}
|
||||
bean.setAreaCfg(areaCfg);
|
||||
auditAreaBeans.addAll(areaCfg);
|
||||
}
|
||||
auditBeans.add(auditBean);
|
||||
}
|
||||
complexStringCfgService.auditStringCfg(isAudit,auditBeans,auditAreaBeans,beans);
|
||||
}
|
||||
addMessage(model,"audit_success");
|
||||
}catch(Exception e){
|
||||
logger.error("发生异常",e);
|
||||
addMessage(model,"audit_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditStringCfg(删除IP配置,逻辑删除)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"cfg:complex:delete"})
|
||||
public String deleteStringCfg(String tableName,int action,String ids,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType","complex");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
List<ComplexkeywordCfg> complexCfgs=new ArrayList<ComplexkeywordCfg>();
|
||||
List<BaseIpCfg> areaCfgs=new ArrayList<BaseIpCfg>();
|
||||
Date date =new Date();
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
for(String compileIdStr:ids.split(",")){
|
||||
if(StringUtils.isNotBlank(compileIdStr)){
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(Integer.parseInt(compileIdStr));
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
c.setEditorId(c.getCurrentUser().getId());
|
||||
c.setEditTime(date);
|
||||
}
|
||||
}
|
||||
areaCfgs.addAll(areaCfg);
|
||||
ComplexkeywordCfg complexCfg=new ComplexkeywordCfg();
|
||||
complexCfg.setCompileId(Integer.parseInt(compileIdStr));
|
||||
complexCfg.setTableName(tableName);
|
||||
complexCfg.setEditorId(complexCfg.getCurrentUser().getId());
|
||||
complexCfg.setEditTime(date);
|
||||
complexCfg.setIsValid(Constants.VALID_DEL);
|
||||
complexCfgs.add(complexCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
complexStringCfgService.deleteStringCfg(complexCfgs,areaCfgs);
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getCompileId(获取编译ID)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*long
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected long getCompileId(ComplexkeywordCfg cfg){
|
||||
long compileId=0l;
|
||||
try {
|
||||
compileId = cfg.getCompileId()==null?new ConvertTool().getCompileId():cfg.getCompileId();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return compileId;
|
||||
}
|
||||
}
|
||||
@@ -1,374 +0,0 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/ip")
|
||||
public class IpCfgController extends BaseController{
|
||||
@RequestMapping(value = {"list"})
|
||||
@RequiresPermissions(value={"cfg:ip:view"})
|
||||
public String ipCfgList(Model model,Integer audit,String cfgName,@ModelAttribute("ipCfg")BaseIpCfg ipCfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", audit);
|
||||
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();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
ipCfg.setTableName(tableName);
|
||||
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request,response,"r");
|
||||
String addWhrere=null;
|
||||
if(audit==Constants.CFG_PAGE){//
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_NO+")";
|
||||
}else if(audit==Constants.AUDIT_PAGE){
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_YES+")";
|
||||
}
|
||||
if(addWhrere!=null){
|
||||
if(StringUtils.isNotBlank(searchPage.getWhere())){
|
||||
searchPage.setWhere(searchPage.getWhere()+" AND "+addWhrere);
|
||||
}else{
|
||||
searchPage.setWhere(addWhrere);
|
||||
}
|
||||
}
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, ipCfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("action", ipCfg.getAction());
|
||||
model.addAttribute("tableName", tableName);
|
||||
initPageCondition(model);
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的serviceId");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "/cfg/ipCfgList";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ipCfgForm(新增页面初始化,只会在配置界面使用)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param action
|
||||
* @param cfgName
|
||||
* @param serviceId
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions("cfg:ip:add")
|
||||
public String ipCfgForm(int action,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
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();
|
||||
ipcfg.setAction(action);
|
||||
//监测缺省不需要区域管控
|
||||
if(action==Constants.ACTION_DJ){
|
||||
ipcfg.setIsAreaEffective(0);
|
||||
}
|
||||
ipcfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", ipcfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
initFormCondition(model);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的serviceId");
|
||||
}
|
||||
|
||||
return "/cfg/ipCfgForm";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* updateIpCfgForm(更新配置页面初始化,只会在配置界面出现)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param tableName
|
||||
* @param action
|
||||
* @param cfgId
|
||||
* @param cfgName
|
||||
* @param serviceId
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequiresPermissions("cfg:ip:edit")
|
||||
@RequestMapping(value = {"updateForm"})
|
||||
public String updateIpCfgForm(String tableName,int action,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("audit",Constants.CFG_PAGE);
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
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.setCompileId(compileId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseIpCfg ipCfg=ipCfgService.get(searchBean);
|
||||
model.addAttribute("_cfg", ipCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
initUpdateFormCondition(model,ipCfg);
|
||||
}else{
|
||||
logger.error("未获取到正确的表名");
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("发生异常", e);
|
||||
}
|
||||
return "/cfg/ipCfgForm";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* addIpCfg(新增IP配置,后台保存方法)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"saveOrUpdateCfg"})
|
||||
@RequiresPermissions(value={"cfg:ip:add","cfg:ip:edit"},logical=Logical.OR)
|
||||
public String saveOrUpdateIpCfg(String cfgName,Model model, BaseIpCfg ipCfg,String areaCfgIds) {
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
model.addAttribute("serviceId",ipCfg.getServiceId());
|
||||
model.addAttribute("action",ipCfg.getAction());
|
||||
model.addAttribute("tableName", ipCfg.getTableName());
|
||||
logger.info("saveOrUpdateIpCfg loaded");
|
||||
try{
|
||||
setSaveOrUpdateProps(model,ipCfg,areaCfgIds);
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* auditIpCfg(审核IP配置)
|
||||
* (审核流程只在审核页面)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions("cfg:ip:audit")
|
||||
public String auditIpCfg(String cfgName,int serviceId,int isAudit,int action,String tableName,String ids,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
try{
|
||||
String maatTable=null;
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
maatTable=serviceConfigInfo.getMaatTable();
|
||||
}
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
List<BaseIpCfg> beans=ipCfgService.getListByComileId(tableName,ids);
|
||||
List<BaseIpCfg> auditBeans=new ArrayList<>();
|
||||
List<BaseIpCfg> auditAreaBeans=new ArrayList<>();
|
||||
Date date=new Date();
|
||||
for(BaseIpCfg bean:beans){
|
||||
BaseIpCfg auditBean=new BaseIpCfg();
|
||||
auditBean.setTableName(tableName);
|
||||
auditBean.setCfgId(bean.getCfgId());
|
||||
bean.setTableName(tableName);
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&isAudit!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
addMessage(model, "audit_failed");
|
||||
return "/cfg/resultPage";
|
||||
}else{
|
||||
auditBean.setAuditorId(bean.getCurrentUser().getId());
|
||||
auditBean.setAuditTime(date);
|
||||
auditBean.setIsAudit(isAudit);
|
||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
||||
bean.setAuditTime(date);
|
||||
bean.setIsAudit(isAudit);
|
||||
if(isAudit==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
auditBean.setIsValid(Constants.VALID_NO);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
}else if(isAudit==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
auditBean.setIsValid(Constants.VALID_YES);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(bean.getCompileId());
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
c.setAuditorId(c.getCurrentUser().getId());
|
||||
c.setAuditTime(date);
|
||||
c.setIsAudit(isAudit);
|
||||
if(isAudit==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
c.setIsValid(Constants.VALID_NO);
|
||||
}else if(isAudit==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
c.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
}
|
||||
bean.setAreaCfg(areaCfg);
|
||||
auditAreaBeans.addAll(areaCfg);
|
||||
}
|
||||
auditBeans.add(auditBean);
|
||||
}
|
||||
// ipCfgService.auditIpCfg(isAudit,auditBeans,auditAreaBeans,beans);
|
||||
}
|
||||
addMessage(model,"audit_success");
|
||||
}catch(Exception e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(model, "audit_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* deleteIpCfg(删除IP配置,逻辑删除)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequiresPermissions("cfg:ip:edit")
|
||||
@RequestMapping(value = {"delete"})
|
||||
public String deleteIpCfg(String tableName,int action,String ids,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<BaseIpCfg> ipCfgs=new ArrayList<BaseIpCfg>();
|
||||
List<AreaIpCfg> areaCfgs=new ArrayList<AreaIpCfg>();
|
||||
Date date =new Date();
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
for(String compileIdStr:ids.split(",")){
|
||||
if(StringUtils.isNotBlank(compileIdStr)){
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(Integer.parseInt(compileIdStr));
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
c.setEditorId(c.getCurrentUser().getId());
|
||||
c.setEditTime(date);
|
||||
}
|
||||
}
|
||||
areaCfgs.addAll(areaCfg);
|
||||
BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
ipCfg.setCompileId(Integer.parseInt(compileIdStr));
|
||||
ipCfg.setTableName(tableName);
|
||||
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setEditTime(date);
|
||||
ipCfg.setIsValid(Constants.VALID_DEL);
|
||||
ipCfgs.add(ipCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
ipCfgService.deleteIpCfg(ipCfgs,areaCfgs);
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getCompileId(获取编译ID)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*long
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected long getCompileId(BaseIpCfg cfg){
|
||||
long compileId=0l;
|
||||
try {
|
||||
compileId = cfg.getCompileId()==null?new ConvertTool().getCompileId():cfg.getCompileId();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return compileId;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,335 +0,0 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
import java.util.ArrayList;
|
||||
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.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* 字符串相关配置控制类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/string")
|
||||
public class StringCfgController extends BaseController{
|
||||
/**
|
||||
*
|
||||
* stringCfgList(列表界面)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param model
|
||||
* @param audit
|
||||
* @param cfgName
|
||||
* @param stringCfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"list"})
|
||||
@RequiresPermissions(value={"cfg:string:view"})
|
||||
public String stringCfgList(Model model,Integer audit,String cfgName,@ModelAttribute("cfg")BaseStringCfg stringCfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", audit);
|
||||
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,"r");
|
||||
String addWhrere=null;
|
||||
if(audit==Constants.CFG_PAGE){//
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_NO+")";
|
||||
}else if(audit==Constants.AUDIT_PAGE){
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_YES+")";
|
||||
}
|
||||
if(addWhrere!=null){
|
||||
if(StringUtils.isNotBlank(searchPage.getWhere())){
|
||||
searchPage.setWhere(searchPage.getWhere()+" AND "+addWhrere);
|
||||
}else{
|
||||
searchPage.setWhere(addWhrere);
|
||||
}
|
||||
}
|
||||
Page<BaseStringCfg> page = stringCfgService.findPage(searchPage, stringCfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("action", stringCfg.getAction());
|
||||
model.addAttribute("tableName", tableName);
|
||||
initPageCondition(model);
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的serviceId");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "/cfg/stringCfgList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"cfg:string:add"})
|
||||
public String stringCfgForm(int action,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
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);
|
||||
//监测缺省不需要区域管控
|
||||
if(action==Constants.ACTION_DJ){
|
||||
stringcfg.setIsAreaEffective(0);
|
||||
}
|
||||
stringcfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", stringcfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
initFormCondition(model);
|
||||
} 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"})
|
||||
@RequiresPermissions(value={"cfg:string:edit"})
|
||||
public String updateStringCfgForm(String tableName,int action,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("tableName", tableName);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
logger.info("table name is "+tableName);
|
||||
BaseStringCfg searchBean=new BaseStringCfg();
|
||||
searchBean.setCompileId(compileId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseStringCfg stringCfg=stringCfgService.get(searchBean);
|
||||
model.addAttribute("_cfg", stringCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
initUpdateFormCondition(model,stringCfg);
|
||||
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("发生异常",e);
|
||||
}
|
||||
return "/cfg/stringCfgForm";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* addStringCfg(新增IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"saveOrUpdateCfg"})
|
||||
@RequiresPermissions(value={"cfg:string:add","cfg:string:edit"},logical=Logical.OR)
|
||||
public String saveOrUpdateStringCfg(String cfgName,Model model, BaseStringCfg stringCfg,String areaCfgIds) {
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType","string");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
model.addAttribute("serviceId",stringCfg.getServiceId());
|
||||
model.addAttribute("action",stringCfg.getAction());
|
||||
logger.info("saveOrUpdateStringCfg loaded");
|
||||
try{
|
||||
setSaveOrUpdateProps(model,stringCfg,areaCfgIds);
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("保存失败!",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* auditStringCfg(审核IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"cfg:string:audit"})
|
||||
public String auditStringCfg(String cfgName,int serviceId,int isAudit,int action,String tableName,String ids,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
model.addAttribute("cfgType","string");
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
try{
|
||||
String maatTable=null;
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
maatTable=serviceConfigInfo.getMaatTable();
|
||||
}
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
List<BaseStringCfg> beans=stringCfgService.getListByCompileId(tableName,ids);
|
||||
List<BaseStringCfg> auditBeans=new ArrayList<>();
|
||||
List<BaseIpCfg> auditAreaBeans=new ArrayList<>();
|
||||
Date date=new Date();
|
||||
for(BaseStringCfg bean:beans){
|
||||
BaseStringCfg auditBean=new BaseStringCfg();
|
||||
auditBean.setTableName(tableName);
|
||||
auditBean.setCfgId(bean.getCfgId());
|
||||
bean.setTableName(tableName);
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&isAudit!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
addMessage(model, "audit_failed");
|
||||
return "/cfg/resultPage";
|
||||
}else{
|
||||
auditBean.setAuditorId(bean.getCurrentUser().getId());
|
||||
auditBean.setAuditTime(date);
|
||||
auditBean.setIsAudit(isAudit);
|
||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
||||
bean.setAuditTime(date);
|
||||
bean.setIsAudit(isAudit);
|
||||
if(isAudit==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
auditBean.setIsValid(Constants.VALID_NO);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
}else if(isAudit==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
auditBean.setIsValid(Constants.VALID_YES);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(bean.getCompileId());
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
c.setAuditorId(c.getCurrentUser().getId());
|
||||
c.setAuditTime(date);
|
||||
c.setIsAudit(isAudit);
|
||||
if(isAudit==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
c.setIsValid(Constants.VALID_NO);
|
||||
}else if(isAudit==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
c.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
}
|
||||
bean.setAreaCfg(areaCfg);
|
||||
auditAreaBeans.addAll(areaCfg);
|
||||
}
|
||||
auditBeans.add(auditBean);
|
||||
}
|
||||
// stringCfgService.auditStringCfg(isAudit,auditBeans,auditAreaBeans,beans);
|
||||
}
|
||||
addMessage(model,"audit_success");
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("审核失败", e);
|
||||
addMessage(model,"audit_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditStringCfg(删除IP配置,逻辑删除)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"cfg:string:delete"})
|
||||
public String deleteStringCfg(String tableName,int action,String ids,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType","string");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<BaseStringCfg> stringCfgs=new ArrayList<BaseStringCfg>();
|
||||
List<BaseIpCfg> areaCfgs=new ArrayList<BaseIpCfg>();
|
||||
Date date =new Date();
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
for(String compileIdStr:ids.split(",")){
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(Integer.parseInt(compileIdStr));
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
c.setEditorId(c.getCurrentUser().getId());
|
||||
c.setEditTime(date);
|
||||
}
|
||||
}
|
||||
areaCfgs.addAll(areaCfg);
|
||||
BaseStringCfg stringCfg=new BaseStringCfg();
|
||||
stringCfg.setCompileId(Integer.parseInt(compileIdStr));
|
||||
stringCfg.setTableName(tableName);
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(date);
|
||||
stringCfg.setIsValid(Constants.VALID_DEL);
|
||||
stringCfgs.add(stringCfg);
|
||||
}
|
||||
}
|
||||
stringCfgService.deleteStringCfg(stringCfgs,areaCfgs);
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败",e);
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user