多媒体、IP复用、增加导出excel和csv

This commit is contained in:
leijun
2018-12-23 00:36:58 +08:00
parent 9080960e95
commit df32c39736
42 changed files with 730 additions and 209 deletions

View File

@@ -39,6 +39,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
@@ -198,4 +199,66 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
return "redirect:" + adminPath +"/proxy/spoofing/pool/list?functionId="+functionId;
}
// ip配置导出
@RequestMapping(value = "exportIpPool")
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") PxyObjSpoofingIpPool 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<PxyObjSpoofingIpPool> ipLists = new ArrayList<PxyObjSpoofingIpPool>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = pxyObjSpoofingIpPoolService.findByPage(ids);
} else {
Page<PxyObjSpoofingIpPool> pageInfo = new Page<PxyObjSpoofingIpPool>(request, response, "r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<PxyObjSpoofingIpPool> page = pxyObjSpoofingIpPoolService.findPage(pageInfo, entity);
ipLists = page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), PxyObjSpoofingIpPool.class);
String cfgIndexInfoNoExport = ",policy_name,do_log,ir_type,whether_area_block,do_blacklist,block_type,ip_pattern,client_ip,server_ip,port_pattern,client_port,server_port,direction,protocol,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("ip white export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}
}