仿冒功能

仿冒地址池ip
来函和任务修改
样例新增界面增加631业务
This commit is contained in:
段冬梅
2018-12-17 00:21:27 +08:00
parent 23bfe1c136
commit f3e4844f92
33 changed files with 2076 additions and 99 deletions

View File

@@ -0,0 +1,108 @@
package com.nis.domain.configuration;
import java.util.Date;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
/**
* 代理欺骗IP池对象类
* @author dell
*
*/
public class PxyObjSpoofingIpPool extends BaseIpCfg{
/**
*
*/
private static final long serialVersionUID = 8149437730819674317L;
private String indexTable="ip_port_cfg";
@Expose
@SerializedName("port")
private String port;
@Expose
@SerializedName("addrType")
private Integer ipType;
@Expose
@SerializedName("ip")
private String ipAddress;
private String groupName;//欺骗IP池IP组名称
@Expose
@SerializedName("policyGroup")
private Integer groupId;//欺骗IP池IP组id
@Expose
@SerializedName("location")
private Integer location;//位置无意义固定为0
@Expose
@SerializedName("cfgId")
private Integer compileId;
@Expose
@SerializedName("userRegion")
private String userRegion;
@Expose
@SerializedName("effectiveRange")
private String areaEffectiveIds ;
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Integer getLocation() {
return location;
}
public void setLocation(Integer location) {
this.location = location;
}
public Integer getCompileId() {
return compileId;
}
public void setCompileId(Integer compileId) {
this.compileId = compileId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public String getPort() {
port="0";
return port;
}
public void setPort(String port) {
this.port = port;
}
public Integer getIpType() {
return ipType;
}
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
public String getUserRegion() {
return userRegion;
}
public void setUserRegion(String userRegion) {
this.userRegion = userRegion;
}
public String getAreaEffectiveIds() {
return areaEffectiveIds;
}
public void setAreaEffectiveIds(String areaEffectiveIds) {
this.areaEffectiveIds = areaEffectiveIds;
}
}

View File

@@ -4,48 +4,130 @@ import java.util.Date;
import java.util.List;
import com.nis.domain.BaseEntity;
import com.nis.domain.SysMenu;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExcelField;
import com.nis.web.security.UserUtils;
public class RequestInfo extends BaseEntity<RequestInfo>{
@ExcelField(title="Id",sort=1)
private Long id;
private Long taskId;
@ExcelField(title="title",sort=2)
private String requestNumber;
@ExcelField(title="request_organization",sort=3)
private String requestOrg;
@ExcelField(title="request_time",sort=4)
private Date requestTime;
@ExcelField(title="request_number",sort=6)
private String requestTitle;
@ExcelField(title="content",sort=7)
private String requestContent;
private Integer isValid;
@ExcelField(title="state",dictType="AUDIT_STATUS",sort=5)
private Integer isAudit;
private Integer creatorId;
@ExcelField(title="create_time",sort=10)
private Date createTime;
private Integer editorId;
@ExcelField(title="edit_time",sort=12)
private Date editTime;
private Integer auditorId;
@ExcelField(title="audit_time",sort=14)
private Date auditTime;
//自定义 创建人员 修改人员 审核人员
@ExcelField(title="creator",sort=9)
private String creatorName;
@ExcelField(title="editor",sort=11)
private String editorName;
@ExcelField(title="auditor",sort=13)
private String auditorName;
private Date beginDate;//来函开始时间
private Date endDate;//来函结束时间
private String timeType;//时间类型
@ExcelField(title="special_task",sort=8)
private String taskName;//专项任务
private String seltype;//选中类型
private Date dobeginDate;//操作开始时间
private Date doendDate;//操作结束时间
/**
* 菜单ID
*/
private Integer functionId;
/**
* 菜单权限
*/
private String permission;
/**
* 菜单权限
*/
private String menuNameCode;
private String columns;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getFunctionId() {
return functionId;
}
/**
* @param functionId the functionId to set
*/
public void setFunctionId(Integer functionId) {
this.functionId = functionId;
if(!StringUtil.isEmpty(functionId) && StringUtil.isEmpty(this.menuNameCode)){
List<SysMenu> list = UserUtils.getMenuList();
if(!StringUtil.isEmpty(list)) {
for (SysMenu menu :list) {
if (!StringUtil.isEmpty(menu.getCode())
&&menu.getFunctionId()!=null
&& menu.getFunctionId().equals(functionId)
//&& menu.getFunctionId().equals(functionId)
) {
this.setMenuNameCode(menu.getCode());
break;
}
}
}
}
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public String getMenuNameCode() {
return menuNameCode;
}
public void setMenuNameCode(String menuNameCode) {
this.menuNameCode = menuNameCode;
}
public String getColumns() {
return columns;
}
public void setColumns(String columns) {
this.columns = columns;
}
public Long getTaskId() {
return taskId;

View File

@@ -1,45 +1,114 @@
package com.nis.domain.configuration;
import java.util.Date;
import java.util.List;
import com.nis.domain.BaseEntity;
import com.nis.domain.SysMenu;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExcelField;
import com.nis.web.security.UserUtils;
public class TaskInfo extends BaseEntity<TaskInfo> {
private static final long serialVersionUID = 1L;
@ExcelField(title="task_name",sort=1)
private String taskName;
@ExcelField(title="task_org",sort=2)
private String taskOrg;
@ExcelField(title="task_time",sort=3)
private Date taskTime;
@ExcelField(title="desc",sort=6)
private String taskDesc;
private Integer isValid;
@ExcelField(title="state",dictType="AUDIT_STATUS",sort=4)
private Integer isAudit;
private Integer creatorId;
private Date createTime;
private Integer editorId;
private Date editTime;
private Integer auditorId;
private Date auditTime;
private Integer creatorId;
@ExcelField(title="create_time",sort=8)
private Date createTime;
private Integer editorId;
@ExcelField(title="edit_time",sort=10)
private Date editTime;
private Integer auditorId;
@ExcelField(title="audit_time",sort=12)
private Date auditTime;
//自定义 创建人员 修改人员 审核人员
@ExcelField(title="creator",sort=7)
private String creatorName;
@ExcelField(title="editor",sort=9)
private String editorName;
@ExcelField(title="auditor",sort=11)
private String auditorName;
private Date beginDate;//来函开始时间
private Date endDate;//来函结束时间
private String seltype;//选中类型
private Date dobeginDate;//操作开始时间
private Date doendDate;//操作结束时间
/**
* 菜单ID
*/
private Integer functionId;
/**
* 菜单权限
*/
private String permission;
/**
* 菜单权限
*/
private String menuNameCode;
private String columns;
public String getColumns() {
return columns;
}
public void setColumns(String columns) {
this.columns = columns;
}
public Integer getFunctionId() {
return functionId;
}
/**
* @param functionId the functionId to set
*/
public void setFunctionId(Integer functionId) {
this.functionId = functionId;
if(!StringUtil.isEmpty(functionId) && StringUtil.isEmpty(this.menuNameCode)){
List<SysMenu> list = UserUtils.getMenuList();
if(!StringUtil.isEmpty(list)) {
for (SysMenu menu :list) {
if (!StringUtil.isEmpty(menu.getCode())
&&menu.getFunctionId()!=null
&& menu.getFunctionId().equals(functionId)
//&& menu.getFunctionId().equals(functionId)
) {
this.setMenuNameCode(menu.getCode());
break;
}
}
}
}
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public String getMenuNameCode() {
return menuNameCode;
}
public void setMenuNameCode(String menuNameCode) {
this.menuNameCode = menuNameCode;
}
public String getTaskName() {
return taskName;

View File

@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.ss.usermodel.DateUtil;
import org.jets3t.service.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
@@ -399,14 +400,18 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
* @throws ParserConfigurationException
* @throws OpenXML4JException
* @throws IOException
* @throws ServiceException
*/
public <E> BlockingQueue<E> getDataList(Class<E> cls) throws InstantiationException, IllegalAccessException, IOException, OpenXML4JException, ParserConfigurationException, SAXException, SQLException{
public <E> BlockingQueue<E> getDataList(Class<E> cls) throws InstantiationException, IllegalAccessException, IOException, OpenXML4JException, ParserConfigurationException, SAXException, SQLException, ServiceException{
log.warn("start to load data...");
this.processOneSheet(uploadFile, this.sheetIndex);
long start=System.currentTimeMillis();
if(regionDict==null) {
throw new RuntimeException("regionDict is null!");
}
if(dataList.size()==0) {
throw new ServiceException(props.getProperty("noneData", "noneData"));
}
// Get excel data
BlockingQueue<E> _dataList =new ArrayBlockingQueue(dataList.size(),true);
for (int i = 0; i < dataList.size(); i++) {

View File

@@ -1,23 +1,33 @@
package com.nis.web.controller.basics;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.configuration.TaskInfo;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExcelField;
import com.nis.web.controller.BaseController;
import com.nis.web.service.basics.TaskInfoService;
import jersey.repackaged.com.google.common.collect.Lists;
@Controller
@RequestMapping("${adminPath}/basics/taskInfo")
public class TaskInfoController extends BaseController{
@@ -25,7 +35,6 @@ public class TaskInfoController extends BaseController{
@Autowired
private TaskInfoService taskInfoService;
/**
*来函列表
*/
@@ -41,7 +50,9 @@ public class TaskInfoController extends BaseController{
@RequestMapping(value={"form"})
public String form(TaskInfo taskInfo, Model model) {
if(taskInfo.getId()!=null){
Integer functionId=taskInfo.getFunctionId();
taskInfo = taskInfoService.getTaskInfoById(taskInfo.getId());
taskInfo.setFunctionId(functionId);
model.addAttribute("taskInfo", taskInfo);
}else{
model.addAttribute("taskInfo", taskInfo);
@@ -63,7 +74,7 @@ public class TaskInfoController extends BaseController{
}else{
if (!"true".equals(checkTaskName(taskInfo.getTaskName()))){
logger.info(taskInfo.getTaskName()+"重复数据");
addMessage(model,"error", "save_failed");
addMessage("error",model,"save_failed");
return form(taskInfo, model);
}
// 保存用户信息
@@ -76,7 +87,7 @@ public class TaskInfoController extends BaseController{
e.printStackTrace();
addMessage(redirectAttributes,"error", "save_failed");
}
return "redirect:" + adminPath + "/basics/taskInfo/list?repage";
return "redirect:" + adminPath + "/basics/taskInfo/list?functionId="+taskInfo.getFunctionId()+"&repage";
}
/**
@@ -98,11 +109,11 @@ public class TaskInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "taskExamine")
public String taskExamine(String ids, Model model,RedirectAttributes redirectAttributes){
public String taskExamine(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] exId = ids.split(",");
taskInfoService.taskExamine(exId);
addMessage(redirectAttributes,"success", "save_success");
return "redirect:" + adminPath + "/basics/taskInfo/list?repage";
addMessage(redirectAttributes,"success", "audit_success");
return "redirect:" + adminPath + "/basics/taskInfo/list?functionId="+functionId+"&repage";
}
/**
@@ -112,11 +123,11 @@ public class TaskInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "taskExamineNo")
public String taskExamineNo(String ids, Model model,RedirectAttributes redirectAttributes){
public String taskExamineNo(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] noId = ids.split(",");
taskInfoService.taskExamineNo(noId);
addMessage(redirectAttributes,"success", "save_success");
return "redirect:" + adminPath + "/basics/taskInfo/list?repage";
addMessage(redirectAttributes,"success", "audit_success");
return "redirect:" + adminPath + "/basics/taskInfo/list?functionId="+functionId+"&repage";
}
/**
@@ -126,11 +137,11 @@ public class TaskInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "taskCancelExamine")
public String taskCancelExamine(String ids, Model model,RedirectAttributes redirectAttributes){
public String taskCancelExamine(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] canclelId = ids.split(",");
taskInfoService.taskCancelExamine(canclelId);
addMessage(redirectAttributes,"success", "save_success");
return "redirect:" + adminPath + "/basics/taskInfo/list?repage";
addMessage(redirectAttributes,"success", "audit_success");
return "redirect:" + adminPath + "/basics/taskInfo/list?functionId="+functionId+"&repage";
}
/**
@@ -140,12 +151,67 @@ public class TaskInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "delete")
public String delete(String ids, Model model,RedirectAttributes redirectAttributes){
public String delete(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] delId = ids.split(",");
taskInfoService.delete(delId);
addMessage(redirectAttributes,"success", "delete_success");
return "redirect:" + adminPath + "/basics/taskInfo/list?repage";
return "redirect:" + adminPath + "/basics/taskInfo/list?functionId="+functionId+"&repage";
}
//配置导出
@RequestMapping(value = "exportTaskInfo")
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")TaskInfo 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<TaskInfo> list=Lists.newArrayList();
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), TaskInfo.class);
Field[] fields=TaskInfo.class.getDeclaredFields();
StringBuffer column=new StringBuffer();
Properties props= this.getMsgProp();
for(Field f: fields) {
ExcelField ex=f.getAnnotation(ExcelField.class);
if(ex!=null) {
String title=ex.title();
if(entity.getColumns().indexOf(props.getProperty(title, title))==-1) {
column.append(","+title);
}
}
}
if(column.toString().length()>0) {
column.append(",");
}
noExportMap.put(entity.getMenuNameCode(),column.toString());
if(!StringUtil.isEmpty(ids)){
for(String id:ids.split(",")){
Long.parseLong(id);
}
list=taskInfoService.getTaskInfoByIds(ids);
}else{
//条件导出数据大于最大导出数,只导出最大导出条数
Page<TaskInfo> pageInfo=new Page<TaskInfo>(request, response,"a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<TaskInfo> page = taskInfoService.findTaskInfo(pageInfo, entity);
list=page.getList();
}
dataMap.put(entity.getMenuNameCode(),list);
// 获取国际化配置
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
} catch (Exception e) {
logger.error("ip addr export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}
}

View File

@@ -1,6 +1,11 @@
package com.nis.web.controller.configuration;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -9,6 +14,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -16,9 +22,14 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.TaskInfo;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExcelField;
import com.nis.web.controller.BaseController;
import com.nis.web.service.configuration.RequestInfoService;
import jersey.repackaged.com.google.common.collect.Lists;
@Controller
@RequestMapping("${adminPath}/cfg/request")
public class RequestInfoController extends BaseController{
@@ -45,7 +56,9 @@ public class RequestInfoController extends BaseController{
taskInfo.setId(requestInfo.getTaskId());
showTask(taskInfo,model);
if(requestInfo.getId()!=null){
Integer functionId=requestInfo.getFunctionId();
requestInfo = requestInfoService.getRequestInfoById(requestInfo.getId());
requestInfo.setFunctionId(functionId);
model.addAttribute("requestInfo", requestInfo);
}else{
model.addAttribute("requestInfo", requestInfo);
@@ -67,7 +80,7 @@ public class RequestInfoController extends BaseController{
}else{
if (!"true".equals(checkRequestNumber(requestInfo.getRequestNumber()))){
logger.info(requestInfo.getRequestNumber()+"重复数据");
addMessage(redirectAttributes,"error","save_failed");
addMessage("error",model,"save_failed");
return form(requestInfo, model);
}
// 保存用户信息
@@ -78,9 +91,9 @@ public class RequestInfoController extends BaseController{
} catch (Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
addMessage(redirectAttributes,"error","save_failed");
addMessage(model,"error","save_failed");
}
return "redirect:" + adminPath + "/cfg/request/list?repage";
return "redirect:" + adminPath + "/cfg/request/list?functionId="+requestInfo.getFunctionId()+"&repage";
}
/**
@@ -102,11 +115,11 @@ public class RequestInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "requestExamine")
public String requestExamine(String ids, Model model,RedirectAttributes redirectAttributes){
public String requestExamine(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] exId = ids.split(",");
requestInfoService.requestExamine(exId);
addMessage(redirectAttributes,"success","save_success");
return "redirect:" + adminPath + "/cfg/request/list?repage";
addMessage(redirectAttributes,"success","audit_success");
return "redirect:" + adminPath + "/cfg/request/list?functionId="+functionId+"&repage";
}
/**
@@ -116,11 +129,11 @@ public class RequestInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "requestExamineNo")
public String requestExamineNo(String ids, Model model,RedirectAttributes redirectAttributes){
public String requestExamineNo(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] noId = ids.split(",");
requestInfoService.requestExamineNo(noId);
addMessage(redirectAttributes,"success","save_success");
return "redirect:" + adminPath + "/cfg/request/list?repage";
addMessage(redirectAttributes,"success","audit_success");
return "redirect:" + adminPath + "/cfg/request/list?functionId="+functionId+"&repage";
}
/**
@@ -130,11 +143,11 @@ public class RequestInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "requestCancelExamine")
public String requestCancelExamine(String ids, Model model,RedirectAttributes redirectAttributes){
public String requestCancelExamine(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] canclelId = ids.split(",");
requestInfoService.requestCancelExamine(canclelId);
addMessage(redirectAttributes,"success","save_success");
return "redirect:" + adminPath + "/cfg/request/list?repage";
addMessage(redirectAttributes,"success","audit_success");
return "redirect:" + adminPath + "/cfg/request/list?functionId="+functionId+"&repage";
}
/**
@@ -144,11 +157,11 @@ public class RequestInfoController extends BaseController{
* @return
*/
@RequestMapping(value = "delete")
public String delete(String ids, Model model,RedirectAttributes redirectAttributes){
public String delete(Integer functionId,String ids, Model model,RedirectAttributes redirectAttributes){
String[] delId = ids.split(",");
requestInfoService.delete(delId);
addMessage(redirectAttributes,"success","delete_success");
return "redirect:" + adminPath + "/cfg/request/list?repage";
return "redirect:" + adminPath + "/cfg/request/list?functionId="+functionId+"&repage";
}
@@ -173,4 +186,59 @@ public class RequestInfoController extends BaseController{
model.addAttribute("requestInfos", requestInfos);
return "/basics/requestSelectInfo";
}
//配置导出
@RequestMapping(value = "exportRequestInfo")
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("requestInfo")RequestInfo 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<RequestInfo> list=Lists.newArrayList();
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), RequestInfo.class);
Field[] fields=RequestInfo.class.getDeclaredFields();
StringBuffer column=new StringBuffer();
Properties props= this.getMsgProp();
for(Field f: fields) {
ExcelField ex=f.getAnnotation(ExcelField.class);
if(ex!=null) {
String title=ex.title();
if(entity.getColumns().indexOf(props.getProperty(title, title))==-1) {
column.append(","+title);
}
}
}
if(column.toString().length()>0) {
column.append(",");
}
noExportMap.put(entity.getMenuNameCode(),column.toString());
if(!StringUtil.isEmpty(ids)){
for(String id:ids.split(",")){
Long.parseLong(id);
}
list=requestInfoService.getRequestInfoByIds(ids);
}else{
//条件导出数据大于最大导出数,只导出最大导出条数
Page<RequestInfo> pageInfo=new Page<RequestInfo>(request, response,"a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<RequestInfo> page = requestInfoService.findRequestInfo(pageInfo, entity);
list=page.getList();
}
dataMap.put(entity.getMenuNameCode(),list);
// 获取国际化配置
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
} catch (Exception e) {
logger.error("ip addr export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}
}

View File

@@ -20,6 +20,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg;
@@ -58,7 +59,9 @@ public class InterceptController extends CommonController{
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
}
model.addAttribute("certificateList", certificateList);
//IP地址仿冒策略使用策略组
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6);
model.addAttribute("policyGroups", policyGroups);
return "/cfg/intercept/interceptList";
}
@RequestMapping(value = {"/interceptIpForm","interceptDomainForm","interceptIpPayloadForm"})
@@ -80,6 +83,10 @@ public class InterceptController extends CommonController{
model.addAttribute("certificateList", certificateList);
model.addAttribute("_cfg", entity);
//IP地址仿冒策略使用策略组
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6);
model.addAttribute("policyGroups", policyGroups);
return "/cfg/intercept/interceptForm";
}
@RequestMapping(value = {"/ip/saveOrUpdate","/domain/saveOrUpdate","/ippayload/SaveOrUpdate"})
@@ -173,7 +180,6 @@ public class InterceptController extends CommonController{
try {
auditAll(auditPage,isValid , cfg);
addMessage(redirectAttributes,"success", "audit_success");
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {

View File

@@ -0,0 +1,201 @@
package com.nis.web.controller.configuration.proxy;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.security.KeyStore;
import java.security.Principal;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
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.DnsResStrategy;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjTrustedCaCert;
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.exceptions.MultiPartNewException;
import com.nis.util.ConfigDictUtils;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
/**
* 拦截策略
* @author ddm
*
*/
@Controller
@RequestMapping("${adminPath}/proxy/spoofing/pool")
public class PxyObjSpoofingIpPoolController extends BaseController {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@RequestMapping(value = {"/form"})
@RequiresPermissions(value={"proxy:spoofing:pool:config"})
public String from(Model model,
HttpServletRequest request,
HttpServletResponse response,
String ids,
@ModelAttribute("cfg")PxyObjSpoofingIpPool cfg
,RedirectAttributes redirectAttributes){
if(cfg == null){
cfg=new PxyObjSpoofingIpPool();
}
if(!StringUtil.isEmpty(ids)){
cfg = pxyObjSpoofingIpPoolService.getPxyObjSpoofingIpPool(Long.valueOf(ids));
initFormCondition(model, cfg);
model.addAttribute("isAdd", false);
}else{
initFormCondition(model, cfg);
model.addAttribute("isAdd", true);
}
List<PolicyGroupInfo> groups=policyGroupInfoService.findPolicyGroupInfosByType(6);
List<PolicyGroupInfo> policyGroups = new ArrayList();
//解决目前一个分组只能有一个生效IP
for(PolicyGroupInfo group:groups){
PxyObjSpoofingIpPool entity = new PxyObjSpoofingIpPool();
entity.setGroupId(group.getGroupId());
entity.setCfgId(cfg.getCfgId());
List<PxyObjSpoofingIpPool> spoofingIpPool = pxyObjSpoofingIpPoolService.findPxyObjSpoofingIpPools(entity);
if(spoofingIpPool==null || spoofingIpPool.size()==0){
policyGroups.add(group);
}
}
model.addAttribute("policyGroups", policyGroups);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/spoofingIpPool/form";
}
@RequestMapping(value = {"/saveOrUpdate"})
@RequiresPermissions(value={"proxy:spoofing:pool:config"})
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")PxyObjSpoofingIpPool cfg,
RedirectAttributes redirectAttributes){
try{
pxyObjSpoofingIpPoolService.saveOrUpdate(cfg);
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");
}
}
return "redirect:" + adminPath +"/proxy/spoofing/pool/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/list"})
@RequiresPermissions(value={"proxy:spoofing:pool:config"})
public String list(Model model,HttpServletRequest request,HttpServletResponse response
,@ModelAttribute("cfg")PxyObjSpoofingIpPool entity
,RedirectAttributes redirectAttributes){
//查询时left join policyGroup
Page<PxyObjSpoofingIpPool> page = pxyObjSpoofingIpPoolService.findPage(new Page<PxyObjSpoofingIpPool>(request, response,"r"), entity);
model.addAttribute("page", page);
initPageCondition(model,entity);
return "/cfg/proxy/spoofingIpPool/list";
}
@RequestMapping(value = {"/delete"})
@RequiresPermissions(value={"proxy:spoofing:pool:config"})
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId
,Model model,HttpServletRequest request
,HttpServletResponse response
,RedirectAttributes redirectAttributes){
if(!StringUtil.isEmpty(ids)){
pxyObjSpoofingIpPoolService.delete(isAudit,isValid,ids,functionId);
}
return "redirect:" + adminPath +"/proxy/spoofing/pool/list?functionId="+functionId;
}
@RequestMapping(value = {"/audit"})
@RequiresPermissions(value={"proxy:spoofing:pool:confirm"})
public String audit(Model model,@ModelAttribute("cfg")PxyObjSpoofingIpPool 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){
try {
pxyObjSpoofingIpPoolService.audit(isAudit,isValid,functionId,id,auditTime);
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes,"error", "request_service_failed");
}catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes,"error", "audit_failed");
}
}
}else {
/*Page<PxyObjSpoofingIpPool> searchPage=new Page<PxyObjSpoofingIpPool>(request,response,"r");
Page<PxyObjSpoofingIpPool> auditPage=new Page<PxyObjSpoofingIpPool>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
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,redirectAttributes);*/
}
return "redirect:" + adminPath +"/proxy/spoofing/pool/list?functionId="+functionId;
}
}

View File

@@ -0,0 +1,21 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjTrustedCaCert;
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface PxyObjSpoofingIpPoolDao extends CrudDao<PxyObjSpoofingIpPool>{
List<PxyObjSpoofingIpPool> findPage(PxyObjSpoofingIpPool spoofingPool);
List<PxyObjSpoofingIpPool> findList(PxyObjSpoofingIpPool spoofingPool);
PxyObjSpoofingIpPool getPxyObjSpoofingIpPool(Long cfgId);
int insert(PxyObjSpoofingIpPool spoofingPool);
int update(PxyObjSpoofingIpPool spoofingPool);
}

View File

@@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.PxyObjSpoofingIpPoolDao" >
<resultMap id="PxyObjSpoofingPoolMap" type="com.nis.domain.configuration.PxyObjSpoofingIpPool" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_address" property="ipAddress" jdbcType="VARCHAR" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="location" property="location" jdbcType="INTEGER" />
<result column="port" property="port" jdbcType="VARCHAR" />
<!-- <result column="action" property="action" jdbcType="INTEGER" /> -->
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="location" property="location" jdbcType="INTEGER"/>
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="group_name" property="groupName" jdbcType="INTEGER" />
<result column="user_region" property="userRegion" jdbcType="VARCHAR" />
</resultMap>
<sql id="PxyObjSpoofingIpPoolColumns">
r.CFG_ID, r.CFG_DESC,r.CFG_REGION_CODE, r.IP_TYPE, r.IP_ADDRESS,
r.DIRECTION,r.PROTOCOL,r.IS_VALID,r.IS_AUDIT,r.location,r.port,
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY,
r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.FUNCTION_ID,r.GROUP_ID,r.user_region
</sql>
<!-- 查出所有 有效数据-->
<select id="findPage" resultMap="PxyObjSpoofingPoolMap">
SELECT
<include refid="PxyObjSpoofingIpPoolColumns"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName,p.group_name as group_name
</trim>
FROM pxy_obj_spoofing_ip_pool r
left join policy_group_info p on p.group_id=r.group_id
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
left join sys_user u on r.auditor_id=u.id
left join request_info ri on r.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId != null">
AND r.compile_id=#{compileId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getPxyObjSpoofingIpPool" resultMap="PxyObjSpoofingPoolMap" >
SELECT
<include refid="PxyObjSpoofingIpPoolColumns"/>
FROM pxy_obj_spoofing_ip_pool r
where r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</select>
<!-- 查出所有 有效数据-->
<select id="findList" resultMap="PxyObjSpoofingPoolMap" parameterType="com.nis.domain.configuration.PxyObjSpoofingIpPool">
SELECT
<include refid="PxyObjSpoofingIpPoolColumns"/>
FROM pxy_obj_spoofing_ip_pool r where (r.is_valid!=-1 and r.is_audit!=3) AND r.group_id =#{groupId,jdbcType=INTEGER}
<if test="cfgId != null">
AND r.CFG_ID!=#{cfgId,jdbcType=BIGINT}
</if>
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.PxyObjSpoofingIpPool" >
insert into pxy_obj_spoofing_ip_pool (
CFG_ID,
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
ip_address,
direction,
protocol,
location,
group_id,
compile_Id,
cfg_region_code,
user_region
)values (
#{cfgId,jdbcType=VARCHAR},
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType, jdbcType=INTEGER},
#{ipAddress, jdbcType=VARCHAR},
#{direction, jdbcType=INTEGER},
#{protocol, jdbcType=INTEGER},
0,
#{groupId, jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER},
#{userRegion,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.configuration.PxyObjSpoofingIpPool" >
update pxy_obj_spoofing_ip_pool
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="compileId != null " >
compile_Id = #{compileId,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="port != null and port!=''" >
port=#{port, jdbcType=VARCHAR},
</if>
<if test="ipType != null" >
ip_type=#{ipType, jdbcType=INTEGER},
</if>
<if test="ipAddress != null and ipAddress!=''" >
ip_address=#{ipAddress, jdbcType=VARCHAR},
</if>
<if test="groupId != null" >
group_id=#{groupId, jdbcType=INTEGER},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="userRegion != null and userRegion!=''" >
user_region=#{userRegion, jdbcType=VARCHAR},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
<if test="functionId != null" >
and function_id = #{functionId,jdbcType=INTEGER}
</if>
</where>
</update>
</mapper>

View File

@@ -18,6 +18,7 @@ public interface RequestInfoDao extends CrudDao {
RequestInfo getRequestInfoByRequestNumber(@Param("requestNumber") String requestNumber);
RequestInfo getRequestInfoById(@Param("id") Long id);
List<RequestInfo> getRequestInfoByIds(@Param("ids") String ids);
int deleteByPrimaryKey(Long id);

View File

@@ -129,6 +129,33 @@
where r.is_valid!=-1 and r.is_audit !=3
and r.id = #{id,jdbcType=BIGINT}
</select>
<select id="getRequestInfoByIds" parameterType="java.lang.String" resultMap="BaseResultMap">
select
r.id AS id,
r.task_id AS taskId,
r.request_number AS requestNumber,
r.request_org AS requestOrg,
r.request_time AS requestTime,
r.request_title AS requestTitle,
r.request_content AS requestContent,
r.is_valid AS isValid,
r.is_audit AS isAudit,
s.name AS creatorName,
r.create_time AS createTime,
u.name AS editorName,
r.edit_time AS editTime,
e.name AS currentName,
e.name AS auditorName,
r.audit_time AS auditTime,
t.task_name AS taskName
from request_info r
left join sys_user s on r.creator_id=s.id
left join sys_user u on r.editor_id=u.id
left join sys_user e on r.auditor_id=e.id
left join task_info t on r.task_id=t.id
where r.is_valid!=-1 and r.is_audit !=3
and r.id in(${ids})
</select>
<!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.configuration.RequestInfo">
insert into request_info (

View File

@@ -14,6 +14,7 @@ public interface TaskInfoDao extends CrudDao<TaskInfo>{
TaskInfo getTaskInfoByTaskName(@Param("taskName") String taskName);
TaskInfo getTaskInfoById(@Param("id") Long id);
List<TaskInfo> getTaskInfoByIds(@Param("ids") String ids);
void delete(@Param("id") Long id);

View File

@@ -105,6 +105,13 @@
from task_info
where id = #{id,jdbcType=BIGINT}
</select>
<!-- 根据来id查询 -->
<select id="getTaskInfoByIds" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from task_info
where id in (${ids})
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.TaskInfo">
insert into task_info (id, task_name, task_org,
task_time, task_desc, is_valid,

View File

@@ -59,6 +59,10 @@ public class TaskInfoService extends BaseService{
return taskInfoDao.getTaskInfoById(id);
}
public List<TaskInfo> getTaskInfoByIds(String ids) {
return taskInfoDao.getTaskInfoByIds(ids);
}
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
public void taskExamine(String[] exId){
TaskInfo taskInfo = new TaskInfo();

View File

@@ -394,6 +394,13 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
userRegion=userRegion+";"+Constants.REPLACE_SUBSTITUTE_KEY+"="+substitute;
maatCfg.setUserRegion(userRegion);
}
//ip仿冒自定义域信息
if(entity.getAction().equals(48)){
//HTTP replace replace type is not null ;find is not null;replace with is not null(userRegion is not null)
userRegion="nat_type="+entity.getUserRegion1();
userRegion+=";spoofing_ip_pool="+entity.getUserRegion2();
maatCfg.setUserRegion(userRegion);
}
//域名拦截需要增加域名id和域名字符串自定义配置
if(StringUtil.isEmpty(maatCfg.getUserRegion())

View File

@@ -0,0 +1,269 @@
package com.nis.web.service.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.Page;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.callback.ProxyObjKeyring;
import com.nis.domain.callback.ProxyObjTrustedCa;
import com.nis.domain.callback.ProxyObjTrustedCaCrl;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.maat.EffectiveRangeCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.EffectiveRangeCfg.AreaIsp;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.dao.basics.ServiceDictInfoDao;
import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.dao.configuration.PxyObjSpoofingIpPoolDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
import com.nis.web.service.SpringContextHolder;
import com.nis.web.service.basics.SysDictInfoService;
import oracle.sql.ARRAY;
/**
* 欺骗IP地址池管理
* @author dell
*
*/
@Service
public class PxyObjSpoofingIpPoolService extends BaseService{
@Autowired
protected PxyObjSpoofingIpPoolDao pxyObjSpoofingIpPoolDao;
@Autowired
private SysDictInfoDao sysDictInfoDao;
/**
* @param entity
* @return
*/
public PxyObjSpoofingIpPool getPxyObjSpoofingIpPool(Long cfgId) {
return pxyObjSpoofingIpPoolDao.getPxyObjSpoofingIpPool(cfgId);
}
/**
* 查询分页数据
* @param page 分页对象
* @param entity
* @return
*/
public Page<PxyObjSpoofingIpPool> findPage(Page page, PxyObjSpoofingIpPool entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
List<PxyObjSpoofingIpPool> list=pxyObjSpoofingIpPoolDao.findPage(entity);
page.setList(list);
return page;
}
public List<PxyObjSpoofingIpPool> findPxyObjSpoofingIpPools(PxyObjSpoofingIpPool entity) {
List<PxyObjSpoofingIpPool> list=pxyObjSpoofingIpPoolDao.findList(entity);
return list;
}
//新增或保存
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(PxyObjSpoofingIpPool entity){
Date createTime=new Date();
setAreaEffectiveIds(entity);
entity.setIsValid(0);
entity.setIsAudit(0);
//设置区域运营商信息
setAreaEffectiveIds(entity);
//新增
if(StringUtil.isEmpty(entity.getCfgId())){
entity.initDefaultValue();
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
//调用服务接口获取compileId
List<Integer> compileIds = new ArrayList<Integer>();
try {
compileIds = ConfigServiceUtil.getId(1,1);
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
entity.setCompileId(compileIds.get(0));
}
pxyObjSpoofingIpPoolDao.insert(entity);
//修改
}else{
Date editTime=new Date();
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
pxyObjSpoofingIpPoolDao.update(entity);
}
}
/**
*
* @param isAudit
* @param isValid
* @param ids compileIds
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
String[] idArray = ids.split(",");
for(String id :idArray){
PxyObjSpoofingIpPool entity = new PxyObjSpoofingIpPool();
entity.setCfgId(Long.valueOf(id));
entity.setFunctionId(functionId);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
pxyObjSpoofingIpPoolDao.update(entity);
}
}
/**
*
* @param isAudit
* @param isValid
* @param ids cfgId
* @param functionId
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
PxyObjSpoofingIpPool entity=new PxyObjSpoofingIpPool();
entity.setCfgId(Long.valueOf(id));
entity.setIsValid(isValid);
entity.setIsAudit(isAudit);
entity.setEditTime(auditTime);
entity.setEditorId(UserUtils.getUser().getId());
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
pxyObjSpoofingIpPoolDao.update(entity);
entity=pxyObjSpoofingIpPoolDao.getPxyObjSpoofingIpPool(entity.getCfgId());
List<PxyObjSpoofingIpPool> list = new ArrayList<PxyObjSpoofingIpPool>();
String json="";
String areaEffectiveIds="0";
if(entity.getIsAudit()==1){
if(!StringUtils.isEmpty(entity.getAreaEffectiveIds())){
// 组织区域、运营商配置下发格式
areaEffectiveIds = this.setEffectiveRange(entity.getAreaEffectiveIds());
}
entity.setAreaEffectiveIds(areaEffectiveIds);
list.add(entity);
//调用服务接口下发配置数据
json=gsonToJson(list);
logger.info("欺骗IP池配置下发配置参数"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
if(result!=null){
logger.info("欺骗IP池配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("欺骗IP池配置配置下发失败",e);
throw e;
}
}else if(entity.getIsAudit()==3){
PxyObjSpoofingIpPool cfg = new PxyObjSpoofingIpPool();
cfg.setIsValid(0);
cfg.setCompileId(entity.getCompileId());
cfg.setServiceId(entity.getServiceId());
list.add(cfg);
//调用服务接口取消配置
json=gsonToJson(list);
logger.info("欺骗IP池配置配置参数"+json);
//调用服务接口取消配置
try {
ToMaatResult result = ConfigServiceUtil.put(json, 2);
logger.info("欺骗IP池配置响应信息"+result.getMsg());
} catch (Exception e) {
e.printStackTrace();
logger.info("欺骗IP池配置配置失败");
throw e;
}
}
}
public String setEffectiveRange(String areaEffectiveIds){
HashMap<String, List<String>> map = new HashMap<String,List<String>>();
List<String> ispList = new ArrayList();
for (String areaEffectiveId : StringUtils.split(areaEffectiveIds, ",")) {
if(areaEffectiveId.contains(":")) {
// 区域和运营商
int index = areaEffectiveId.indexOf(":");
String areaCode = areaEffectiveId.substring(0, index);
String ispCode = areaEffectiveId.substring(index+1);
if(!map.containsKey(areaCode)){
ispList = new ArrayList();
ispList.add(ispCode);
map.put(areaCode, ispList);
}else{
if(!ispList.contains(ispCode)){
ispList.add(ispCode);
}
map.replace(areaCode, ispList);
}
}else {
// 区域
if(!map.containsKey(areaEffectiveId)){
map.put(areaEffectiveId, null);
}
}
}
EffectiveRangeCfg rangeCfg = new EffectiveRangeCfg();
List<List<AreaIsp>> effectiveRangeList = new ArrayList();
Set<String> keySet = map.keySet();
for (String key : keySet) {
AreaIsp area = new AreaIsp();
area.setTag(Constants.AREA_TAG);
AreaIsp isp = new AreaIsp();
isp.setTag(Constants.ISP_TAG);
List<String> locaValueList = new ArrayList();
List<String> ispValueList = new ArrayList();
List<AreaIsp> areaIspList = new ArrayList();
// 获取区域信息
String areaStr = "";
SysDictInfo areaDict = sysDictInfoDao.getDictByItemCode(key);
areaStr += areaDict.getItemValue();
while(areaDict.getParent().getSysDictId() != 0) {
areaDict = sysDictInfoDao.getDictById(areaDict.getParent().getSysDictId());
areaStr += "/"+areaDict.getItemValue();
}
locaValueList.add(StringUtils.revertStr(areaStr, "/"));
area.setValue(locaValueList);
areaIspList.add(area);
// 获取运营商信息
if(map.get(key) != null){
for (String ispCode : map.get(key)) {
SysDictInfo ispDict = sysDictInfoDao.getDictByItemCode(ispCode);
ispValueList.add(ispDict.getItemValue());
}
isp.setValue(ispValueList);
areaIspList.add(isp);
}
effectiveRangeList.add(areaIspList);
}
rangeCfg.setEffectiveRangeList(effectiveRangeList);
return gsonToJson(rangeCfg);
}
}

View File

@@ -63,6 +63,9 @@ public class RequestInfoService extends BaseService{
return requestInfoDao.getRequestInfoById(id);
}
public List<RequestInfo> getRequestInfoByIds(String ids) {
return requestInfoDao.getRequestInfoByIds(ids);
}
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
public void requestExamine(String[] exId){
RequestInfo requestInfo = new RequestInfo();