Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group

This commit is contained in:
李皓宸
2019-04-24 18:09:19 +08:00
8 changed files with 249 additions and 262 deletions

View File

@@ -69,6 +69,7 @@ public class ScheduleStatusJob implements Job{
try {
scheduleService.issueCompileInfo(cfg, isValid?1:0);
} catch (Exception e) {
e.printStackTrace();
log.error("定时任务"+cfg.getId()+"执行失败",e);
}finally {
log.debug(String.format("任务执行完成compileId:%s,isValid:%s",compileId,isValid ));

View File

@@ -395,31 +395,45 @@ public class ConfigConvertUtil {
*/
public static List<IpCfg> ipConvert(IpCfg dstIp, BaseIpCfg srcIp) {
List<IpCfg> ipConvertList = Lists.newArrayList();
boolean isRange = (((srcIp.getSrcIpPattern() != null && srcIp.getSrcIpPattern() == 2)||(srcIp.getDestIpPattern()) != null && srcIp.getDestIpPattern() == 2)
|| (srcIp.getSrcIpAddress() != null && srcIp.getSrcIpAddress().indexOf("-") > -1)
|| (srcIp.getDestIpAddress() != null && srcIp.getDestIpAddress().indexOf("-") > -1));
if (isRange) {
List<IpCfg> tempList = Lists.newArrayList();
List<IpCfg> tempList1 = Lists.newArrayList();
if (srcIp.getIpType().intValue() == 4) {
if (srcIp.getSrcIpAddress() != null) {
String startIpPart = srcIp.getSrcIpAddress().split("-")[0];
String endIpPart = srcIp.getSrcIpAddress().split("-")[1];
Integer startNum = Integer.parseInt(startIpPart.split("\\.")[3]);
Integer endNum = Integer.parseInt(endIpPart.split("\\.")[3]);
for (int i = startNum; i <= endNum; i++) {
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(dstIp, tempIp);
tempIp.setSrcIp(startIpPart.substring(0, startIpPart.lastIndexOf(".") + 1) + i);
tempIp.setSrcIpMask("255.255.255.255");
tempList.add(tempIp);
List<IpCfg> tempList = Lists.newArrayList();
List<IpCfg> tempList1 = Lists.newArrayList();
if (srcIp.getIpType().equals(4)) {// IP V4
if(srcIp.getSrcIpPattern().equals(2)) {//源IP范围
if (srcIp.getSrcIpAddress() != null) {
String startIpPart = srcIp.getSrcIpAddress().split("-")[0];
String endIpPart = srcIp.getSrcIpAddress().split("-")[1];
Integer startNum = Integer.parseInt(startIpPart.split("\\.")[3]);
Integer endNum = Integer.parseInt(endIpPart.split("\\.")[3]);
for (int i = startNum; i <= endNum; i++) {
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(dstIp, tempIp);
tempIp.setSrcIp(startIpPart.substring(0, startIpPart.lastIndexOf(".") + 1) + i);
tempIp.setSrcIpMask("255.255.255.255");
tempList.add(tempIp);
}
}else {
dstIp.setSrcIp("0.0.0.0");
dstIp.setSrcIpMask("255.255.255.255");
tempList.add(dstIp);
}
}else if(srcIp.getSrcIpPattern().equals(1)){
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
if (srcMaskNum == 0) {
dstIp.setSrcIpMask("0.0.0.0");
} else {
dstIp.setSrcIp("0.0.0.0");
dstIp.setSrcIpMask("255.255.255.255");
tempList.add(dstIp);
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
}
if (srcIp.getDestIpAddress() != null) {
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
tempList.add(dstIp);
}else if(srcIp.getSrcIpPattern().equals(3)){
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
tempList.add(dstIp);
}else {
throw new RuntimeException("Unsupported IP Pattern " + srcIp.getSrcIpPattern());
}
if (srcIp.getDestIpAddress() != null) {
if(srcIp.getDestIpPattern().equals(2)) {
String startIpPart = srcIp.getDestIpAddress().split("-")[0];
String endIpPart = srcIp.getDestIpAddress().split("-")[1];
Integer startNum = Integer.parseInt(startIpPart.split("\\.")[3]);
@@ -439,217 +453,93 @@ public class ConfigConvertUtil {
}
}
tempList.clear();
} else {
}else if(srcIp.getDestIpPattern().equals(1)) {
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
for (IpCfg _cfg : tempList) {
_cfg.setDstIp("0.0.0.0");
_cfg.setSrcIpMask("255.255.255.255");
convertPortValues(_cfg, srcIp);
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(_cfg, tempIp);
if (dstMaskNum == 0) {
tempIp.setDstIpMask("0.0.0.0");
} else {
tempIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
}
tempIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
if (!tempIp.getSrcIp().equals(tempIp.getDstIp())) {
// 处理
convertPortValues(tempIp, srcIp);
tempList1.add(tempIp);
}
}
tempList.clear();
}else {
for (IpCfg _cfg : tempList) {
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(_cfg, tempIp);
tempIp.setDstIp(srcIp.getDestIpAddress());
if (!tempIp.getSrcIp().equals(tempIp.getDstIp())) {
tempIp.setDstIpMask("255.255.255.255");
// 处理
convertPortValues(tempIp, srcIp);
tempList1.add(tempIp);
}
}
tempList.clear();
}
if (tempList1.size() > 0) {
ipConvertList.addAll(tempList1);
} else {
ipConvertList.addAll(tempList);
}else {
for (IpCfg _cfg : tempList) {
_cfg.setDstIp("0.0.0.0");
_cfg.setSrcIpMask("255.255.255.255");
convertPortValues(_cfg, srcIp);
}
} else if (srcIp.getIpType().intValue() == 6) {
if (srcIp.getSrcIpAddress() != null) {
}
if (tempList1.size() > 0) {
ipConvertList.addAll(tempList1);
} else {
ipConvertList.addAll(tempList);
}
}else if(srcIp.getIpType().equals(6)){// IP V6
if (srcIp.getSrcIpAddress() != null) {
if(srcIp.getSrcIpPattern().equals(2)) {
IPv6Address address1 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[0]);
IPv6Address address2 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[1]);
IPv6Network network = IPv6Network.fromTwoAddresses(address1, address2);
dstIp.setSrcIp(address1.toString());
dstIp.setSrcIpMask(network.getNetmask().asAddress().toString());
} else {
dstIp.setSrcIp("::");
}else if(srcIp.getSrcIpPattern().equals(1)){// IP/掩码
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {// IP
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if (srcIp.getDestIpAddress() != null) {
} else {
dstIp.setSrcIp("::");
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if (srcIp.getDestIpAddress() != null) {
if(srcIp.getDestIpPattern().equals(2)) {
IPv6Address address1 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[0]);
IPv6Address address2 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[1]);
IPv6Network network = IPv6Network.fromTwoAddresses(address1, address2);
dstIp.setDstIp(address1.toString());
dstIp.setDstIpMask(network.getNetmask().asAddress().toString());
} else {
dstIp.setDstIp("::");
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
ipConvertList.add(dstIp);
} else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
} else {
if (srcIp.getSrcIpAddress() != null) {
if (srcIp.getSrcIpAddress().indexOf("/") != -1) {
if (srcIp.getIpType() == 4 /* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
if (srcMaskNum == 0) {
dstIp.setSrcIpMask("0.0.0.0");
} else {
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
}
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
} /*
* else { Pattern
* patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern
* patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher
* matchernV4Subnet=patternV4Subnet.matcher(srcIp.getSrcIpAddress()); Matcher
* matcherV6Subnet=patternV6Subnet.matcher(srcIp.getSrcIpAddress());
* if(matchernV4Subnet.matches()) { Integer srcMaskNum =
* Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]); if(srcMaskNum==0){
* dstIp.setSrcIpMask("0.0.0.0"); }else{
* dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum)); }
* dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]); }else
* if(matcherV6Subnet.matches()){ IPv6Network strangeNetwork =
* IPv6Network.fromString(srcIp.getSrcIpAddress());
* dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
* dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString()); }else
* { throw new RuntimeException("Invalid IP/subnet mask format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
* Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher
* matcherV4=patternV4.matcher(srcIp.getSrcIpAddress()); Matcher
* matcherV6=patternV6.matcher(srcIp.getSrcIpAddress()); if(matcherV4.matches())
* { dstIp.setSrcIp(srcIp.getSrcIpAddress());
* dstIp.setSrcIpMask("255.255.255.255"); }else if(matcherV6.matches()) {
* dstIp.setSrcIp(srcIp.getSrcIpAddress());
* dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); }else { throw
* new RuntimeException("Invalid IP format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all dstIp.setSrcIp(srcIp.getSrcIpAddress());
* dstIp.setSrcIpMask("255.255.255.255"); }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
if (srcIp.getDestIpAddress() != null) {
if (srcIp.getDestIpAddress().indexOf("/") != -1) {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
if (dstMaskNum == 0) {
dstIp.setDstIpMask("0.0.0.0");
} else {
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
;
}
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
} /*
* else { Pattern
* patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern
* patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher
* matchernV4Subnet=patternV4Subnet.matcher(srcIp.getDestIpAddress()); Matcher
* matcherV6Subnet=patternV6Subnet.matcher(srcIp.getDestIpAddress());
* if(matchernV4Subnet.matches()) { Integer dstMaskNum =
* Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]); if(dstMaskNum==0){
* dstIp.setDstIpMask("0.0.0.0"); }else{
* dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));; }
* dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]); }else
* if(matcherV6Subnet.matches()){ IPv6Network strangeNetwork =
* IPv6Network.fromString(srcIp.getDestIpAddress());
* dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
* dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString()); }else
* { throw new RuntimeException("Invalid IP/subnet mask format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
* Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher
* matcherV4=patternV4.matcher(srcIp.getDestIpAddress()); Matcher
* matcherV6=patternV6.matcher(srcIp.getDestIpAddress());
* if(matcherV4.matches()) { dstIp.setDstIp(srcIp.getDestIpAddress());
* dstIp.setDstIpMask("255.255.255.255"); }else if(matcherV6.matches()) {
* dstIp.setDstIp(srcIp.getDestIpAddress());
* dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); }else { throw
* new RuntimeException("invalid ip format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
}else if(srcIp.getDestIpPattern().equals(1)) {// IP/掩码
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {// IP
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all dstIp.setDstIp(srcIp.getDestIpAddress());
* dstIp.setDstIpMask("255.255.255.255"); }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
if (srcIp.getSrcPort() != null) {
if (srcIp.getSrcPort().indexOf("/") != -1) {
String srcMaskNum = srcIp.getSrcPort().split("/")[1];
dstIp.setSrcPortMask(srcMaskNum);
dstIp.setSrcPort(srcIp.getSrcPort().split("/")[0]);
} else {
dstIp.setSrcPort(srcIp.getSrcPort());
dstIp.setSrcPortMask("65535");
}
} else {
dstIp.setSrcPort("0");
dstIp.setSrcPortMask("65535");
}
if (srcIp.getDestPort() != null) {
if (srcIp.getDestPort().indexOf("/") != -1) {
String dstMaskNum = srcIp.getDestPort().split("/")[1];
dstIp.setDstPortMask(dstMaskNum);
dstIp.setDstPort(srcIp.getDestPort().split("/")[0]);
} else {
dstIp.setDstPort(srcIp.getDestPort());
dstIp.setDstPortMask("65535");
}
} else {
dstIp.setDstPort("0");
dstIp.setDstPortMask("65535");
dstIp.setDstIp("::");
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
convertPortValues(dstIp, srcIp);
ipConvertList.add(dstIp);
}else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
return ipConvertList;
}

View File

@@ -3296,7 +3296,7 @@ public class BaseController {
//批量审核通过时如果没有携带isValid检索条件返回界面需要将isValid置为null
if(!StringUtil.isEmpty(entity)) {
BaseCfg base=(BaseCfg)entity ;
if(!StringUtil.isEmpty(base.getSeltype()) && base.getSeltype().equals("isValid")) {
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
BeanUtils.copyProperties(base, entity);
}
@@ -3818,15 +3818,16 @@ public class BaseController {
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
//auditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId())); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
//notAuditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId())); // 移至下发前处理
notAuditList.add(cfg);
}
}
@@ -3883,14 +3884,16 @@ public class BaseController {
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.add(BaseService.convertCallBackProxyObjKeyring(cfg));
//auditList.add(BaseService.convertCallBackProxyObjKeyring(cfg)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.add(BaseService.convertCallBackProxyObjKeyring(cfg));
//notAuditList.add(BaseService.convertCallBackProxyObjKeyring(cfg)); // 移至下发前处理
notAuditList.add(cfg);
}
}
}else if(className.equals("PxyObjTrustedCaCert")){
@@ -3903,14 +3906,16 @@ public class BaseController {
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null));
//auditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null));
//notAuditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null)); // 移至下发前处理
notAuditList.add(cfg);
}
}
if(!StringUtil.isEmpty(ids)) {
@@ -3923,14 +3928,16 @@ public class BaseController {
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg));
//auditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg));
//notAuditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg)); // 移至下发前处理
notAuditList.add(cfg);
}
}
}
@@ -3952,14 +3959,16 @@ public class BaseController {
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.add(BaseService.convertCallBackDnsResStrategy(cfg));
//auditList.add(BaseService.convertCallBackDnsResStrategy(cfg)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.add(BaseService.convertCallBackDnsResStrategy(cfg));
//notAuditList.add(BaseService.convertCallBackDnsResStrategy(cfg)); // 移至下发前处理
notAuditList.add(cfg);
}
}
}else if(className.equals("DnsIpCfg")){
@@ -3972,14 +3981,16 @@ public class BaseController {
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId()));
//auditList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId())); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId()));
//notAuditList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId()));
notAuditList.add(cfg);
}
}
}else if(className.equals("IpPortCfg")){

View File

@@ -132,10 +132,10 @@ public class WhiteListController extends CommonController {
ipCfgService.auditIpCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.info("ip配置下发失败" + e.getMessage());
logger.error("ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.info("ip配置下发失败" + e.getMessage());
logger.error("ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
}
}

View File

@@ -1,44 +1,25 @@
package com.nis.web.service.configuration;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import com.nis.domain.Page;
import com.nis.domain.basics.AsnGroupInfo;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.callback.InlineIp;
import com.nis.domain.callback.NtcDnsResStrategy;
import com.nis.domain.callback.ProxyObjKeyring;
import com.nis.domain.callback.ProxyObjTrustedCa;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.CommonStringCfg;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DnsIpCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.FileDigestCfg;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjTrustedCaCert;
@@ -46,24 +27,15 @@ import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.maat.GroupReuseAddBean;
import com.nis.domain.maat.GroupReuseCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.MaatCfg.DigestCfg;
import com.nis.domain.maat.MaatCfg.GroupCfg;
import com.nis.domain.maat.MaatCfg.IpCfg;
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
import com.nis.domain.maat.MaatCfg.StringCfg;
import com.nis.domain.maat.ToMaatBean;
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.DateUtils;
import com.nis.util.FileUtils;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.CommonPolicyDao;
import com.nis.web.dao.configuration.ConfigSynchronizationDao;
import com.nis.web.dao.configuration.PxyObjSpoofingIpPoolDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.dao.configuration.WebsiteCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
@@ -315,7 +287,8 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
long start=System.currentTimeMillis();
long end=System.currentTimeMillis();
if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) {
commonPolicyDao.auditCfgBatch( "cfg_index_info", entity,compileIds,null);
commonPolicyDao.auditCfgBatch("cfg_index_info", entity,compileIds,null);
commonPolicyDao.auditCfgBatch("ip_port_cfg", entity,compileIds,null);
if(entity.getIsAudit()!=1) {
//更新各配置定时任务信息
handelScheduleCfg(auditList, entity.getTableName(),entity);
@@ -337,6 +310,60 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
}
if(entity.getIsAudit()==1){
// 格式转换 -->
if(entity.getServiceId().equals(3)){ // IP Address Drop
List<InlineIp> convertList = Lists.newArrayList();
for (Object object : notAuditList) {
IpPortCfg cfg = (IpPortCfg)object;
convertList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
}
if(convertList.size() > 0) {
notAuditList = convertList;
}
}else if(entity.getServiceId().equals(65)) { // DNS响应策略
List<NtcDnsResStrategy> convertList = Lists.newArrayList();
for (Object object : notAuditList) {
DnsResStrategy cfg = (DnsResStrategy)object;
convertList.add(BaseService.convertCallBackDnsResStrategy(cfg));
}
if(convertList.size() > 0) {
notAuditList = convertList;
}
}else if(entity.getServiceId().equals(64)) { // DNS欺骗IP
List<InlineIp> convertList = Lists.newArrayList();
for (Object object : notAuditList) {
DnsIpCfg cfg = (DnsIpCfg)object;
convertList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId()));
}
if(convertList.size() > 0) {
notAuditList = convertList;
}
}else if(entity.getServiceId().equals(520)) { // 证书管理
List<ProxyObjKeyring> convertList = Lists.newArrayList();
for (Object object : notAuditList) {
PxyObjKeyring cfg = (PxyObjKeyring)object;
convertList.add(BaseService.convertCallBackProxyObjKeyring(cfg));
}
if(convertList.size() > 0) {
notAuditList = convertList;
}
}else if(entity.getFunctionId().equals(571)) { // 可信证书颁发机构+证书吊销列表
List<ProxyObjTrustedCa> convertList = Lists.newArrayList();
for (Object object : notAuditList) {
if(object instanceof PxyObjTrustedCaCert) {
PxyObjTrustedCaCert cfg = (PxyObjTrustedCaCert)object;
convertList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null));
}else if(object instanceof PxyObjTrustedCaCrl) {
PxyObjTrustedCaCrl cfg = (PxyObjTrustedCaCrl)object;
convertList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg));
}
}
if(convertList.size() > 0) {
notAuditList = convertList;
}
}
// 格式转换 -->
//调用服务接口下发配置数据
String json=gsonToJson(notAuditList);
//logger.warn("批量下发配置参数:"+json);
@@ -345,6 +372,60 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
logger.warn("批量下发响应信息:"+result.getMsg());
}else if(entity.getIsAudit()==3){
// 格式转换 -->
if(entity.getServiceId().equals(3)){ // IP Address Drop
List<InlineIp> convertList = Lists.newArrayList();
for (Object object : auditList) {
IpPortCfg cfg = (IpPortCfg)object;
convertList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
}
if(convertList.size() > 0) {
auditList = convertList;
}
}else if(entity.getServiceId().equals(65)) { // DNS响应策略
List<NtcDnsResStrategy> convertList = Lists.newArrayList();
for (Object object : auditList) {
DnsResStrategy cfg = (DnsResStrategy)object;
convertList.add(BaseService.convertCallBackDnsResStrategy(cfg));
}
if(convertList.size() > 0) {
auditList = convertList;
}
}else if(entity.getServiceId().equals(64)) { // DNS欺骗IP
List<InlineIp> convertList = Lists.newArrayList();
for (Object object : auditList) {
DnsIpCfg cfg = (DnsIpCfg)object;
convertList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId()));
}
if(convertList.size() > 0) {
auditList = convertList;
}
}else if(entity.getServiceId().equals(520)) { // 证书管理
List<ProxyObjKeyring> convertList = Lists.newArrayList();
for (Object object : auditList) {
PxyObjKeyring cfg = (PxyObjKeyring)object;
convertList.add(BaseService.convertCallBackProxyObjKeyring(cfg));
}
if(convertList.size() > 0) {
auditList = convertList;
}
}else if(entity.getFunctionId().equals(571)) { // 可信证书颁发机构+证书吊销列表
List<ProxyObjTrustedCa> convertList = Lists.newArrayList();
for (Object object : auditList) {
if(object instanceof PxyObjTrustedCaCert) {
PxyObjTrustedCaCert cfg = (PxyObjTrustedCaCert)object;
convertList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null));
}else if(object instanceof PxyObjTrustedCaCrl) {
PxyObjTrustedCaCrl cfg = (PxyObjTrustedCaCrl)object;
convertList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg));
}
}
if(convertList.size() > 0) {
auditList = convertList;
}
}
// 格式转换 -->
//调用服务接口取消配置
String json=gsonToJson(auditList);
//logger.warn("批量下发配置参数:"+json);

View File

@@ -252,7 +252,7 @@ maxlength_128=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0435 \u0431\u04
maxlength_256=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 256 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432!
maxlength_512=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 512 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432!
maxlength_4000=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 4000 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432!
ok=OK
ok=\u0414\u0430
clear=\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c
close=\u0417\u0430\u043a\u0440\u044b\u0442\u044c
reselect=\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435

View File

@@ -471,7 +471,7 @@ function doAll(checkboxes,url){
if(v=="ok"){
if(url.indexOf("?")>0){
if(url.indexOf("isValid") < 0){
if(url.indexOf("exType") > 0){
url = url+"&ids="+ids+"&compileIds="+compileIds;
exportXmlRequest(url);
}else{

View File

@@ -181,6 +181,10 @@
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
} */
if($(".boxSolid:visible").length==0){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
//代表所有区域都隐藏了,提示必须增加个区域信息
if($("input[name='isAreaEffective']:checked").val()==1 && $(".container-fluid:visible").size()==0){
if($("#areaIsp").hasClass("hidden")) $("#areaIp").find(".glyphicon-plus").click();