ip导出bug修正
This commit is contained in:
@@ -275,74 +275,73 @@ public class IpController extends BaseController{
|
|||||||
|
|
||||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+5;
|
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+5;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ip配置导出
|
//ip配置导出
|
||||||
@RequestMapping(value = "exportIpAddr")
|
@RequestMapping(value = "exportIpAddr")
|
||||||
public void exportIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
public void exportIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||||
try {
|
try {
|
||||||
//export data info
|
//export data info
|
||||||
List<String> titleList=new ArrayList<String>();
|
List<String> titleList=new ArrayList<String>();
|
||||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||||
Map<String, List> dataMap=new HashMap<String, List>();
|
Map<String, List> dataMap=new HashMap<String, List>();
|
||||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
/*//导出选中记录
|
/*//导出选中记录
|
||||||
* if(!StringUtil.isEmpty(ids)){
|
* if(!StringUtil.isEmpty(ids)){
|
||||||
for(String id:ids.split(",")){
|
for(String id:ids.split(",")){
|
||||||
Long.parseLong(id);
|
Long.parseLong(id);
|
||||||
|
}
|
||||||
|
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||||
|
}else{*/
|
||||||
|
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||||
|
entity.setTableName(IpPortCfg.getTablename());
|
||||||
|
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||||
|
if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){
|
||||||
|
pageInfo.setPageNo(1);
|
||||||
|
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||||
|
}else{
|
||||||
|
pageInfo.setPageNo(1);
|
||||||
|
pageInfo.setPageSize(-1);
|
||||||
|
}
|
||||||
|
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||||
|
titleList.add(entity.getMenuNameCode());
|
||||||
|
titleList.add("NTC_IP");
|
||||||
|
titleList.add("asn_policy");
|
||||||
|
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||||
|
classMap.put("NTC_IP", IpPortCfg.class);
|
||||||
|
classMap.put("asn_policy", ConfigGroupInfo.class);
|
||||||
|
String cfgIndexInfoNoExport=",group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||||
|
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||||
|
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||||
|
+",letter,whether_area_block,classification,attribute,label"
|
||||||
|
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||||
|
String asnGroupInfoNoExport="";
|
||||||
|
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||||
|
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||||
|
noExportMap.put("asn_policy", asnGroupInfoNoExport);
|
||||||
|
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||||
|
List<ConfigGroupInfo> groupInfoList=new ArrayList<ConfigGroupInfo>();
|
||||||
|
for (CfgIndexInfo cfg : page.getList()) {
|
||||||
|
CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg);
|
||||||
|
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||||
|
if(!StringUtil.isEmpty(cfgIndexInfo.getAsnIpGroupName())){
|
||||||
|
ConfigGroupInfo group=new ConfigGroupInfo();
|
||||||
|
group.setCompileId(cfgIndexInfo.getCompileId());
|
||||||
|
group.setGroupName(cfgIndexInfo.getAsnIpGroupName());
|
||||||
|
groupInfoList.add(group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||||
|
dataMap.put("NTC_IP", ipList);
|
||||||
|
dataMap.put("asn_policy", groupInfoList);
|
||||||
|
|
||||||
|
/*}*/
|
||||||
|
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("ip addr export failed",e);
|
||||||
|
addMessage(redirectAttributes, "export_failed");
|
||||||
}
|
}
|
||||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||||
}else{*/
|
}
|
||||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
|
||||||
entity.setTableName(IpPortCfg.getTablename());
|
|
||||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
|
||||||
if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){
|
|
||||||
pageInfo.setPageNo(1);
|
|
||||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
|
||||||
}else{
|
|
||||||
pageInfo.setPageNo(1);
|
|
||||||
pageInfo.setPageSize(-1);
|
|
||||||
}
|
|
||||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
|
||||||
titleList.add(entity.getMenuNameCode());
|
|
||||||
titleList.add("ip_addr");
|
|
||||||
titleList.add("asn_policy");
|
|
||||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
|
||||||
classMap.put("ip_port_cfg", IpPortCfg.class);
|
|
||||||
classMap.put("asn_policy", ConfigGroupInfo.class);
|
|
||||||
String cfgIndexInfoNoExport=",group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
|
||||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
|
||||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
|
||||||
+",letter,whether_area_block,classification,attribute,label"
|
|
||||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
|
||||||
String asnGroupInfoNoExport="";
|
|
||||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
|
||||||
noExportMap.put("ip_addr", ipPortInfoNoExport);
|
|
||||||
noExportMap.put("asn_policy", asnGroupInfoNoExport);
|
|
||||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
|
||||||
List<ConfigGroupInfo> groupInfoList=new ArrayList<ConfigGroupInfo>();
|
|
||||||
for (CfgIndexInfo cfg : page.getList()) {
|
|
||||||
CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg);
|
|
||||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
|
||||||
if(!StringUtil.isEmpty(cfgIndexInfo.getAsnIpGroupName())){
|
|
||||||
ConfigGroupInfo group=new ConfigGroupInfo();
|
|
||||||
group.setCompileId(cfgIndexInfo.getCompileId());
|
|
||||||
group.setGroupName(cfgIndexInfo.getAsnIpGroupName());
|
|
||||||
groupInfoList.add(group);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
|
||||||
dataMap.put("ip_addr", ipList);
|
|
||||||
dataMap.put("asn_policy", groupInfoList);
|
|
||||||
|
|
||||||
/*}*/
|
|
||||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("ip addr export failed",e);
|
|
||||||
addMessage(redirectAttributes, "export_failed");
|
|
||||||
}
|
|
||||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user