添加摘要类域配置
This commit is contained in:
@@ -93,6 +93,9 @@ public class ConfigCompile implements Serializable {
|
|||||||
@ApiModelProperty(value = "数值域分组列表", required = true)
|
@ApiModelProperty(value = "数值域分组列表", required = true)
|
||||||
private List<NumRegion> numRegionList;
|
private List<NumRegion> numRegionList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "摘要域分组列表", required = true)
|
||||||
|
private List<DigestRegion> digestRegionList;
|
||||||
|
|
||||||
@ApiModelProperty(value="版本序列号", required=true)
|
@ApiModelProperty(value="版本序列号", required=true)
|
||||||
private Long procSeq;
|
private Long procSeq;
|
||||||
|
|
||||||
@@ -417,6 +420,14 @@ public class ConfigCompile implements Serializable {
|
|||||||
public void setNumRegionList(List<NumRegion> numRegionList) {
|
public void setNumRegionList(List<NumRegion> numRegionList) {
|
||||||
this.numRegionList = numRegionList;
|
this.numRegionList = numRegionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DigestRegion> getDigestRegionList() {
|
||||||
|
return digestRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDigestRegionList(List<DigestRegion> digestRegionList) {
|
||||||
|
this.digestRegionList = digestRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getTaskId() {
|
public Integer getTaskId() {
|
||||||
return taskId;
|
return taskId;
|
||||||
|
|||||||
75
src/main/java/com/nis/domain/restful/DigestRegion.java
Normal file
75
src/main/java/com/nis/domain/restful/DigestRegion.java
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package com.nis.domain.restful;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class DigestRegion implements Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long regionId;
|
||||||
|
private Long groupId;
|
||||||
|
private String tableName;
|
||||||
|
private Long rawLen;
|
||||||
|
private String digest;
|
||||||
|
private Integer cfdsLevel;
|
||||||
|
private int isValid ;
|
||||||
|
private Date opTime = new Date();
|
||||||
|
public Long getRegionId() {
|
||||||
|
return regionId;
|
||||||
|
}
|
||||||
|
public void setRegionId(Long regionId) {
|
||||||
|
this.regionId = regionId;
|
||||||
|
}
|
||||||
|
public Long getGroupId() {
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
public void setGroupId(Long groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
public String getTableName() {
|
||||||
|
return tableName;
|
||||||
|
}
|
||||||
|
public void setTableName(String tableName) {
|
||||||
|
this.tableName = tableName;
|
||||||
|
}
|
||||||
|
public Long getRawLen() {
|
||||||
|
return rawLen;
|
||||||
|
}
|
||||||
|
public void setRawLen(Long rawLen) {
|
||||||
|
this.rawLen = rawLen;
|
||||||
|
}
|
||||||
|
public String getDigest() {
|
||||||
|
return digest;
|
||||||
|
}
|
||||||
|
public void setDigest(String digest) {
|
||||||
|
this.digest = digest;
|
||||||
|
}
|
||||||
|
public Integer getCfdsLevel() {
|
||||||
|
return cfdsLevel;
|
||||||
|
}
|
||||||
|
public void setCfdsLevel(Integer cfdsLevel) {
|
||||||
|
this.cfdsLevel = cfdsLevel;
|
||||||
|
}
|
||||||
|
public int getIsValid() {
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
public void setIsValid(int isValid) {
|
||||||
|
this.isValid = isValid;
|
||||||
|
}
|
||||||
|
public Date getOpTime() {
|
||||||
|
return opTime;
|
||||||
|
}
|
||||||
|
public void setOpTime(Date opTime) {
|
||||||
|
this.opTime = opTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,9 +4,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.nis.domain.restful.ConfigCompile;
|
import com.nis.domain.restful.ConfigCompile;
|
||||||
import com.nis.domain.restful.ConfigGroupRelation;
|
import com.nis.domain.restful.ConfigGroupRelation;
|
||||||
import com.nis.domain.restful.DataDictionaryValue;
|
import com.nis.domain.restful.DataDictionaryValue;
|
||||||
|
import com.nis.domain.restful.DigestRegion;
|
||||||
import com.nis.domain.restful.IpRegion;
|
import com.nis.domain.restful.IpRegion;
|
||||||
import com.nis.domain.restful.NumRegion;
|
import com.nis.domain.restful.NumRegion;
|
||||||
import com.nis.domain.restful.StrRegion;
|
import com.nis.domain.restful.StrRegion;
|
||||||
@@ -303,22 +305,49 @@ public class CompileVal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<DigestRegion> digestRegionList = configCompile.getDigestRegionList();
|
||||||
|
|
||||||
// if (regionGroupIdList.size() > 0 && groupList.size() > 0 && groupList.size() != regionGroupIdList.size()) {
|
//不判断是否为空
|
||||||
// for (Long groupId : groupList) {
|
|
||||||
// if (!regionGroupIdList.contains(groupId)) {
|
//验证
|
||||||
// return "配置id为" + configCompile.getCompileId() + "的配置中配置分组groupid为" + groupId + "的配置在域配置中未被使用";
|
if (digestRegionList != null && digestRegionList.size() > 0) {
|
||||||
// }
|
for (DigestRegion digestRegion : digestRegionList) {
|
||||||
// }
|
|
||||||
//
|
//不验证表名和业务类型是否对应
|
||||||
// for (Long groupId : regionGroupIdList) {
|
|
||||||
// if (!groupList.contains(groupId)) {
|
|
||||||
// return "配置id为" + configCompile.getCompileId() + "的配置中域配置中的groupid为" + groupId + "的域配置在配置分组关系中不存在";
|
if (!isUpdate && digestRegion.getIsValid() != 1) {
|
||||||
// }
|
return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为"
|
||||||
// }
|
+ digestRegion.getRegionId() + "的域配置在添加时不能为无效";
|
||||||
//
|
}
|
||||||
// }
|
if (isUpdate && digestRegion.getIsValid() != 0) {
|
||||||
|
return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为"
|
||||||
|
+ digestRegion.getRegionId() + "的域配置在修改时不能为有效";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupList.size() > 0 && !groupList.contains(digestRegion.getGroupId())) {
|
||||||
|
return "配置id为" + configCompile.getCompileId() + "的配置中digestRegion中的regionid为"
|
||||||
|
+ digestRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在";
|
||||||
|
}
|
||||||
|
if (!regionGroupIdList.contains(digestRegion.getGroupId())) {
|
||||||
|
regionGroupIdList.add(digestRegion.getGroupId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isUpdate && Constants.BASE_VALIDATE) {
|
||||||
|
String valDigestRegion = valDigestRegion(digestRegion, compileId);
|
||||||
|
if (!valDigestRegion.equals("ok")) {
|
||||||
|
return valDigestRegion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isUpdate && Constants.SERVICE_VALIDATE) {
|
||||||
|
String serviceDigestRegionVal = serviceDigestRegionVal(digestRegion, compileId);
|
||||||
|
if (!serviceDigestRegionVal.equals("ok")) {
|
||||||
|
return serviceDigestRegionVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return CompileJudgeCode.CompileGroupSizeGtZero.getErrorReason();
|
return CompileJudgeCode.CompileGroupSizeGtZero.getErrorReason();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,6 +578,26 @@ public class CompileVal {
|
|||||||
}
|
}
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String valDigestRegion(DigestRegion digestRegion, Long compileId) {
|
||||||
|
Long regionId = digestRegion.getRegionId();
|
||||||
|
if (null == regionId) {
|
||||||
|
return "id为" + compileId + "的编译配置中的摘要类域配置的regionId不能为空";
|
||||||
|
}
|
||||||
|
if (null == digestRegion.getGroupId()) {
|
||||||
|
return "id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置groupId不能为空";
|
||||||
|
}
|
||||||
|
if (null == digestRegion.getRawLen()) {
|
||||||
|
return "id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置rawLen不能为空";
|
||||||
|
}
|
||||||
|
if (null == digestRegion.getDigest() || digestRegion.getDigest().equals("")) {
|
||||||
|
return "id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置digest不能为空";
|
||||||
|
}
|
||||||
|
if (null == digestRegion.getCfdsLevel()) {
|
||||||
|
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置cfdsLevel不能为空";
|
||||||
|
}
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
|
||||||
public static String serviceIpRegionVal(IpRegion ipRegion, Long compileId) {
|
public static String serviceIpRegionVal(IpRegion ipRegion, Long compileId) {
|
||||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), ipRegion.getAddrType())) {
|
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), ipRegion.getAddrType())) {
|
||||||
@@ -685,6 +734,17 @@ public class CompileVal {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String serviceDigestRegionVal(DigestRegion digestRegion, Long compileId) {
|
||||||
|
|
||||||
|
Integer cfdsLevel = digestRegion.getCfdsLevel();
|
||||||
|
if (!(cfdsLevel>=1&&cfdsLevel<=10)) {
|
||||||
|
return "编译配置id为" + compileId + "的配置中digestRegionList中regionId为" + digestRegion.getRegionId()
|
||||||
|
+ "的域配置cfdsLevel的值只能是1到10";
|
||||||
|
}
|
||||||
|
return "ok";
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 禁配词业务校验
|
* 禁配词业务校验
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.nis.domain.Page;
|
|||||||
import com.nis.domain.restful.ConfigCompile;
|
import com.nis.domain.restful.ConfigCompile;
|
||||||
import com.nis.domain.restful.ConfigCompileTest;
|
import com.nis.domain.restful.ConfigCompileTest;
|
||||||
import com.nis.domain.restful.ConfigGroupRelation;
|
import com.nis.domain.restful.ConfigGroupRelation;
|
||||||
|
import com.nis.domain.restful.DigestRegion;
|
||||||
import com.nis.domain.restful.IpRegion;
|
import com.nis.domain.restful.IpRegion;
|
||||||
import com.nis.domain.restful.NumRegion;
|
import com.nis.domain.restful.NumRegion;
|
||||||
import com.nis.domain.restful.StrRegion;
|
import com.nis.domain.restful.StrRegion;
|
||||||
@@ -84,15 +85,20 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
typeMap.put("HID_CONTENT", "ip");
|
typeMap.put("HID_CONTENT", "ip");
|
||||||
typeMap.put("GSB_PZ_IP", "ip");
|
typeMap.put("GSB_PZ_IP", "ip");
|
||||||
typeMap.put("FAKE_REGION_EXTEND", "str");
|
typeMap.put("FAKE_REGION_EXTEND", "str");
|
||||||
|
typeMap.put("CTRL_URL_REGION", "str");
|
||||||
|
typeMap.put("CTRL_VOIP_BLACKACCOUNT_REGION", "str");
|
||||||
|
typeMap.put("CTRL_MEDIA_FILE_FP", "digest");
|
||||||
tableMap.put(0, typeMap);
|
tableMap.put(0, typeMap);
|
||||||
|
|
||||||
typeMap = new HashMap<String, String>();
|
typeMap = new HashMap<String, String>();
|
||||||
typeMap.put("DF_IP_PORT", "ip");
|
typeMap.put("DF_IP_PORT", "ip");
|
||||||
|
typeMap.put("GSB_PZ_IP", "ip");//IP复用
|
||||||
tableMap.put(1, typeMap);
|
tableMap.put(1, typeMap);
|
||||||
|
|
||||||
typeMap = new HashMap<String, String>();
|
typeMap = new HashMap<String, String>();
|
||||||
typeMap.put("FX_IP_PORT", "ip");
|
typeMap.put("FX_IP_PORT", "ip");
|
||||||
typeMap.put("UNIVERSAL_PROTO_TYPE", "num");
|
typeMap.put("UNIVERSAL_PROTO_TYPE", "num");
|
||||||
|
typeMap.put("GSB_PZ_IP", "ip");//网站伪造
|
||||||
tableMap.put(2, typeMap);
|
tableMap.put(2, typeMap);
|
||||||
|
|
||||||
typeMap = new HashMap<String, String>();
|
typeMap = new HashMap<String, String>();
|
||||||
@@ -100,12 +106,14 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
typeMap.put("UNIVERSAL_IP", "ip");
|
typeMap.put("UNIVERSAL_IP", "ip");
|
||||||
typeMap.put("DF_HTTP_REQ_HDR", "str");
|
typeMap.put("DF_HTTP_REQ_HDR", "str");
|
||||||
typeMap.put("DF_HTTP_URL", "str");
|
typeMap.put("DF_HTTP_URL", "str");
|
||||||
|
typeMap.put("GSB_PZ_IP", "ip");//内容篡改
|
||||||
tableMap.put(3, typeMap);
|
tableMap.put(3, typeMap);
|
||||||
|
|
||||||
typeMap = new HashMap<String, String>();
|
typeMap = new HashMap<String, String>();
|
||||||
typeMap.put("UNIVERSAL_PROTO_TYPE", "num");
|
typeMap.put("UNIVERSAL_PROTO_TYPE", "num");
|
||||||
typeMap.put("UNIVERSAL_IP", "ip");
|
typeMap.put("UNIVERSAL_IP", "ip");
|
||||||
typeMap.put("DF_HTTP_RES_HDR", "str");
|
typeMap.put("DF_HTTP_RES_HDR", "str");
|
||||||
|
typeMap.put("GSB_PZ_IP", "ip");//随机丢包
|
||||||
tableMap.put(4, typeMap);
|
tableMap.put(4, typeMap);
|
||||||
|
|
||||||
typeMap = new HashMap<String, String>();
|
typeMap = new HashMap<String, String>();
|
||||||
@@ -1033,7 +1041,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
Map<String, List<StrRegion>> strStongRegionMap = new HashMap<String, List<StrRegion>>();
|
Map<String, List<StrRegion>> strStongRegionMap = new HashMap<String, List<StrRegion>>();
|
||||||
Map<String, List<IpRegion>> ipRegionMap = new HashMap<String, List<IpRegion>>();
|
Map<String, List<IpRegion>> ipRegionMap = new HashMap<String, List<IpRegion>>();
|
||||||
Map<String, List<NumRegion>> numRegionMap = new HashMap<String, List<NumRegion>>();
|
Map<String, List<NumRegion>> numRegionMap = new HashMap<String, List<NumRegion>>();
|
||||||
|
Map<String, List<DigestRegion>> digestRegionMap = new HashMap<String, List<DigestRegion>>();
|
||||||
for (ConfigCompile configCompile : configCompileList) {
|
for (ConfigCompile configCompile : configCompileList) {
|
||||||
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
||||||
if (msg != CompileJudgeCode.CompileIsOk.getErrorReason()) {
|
if (msg != CompileJudgeCode.CompileIsOk.getErrorReason()) {
|
||||||
@@ -1130,6 +1138,26 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null != configCompile.getDigestRegionList() && configCompile.getDigestRegionList().size() > 0) {
|
||||||
|
for (DigestRegion digestRegion : configCompile.getDigestRegionList()) {
|
||||||
|
if (digestRegion.getRegionId() == null) {
|
||||||
|
String errorMsg = "摘要类域配置id不能为空 ,表名---" + digestRegion.getTableName() + "" + sb.toString();
|
||||||
|
logger1.error(errorMsg);
|
||||||
|
thread.setExceptionInfo(errorMsg);
|
||||||
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, errorMsg,
|
||||||
|
RestBusinessCode.missing_args.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (digestRegionMap.containsKey(digestRegion.getTableName())) {
|
||||||
|
digestRegionMap.get(digestRegion.getTableName()).add(digestRegion);
|
||||||
|
} else {
|
||||||
|
List<DigestRegion> digestRegionList = new ArrayList<DigestRegion>();
|
||||||
|
digestRegionList.add(digestRegion);
|
||||||
|
digestRegionMap.put(digestRegion.getTableName(), digestRegionList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Configurations.getStringProperty("isCommit", "false").equals("true")) {
|
if (Configurations.getStringProperty("isCommit", "false").equals("true")) {
|
||||||
@@ -1152,6 +1180,10 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (null != numRegionMap && numRegionMap.size() > 0) {
|
if (null != numRegionMap && numRegionMap.size() > 0) {
|
||||||
count += numRegionMap.size();
|
count += numRegionMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null != digestRegionMap && digestRegionMap.size() > 0) {
|
||||||
|
count += digestRegionMap.size();
|
||||||
|
}
|
||||||
|
|
||||||
SqlSessionFactory sqlSessionFactory = SpringContextHolder.getBean(SqlSessionFactory.class);
|
SqlSessionFactory sqlSessionFactory = SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||||
Connection conn = sqlSessionFactory.openSession().getConnection();
|
Connection conn = sqlSessionFactory.openSession().getConnection();
|
||||||
@@ -1208,6 +1240,16 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (digestRegionMap.size() > 0) {
|
||||||
|
for (String digest : digestRegionMap.keySet()) {
|
||||||
|
SaveCompileByJDBCThread digestRegion = new SaveCompileByJDBCThread(digest, conn, latch, start);
|
||||||
|
digestRegion.setDigestRegionList(digestRegionMap.get(digest));
|
||||||
|
Thread digestThread = new Thread(digestRegion);
|
||||||
|
digestThread.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
latch.await();
|
latch.await();
|
||||||
if (msgList.size() > 0) {
|
if (msgList.size() > 0) {
|
||||||
@@ -1574,6 +1616,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
Map<String, List<StrRegion>> strRegionMap = new HashMap<String, List<StrRegion>>();
|
Map<String, List<StrRegion>> strRegionMap = new HashMap<String, List<StrRegion>>();
|
||||||
Map<String, List<IpRegion>> ipRegionMap = new HashMap<String, List<IpRegion>>();
|
Map<String, List<IpRegion>> ipRegionMap = new HashMap<String, List<IpRegion>>();
|
||||||
Map<String, List<NumRegion>> numRegionMap = new HashMap<String, List<NumRegion>>();
|
Map<String, List<NumRegion>> numRegionMap = new HashMap<String, List<NumRegion>>();
|
||||||
|
Map<String, List<DigestRegion>> digestRegionMap = new HashMap<String, List<DigestRegion>>();
|
||||||
if (null != compileList && compileList.size() > 0) {
|
if (null != compileList && compileList.size() > 0) {
|
||||||
for (ConfigCompile config : compileList) {
|
for (ConfigCompile config : compileList) {
|
||||||
String msg = CompileVal.compileIsOk(config, true, sb);
|
String msg = CompileVal.compileIsOk(config, true, sb);
|
||||||
@@ -1637,6 +1680,21 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<DigestRegion> digestRegionList = config.getDigestRegionList();// 获取编译下所有摘要类域配置(要修改的数据
|
||||||
|
if (null != digestRegionList && digestRegionList.size() > 0) {
|
||||||
|
for (DigestRegion digestRegion : digestRegionList) {
|
||||||
|
if (digestRegion.getIsValid() == 0) {
|
||||||
|
if (digestRegionMap.containsKey(digestRegion.getTableName())) {
|
||||||
|
digestRegionMap.get(digestRegion.getTableName()).add(digestRegion);
|
||||||
|
} else {
|
||||||
|
List<DigestRegion> digestList = new ArrayList<DigestRegion>();
|
||||||
|
digestList.add(digestRegion);
|
||||||
|
digestRegionMap.put(digestRegion.getTableName(), digestList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
compileAllList.add(config);
|
compileAllList.add(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1707,7 +1765,15 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
numThread.start();
|
numThread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (null != digestRegionMap && digestRegionMap.size() > 0) {
|
||||||
|
for (String num : digestRegionMap.keySet()) {
|
||||||
|
UpdateCompileByJDBCThread digestRegion = new UpdateCompileByJDBCThread(num, conn, latch, start,
|
||||||
|
opTime);
|
||||||
|
digestRegion.setDigestRegionList(digestRegionMap.get(num));
|
||||||
|
Thread digestThread = new Thread(digestRegion);
|
||||||
|
digestThread.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
latch.await();
|
latch.await();
|
||||||
if (msgList.size() > 0) {
|
if (msgList.size() > 0) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.nis.web.service.restful;
|
package com.nis.web.service.restful;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@@ -12,11 +11,11 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.nis.domain.restful.ConfigCompile;
|
import com.nis.domain.restful.ConfigCompile;
|
||||||
import com.nis.domain.restful.ConfigGroupRelation;
|
import com.nis.domain.restful.ConfigGroupRelation;
|
||||||
|
import com.nis.domain.restful.DigestRegion;
|
||||||
import com.nis.domain.restful.IpRegion;
|
import com.nis.domain.restful.IpRegion;
|
||||||
import com.nis.domain.restful.NumRegion;
|
import com.nis.domain.restful.NumRegion;
|
||||||
import com.nis.domain.restful.StrRegion;
|
import com.nis.domain.restful.StrRegion;
|
||||||
import com.nis.util.Configurations;
|
import com.nis.util.Configurations;
|
||||||
import com.thoughtworks.xstream.core.util.Fields;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jdbc测试批量插入
|
* jdbc测试批量插入
|
||||||
@@ -36,7 +35,7 @@ public class SaveCompileByJDBCThread implements Runnable {
|
|||||||
private List<IpRegion> ipRegionList;
|
private List<IpRegion> ipRegionList;
|
||||||
private List<NumRegion> numRegionList;
|
private List<NumRegion> numRegionList;
|
||||||
private List<StrRegion> strRegionList;
|
private List<StrRegion> strRegionList;
|
||||||
|
private List<DigestRegion> digestRegionList;
|
||||||
|
|
||||||
private Method method = null;
|
private Method method = null;
|
||||||
public SaveCompileByJDBCThread() {
|
public SaveCompileByJDBCThread() {
|
||||||
@@ -147,6 +146,14 @@ public class SaveCompileByJDBCThread implements Runnable {
|
|||||||
public void setStrRegionList(List<StrRegion> strRegionList) {
|
public void setStrRegionList(List<StrRegion> strRegionList) {
|
||||||
this.strRegionList = strRegionList;
|
this.strRegionList = strRegionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DigestRegion> getDigestRegionList() {
|
||||||
|
return digestRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDigestRegionList(List<DigestRegion> digestRegionList) {
|
||||||
|
this.digestRegionList = digestRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
public static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
public static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
||||||
java.sql.Timestamp sqlDate = null;
|
java.sql.Timestamp sqlDate = null;
|
||||||
@@ -524,6 +531,25 @@ public class SaveCompileByJDBCThread implements Runnable {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void saveDigestRegion(String name, List<DigestRegion> digestRegionList, Connection conn,
|
||||||
|
List<Exception> msgList) {
|
||||||
|
if (null != digestRegionList && digestRegionList.size() > 0) {
|
||||||
|
try {
|
||||||
|
String fieldName = Configurations.getStringProperty("digestRegionFieldName", "REGION_ID");
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName));
|
||||||
|
for (DigestRegion numRegion : digestRegionList) {
|
||||||
|
setPsParams(fieldName.split(","),ps,numRegion);
|
||||||
|
ps.addBatch();
|
||||||
|
}
|
||||||
|
ps.executeBatch();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e);
|
||||||
|
msgList.add(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @Description:根据表名和字段名称构建sql
|
* @Description:根据表名和字段名称构建sql
|
||||||
@@ -625,6 +651,8 @@ public class SaveCompileByJDBCThread implements Runnable {
|
|||||||
}
|
}
|
||||||
} else if (null != numRegionList && numRegionList.size() > 0) {
|
} else if (null != numRegionList && numRegionList.size() > 0) {
|
||||||
saveNumRegion(tableName, numRegionList, conn, msgList);
|
saveNumRegion(tableName, numRegionList, conn, msgList);
|
||||||
|
} else if (null != digestRegionList && digestRegionList.size() > 0) {
|
||||||
|
saveDigestRegion(tableName, digestRegionList, conn, msgList);
|
||||||
}
|
}
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
System.out.println("latchCount=======================" + latch.getCount());
|
System.out.println("latchCount=======================" + latch.getCount());
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.nis.domain.restful.ConfigCompile;
|
import com.nis.domain.restful.ConfigCompile;
|
||||||
import com.nis.domain.restful.ConfigGroupRelation;
|
import com.nis.domain.restful.ConfigGroupRelation;
|
||||||
|
import com.nis.domain.restful.DigestRegion;
|
||||||
import com.nis.domain.restful.IpRegion;
|
import com.nis.domain.restful.IpRegion;
|
||||||
import com.nis.domain.restful.NumRegion;
|
import com.nis.domain.restful.NumRegion;
|
||||||
import com.nis.domain.restful.StrRegion;
|
import com.nis.domain.restful.StrRegion;
|
||||||
@@ -33,6 +34,7 @@ public class UpdateCompileByJDBCThread implements Runnable {
|
|||||||
private List<IpRegion> ipRegionList;
|
private List<IpRegion> ipRegionList;
|
||||||
private List<NumRegion> numRegionList;
|
private List<NumRegion> numRegionList;
|
||||||
private List<StrRegion> strRegionList;
|
private List<StrRegion> strRegionList;
|
||||||
|
private List<DigestRegion> digestRegionList;
|
||||||
private Date opTime;
|
private Date opTime;
|
||||||
|
|
||||||
public UpdateCompileByJDBCThread() {
|
public UpdateCompileByJDBCThread() {
|
||||||
@@ -136,6 +138,14 @@ public class UpdateCompileByJDBCThread implements Runnable {
|
|||||||
this.strRegionList = strRegionList;
|
this.strRegionList = strRegionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DigestRegion> getDigestRegionList() {
|
||||||
|
return digestRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDigestRegionList(List<DigestRegion> digestRegionList) {
|
||||||
|
this.digestRegionList = digestRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
public synchronized static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
||||||
java.sql.Timestamp sqlDate = null;
|
java.sql.Timestamp sqlDate = null;
|
||||||
long t = udate.getTime();
|
long t = udate.getTime();
|
||||||
@@ -390,6 +400,55 @@ public class UpdateCompileByJDBCThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateDigestRegion(String name, List<DigestRegion> digestRegionList, Connection conn, Date opTime,
|
||||||
|
List<Exception> msgList) {
|
||||||
|
if (null != digestRegionList && digestRegionList.size() > 0) {
|
||||||
|
try {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID");
|
||||||
|
String condition = Configurations.getStringProperty("regionId", "REGION_ID");
|
||||||
|
sb.append("update ");
|
||||||
|
sb.append(name);
|
||||||
|
sb.append(" set ");
|
||||||
|
|
||||||
|
String fieldNameObj [] = fieldName.split(",");
|
||||||
|
//加上where条件的参数名称
|
||||||
|
String newParamsStr = fieldName+","+condition;
|
||||||
|
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||||
|
sb.append(fieldNameObj[i]+"=?");
|
||||||
|
if (i+1<fieldNameObj.length) {
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//是否包含更新时间字段 值为数据库当前时间
|
||||||
|
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||||
|
sb.append(", LAST_UPDATE= sysdate");
|
||||||
|
}
|
||||||
|
// + "where GROUP_ID=? and COMPILE_ID=? ");
|
||||||
|
sb.append(" where ");
|
||||||
|
String [] condObjs = condition.split(",");
|
||||||
|
for (int i = 0; i < condObjs.length; i++) {
|
||||||
|
sb.append(condObjs[i]+"=?");
|
||||||
|
if (i+1<condObjs.length) {
|
||||||
|
sb.append(" and ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||||
|
for (DigestRegion digestRegion : digestRegionList) {
|
||||||
|
setPsParams(newParamsStr.split(","), ps, digestRegion);
|
||||||
|
ps.addBatch();
|
||||||
|
}
|
||||||
|
ps.executeBatch();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e);
|
||||||
|
msgList.add(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @Description: 向PreparedStatement设置参数
|
* @Description: 向PreparedStatement设置参数
|
||||||
* @author (zdx)
|
* @author (zdx)
|
||||||
@@ -488,6 +547,8 @@ public class UpdateCompileByJDBCThread implements Runnable {
|
|||||||
updateStrRegion(tableName, strRegionList, conn, opTime, msgList);
|
updateStrRegion(tableName, strRegionList, conn, opTime, msgList);
|
||||||
} else if (null != numRegionList && numRegionList.size() > 0) {
|
} else if (null != numRegionList && numRegionList.size() > 0) {
|
||||||
updateNumRegion(tableName, numRegionList, conn, opTime, msgList);
|
updateNumRegion(tableName, numRegionList, conn, opTime, msgList);
|
||||||
|
} else if (null != digestRegionList && digestRegionList.size() > 0) {
|
||||||
|
updateDigestRegion(tableName, digestRegionList, conn, opTime, msgList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((null !=compileList && compileList.size() > 0)&&(null != groupList && groupList.size()==0)){
|
if((null !=compileList && compileList.size() > 0)&&(null != groupList && groupList.size()==0)){
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ jdbc.product.driver=oracle.jdbc.driver.OracleDriver
|
|||||||
#jdbc.product.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
#jdbc.product.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||||
jdbc.product.url=jdbc:oracle:thin:@10.0.6.165:1521:orcl
|
jdbc.product.url=jdbc:oracle:thin:@10.0.6.165:1521:orcl
|
||||||
#jdbc.product.url=jdbc:oracle:thin:@10.174.196.20:1521:orcl
|
#jdbc.product.url=jdbc:oracle:thin:@10.174.196.20:1521:orcl
|
||||||
jdbc.product.username=dfxj_2015
|
jdbc.product.username=kaz_maat
|
||||||
|
#jdbc.product.username=dfxj_2015
|
||||||
#jdbc.product.username=gk_pz
|
#jdbc.product.username=gk_pz
|
||||||
#jdbc.product.username=z2_5x9pz
|
#jdbc.product.username=z2_5x9pz
|
||||||
jdbc.product.key=3X3ZBejyxS7lkVsHVm9KTw==
|
jdbc.product.key=3X3ZBejyxS7lkVsHVm9KTw==
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#编译表表名
|
#编译表表名
|
||||||
compileTabName=MATT_CONFIG_COMPILE_WY
|
compileTabName=MATT_CONFIG_COMPILE
|
||||||
#编译表 新增配置时添加的字段 英文逗号分隔
|
#编译表 新增配置时添加的字段 英文逗号分隔
|
||||||
compileFieldName=COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME
|
compileFieldName=COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME
|
||||||
#编译表 配置状态更新的条件
|
#编译表 配置状态更新的条件
|
||||||
compileUpdateCondition=COMPILE_ID
|
compileUpdateCondition=COMPILE_ID
|
||||||
|
|
||||||
#分组表表名
|
#分组表表名
|
||||||
groupTabName=MAAT_CONFIG_GROUP_WY
|
groupTabName=MAAT_CONFIG_GROUP
|
||||||
#分组表 新增配置时添加的字段 英文逗号分隔
|
#分组表 新增配置时添加的字段 英文逗号分隔
|
||||||
#注意:第一个字段必需是分组表主键
|
#注意:第一个字段必需是分组表主键
|
||||||
groupFieldName=ID,GROUP_ID, COMPILE_ID, IS_VALID, OP_TIME
|
groupFieldName=ID,GROUP_ID, COMPILE_ID, IS_VALID, OP_TIME
|
||||||
@@ -30,6 +30,9 @@ ipRegionFieldName=REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT,
|
|||||||
#数值域表 新增配置时添加字段 英文逗号分隔
|
#数值域表 新增配置时添加字段 英文逗号分隔
|
||||||
numRegionFieldName = REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME
|
numRegionFieldName = REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME
|
||||||
|
|
||||||
|
#摘要域表 新增配置时添加字段 英文逗号分隔
|
||||||
|
digestRegionFieldName = REGION_ID,GROUP_ID,RAW_LEN,DIGEST,CFDS_LEVEL,IS_VALID,OP_TIME
|
||||||
|
|
||||||
#是否包含LAST_UPDATE字段 (状态更新中使用)
|
#是否包含LAST_UPDATE字段 (状态更新中使用)
|
||||||
hasLastUpdate=true
|
hasLastUpdate=true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user