业务配置ip白名单导出,导出后与界面展示字段不一样,已调整

This commit is contained in:
李皓宸
2019-01-14 15:48:24 +08:00
parent f1dfdf281a
commit ffab6083fd
3 changed files with 38 additions and 7 deletions

View File

@@ -130,9 +130,7 @@ public class ExcelCsv {
Map<String, List<String>> commentMap=new HashMap<String, List<String>>(); Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
for (String title : titleList) { for (String title : titleList) {
String noExportField=noExportMap.get(title); String noExportField=noExportMap.get(title);
if(noExportField.contains("do_log")){ noExportField=",do_blacklist,"+noExportField;
noExportField=",do_blacklist,"+noExportField;
}
List<Object[]> annotationList = Lists.newArrayList(); List<Object[]> annotationList = Lists.newArrayList();
List<Field> list=new ArrayList<Field>(); List<Field> list=new ArrayList<Field>();
// Get annotation field // Get annotation field

View File

@@ -2406,9 +2406,7 @@ public class ExportExcel {
Map<String, List<String>> commentMap=new HashMap<String, List<String>>(); Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
for (String title : titleList) { for (String title : titleList) {
String noExportField=noExportMap.get(title); String noExportField=noExportMap.get(title);
if(noExportField.contains("do_log")){ noExportField=",do_blacklist,"+noExportField;
noExportField=",do_blacklist,"+noExportField;
}
List<Object[]> annotationList = Lists.newArrayList(); List<Object[]> annotationList = Lists.newArrayList();
List<Field> list=new ArrayList<Field>(); List<Field> list=new ArrayList<Field>();
// Get annotation field // Get annotation field

View File

@@ -369,11 +369,40 @@ public class WhiteListController extends CommonController {
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity); Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
ipLists = page.getList(); ipLists = page.getList();
} }
//日志总量
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
StringBuilder compileIds=new StringBuilder(",");//配置ids
Set<Integer> set=new HashSet<Integer>();//服务ids
for (CfgIndexInfo cfg : ipLists) {
if(cfg.getIsAudit()!=0){
set.add(cfg.getServiceId());
compileIds.append(cfg.getCompileId()+",");
}else{
Map<String,Object> logTotal=new HashMap<String,Object>();
logTotal.put("compileId", cfg.getCompileId()+"");
logTotal.put("sum",0L);
logTotals.add(logTotal);
}
}
StringBuilder serviceIds=new StringBuilder(",");
for (Integer id : set) {
serviceIds.append(id+",");
}
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
//获取日志总量
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
logTotals.addAll(logs);
}
titleList.add(entity.getMenuNameCode()); titleList.add(entity.getMenuNameCode());
titleList.add("NTC_IP"); titleList.add("NTC_IP");
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
classMap.put("NTC_IP", IpPortCfg.class); classMap.put("NTC_IP", IpPortCfg.class);
String cfgIndexInfoNoExport = ",log_total,policy_name,do_log,letter,whether_area_block,classification,attribute,label,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; String cfgIndexInfoNoExport = ",policy_name,letter,whether_area_block,classification,attribute,label,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
String ipPortInfoNoExport = ",protocol,direction,do_log,action,config_describe,valid_identifier,is_audit,creator,creator" String ipPortInfoNoExport = ",protocol,direction,do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time" + ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label" + ",letter,whether_area_block,classification,attribute,label"
@@ -397,6 +426,12 @@ public class WhiteListController extends CommonController {
noExportMap.put("NTC_IP", ipPortInfoNoExport); noExportMap.put("NTC_IP", ipPortInfoNoExport);
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>(); List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
for (CfgIndexInfo cfg : ipLists) { for (CfgIndexInfo cfg : ipLists) {
for (Map<String,Object> logTotal : logTotals) {
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
cfg.setTotalLogs((Long)logTotal.get("sum"));
break;
}
}
CfgIndexInfo cfgIndexInfo = ipCfgService.exportIpInfo(cfg); CfgIndexInfo cfgIndexInfo = ipCfgService.exportIpInfo(cfg);
ipList.addAll(cfgIndexInfo.getIpPortList()); ipList.addAll(cfgIndexInfo.getIpPortList());
} }