新增劫持文件、注入脚本文件、流量转发目的地菜单,完善文件劫持菜单。
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.nis.domain.callback;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* http代理劫持文件
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
public class ProxyFileHijackCfg extends BaseCfg<ProxyFileHijackCfg>{
|
||||
|
||||
private static final long serialVersionUID = -4600604393808056286L;
|
||||
public String indexTable = "pxy_profile_hijack_files";//对应表名
|
||||
@ExcelField(title="profile_name",sort=1)
|
||||
private String profileName;//名称,辅助记忆
|
||||
@ExcelField(title="content_type",sort=3)
|
||||
private String contentType;//填充HTTP content-type,如“video/mp4” (exe、apk)
|
||||
@ExcelField(title="path",sort=2)
|
||||
private String path;//储存路径
|
||||
@ExcelField(title="content_name",sort=3)
|
||||
private String contentName;//内容格式
|
||||
private int quote;//判断与其他菜单是否关联使用中
|
||||
|
||||
public String getContentName() {
|
||||
return contentName;
|
||||
}
|
||||
public void setContentName(String contentName) {
|
||||
this.contentName = contentName;
|
||||
}
|
||||
public int getQuote() {
|
||||
return quote;
|
||||
}
|
||||
public void setQuote(int quote) {
|
||||
this.quote = quote;
|
||||
}
|
||||
public String getIndexTable() {
|
||||
return indexTable;
|
||||
}
|
||||
public void setIndexTable(String indexTable) {
|
||||
this.indexTable = indexTable;
|
||||
}
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.nis.domain.callback;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
public class ProxyFileHijackCfgAudit {
|
||||
|
||||
@Expose
|
||||
private Long id; //compileId
|
||||
@Expose
|
||||
private Integer cfgId; //compileId
|
||||
@Expose
|
||||
private Integer profileId;//compileId
|
||||
@Expose
|
||||
private Integer action;
|
||||
@Expose
|
||||
private Integer service;
|
||||
@Expose
|
||||
private Integer isValid;
|
||||
@Expose
|
||||
private Date opTime;
|
||||
@Expose
|
||||
private String profileName;
|
||||
@Expose
|
||||
private String contentType;
|
||||
@Expose
|
||||
private String path;
|
||||
@Expose
|
||||
private String contentName;
|
||||
|
||||
public String getContentName() {
|
||||
return contentName;
|
||||
}
|
||||
|
||||
public void setContentName(String contentName) {
|
||||
this.contentName = contentName;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Integer getProfileId() {
|
||||
return profileId;
|
||||
}
|
||||
|
||||
public void setProfileId(Integer profileId) {
|
||||
this.profileId = profileId;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Integer cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
}
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
}
|
||||
public Integer getService() {
|
||||
return service;
|
||||
}
|
||||
public void setService(Integer service) {
|
||||
this.service = service;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.nis.domain.callback;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class ProxyFileInsertScriptCfg extends BaseCfg<ProxyFileInsertScriptCfg>{
|
||||
|
||||
private static final long serialVersionUID = 4705202662940705064L;
|
||||
public String indexTable = "pxy_profile_insert_scripts";//对应表名
|
||||
@ExcelField(title="profile_name",sort=1)
|
||||
private String profileName;//名称,辅助记忆
|
||||
@ExcelField(title="format ",sort=3)
|
||||
private String format;//css/js
|
||||
@ExcelField(title="path",sort=2)
|
||||
private String path;//储存路径
|
||||
private int quote;//判断与其他菜单是否关联使用中
|
||||
|
||||
public int getQuote() {
|
||||
return quote;
|
||||
}
|
||||
public void setQuote(int quote) {
|
||||
this.quote = quote;
|
||||
}
|
||||
public String getIndexTable() {
|
||||
return indexTable;
|
||||
}
|
||||
public void setIndexTable(String indexTable) {
|
||||
this.indexTable = indexTable;
|
||||
}
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
public void setFormat(String format) {
|
||||
this.format = format;
|
||||
}
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.nis.domain.callback;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
public class ProxyFileInsertScriptCfgAudit {
|
||||
@Expose
|
||||
private Long id; //compileId
|
||||
@Expose
|
||||
private Integer cfgId; //compileId
|
||||
@Expose
|
||||
private Integer profileId;//compileId
|
||||
@Expose
|
||||
private Integer action;
|
||||
@Expose
|
||||
private Integer service;
|
||||
@Expose
|
||||
private Integer isValid;
|
||||
@Expose
|
||||
private Date opTime;
|
||||
@Expose
|
||||
private String profileName;
|
||||
@Expose
|
||||
private String format;
|
||||
@Expose
|
||||
private String path;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Integer cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
public Integer getProfileId() {
|
||||
return profileId;
|
||||
}
|
||||
public void setProfileId(Integer profileId) {
|
||||
this.profileId = profileId;
|
||||
}
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
}
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
}
|
||||
public Integer getService() {
|
||||
return service;
|
||||
}
|
||||
public void setService(Integer service) {
|
||||
this.service = service;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
public void setFormat(String format) {
|
||||
this.format = format;
|
||||
}
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,12 +9,21 @@ import com.nis.domain.configuration.BaseCfg;
|
||||
public class ProxyFileStrategyCfg extends BaseCfg<ProxyFileStrategyCfg> {
|
||||
private static final long serialVersionUID = 4283944377949702481L;
|
||||
public final static String TABLE_NAME = "PROXY_FILE_STRATEGY_CFG";//对应表名
|
||||
private String indexTable = "proxy_file_strategy_cfg";
|
||||
private String fileDesc;//文件描述
|
||||
private String url;//文件保存的url
|
||||
private String contentType;//内容类型,如text/html,取字典表contentType
|
||||
private String md5;//文件md5值
|
||||
private Long contentLength;//文件长度
|
||||
|
||||
public String getIndexTable() {
|
||||
return indexTable;
|
||||
}
|
||||
|
||||
public void setIndexTable(String indexTable) {
|
||||
this.indexTable = indexTable;
|
||||
}
|
||||
|
||||
public ProxyFileStrategyCfg() {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.nis.domain.callback;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
public class ProxyFileStrategyCfgAudit {
|
||||
@Expose
|
||||
private Long id; //compileId
|
||||
@Expose
|
||||
private Integer cfgId; //compileId
|
||||
@Expose
|
||||
private Integer action;
|
||||
@Expose
|
||||
private Integer service;
|
||||
@Expose
|
||||
private Integer isValid;
|
||||
@Expose
|
||||
private Date opTime;
|
||||
@Expose
|
||||
private String contentType;
|
||||
@Expose
|
||||
private Long contentLength;
|
||||
@Expose
|
||||
private String filePath;
|
||||
@Expose
|
||||
private Long fileId;
|
||||
@Expose
|
||||
private String fileDesc;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Integer cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
}
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
}
|
||||
public Integer getService() {
|
||||
return service;
|
||||
}
|
||||
public void setService(Integer service) {
|
||||
this.service = service;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
public Long getContentLength() {
|
||||
return contentLength;
|
||||
}
|
||||
public void setContentLength(Long contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
}
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
public Long getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
public void setFileId(Long fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
public String getFileDesc() {
|
||||
return fileDesc;
|
||||
}
|
||||
public void setFileDesc(String fileDesc) {
|
||||
this.fileDesc = fileDesc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.nis.domain.callback;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
import antlr.collections.List;
|
||||
|
||||
public class ProxyFileTrafficMirrorCfg extends BaseCfg<ProxyFileTrafficMirrorCfg>{
|
||||
|
||||
private static final long serialVersionUID = -5895958073449509268L;
|
||||
public String indexTable = "pxy_profile_traffic_mirror";//对应表名
|
||||
@ExcelField(title="profile_name",sort=1)
|
||||
private String profileName;//名称,辅助记忆
|
||||
@ExcelField(title="addr_list",sort=2)
|
||||
private String addrList;//目标表示列表
|
||||
@ExcelField(title="addr_type",sort=3)
|
||||
private String addrType;//目标表示类型
|
||||
|
||||
public String getAddrList() {
|
||||
return addrList;
|
||||
}
|
||||
public void setAddrList(String addrList) {
|
||||
this.addrList = addrList;
|
||||
}
|
||||
public String getIndexTable() {
|
||||
return indexTable;
|
||||
}
|
||||
public void setIndexTable(String indexTable) {
|
||||
this.indexTable = indexTable;
|
||||
}
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
public String getAddrType() {
|
||||
return addrType;
|
||||
}
|
||||
public void setAddrType(String addrType) {
|
||||
this.addrType = addrType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.nis.domain.callback;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
public class ProxyFileTrafficMirrorCfgAudit {
|
||||
@Expose
|
||||
private Long id; //compileId
|
||||
@Expose
|
||||
private Integer cfgId; //compileId
|
||||
@Expose
|
||||
private Integer profileId;//compileId
|
||||
@Expose
|
||||
private Integer action;
|
||||
@Expose
|
||||
private Integer service;
|
||||
@Expose
|
||||
private Integer isValid;
|
||||
@Expose
|
||||
private Date opTime;
|
||||
@Expose
|
||||
private String profileName;
|
||||
@Expose
|
||||
private List<String> addrList;
|
||||
@Expose
|
||||
private String addrType;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Integer cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
public Integer getProfileId() {
|
||||
return profileId;
|
||||
}
|
||||
public void setProfileId(Integer profileId) {
|
||||
this.profileId = profileId;
|
||||
}
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
}
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
}
|
||||
public Integer getService() {
|
||||
return service;
|
||||
}
|
||||
public void setService(Integer service) {
|
||||
this.service = service;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
public String getAddrType() {
|
||||
return addrType;
|
||||
}
|
||||
public void setAddrType(String addrType) {
|
||||
this.addrType = addrType;
|
||||
}
|
||||
public List<String> getAddrList() {
|
||||
return addrList;
|
||||
}
|
||||
public void setAddrList(List<String> addrList) {
|
||||
this.addrList = addrList;
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,10 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -48,6 +50,10 @@ import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
@@ -183,7 +189,10 @@ import com.nis.web.service.configuration.IpCfgService;
|
||||
import com.nis.web.service.configuration.IpMultiplexPoolCfgService;
|
||||
import com.nis.web.service.configuration.MailCfgService;
|
||||
import com.nis.web.service.configuration.NumCfgService;
|
||||
import com.nis.web.service.configuration.ProxyFileHijackService;
|
||||
import com.nis.web.service.configuration.ProxyFileInsertScriptService;
|
||||
import com.nis.web.service.configuration.ProxyFileStrategyService;
|
||||
import com.nis.web.service.configuration.ProxyFileTrafficMirrorService;
|
||||
import com.nis.web.service.configuration.PxyObjKeyringService;
|
||||
import com.nis.web.service.configuration.PxyObjSpoofingIpPoolService;
|
||||
import com.nis.web.service.configuration.RequestInfoService;
|
||||
@@ -299,6 +308,12 @@ public class BaseController {
|
||||
@Autowired
|
||||
protected PxyObjKeyringService pxyObjKeyringService;// 拦截策略service
|
||||
@Autowired
|
||||
protected ProxyFileHijackService proxyFileHijackService;// 劫持文件service
|
||||
@Autowired
|
||||
protected ProxyFileInsertScriptService proxyFileInsertScriptService;//注入脚本文件service
|
||||
@Autowired
|
||||
protected ProxyFileTrafficMirrorService proxyFileTrafficMirrorService;//注入流量镜像文件ervice
|
||||
@Autowired
|
||||
protected AppBuiltInFeatureService appBuiltInFeatureService;// 拦截策略service
|
||||
@Autowired
|
||||
protected AsnIpCfgService asnIpCfgService;// asn ip service
|
||||
@@ -2667,6 +2682,10 @@ public class BaseController {
|
||||
AppFeatureIndex searchAppFeatureIndex=new AppFeatureIndex();
|
||||
AppSslCertCfg searchAppSslCertCfg=new AppSslCertCfg();
|
||||
AsnIpCfg searchAsnIpCfg=new AsnIpCfg();
|
||||
ProxyFileHijackCfg searFileHijackCfg = new ProxyFileHijackCfg();
|
||||
ProxyFileInsertScriptCfg searFileInsertScriptCfg = new ProxyFileInsertScriptCfg();
|
||||
ProxyFileTrafficMirrorCfg searFileTrafficMirrorCfg = new ProxyFileTrafficMirrorCfg();
|
||||
ProxyFileStrategyCfg searFileStrategyCfg = new ProxyFileStrategyCfg();
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchCfg);
|
||||
@@ -2743,8 +2762,21 @@ public class BaseController {
|
||||
if(entity != null && (entity instanceof AsnIpCfg)) {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchAsnIpCfg);
|
||||
}if(entity != null && (entity instanceof ProxyFileHijackCfg)){
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searFileHijackCfg);
|
||||
}if(entity != null && (entity instanceof ProxyFileInsertScriptCfg)){
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searFileInsertScriptCfg);
|
||||
}if(entity != null && (entity instanceof ProxyFileTrafficMirrorCfg)){
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searFileTrafficMirrorCfg);
|
||||
}if(entity != null && (entity instanceof ProxyFileStrategyCfg)){
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searFileStrategyCfg);
|
||||
}
|
||||
|
||||
|
||||
auditType = (Integer)Reflections.invokeGetter(entity, "isAudit");
|
||||
|
||||
//全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过
|
||||
@@ -2815,6 +2847,14 @@ public class BaseController {
|
||||
searchAppFeatureIndex.setTableName(tableNameXml);
|
||||
searchAppSslCertCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searchAppSslCertCfg.setTableName(tableNameXml);
|
||||
searFileHijackCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searFileHijackCfg.setTableName(tableNameXml);
|
||||
searFileInsertScriptCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searFileInsertScriptCfg.setTableName(tableNameXml);
|
||||
searFileTrafficMirrorCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searFileTrafficMirrorCfg.setTableName(tableNameXml);
|
||||
searFileStrategyCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searFileStrategyCfg.setTableName(tableNameXml);
|
||||
|
||||
if("1".equals(serviceTypeXml)){//maat类配置
|
||||
// 存放域配置类型 及 对应表名
|
||||
@@ -3210,7 +3250,11 @@ public class BaseController {
|
||||
, searchDnsResStrategy
|
||||
, searchDnsIpCfg
|
||||
, searchIpPortCfg
|
||||
, searchSignSampleCfg);
|
||||
, searchSignSampleCfg
|
||||
, searFileHijackCfg
|
||||
, searFileInsertScriptCfg
|
||||
, searFileTrafficMirrorCfg
|
||||
, searFileStrategyCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3290,6 +3334,10 @@ public class BaseController {
|
||||
PxyObjKeyring searchObjKeyringCfg=new PxyObjKeyring();
|
||||
PxyObjTrustedCaCert searchTrustedCaCertCfg=new PxyObjTrustedCaCert();
|
||||
AsnIpCfg searchAsnIpCfg=new AsnIpCfg();
|
||||
ProxyFileHijackCfg searchFileHijackCfg = new ProxyFileHijackCfg();
|
||||
ProxyFileInsertScriptCfg searchFileInsertScriptCfg = new ProxyFileInsertScriptCfg();
|
||||
ProxyFileTrafficMirrorCfg searchFileTrafficMirrorCfg = new ProxyFileTrafficMirrorCfg();
|
||||
ProxyFileStrategyCfg searchFileStrategyCfg = new ProxyFileStrategyCfg();
|
||||
|
||||
// 传递检索条件
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
@@ -3360,6 +3408,19 @@ public class BaseController {
|
||||
BeanUtils.copyProperties(entity, searchAsnIpCfg);
|
||||
searchAsnIpCfg.setFunctionId(functionId);
|
||||
}
|
||||
if(entity != null && (entity instanceof ProxyFileHijackCfg)){
|
||||
BeanUtils.copyProperties(entity, searchFileHijackCfg);
|
||||
searchFileHijackCfg.setFunctionId(functionId);
|
||||
}if(entity != null && (entity instanceof ProxyFileInsertScriptCfg)){
|
||||
BeanUtils.copyProperties(entity, searchFileInsertScriptCfg);
|
||||
searchFileInsertScriptCfg.setFunctionId(functionId);
|
||||
}if(entity != null && (entity instanceof ProxyFileTrafficMirrorCfg)){
|
||||
BeanUtils.copyProperties(entity, searchFileTrafficMirrorCfg);
|
||||
searchFileTrafficMirrorCfg.setFunctionId(functionId);
|
||||
}if(entity != null && (entity instanceof ProxyFileStrategyCfg)){
|
||||
BeanUtils.copyProperties(entity, searchFileStrategyCfg);
|
||||
searchFileStrategyCfg.setFunctionId(functionId);
|
||||
}
|
||||
|
||||
BaseCfg batchCfg = new BaseCfg();
|
||||
batchCfg.setIsValid(-1);
|
||||
@@ -3569,6 +3630,71 @@ public class BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
}else if("pxy_profile_hijack_files".equals(tableNameXml)) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List list = proxyFileHijackService.findPage(page, searchFileHijackCfg).getList();
|
||||
List<BaseCfg> result = new ArrayList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
ProxyFileHijackCfg temp=(ProxyFileHijackCfg)list.get(i);
|
||||
if(temp.getQuote() == -1 || temp.getQuote() ==0){
|
||||
result.add(temp);
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, result, hasData);
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
}else if("pxy_profile_insert_scripts".equals(tableNameXml)) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List list = proxyFileInsertScriptService.findPage(page,searchFileInsertScriptCfg).getList();
|
||||
List<BaseCfg> result = new ArrayList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
ProxyFileInsertScriptCfg temp=(ProxyFileInsertScriptCfg)list.get(i);
|
||||
if(temp.getQuote() == -1 || temp.getQuote() ==0){
|
||||
result.add(temp);
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, result, hasData);
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
}else if("pxy_profile_traffic_mirror".equals(tableNameXml)) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List list = proxyFileTrafficMirrorService.findPage(page,searchFileTrafficMirrorCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData);
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
}else if("proxy_file_strategy_cfg".equals(tableNameXml)) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List list = proxyFileStrategyService.findPage(page,searchFileStrategyCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData);
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
@@ -3703,7 +3829,11 @@ public class BaseController {
|
||||
,DnsResStrategy searchDnsResStrategy
|
||||
,DnsIpCfg searchDnsIpCfg
|
||||
,IpPortCfg searchIpPortCfg
|
||||
,AvSignSampleCfg searchSignSampleCfg) {
|
||||
,AvSignSampleCfg searchSignSampleCfg
|
||||
,ProxyFileHijackCfg searFileHijackCfg
|
||||
,ProxyFileInsertScriptCfg searFileInsertScriptCfg
|
||||
,ProxyFileTrafficMirrorCfg searFileTrafficMirrorCfg
|
||||
,ProxyFileStrategyCfg searFileStrategyCfg) {
|
||||
ToMaatBean maatBean;
|
||||
MaatCfg maatCfg;
|
||||
List<MaatCfg> configCompileList;
|
||||
@@ -3792,6 +3922,82 @@ public class BaseController {
|
||||
notAuditList.add(cfg);
|
||||
}
|
||||
}
|
||||
}else if(className.equals("ProxyFileTrafficMirrorCfg")){
|
||||
list = proxyFileTrafficMirrorService.findPage(page, searFileTrafficMirrorCfg).getList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
ProxyFileTrafficMirrorCfg cfg = (ProxyFileTrafficMirrorCfg) list.get(i);
|
||||
ids.add(cfg.getCompileId());
|
||||
if(cfg.getIsValid()==1) {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
auditList.add(cfg);
|
||||
}else {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
notAuditList.add(cfg);
|
||||
}
|
||||
}
|
||||
}else if(className.equals("ProxyFileStrategyCfg")){
|
||||
list = proxyFileStrategyService.findPage(page, searFileStrategyCfg).getList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
ProxyFileStrategyCfg cfg = (ProxyFileStrategyCfg) list.get(i);
|
||||
ids.add(cfg.getCompileId());
|
||||
if(cfg.getIsValid()==1) {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
auditList.add(cfg);
|
||||
}else {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
notAuditList.add(cfg);
|
||||
}
|
||||
}
|
||||
}else if(className.equals("ProxyFileHijackCfg")){
|
||||
list = proxyFileHijackService.findPage(page, searFileHijackCfg).getList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
ProxyFileHijackCfg cfg = (ProxyFileHijackCfg) list.get(i);
|
||||
ids.add(cfg.getCompileId());
|
||||
if(cfg.getIsValid()==1) {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
auditList.add(cfg);
|
||||
}else {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
notAuditList.add(cfg);
|
||||
}
|
||||
}
|
||||
}else if(className.equals("ProxyFileInsertScriptCfg")){
|
||||
list = proxyFileInsertScriptService.findPage(page, searFileInsertScriptCfg).getList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
ProxyFileInsertScriptCfg cfg = (ProxyFileInsertScriptCfg) list.get(i);
|
||||
ids.add(cfg.getCompileId());
|
||||
if(cfg.getIsValid()==1) {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
auditList.add(cfg);
|
||||
}else {
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
notAuditList.add(cfg);
|
||||
}
|
||||
}
|
||||
}else if(className.equals("PxyObjKeyring")){
|
||||
list = pxyObjKeyringService.findPage(page, searchObjKeyringCfg).getList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
package com.nis.web.controller.configuration.proxy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
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.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/proxy/fileHijack")
|
||||
public class FileHijackController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"list"})
|
||||
public String fileHijackList(ProxyFileHijackCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(new Page<ProxyFileHijackCfg>(request, response,"a"), cfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("cfg", cfg);
|
||||
initPageCondition(model);
|
||||
return "/cfg/proxy/fileHijack/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"proxy:fileHijack:config"})
|
||||
public String fileform(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,@ModelAttribute("cfg")ProxyFileHijackCfg cfg
|
||||
,String ids
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = proxyFileHijackService.getCfgById(Long.valueOf(ids));
|
||||
}
|
||||
//初始化各字典
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/proxy/fileHijack/form";
|
||||
}
|
||||
|
||||
@RequiresPermissions(value={"proxy:fileHijack:config"})
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,MultipartFile cfgFile,
|
||||
@ModelAttribute("cfg")ProxyFileHijackCfg cfg,
|
||||
RedirectAttributes redirectAttributes){
|
||||
File file = null;
|
||||
try{
|
||||
if(cfgFile != null) {
|
||||
String filename = cfgFile.getOriginalFilename();
|
||||
String prefix = FileUtils.getPrefix(filename, false);
|
||||
String suffix = FileUtils.getSuffix(filename, false);
|
||||
file = File.createTempFile("file_" + prefix, suffix);
|
||||
cfgFile.transferTo(file);// 复制文件
|
||||
String md5 = FileUtils.getFileMD5(file);
|
||||
Map<String, Object> srcMap = Maps.newHashMap();
|
||||
srcMap.put("filetype", suffix);
|
||||
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
|
||||
srcMap.put("createTime", new Date());
|
||||
srcMap.put("key", prefix);
|
||||
srcMap.put("fileName", filename);
|
||||
srcMap.put("checksum", md5);
|
||||
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
|
||||
logger.info("proxy 劫持文件 上传响应信息:" + JsonMapper.toJsonString(result));
|
||||
String path = null;
|
||||
if (!StringUtil.isEmpty(result)) {
|
||||
ResponseData data = result.getData();
|
||||
path = data.getAccessUrl();
|
||||
cfg.setPath(path);
|
||||
}
|
||||
}
|
||||
proxyFileHijackService.saveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}finally {
|
||||
if(file != null) {
|
||||
file.delete();//删除临时文件
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"proxy:fileStrategy:config"})
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileHijackCfg cfg,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
proxyFileHijackService.update(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<ProxyFileHijackCfg> searchPage = new Page<ProxyFileHijackCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"proxy:fileHijack:confirm"})
|
||||
public String audit(Model model, @ModelAttribute("cfg") ProxyFileHijackCfg cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
proxyFileHijackService.audit(isAudit, isValid, functionId, id);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Page<ProxyFileHijackCfg> searchPage = new Page<ProxyFileHijackCfg>(request, response, "a");
|
||||
Page<ProxyFileHijackCfg> auditPage = new Page<ProxyFileHijackCfg>(request, response, "a");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return fileHijackList(cfg, model, request, response);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "exportFileHijack")
|
||||
public void exportPxy(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") ProxyFileHijackCfg 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<ProxyFileHijackCfg> ipLists = new ArrayList<ProxyFileHijackCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = proxyFileHijackService.findByList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<ProxyFileHijackCfg> pageInfo = new Page<ProxyFileHijackCfg>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
ipLists.get(i).setProfileName(ipLists.get(i).getCfgDesc());
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), ProxyFileHijackCfg.class);
|
||||
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,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("proxyFileHijack export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
package com.nis.web.controller.configuration.proxy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
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.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/proxy/fileInsertScript")
|
||||
public class FileInsertScriptController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"list"})
|
||||
public String fileInsertScriptList(ProxyFileInsertScriptCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(new Page<ProxyFileInsertScriptCfg>(request, response,"a"), cfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("cfg", cfg);
|
||||
initPageCondition(model);
|
||||
return "/cfg/proxy/fileInsertScript/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
|
||||
public String fileform(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,@ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg
|
||||
,String ids
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = proxyFileInsertScriptService.getCfgById(Long.valueOf(ids));
|
||||
}
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/proxy/fileInsertScript/form";
|
||||
}
|
||||
|
||||
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,MultipartFile cfgFile,
|
||||
@ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg,
|
||||
RedirectAttributes redirectAttributes){
|
||||
File file = null;
|
||||
try{
|
||||
if(cfgFile != null) {
|
||||
String filename = cfgFile.getOriginalFilename();
|
||||
String prefix = FileUtils.getPrefix(filename, false);
|
||||
String suffix = FileUtils.getSuffix(filename, false);
|
||||
file = File.createTempFile("file_"+ prefix, suffix);
|
||||
cfgFile.transferTo(file);//复制文件
|
||||
String md5 = FileUtils.getFileMD5(file);
|
||||
Map<String,Object> srcMap = Maps.newHashMap();
|
||||
srcMap.put("filetype", suffix);
|
||||
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
|
||||
srcMap.put("createTime",new Date());
|
||||
srcMap.put("key",prefix);
|
||||
srcMap.put("fileName", filename);
|
||||
srcMap.put("checksum", md5);
|
||||
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
|
||||
logger.info("注入脚本文件上传响应信息:"+JsonMapper.toJsonString(result));
|
||||
String srcAccessUrl = null;
|
||||
if(!StringUtil.isEmpty(result)){
|
||||
ResponseData data = result.getData();
|
||||
srcAccessUrl=data.getAccessUrl();
|
||||
cfg.setPath(srcAccessUrl);
|
||||
}
|
||||
}
|
||||
proxyFileInsertScriptService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}finally {
|
||||
if(file != null) {
|
||||
file.delete();//删除临时文件
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"proxy:fileInsertScript:confirm"})
|
||||
public String audit(Model model, @ModelAttribute("cfg") ProxyFileInsertScriptCfg cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
proxyFileInsertScriptService.audit(isAudit, isValid, functionId, id);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Page<ProxyFileInsertScriptCfg> searchPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
|
||||
Page<ProxyFileInsertScriptCfg> auditPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return fileInsertScriptList(cfg, model, request, response);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
proxyFileInsertScriptService.delete(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<ProxyFileInsertScriptCfg> searchPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "exportFileInsertScript")
|
||||
public void exportFileHijack(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") ProxyFileInsertScriptCfg 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<ProxyFileInsertScriptCfg> ipLists = new ArrayList<ProxyFileInsertScriptCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = proxyFileInsertScriptService.findByList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<ProxyFileInsertScriptCfg> pageInfo = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
ipLists.get(i).setProfileName(ipLists.get(i).getCfgDesc());
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), ProxyFileInsertScriptCfg.class);
|
||||
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,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("proxyFileInsertScript export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
||||
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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
@@ -118,6 +120,13 @@ public class FileStrategyController extends CommonController {
|
||||
cfg.setContentLength(file.length());//文件长度
|
||||
}
|
||||
proxyFileStrategyService.saveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
@@ -133,27 +142,81 @@ public class FileStrategyController extends CommonController {
|
||||
file.delete();//删除临时文件
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"proxy:fileStrategy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes){
|
||||
proxyFileStrategyService.update(isAudit,isValid,ids,functionId);
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileStrategyCfg cfg,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
proxyFileStrategyService.update(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<ProxyFileStrategyCfg> searchPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"proxy:fileStrategy:confirm"})
|
||||
public String audit(Integer isAudit,Integer isValid,String ids
|
||||
,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
proxyFileStrategyService.audit(isAudit, isValid, functionId, ids);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
public String audit(Model model, @ModelAttribute("cfg") ProxyFileStrategyCfg cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
proxyFileStrategyService.audit(isAudit, isValid, functionId, id);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Page<ProxyFileStrategyCfg> searchPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
|
||||
Page<ProxyFileStrategyCfg> auditPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return fileStrategyList(cfg, model, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.nis.web.controller.configuration.proxy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
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.callback.ProxyFileTrafficMirrorCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/proxy/fileTrafficMirror")
|
||||
public class FileTrafficMirrorController extends CommonController {
|
||||
@RequestMapping(value = {"list"})
|
||||
public String fileTrafficMirrorList(ProxyFileTrafficMirrorCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<ProxyFileTrafficMirrorCfg> page = proxyFileTrafficMirrorService.findPage(new Page<ProxyFileTrafficMirrorCfg>(request, response,"a"), cfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("cfg", cfg);
|
||||
initPageCondition(model);
|
||||
return "/cfg/proxy/fileTrafficMirror/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
|
||||
public String fileform(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,@ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg
|
||||
,String ids
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = proxyFileTrafficMirrorService.getCfgById(Long.valueOf(ids));
|
||||
}
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/proxy/fileTrafficMirror/form";
|
||||
}
|
||||
|
||||
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,MultipartFile cfgFile,
|
||||
@ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg,
|
||||
RedirectAttributes redirectAttributes){
|
||||
File file = null;
|
||||
try{
|
||||
if(cfgFile != null) {
|
||||
String filename = cfgFile.getOriginalFilename();
|
||||
String prefix = FileUtils.getPrefix(filename, false);
|
||||
String suffix = FileUtils.getSuffix(filename, false);
|
||||
file = File.createTempFile("file_"+ prefix, suffix);
|
||||
cfgFile.transferTo(file);//复制文件
|
||||
String md5 = FileUtils.getFileMD5(file);
|
||||
Map<String,Object> srcMap = Maps.newHashMap();
|
||||
srcMap.put("filetype", suffix);
|
||||
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
|
||||
srcMap.put("createTime",new Date());
|
||||
srcMap.put("key",prefix);
|
||||
srcMap.put("fileName", filename);
|
||||
srcMap.put("checksum", md5);
|
||||
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
|
||||
logger.info("注入脚本文件上传响应信息:"+JsonMapper.toJsonString(result));
|
||||
}
|
||||
proxyFileTrafficMirrorService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}finally {
|
||||
if(file != null) {
|
||||
file.delete();//删除临时文件
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"proxy:fileTrafficMirror:confirm"})
|
||||
public String audit(Model model, @ModelAttribute("cfg") ProxyFileTrafficMirrorCfg cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
proxyFileTrafficMirrorService.audit(isAudit, isValid, functionId, id);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Page<ProxyFileTrafficMirrorCfg> searchPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
|
||||
Page<ProxyFileTrafficMirrorCfg> auditPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return fileTrafficMirrorList(cfg, model, request, response);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
proxyFileTrafficMirrorService.delete(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<ProxyFileTrafficMirrorCfg> searchPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "d");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "exportFileTrafficMirror")
|
||||
public void exportFileHijack(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") ProxyFileTrafficMirrorCfg 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<ProxyFileTrafficMirrorCfg> ipLists = new ArrayList<ProxyFileTrafficMirrorCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = proxyFileTrafficMirrorService.findByList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<ProxyFileTrafficMirrorCfg> pageInfo = new Page<ProxyFileTrafficMirrorCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<ProxyFileTrafficMirrorCfg> page = proxyFileTrafficMirrorService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), ProxyFileTrafficMirrorCfg.class);
|
||||
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,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("proxyFileTrafficMirror export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
/**
|
||||
* 劫持文件处理
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
@MyBatisDao
|
||||
public interface ProxyFileHijackDao extends CrudDao<ProxyFileHijackCfg>{
|
||||
|
||||
public List<ProxyFileHijackCfg> findPage(ProxyFileHijackCfg entity) ;
|
||||
|
||||
public ProxyFileHijackCfg getCfgById(@Param("cfgId")Long cfgId);
|
||||
|
||||
public int insert(ProxyFileHijackCfg entity);
|
||||
|
||||
public int update(ProxyFileHijackCfg entity);
|
||||
|
||||
List<ProxyFileHijackCfg> findByList(@Param("ids")String ids);
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
<?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.ProxyFileHijackDao" >
|
||||
|
||||
<resultMap id="ProxyFileHijackCfg" type="com.nis.domain.callback.ProxyFileHijackCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="level" property="level" 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="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="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
|
||||
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
|
||||
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
|
||||
|
||||
<result column="content_type" property="contentType" jdbcType="VARCHAR" />
|
||||
<result column="content_name" property="contentName" jdbcType="VARCHAR" />
|
||||
<result column="path" property="path" jdbcType="VARCHAR" />
|
||||
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="ProxyFileHijackCfgColumn" >
|
||||
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
|
||||
a.CONTENT_TYPE,a.CONTENT_NAME,a.PATH,a.CANCEL_REQUEST_ID
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- voip条件查询列表信息 -->
|
||||
<select id="findPage" resultMap="ProxyFileHijackCfg" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" >
|
||||
SELECT
|
||||
<include refid="ProxyFileHijackCfgColumn" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName,i.is_valid as quote
|
||||
</trim>
|
||||
FROM PXY_PROFILE_HIJACK_FILES a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
left join cfg_index_info i on a.COMPILE_ID=i.user_region4
|
||||
<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 a.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND a.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchValidValue != null and batchValidValue != ''">
|
||||
AND a.IS_VALID in (${batchValidValue})
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchAuditValue != null and batchAuditValue != ''">
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT in(${batchAuditValue})
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName != ''">
|
||||
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.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},a.is_audit,a.CFG_ID desc
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY a.is_audit,a.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getCfgById" resultMap="ProxyFileHijackCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileHijackCfgColumn" />
|
||||
FROM PXY_PROFILE_HIJACK_FILES a
|
||||
<where>
|
||||
<if test="cfgId != null">
|
||||
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileHijackCfg">
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into PXY_PROFILE_HIJACK_FILES (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
|
||||
path,
|
||||
content_type,
|
||||
content_name
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
|
||||
#{path,jdbcType=VARCHAR},
|
||||
#{contentType,jdbcType=VARCHAR},
|
||||
#{contentName,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" >
|
||||
update PXY_PROFILE_HIJACK_FILES
|
||||
<set>
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,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="creatorId != null" >
|
||||
creator_id = #{creatorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
<if test="auditorId != null" >
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</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="cfgRegionCode != null" >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgType != null" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="path != null" >
|
||||
path = #{path,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="contentType != null" >
|
||||
content_type = #{contentType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="contentName != null" >
|
||||
content_name = #{contentName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findByList" resultMap="ProxyFileHijackCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileHijackCfgColumn"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM PXY_PROFILE_HIJACK_FILES a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
where a.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
/**
|
||||
* 注入脚本文件
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
@MyBatisDao
|
||||
public interface ProxyFileInsertScriptDao extends CrudDao<ProxyFileInsertScriptCfg> {
|
||||
|
||||
public List<ProxyFileInsertScriptCfg> findPage(ProxyFileInsertScriptCfg entity);
|
||||
|
||||
public ProxyFileInsertScriptCfg getCfgById(@Param("cfgId")Long cfgId);
|
||||
|
||||
public int insert(ProxyFileInsertScriptCfg entity);
|
||||
|
||||
public int update(ProxyFileInsertScriptCfg entity);
|
||||
|
||||
List<ProxyFileInsertScriptCfg> findByList(@Param("ids")String ids);
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
<?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.ProxyFileInsertScriptDao" >
|
||||
|
||||
<resultMap id="ProxyFileInsertScriptCfg" type="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
|
||||
<result column="format" property="format" jdbcType="VARCHAR" />
|
||||
<result column="path" property="path" jdbcType="VARCHAR" />
|
||||
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
|
||||
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="level" property="level" 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="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="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
|
||||
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
|
||||
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="ProxyFileInsertScriptCfgColumn" >
|
||||
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
|
||||
a.FORMAT,a.PATH,a.cancel_request_id
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- voip条件查询列表信息 -->
|
||||
<select id="findPage" resultMap="ProxyFileInsertScriptCfg" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
|
||||
SELECT
|
||||
<include refid="ProxyFileInsertScriptCfgColumn" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName,i.is_valid as quote
|
||||
</trim>
|
||||
FROM PXY_PROFILE_INSERT_SCRIPTS a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
left join cfg_index_info i on a.COMPILE_ID=i.user_region4
|
||||
<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 a.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND a.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchValidValue != null and batchValidValue != ''">
|
||||
AND a.IS_VALID in (${batchValidValue})
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchAuditValue != null and batchAuditValue != ''">
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT in(${batchAuditValue})
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName != ''">
|
||||
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.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},a.is_audit,a.CFG_ID desc
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY a.is_audit,a.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getCfgById" resultMap="ProxyFileInsertScriptCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileInsertScriptCfgColumn" />
|
||||
FROM PXY_PROFILE_INSERT_SCRIPTS a
|
||||
<where>
|
||||
<if test="cfgId != null">
|
||||
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg">
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into PXY_PROFILE_INSERT_SCRIPTS (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
|
||||
path,
|
||||
format
|
||||
)values (
|
||||
#{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},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
|
||||
#{path,jdbcType=VARCHAR},
|
||||
#{format,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
|
||||
update PXY_PROFILE_INSERT_SCRIPTS
|
||||
<set>
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,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="creatorId != null" >
|
||||
creator_id = #{creatorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
<if test="auditorId != null" >
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</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="cfgRegionCode != null" >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgType != null" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="path != null" >
|
||||
path = #{path ,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="format != null" >
|
||||
format = #{format ,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findByList" resultMap="ProxyFileInsertScriptCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileInsertScriptCfgColumn"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM PXY_PROFILE_INSERT_SCRIPTS a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
where a.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -74,15 +74,33 @@
|
||||
<if test="action != null">
|
||||
AND a.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchValidValue != null and batchValidValue != ''">
|
||||
AND a.IS_VALID in (${batchValidValue})
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchAuditValue != null and batchAuditValue != ''">
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT in(${batchAuditValue})
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
@@ -148,6 +166,9 @@
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileStrategyCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into proxy_file_strategy_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
@@ -179,8 +200,8 @@
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface ProxyFileTrafficMirrorDao extends CrudDao<ProxyFileTrafficMirrorCfg>{
|
||||
|
||||
public List<ProxyFileTrafficMirrorCfg> findPage(ProxyFileTrafficMirrorCfg entity) ;
|
||||
|
||||
public ProxyFileTrafficMirrorCfg getCfgById(@Param("cfgId")Long cfgId);
|
||||
|
||||
List<ProxyFileTrafficMirrorCfg> findByList(@Param("ids")String ids);
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
<?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.ProxyFileTrafficMirrorDao" >
|
||||
|
||||
<resultMap id="ProxyFileTrafficMirrorCfg" type="com.nis.domain.callback.ProxyFileTrafficMirrorCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="level" property="level" 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="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="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
|
||||
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
|
||||
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
|
||||
|
||||
<result column="addr_list" property="addrList" jdbcType="VARCHAR" />
|
||||
<result column="addr_type" property="addrType" jdbcType="VARCHAR" />
|
||||
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="ProxyFileTrafficMirrorCfgColumn" >
|
||||
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
|
||||
a.ADDR_LIST,a.ADDR_TYPE,a.CANCEL_REQUEST_ID
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- voip条件查询列表信息 -->
|
||||
<select id="findPage" resultMap="ProxyFileTrafficMirrorCfg" parameterType="com.nis.domain.callback.ProxyFileTrafficMirrorCfg" >
|
||||
SELECT
|
||||
<include refid="ProxyFileTrafficMirrorCfgColumn" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName<!-- ,i.is_valid as quote -->
|
||||
</trim>
|
||||
FROM PXY_PROFILE_TRAFFIC_MIRROR a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
<!-- left join cfg_index_info i on a.COMPILE_ID=i.user_region4 -->
|
||||
<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 a.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND a.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchValidValue != null and batchValidValue != ''">
|
||||
AND a.IS_VALID in (${batchValidValue})
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<!-- 判断是否批量操作 -->
|
||||
<when test="batchAuditValue != null and batchAuditValue != ''">
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT in(${batchAuditValue})
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName != ''">
|
||||
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="addrType != null and addrType != ''">
|
||||
AND a.addr_type like concat(concat('%',#{addrType,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY a.is_audit,a.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getCfgById" resultMap="ProxyFileTrafficMirrorCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileTrafficMirrorCfgColumn" />
|
||||
FROM PXY_PROFILE_TRAFFIC_MIRROR a
|
||||
<where>
|
||||
<if test="cfgId != null">
|
||||
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileTrafficMirrorCfg">
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into PXY_PROFILE_TRAFFIC_MIRROR (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
|
||||
addr_list,
|
||||
addr_type
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
|
||||
#{addrList,jdbcType=VARCHAR},
|
||||
#{addrType,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.callback.ProxyFileTrafficMirrorCfg" >
|
||||
update PXY_PROFILE_TRAFFIC_MIRROR
|
||||
<set>
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,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="creatorId != null" >
|
||||
creator_id = #{creatorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
<if test="auditorId != null" >
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</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="cfgRegionCode != null" >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgType != null" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="addrList != null" >
|
||||
addr_list = #{addrList,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="addrType != null" >
|
||||
addr_type = #{addrType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<!-- 导出:查出所有有效数据-->
|
||||
<select id="findByList" resultMap="ProxyFileTrafficMirrorCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileTrafficMirrorCfgColumn"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM PXY_PROFILE_TRAFFIC_MIRROR a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
where a.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -9,6 +9,7 @@ import java.nio.charset.Charset;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -53,6 +54,14 @@ import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.callback.NtcDnsResStrategy;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfgAudit;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfgAudit;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfgAudit;
|
||||
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
|
||||
import com.nis.domain.callback.ProxyFileTrafficMirrorCfgAudit;
|
||||
import com.nis.domain.callback.ProxyObjKeyring;
|
||||
import com.nis.domain.callback.ProxyObjTrustedCa;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
@@ -3078,5 +3087,68 @@ public abstract class BaseService {
|
||||
}
|
||||
return schedule;
|
||||
}
|
||||
|
||||
//劫持文件
|
||||
public static ProxyFileHijackCfgAudit convertCallBackProxyFileHijack(ProxyFileHijackCfg cfg) {
|
||||
ProxyFileHijackCfgAudit hijackTemp = new ProxyFileHijackCfgAudit();
|
||||
hijackTemp.setId(Long.valueOf(cfg.getCompileId()));
|
||||
hijackTemp.setCfgId(cfg.getCompileId());
|
||||
hijackTemp.setProfileId(cfg.getCompileId());
|
||||
hijackTemp.setContentType(cfg.getContentType());
|
||||
hijackTemp.setContentName(keywordsEscape(cfg.getContentName()));
|
||||
hijackTemp.setProfileName(keywordsEscape(cfg.getCfgDesc()));
|
||||
hijackTemp.setPath(cfg.getPath());
|
||||
hijackTemp.setAction(cfg.getAction());
|
||||
hijackTemp.setService(cfg.getServiceId());
|
||||
hijackTemp.setIsValid(cfg.getIsValid());
|
||||
hijackTemp.setOpTime(cfg.getAuditTime());
|
||||
return hijackTemp;
|
||||
}
|
||||
//注入脚本文件
|
||||
public static ProxyFileInsertScriptCfgAudit convertCallBackProxyFileInsertScript(ProxyFileInsertScriptCfg cfg) {
|
||||
ProxyFileInsertScriptCfgAudit fileInsertScriptTemp = new ProxyFileInsertScriptCfgAudit();
|
||||
fileInsertScriptTemp.setId(Long.valueOf(cfg.getCompileId()));
|
||||
fileInsertScriptTemp.setCfgId(cfg.getCompileId());
|
||||
fileInsertScriptTemp.setProfileId(cfg.getCompileId());
|
||||
fileInsertScriptTemp.setFormat(cfg.getFormat());
|
||||
fileInsertScriptTemp.setProfileName(keywordsEscape(cfg.getCfgDesc()));
|
||||
fileInsertScriptTemp.setPath(cfg.getPath());
|
||||
fileInsertScriptTemp.setAction(cfg.getAction());
|
||||
fileInsertScriptTemp.setService(cfg.getServiceId());
|
||||
fileInsertScriptTemp.setIsValid(cfg.getIsValid());
|
||||
fileInsertScriptTemp.setOpTime(cfg.getAuditTime());
|
||||
return fileInsertScriptTemp;
|
||||
}
|
||||
//流量转发目的地址
|
||||
public static ProxyFileTrafficMirrorCfgAudit convertCallBackProxyFileTrafficMirror(ProxyFileTrafficMirrorCfg cfg) {
|
||||
ProxyFileTrafficMirrorCfgAudit fileTemp = new ProxyFileTrafficMirrorCfgAudit();
|
||||
fileTemp.setId(Long.valueOf(cfg.getCompileId()));
|
||||
fileTemp.setCfgId(cfg.getCompileId());
|
||||
fileTemp.setProfileId(cfg.getCompileId());
|
||||
fileTemp.setProfileName(keywordsEscape(cfg.getCfgDesc()));
|
||||
fileTemp.setAddrList(Arrays.asList(cfg.getAddrList().split(",")));
|
||||
fileTemp.setAddrType(cfg.getAddrType());
|
||||
fileTemp.setAction(cfg.getAction());
|
||||
fileTemp.setService(cfg.getServiceId());
|
||||
fileTemp.setIsValid(cfg.getIsValid());
|
||||
fileTemp.setOpTime(cfg.getAuditTime());
|
||||
return fileTemp;
|
||||
}
|
||||
//文件策略
|
||||
public static ProxyFileStrategyCfgAudit convertCallBackProxyFileStrategy(ProxyFileStrategyCfg cfg) {
|
||||
ProxyFileStrategyCfgAudit fileTemp = new ProxyFileStrategyCfgAudit();
|
||||
fileTemp.setId(Long.valueOf(cfg.getCompileId()));
|
||||
fileTemp.setCfgId(cfg.getCompileId());
|
||||
fileTemp.setFileId(Long.valueOf(cfg.getCompileId()));
|
||||
fileTemp.setFileDesc(keywordsEscape(cfg.getFileDesc()));
|
||||
fileTemp.setContentType(cfg.getContentType());
|
||||
fileTemp.setContentLength(cfg.getContentLength());
|
||||
fileTemp.setAction(cfg.getAction());
|
||||
fileTemp.setService(cfg.getServiceId());
|
||||
fileTemp.setFilePath(cfg.getUrl());
|
||||
fileTemp.setIsValid(cfg.getIsValid());
|
||||
fileTemp.setOpTime(cfg.getAuditTime());
|
||||
return fileTemp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,14 @@ import com.google.common.collect.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.callback.NtcDnsResStrategy;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfgAudit;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfgAudit;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfgAudit;
|
||||
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
|
||||
import com.nis.domain.callback.ProxyFileTrafficMirrorCfgAudit;
|
||||
import com.nis.domain.callback.ProxyObjKeyring;
|
||||
import com.nis.domain.callback.ProxyObjTrustedCa;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
@@ -361,6 +369,42 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
|
||||
if(convertList.size() > 0) {
|
||||
notAuditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(643)) { // 劫持文件
|
||||
List<ProxyFileHijackCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : notAuditList) {
|
||||
ProxyFileHijackCfg cfg = (ProxyFileHijackCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileHijack(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
notAuditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(644)) { // 注入脚本文件
|
||||
List<ProxyFileInsertScriptCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : notAuditList) {
|
||||
ProxyFileInsertScriptCfg cfg = (ProxyFileInsertScriptCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileInsertScript(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
notAuditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(645)) { // 流量转发目的地址
|
||||
List<ProxyFileTrafficMirrorCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : notAuditList) {
|
||||
ProxyFileTrafficMirrorCfg cfg = (ProxyFileTrafficMirrorCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileTrafficMirror(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
notAuditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(608)) { // 文件策略
|
||||
List<ProxyFileStrategyCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : notAuditList) {
|
||||
ProxyFileStrategyCfg cfg = (ProxyFileStrategyCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileStrategy(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
notAuditList = convertList;
|
||||
}
|
||||
}
|
||||
// 格式转换 -->
|
||||
|
||||
@@ -423,6 +467,42 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
|
||||
if(convertList.size() > 0) {
|
||||
auditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(643)) { // 劫持文件
|
||||
List<ProxyFileHijackCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : auditList) {
|
||||
ProxyFileHijackCfg cfg = (ProxyFileHijackCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileHijack(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
auditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(644)) { // 劫持文件
|
||||
List<ProxyFileInsertScriptCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : auditList) {
|
||||
ProxyFileInsertScriptCfg cfg = (ProxyFileInsertScriptCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileInsertScript(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
auditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(645)) { // 流量转发目的地址
|
||||
List<ProxyFileTrafficMirrorCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : auditList) {
|
||||
ProxyFileTrafficMirrorCfg cfg = (ProxyFileTrafficMirrorCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileTrafficMirror(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
auditList = convertList;
|
||||
}
|
||||
}else if(entity.getServiceId().equals(608)) { // 文件策略
|
||||
List<ProxyFileStrategyCfgAudit> convertList = Lists.newArrayList();
|
||||
for (Object object : notAuditList) {
|
||||
ProxyFileStrategyCfg cfg = (ProxyFileStrategyCfg)object;
|
||||
convertList.add(BaseService.convertCallBackProxyFileStrategy(cfg));
|
||||
}
|
||||
if(convertList.size() > 0) {
|
||||
notAuditList = convertList;
|
||||
}
|
||||
}
|
||||
// 格式转换 -->
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfgAudit;
|
||||
import com.nis.domain.callback.ProxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.ProxyFileHijackDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Maps;
|
||||
|
||||
@Service
|
||||
public class ProxyFileHijackService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
protected ProxyFileHijackDao proxyFileDao;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<ProxyFileHijackCfg> findPage(Page page, ProxyFileHijackCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
List<ProxyFileHijackCfg> list=proxyFileDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public ProxyFileHijackCfg getCfgById(Long cfgId) {
|
||||
return proxyFileDao.getCfgById(cfgId);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(ProxyFileHijackCfg entity){
|
||||
Date createTime=new Date();
|
||||
setAreaEffectiveIds(entity);
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
//新增
|
||||
if(StringUtil.isEmpty(entity.getCfgId())){
|
||||
entity.initDefaultValue();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
//调用服务接口获取compileId
|
||||
try {
|
||||
Integer compileId = ConfigServiceUtil.getId(1, 1).get(0);//获取编译id
|
||||
entity.setCompileId(compileId);
|
||||
} catch (Exception e) {
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
proxyFileDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
|
||||
proxyFileDao.update(entity);
|
||||
}
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void update(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
ProxyFileHijackCfg entity = new ProxyFileHijackCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
proxyFileDao.update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id){
|
||||
Date auditTime = new Date();
|
||||
ProxyFileHijackCfg cfg=new ProxyFileHijackCfg();
|
||||
cfg.setCfgId(Long.valueOf(id));
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setIsAudit(isAudit);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
proxyFileDao.update(cfg);
|
||||
cfg=proxyFileDao.getCfgById(cfg.getCfgId());
|
||||
String json="";
|
||||
if(cfg.getIsAudit()==1){
|
||||
List<ProxyFileHijackCfgAudit> list = new ArrayList<ProxyFileHijackCfgAudit>();
|
||||
ProxyFileHijackCfgAudit listConvert=convertCallBackProxyFileHijack(cfg);
|
||||
list.add(listConvert);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(list);
|
||||
logger.info("劫持文件配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
//ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
/*if(result!=null){
|
||||
logger.info("劫持文件配置下发响应信息:"+result.getMsg());
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
logger.error("劫持文件配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else if(cfg.getIsAudit()==3){
|
||||
List<ProxyFileHijackCfgAudit> list = new ArrayList<ProxyFileHijackCfgAudit>();
|
||||
ProxyFileHijackCfgAudit listConvert = convertCallBackProxyFileHijack(cfg);
|
||||
list.add(listConvert);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(list);
|
||||
logger.info("劫持文件配置配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
/*ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("劫持文件配置响应信息:"+result.getMsg());*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("劫持文件置配置失败");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<ProxyFileHijackCfg> findByList(String ids) {
|
||||
List<ProxyFileHijackCfg> list=proxyFileDao.findByList(ids);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfgAudit;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfgAudit;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.ProxyFileInsertScriptDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@Service
|
||||
public class ProxyFileInsertScriptService extends BaseService{
|
||||
|
||||
|
||||
@Autowired
|
||||
protected ProxyFileInsertScriptDao proxyFileDao;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<ProxyFileInsertScriptCfg> findPage(Page page, ProxyFileInsertScriptCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
List<ProxyFileInsertScriptCfg> list = proxyFileDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public ProxyFileInsertScriptCfg getCfgById(Long cfgId) {
|
||||
return proxyFileDao.getCfgById(cfgId);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(ProxyFileInsertScriptCfg entity){
|
||||
Date createTime=new Date();
|
||||
setAreaEffectiveIds(entity);
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
//新增
|
||||
if(StringUtil.isEmpty(entity.getCfgId())){
|
||||
entity.initDefaultValue();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
//调用服务接口获取compileId
|
||||
try {
|
||||
Integer compileId = ConfigServiceUtil.getId(1, 1).get(0);//获取编译id
|
||||
entity.setCompileId(compileId);
|
||||
} catch (Exception e) {
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
proxyFileDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
|
||||
proxyFileDao.update(entity);
|
||||
}
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id){
|
||||
Date auditTime = new Date();
|
||||
ProxyFileInsertScriptCfg cfg=new ProxyFileInsertScriptCfg();
|
||||
cfg.setCfgId(Long.valueOf(id));
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setIsAudit(isAudit);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
proxyFileDao.update(cfg);
|
||||
cfg=proxyFileDao.getCfgById(cfg.getCfgId());
|
||||
String json="";
|
||||
if(cfg.getIsAudit()==1){
|
||||
List<ProxyFileInsertScriptCfgAudit> list = new ArrayList<ProxyFileInsertScriptCfgAudit>();
|
||||
ProxyFileInsertScriptCfgAudit listConvert=convertCallBackProxyFileInsertScript(cfg);
|
||||
list.add(listConvert);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(list);
|
||||
logger.info("注入脚本文件配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("注入脚本文件配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("注入脚本文件配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else if(cfg.getIsAudit()==3){
|
||||
List<ProxyFileInsertScriptCfgAudit> list = new ArrayList<ProxyFileInsertScriptCfgAudit>();
|
||||
ProxyFileInsertScriptCfgAudit listConvert = convertCallBackProxyFileInsertScript(cfg);
|
||||
list.add(listConvert);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(list);
|
||||
logger.info("注入脚本文件配置配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("注入脚本文件配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("注入脚本文件配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<ProxyFileInsertScriptCfg> findByList(String ids) {
|
||||
List<ProxyFileInsertScriptCfg> list=proxyFileDao.findByList(ids);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
ProxyFileInsertScriptCfg entity = new ProxyFileInsertScriptCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
proxyFileDao.update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,8 +12,10 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfgAudit;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.ProxyFileStrategyDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
@@ -49,7 +51,13 @@ public class ProxyFileStrategyService extends BaseService{
|
||||
public void saveOrUpdate(ProxyFileStrategyCfg entity){
|
||||
Date createTime=new Date();
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
setAreaEffectiveIds(entity);
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
//新增
|
||||
if(entity.getCfgId()==null){
|
||||
Integer compileId = ConfigServiceUtil.getId(1, 1).get(0);//获取编译id
|
||||
@@ -67,6 +75,11 @@ public class ProxyFileStrategyService extends BaseService{
|
||||
entity.setEditTime(editTime);
|
||||
proxyFileDao.update(entity);//更新
|
||||
}
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
@@ -96,7 +109,9 @@ public class ProxyFileStrategyService extends BaseService{
|
||||
entity.setAuditTime(auditTime);
|
||||
proxyFileDao.update(entity);
|
||||
if(isAudit == 1) {//审核通过,下发配置回调配置信息
|
||||
Map<String,Object> params = Maps.newHashMap();
|
||||
List<ProxyFileStrategyCfgAudit> convertList = Lists.newArrayList();
|
||||
convertList.add(BaseService.convertCallBackProxyFileStrategy(entity));
|
||||
/*Map<String,Object> params = Maps.newHashMap();
|
||||
params.put("fileId", entity.getCompileId());//文件ID
|
||||
params.put("service", entity.getServiceId());//业务ID
|
||||
params.put("fileDesc", entity.getFileDesc());//文件描述
|
||||
@@ -106,20 +121,22 @@ public class ProxyFileStrategyService extends BaseService{
|
||||
params.put("isValid", 1);//有效标志,有效
|
||||
params.put("opTime", new Date());
|
||||
List list = Lists.newArrayList();
|
||||
list.add(params);
|
||||
String json = gsonToJson(list);
|
||||
list.add(params);*/
|
||||
String json = gsonToJson(convertList);
|
||||
logger.debug("params:" + json);
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
logger.debug("响应:"+gsonToJson(result));
|
||||
}else if(isAudit == 3) {//取消审核通过,将回调配置信息置为无效
|
||||
Map<String,Object> params = Maps.newHashMap();
|
||||
List<ProxyFileStrategyCfgAudit> convertList = Lists.newArrayList();
|
||||
convertList.add(BaseService.convertCallBackProxyFileStrategy(entity));
|
||||
/*Map<String,Object> params = Maps.newHashMap();
|
||||
params.put("fileId", entity.getCompileId());//文件ID
|
||||
params.put("service", entity.getServiceId());//业务ID
|
||||
params.put("isValid", 0);//有效标志,无效
|
||||
params.put("opTime", new Date());
|
||||
List list = Lists.newArrayList();
|
||||
list.add(params);
|
||||
String json = gsonToJson(list);
|
||||
list.add(params);*/
|
||||
String json = gsonToJson(convertList);
|
||||
logger.debug("params:" + json);
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,2);
|
||||
logger.debug("响应:"+gsonToJson(result));
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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.callback.ProxyFileTrafficMirrorCfg;
|
||||
import com.nis.domain.callback.ProxyFileTrafficMirrorCfgAudit;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.ProxyFileTrafficMirrorDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@Service
|
||||
public class ProxyFileTrafficMirrorService extends BaseService{
|
||||
@Autowired
|
||||
protected ProxyFileTrafficMirrorDao proxyFileDao;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<ProxyFileTrafficMirrorCfg> findPage(Page page, ProxyFileTrafficMirrorCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
List<ProxyFileTrafficMirrorCfg> list = proxyFileDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public ProxyFileTrafficMirrorCfg getCfgById(Long cfgId) {
|
||||
return proxyFileDao.getCfgById(cfgId);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(ProxyFileTrafficMirrorCfg entity){
|
||||
Date createTime=new Date();
|
||||
setAreaEffectiveIds(entity);
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
//新增
|
||||
if(StringUtil.isEmpty(entity.getCfgId())){
|
||||
entity.initDefaultValue();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
//调用服务接口获取compileId
|
||||
try {
|
||||
Integer compileId = ConfigServiceUtil.getId(1, 1).get(0);//获取编译id
|
||||
entity.setCompileId(compileId);
|
||||
} catch (Exception e) {
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
proxyFileDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
|
||||
proxyFileDao.update(entity);
|
||||
}
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id){
|
||||
Date auditTime = new Date();
|
||||
ProxyFileTrafficMirrorCfg cfg=new ProxyFileTrafficMirrorCfg();
|
||||
cfg.setCfgId(Long.valueOf(id));
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setIsAudit(isAudit);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
proxyFileDao.update(cfg);
|
||||
cfg=proxyFileDao.getCfgById(cfg.getCfgId());
|
||||
String json="";
|
||||
if(cfg.getIsAudit()==1){
|
||||
List<ProxyFileTrafficMirrorCfgAudit> list = new ArrayList<ProxyFileTrafficMirrorCfgAudit>();
|
||||
ProxyFileTrafficMirrorCfgAudit listConvert=convertCallBackProxyFileTrafficMirror(cfg);
|
||||
list.add(listConvert);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(list);
|
||||
logger.info("流量镜像文件配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("流量镜像文件配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("流量镜像文件配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else if(cfg.getIsAudit()==3){
|
||||
List<ProxyFileTrafficMirrorCfgAudit> list = new ArrayList<ProxyFileTrafficMirrorCfgAudit>();
|
||||
ProxyFileTrafficMirrorCfgAudit listConvert = convertCallBackProxyFileTrafficMirror(cfg);
|
||||
list.add(listConvert);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(list);
|
||||
logger.info("流量镜像文件配置配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("流量镜像文件配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("流量镜像文件配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<ProxyFileTrafficMirrorCfg> findByList(String ids) {
|
||||
List<ProxyFileTrafficMirrorCfg> list=proxyFileDao.findByList(ids);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
ProxyFileTrafficMirrorCfg entity = new ProxyFileTrafficMirrorCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
proxyFileDao.update(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user