业务配置导出首行增加标题和时间范围
This commit is contained in:
@@ -39,165 +39,189 @@ import com.nis.web.security.UserUtils;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/manipulation/ddos")
|
||||
public class DdosCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DdosIpCfg entity){
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(new Page<DdosIpCfg>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg entity) {
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(new Page<DdosIpCfg>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/ddosIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")DdosIpCfg cfg){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids),null);
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/ddosIpCfgForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DdosIpCfg cfg, RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
ddosCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
ddosCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
ddosCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
//@RequiresPermissions(value={"ddos:ip:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DdosIpCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
// @RequiresPermissions(value={"ddos:ip:confirm"})
|
||||
public String audit(Model model, @ModelAttribute("cfg") DdosIpCfg cfg, Integer isValid, Integer isAudit, String ids,
|
||||
Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ddosCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}else {
|
||||
Page<DdosIpCfg> searchPage=new Page<DdosIpCfg>(request,response,"r");
|
||||
Page<DdosIpCfg> auditPage=new Page<DdosIpCfg>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<DdosIpCfg> searchPage = new Page<DdosIpCfg>(request, response, "r");
|
||||
Page<DdosIpCfg> auditPage = new Page<DdosIpCfg>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//ddos配置导出
|
||||
|
||||
// ddos配置导出
|
||||
@RequestMapping(value = "exportDdos")
|
||||
public void exportddos(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DdosIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportddos(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<DdosIpCfg> ipLists=new ArrayList<DdosIpCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ddosCfgService.findByPage(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<DdosIpCfg> pageInfo=new Page<DdosIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DdosIpCfg.class);
|
||||
String cfgIndexInfoNoExport=",do_log,client_ip,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<DdosIpCfg> ipLists = new ArrayList<DdosIpCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ddosCfgService.findByPage(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<DdosIpCfg> pageInfo = new Page<DdosIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DdosIpCfg.class);
|
||||
String cfgIndexInfoNoExport = ",do_log,client_ip,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ddos export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
logger.error("ddos export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据索引表信息异步获取子表信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/ajaxDdosInfo"})
|
||||
public String getDdosInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
@RequestMapping(value = { "/ajaxDdosInfo" })
|
||||
public String getDdosInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
DdosIpCfg cfg = ddosCfgService.getDdosIpCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
//获取DdosIpCfg信息
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
// 获取DdosIpCfg信息
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/ddosSubList";
|
||||
|
||||
@@ -46,101 +46,116 @@ import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.service.configuration.IpMultiplexService;
|
||||
|
||||
/**
|
||||
* @ClassName: ControlController.java
|
||||
* @ClassName: ControlController.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年6月22日 下午4:35:42
|
||||
* @version V1.0
|
||||
*/
|
||||
@Controller
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/manipulation/ipmulitiplex")
|
||||
public class IpMultiplexController extends CommonController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IpMultiplexService ipMultiplexService;
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
// @RequiresPermissions(value={"ip:mulitiplex:config","ip:mulitiplex:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
this._ipList(cfgName,model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
// @RequiresPermissions(value={"ip:mulitiplex:config","ip:mulitiplex:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName, Model model, @ModelAttribute("cfg") IpPortCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
this._ipList(cfgName, model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "/cfg/common/ipList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:config"})
|
||||
public String ipForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
SysDataDictionaryItem dict=null;
|
||||
List<SysDataDictionaryItem> dictList= DictUtils.getDictList("GROUP_TYPE");
|
||||
for(SysDataDictionaryItem di:dictList){
|
||||
if("IP".equals(di.getItemValue())){
|
||||
dict=di;
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:config" })
|
||||
public String ipForm(String cfgName, Model model, String ids, Integer functionId, BaseIpCfg entity) {
|
||||
this._ipForm(cfgName, model, ids, functionId, entity);
|
||||
SysDataDictionaryItem dict = null;
|
||||
List<SysDataDictionaryItem> dictList = DictUtils.getDictList("GROUP_TYPE");
|
||||
for (SysDataDictionaryItem di : dictList) {
|
||||
if ("IP".equals(di.getItemValue())) {
|
||||
dict = di;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(dict!=null){
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(Integer.parseInt(dict.getItemCode()));
|
||||
if (dict != null) {
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService
|
||||
.findPolicyGroupInfosByType(Integer.parseInt(dict.getItemCode()));
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
}
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "/cfg/manipulation/ipmulitiplex/form";
|
||||
}
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
public String saveOrUpdateIp(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
this._saveOrUpdateIp(cfgName,model, cfg);
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
public String saveOrUpdateIp(String cfgName, RedirectAttributes model, IpPortCfg cfg) {
|
||||
this._saveOrUpdateIp(cfgName, model, cfg);
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions("ip:mulitiplex:config")
|
||||
public String deleteIp(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix","/proxy/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+functionId;
|
||||
public String deleteIp(String cfgName, String ids, String compileIds, Integer functionId,
|
||||
RedirectAttributes model) {
|
||||
this._deleteIp(cfgName, ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix", "/proxy/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions("ip:mulitiplex:confirm")
|
||||
public String auditIp(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
public String auditIp(String cfgName, String ids, IpPortCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
this._auditIp(cfgName, ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
//ip配置导入
|
||||
/*@RequestMapping(value = "/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpMultiplexPolicyTemplate.class);
|
||||
redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
}*/
|
||||
//ip模板下载
|
||||
|
||||
// ip配置导入
|
||||
/*
|
||||
* @RequestMapping(value = "/import", method=RequestMethod.POST) public
|
||||
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
*
|
||||
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
* this._importIp(cfgName,redirectAttributes,
|
||||
* file,cfg,IpMultiplexPolicyTemplate.class);
|
||||
* redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex")
|
||||
* ; redirectAttributes.addAttribute("requiresPermissionPrefix",
|
||||
* "ip:mulitiplex"); return "redirect:" + adminPath
|
||||
* +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId(); }
|
||||
*/
|
||||
// ip模板下载
|
||||
@RequestMapping(value = "import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpMultiplexPolicyTemplate.class);
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
IpMultiplexPolicyTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpPortCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
this._exportIp(columns, model, request, response, entity, ids, redirectAttributes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IP复用策略拆分为SNAT/DNAT复用策略
|
||||
*/
|
||||
@RequestMapping(value = {"/snatPolicyList"})
|
||||
public String snatPolicyList(Model model,@ModelAttribute("cfg")IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(new Page<IpReusePolicyCfg>(request, response,"r"), cfg);
|
||||
@RequestMapping(value = { "/snatPolicyList" })
|
||||
public String snatPolicyList(Model model, @ModelAttribute("cfg") IpReusePolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(new Page<IpReusePolicyCfg>(request, response, "r"),
|
||||
cfg);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,cfg);
|
||||
|
||||
initFormCondition(model, cfg);
|
||||
|
||||
// 获取地址池、用户信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
@@ -148,357 +163,401 @@ public class IpMultiplexController extends CommonController {
|
||||
model.addAttribute("addrPools", addrPools);
|
||||
return "/cfg/manipulation/ipmulitiplex/snatPolicyList2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatPolicyForm"})
|
||||
@RequiresPermissions(value={"snat_policy:config"})
|
||||
public String snatPolicyForm(Model model, String ids, IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
if(cfg == null){
|
||||
cfg=new IpReusePolicyCfg();
|
||||
|
||||
@RequestMapping(value = { "/snatPolicyForm" })
|
||||
@RequiresPermissions(value = { "snat_policy:config" })
|
||||
public String snatPolicyForm(Model model, String ids, IpReusePolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
if (cfg == null) {
|
||||
cfg = new IpReusePolicyCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexService.getPolicyCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexService.getPolicyCfg(Long.valueOf(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
|
||||
// 获取用户信息 地址池信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
return "/cfg/manipulation/ipmulitiplex/snatPolicyForm2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateSnat"})
|
||||
public String saveOrUpdateSnat(Model model, HttpServletRequest request,HttpServletResponse response,
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdateSnat" })
|
||||
public String saveOrUpdateSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, IpReusePolicyCfg cfg) {
|
||||
try{
|
||||
try {
|
||||
// 添加策略配置信息
|
||||
ipMultiplexService.saveOrUpdate(cfg, request, response);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatDelete"})
|
||||
|
||||
@RequestMapping(value = { "/snatDelete" })
|
||||
@RequiresPermissions("snat_policy:config")
|
||||
public String snatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexService.delete(isValid,ids,functionId);
|
||||
public String snatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexService.delete(isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/auditSnat"})
|
||||
|
||||
@RequestMapping(value = { "/auditSnat" })
|
||||
@RequiresPermissions("snat_policy:confirm")
|
||||
public String auditSnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditSnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexService.auditSnatPolicy(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexService.auditSnatPolicy(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("SNAT策略配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("SNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"/ajaxSnatInfo"})
|
||||
public String ajaxSnatInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
|
||||
@RequestMapping(value = { "/ajaxSnatInfo" })
|
||||
public String ajaxSnatInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
IpReusePolicyCfg cfg = ipMultiplexService.getSnatCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("addrPools", addrPools);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/manipulation/ipmulitiplex/snatSubList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = {"/ajaxDnatInfo"})
|
||||
public String ajaxDnatInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
|
||||
@RequestMapping(value = { "/ajaxDnatInfo" })
|
||||
public String ajaxDnatInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
IpReuseDnatPolicyCfg cfg = ipMultiplexService.getDnatCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatSubList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 异步获取地址池信息
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/ajaxGetAddrPools"})
|
||||
public List<IpAddrPoolCfg> ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/ajaxGetAddrPools" })
|
||||
public List<IpAddrPoolCfg> ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
List<IpAddrPoolCfg> addrPoolsNew=new ArrayList<>();
|
||||
List<IpAddrPoolCfg> addrPoolsNew = new ArrayList<>();
|
||||
for (IpAddrPoolCfg addrPool : addrPools) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("addr_pool_id", addrPool.getCfgId());
|
||||
String url =Constants.IP_REUSE_CALL_CGI_URL ;
|
||||
Map<String, Object> resultMap=ConfigServiceUtil.getCGIInfo(url, Constants.IP_NUM_GET, params);
|
||||
if(!StringUtil.isEmpty(resultMap)
|
||||
&& !StringUtil.isEmpty(resultMap.get("num"))
|
||||
String url = Constants.IP_REUSE_CALL_CGI_URL;
|
||||
Map<String, Object> resultMap = ConfigServiceUtil.getCGIInfo(url, Constants.IP_NUM_GET, params);
|
||||
if (!StringUtil.isEmpty(resultMap) && !StringUtil.isEmpty(resultMap.get("num"))
|
||||
&& Integer.parseInt(resultMap.get("num").toString()) > 0) {
|
||||
addrPoolsNew.add(addrPool);
|
||||
}
|
||||
}
|
||||
return addrPoolsNew;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验地址池是否被策略引用
|
||||
*
|
||||
* @param addrPoolIds
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/ajaxIsUsed"})
|
||||
public boolean ajaxIsUsed(String addrPoolIds, HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/ajaxIsUsed" })
|
||||
public boolean ajaxIsUsed(String addrPoolIds, HttpServletRequest request, HttpServletResponse response) {
|
||||
for (String addrPoolId : addrPoolIds.split(",")) {
|
||||
List<IpReusePolicyCfg> ipList = ipMultiplexService.checkAddrPoolIsUsed(addrPoolId);
|
||||
if(ipList != null && ipList.size() > 0){
|
||||
if (ipList != null && ipList.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"/dnatPolicyList"})
|
||||
public String dnatPolicyList(String cfgName,Model model,@ModelAttribute("cfg")IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
//this._ipList(cfgName,model, cfg, request, response);
|
||||
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(new Page<BaseIpCfg>(request, response,"r"), cfg);
|
||||
|
||||
@RequestMapping(value = { "/dnatPolicyList" })
|
||||
public String dnatPolicyList(String cfgName, Model model, @ModelAttribute("cfg") IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
// this._ipList(cfgName,model, cfg, request, response);
|
||||
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(new Page<BaseIpCfg>(request, response, "r"), cfg);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,cfg);
|
||||
|
||||
initFormCondition(model, cfg);
|
||||
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatPolicyList2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/dnatPolicyForm"})
|
||||
@RequiresPermissions(value={"dnat_policy:config"})
|
||||
public String dnatPolicyForm(String cfgName,Model model,String ids,Integer functionId,IpReuseDnatPolicyCfg cfg) {
|
||||
//this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
|
||||
if(cfg == null){
|
||||
cfg=new IpReuseDnatPolicyCfg();
|
||||
|
||||
@RequestMapping(value = { "/dnatPolicyForm" })
|
||||
@RequiresPermissions(value = { "dnat_policy:config" })
|
||||
public String dnatPolicyForm(String cfgName, Model model, String ids, Integer functionId,
|
||||
IpReuseDnatPolicyCfg cfg) {
|
||||
// this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
|
||||
if (cfg == null) {
|
||||
cfg = new IpReuseDnatPolicyCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexService.getDnatPolicyCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexService.getDnatPolicyCfg(Long.valueOf(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatPolicyForm2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateDnat"})
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdateDnat" })
|
||||
public String saveOrUpdateDnat(Model model, RedirectAttributes redirectAttributes, IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
try{
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
// 添加策略配置信息
|
||||
ipMultiplexService.saveOrUpdateDnat(cfg, request, response);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+cfg.getFunctionId();
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/dnatDelete"})
|
||||
|
||||
@RequestMapping(value = { "/dnatDelete" })
|
||||
@RequiresPermissions("dnat_policy:config")
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
//this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexService.deleteDnat(isValid,ids,functionId);
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexService.deleteDnat(isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/auditDnat"})
|
||||
|
||||
@RequestMapping(value = { "/auditDnat" })
|
||||
@RequiresPermissions("dnat_policy:confirm")
|
||||
public String auditDnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
//this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditDnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
// this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexService.auditDnatPolicy(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexService.auditDnatPolicy(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("DNAT策略配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("DNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")BaseIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo=new Page<BaseIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if(StringUtil.isEmpty(baseIp.getGroupName())){
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport=",client_ip,group_name,server_ip,ip_type,ip_pattern,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
// snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") BaseIpCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo = new Page<BaseIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if (StringUtil.isEmpty(baseIp.getGroupName())) {
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
//dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")BaseIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo=new Page<BaseIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if(StringUtil.isEmpty(baseIp.getGroupName())){
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport=",direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport = ",client_ip,group_name,server_ip,ip_type,ip_pattern,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") BaseIpCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo = new Page<BaseIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if (StringUtil.isEmpty(baseIp.getGroupName())) {
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport = ",direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user