删除无用的NumCfgController

This commit is contained in:
wangxin
2018-06-07 11:33:50 +08:00
parent 20370bcf25
commit 4158b86ec7

View File

@@ -1,236 +0,0 @@
package com.nis.web.controller.configuration;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.NumBoundaryCfg;
import com.nis.main.ConvertTool;
import com.nis.util.Constants;
import com.nis.web.controller.BaseController;
/**
* 字符串相关配置控制类
* @author dell
*
*/
@Controller
@RequestMapping("${adminPath}/cfg/num")
public class NumCfgController extends BaseController{
@RequestMapping(value = {"list"})
public String cfgList(Model model,Integer audit,Integer pageNo,Integer pageSize,String cfgName,@ModelAttribute("cfg")NumBoundaryCfg 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){
Page<NumBoundaryCfg> searchPage=new Page<NumBoundaryCfg>(request, response, "r");
Page<NumBoundaryCfg> page = numCfgService.findPage(searchPage, cfg);
model.addAttribute("page", page);
model.addAttribute("action", cfg.getAction());
initPageCondition(model);
}else{
logger.error("未获取到正确的serviceId");
}
}
}
return "/cfg/numCfgList";
}
@RequestMapping(value = {"form"})
public String cfgForm(int action,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
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 info=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
if(info!=null){
NumBoundaryCfg cfg=new NumBoundaryCfg();
cfg.initDefaultValue();
cfg.setAction(action);
//监测缺省不需要区域管控
if(action==Constants.ACTION_DJ){
cfg.setIsAreaEffective(0);
}
cfg.setServiceId(serviceId);
model.addAttribute("_cfg", cfg);
initFormCondition(model);
}
}else{
logger.error("未获取到正确的serviceId");
}
return "/cfg/numCfgForm";
}
@RequestMapping(value = {"updateForm"})
public String updateStringCfgForm(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("audit", Constants.CFG_PAGE);
if(serviceId!=null){
ServiceConfigInfo info=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
if(info!=null){
NumBoundaryCfg searchBean=new NumBoundaryCfg();
searchBean.setCfgId(cfgId);
NumBoundaryCfg cfg=numCfgService.getNumCfgById(searchBean);
model.addAttribute("_cfg", cfg);
initUpdateFormCondition(model,cfg);
}
}else{
logger.error("未获取到正确的表名");
}
return "/cfg/numCfgForm";
}
/**
*
* addStringCfg(新增IP配置)
* (这里描述这个方法适用条件 可选)
* @return
*String
* @exception
* @since 1.0.0
*/
@RequestMapping(value = {"saveOrUpdateCfg"})
public String saveOrUpdateStringCfg(String cfgName,Model model, NumBoundaryCfg cfg,String areaCfgIds) {
model.addAttribute("cfgName",cfgName);
model.addAttribute("cfgType","num");
model.addAttribute("audit", Constants.CFG_PAGE);
logger.info("saveOrUpdateStringCfg loaded");
try{
setSaveOrUpdateProps(model,cfg,areaCfgIds);
}catch(Exception e){
logger.error("保存失败", e);
addMessage(model,"save_failed");
}
return "/cfg/resultPage";
}
/**
*
* auditStringCfg(审核IP配置)
* (这里描述这个方法适用条件 可选)
* @return
*String
* @exception
* @since 1.0.0
*/
@RequestMapping(value = {"audit"})
public String auditCfg(String cfgName,NumBoundaryCfg cfg,Model model) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("audit", Constants.AUDIT_PAGE);
model.addAttribute("cfgType","num");
model.addAttribute("serviceId", cfg.getServiceId());
model.addAttribute("action", cfg.getAction());
try{
int serviceId=cfg.getServiceId();
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
if(serviceConfigInfo!=null){
NumBoundaryCfg bean=numCfgService.getNumCfgById(cfg);
bean.setTableName(serviceConfigInfo.getTableName());
int audit=bean.getIsAudit().intValue();
if(audit==Constants.AUDIT_YES&&cfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
logger.error("审核通过的配置只能取消审核通过!");
}else{
cfg.setAuditorId(cfg.getCurrentUser().getId());
cfg.setAuditTime(new Date());
bean.setIsAudit(cfg.getIsAudit());
if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过设置有效标志为0
cfg.setIsValid(Constants.VALID_NO);
bean.setIsValid(Constants.VALID_NO);
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1
cfg.setIsValid(Constants.VALID_YES);
bean.setIsValid(Constants.VALID_YES);
}
int result=numCfgService.auditNumCfg(bean,cfg);
if(result!=0){
addMessage(model, "audit_success");
}else{
addMessage(model, "audit_failed");
}
}
}
}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"})
public String deleteCfg(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","num");
model.addAttribute("audit", Constants.CFG_PAGE);
if(serviceId!=null){
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
if(serviceConfigInfo!=null){
NumBoundaryCfg cfg=new NumBoundaryCfg();
cfg.setCfgId(cfgId);
int audit=numCfgService.getIsAudit(cfg);
//未审核时可删除
if(audit!=Constants.AUDIT_YES){
cfg.setEditorId(cfg.getCurrentUser().getId());
cfg.setEditTime(new Date());
cfg.setIsValid(Constants.VALID_DEL);
int result=numCfgService.deleteNumCfg(cfg);
addMessage(model,"delete_success");
}else{
logger.error("通过审核的配置不能删除!");
}
}
}else{
logger.error("无法确定IP配置的表名");
}
return "/cfg/resultPage";
}
/**
*
* getCompileId(获取编译ID)
* (这里描述这个方法适用条件 可选)
* @return
*long
* @exception
* @since 1.0.0
*/
protected long getCompileId(NumBoundaryCfg 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;
}
}