(1)IP控制提交
(2)Proxy IP类页面复用
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
*@Title: CommonController.java
|
||||
*@Package com.nis.web.controller.configuration
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年6月22日 下午6:35:37
|
||||
*@version 版本号
|
||||
*/
|
||||
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.ui.Model;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* @ClassName: CommonController.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年6月22日 下午6:35:37
|
||||
* @version V1.0
|
||||
*/
|
||||
public class CommonController extends BaseController {
|
||||
public void _ipList(Model model,IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request,response,"r");
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
}
|
||||
public void _ipForm(Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = ipCfgService.getIpCfgById(IpPortCfg.getTablename(),Long.parseLong(ids));
|
||||
}
|
||||
if(entity.getCfgId()!=null){
|
||||
model.addAttribute("_cfg", entity);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
IpPortCfg cfg=new IpPortCfg();
|
||||
cfg.initDefaultValueImpl();
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
cfg.setProtocolId(entity.getProtocolId());
|
||||
model.addAttribute("_cfg", cfg);
|
||||
initFormCondition(model,entity);
|
||||
}
|
||||
}
|
||||
public void _saveOrUpdateIp(RedirectAttributes model, IpPortCfg cfg) {
|
||||
Date date=new Date();
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
logger.info("saveOrUpdateIp loaded");
|
||||
try{
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgId()==null){//新增
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(date);
|
||||
ipCfgService.addIpCfg(cfg);
|
||||
}else{//修改
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg(cfg);
|
||||
}
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
}
|
||||
public void _deleteIp(String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
try{
|
||||
ipCfgService.deleteIp(ids,compileIds,functionId.intValue());
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
}
|
||||
public void _auditIp(String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
List<BaseIpCfg> beans=ipCfgService.getListByCfgId(IpPortCfg.getTablename(),cfg.getFunctionId().intValue(),ids);
|
||||
Date date=new Date();
|
||||
for(BaseIpCfg bean:beans){
|
||||
bean.setTableName(IpPortCfg.getTablename());
|
||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
||||
bean.setAuditTime(date);
|
||||
bean.setIsAudit(cfg.getIsAudit());
|
||||
bean.setIsValid(cfg.getIsValid());
|
||||
ipCfgService.audit(bean);
|
||||
}
|
||||
addMessage(redirectAttributes,"audit_success");
|
||||
}catch(MaatConvertException e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(redirectAttributes, e.getPrefix()+e.getResult().getReason());
|
||||
}catch(Exception e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(redirectAttributes, "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user