From eb49689c551b032783152e38dcb8af751416311c Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Fri, 10 Aug 2018 15:14:12 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=B1=BB=E5=92=8C=E6=96=B9=E6=B3=95=EF=BC=9B=202=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E4=B8=80=E7=9B=B4=E5=BE=80=E4=B8=8A=E6=8A=9B?= =?UTF-8?q?=E5=9C=A8controller=E9=87=8C=E8=AE=B0=E5=BD=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=B9=B6=E8=BF=94=E5=9B=9E=E7=BB=99=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=EF=BC=9B=203=E3=80=81=E5=9B=9E=E8=B0=83=E7=B1=BB?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=B0=E5=A2=9E=E6=97=B6isValid=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E4=B8=BA1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nis/domain/DfJitLogEntity.java | 179 - .../java/com/nis/domain/DfReportEntity.java | 149 - .../java/com/nis/domain/StatLogEntity.java | 203 -- .../nis/domain/restful/ConfigCompileTest.java | 82 - .../restful/ConfigGroupRelationTest.java | 10 - .../nis/domain/restful/ConfigSourceTest.java | 25 - .../java/com/nis/domain/restful/DmbCk.java | 121 - .../com/nis/domain/restful/DmbCkSource.java | 120 - .../java/com/nis/domain/restful/DmbPort.java | 168 - .../com/nis/domain/restful/DmbPortSource.java | 121 - .../com/nis/domain/restful/DnsFakeInfo.java | 227 -- .../nis/domain/restful/DnsFakeInfoSource.java | 125 - .../com/nis/domain/restful/DnsFakeIp.java | 391 --- .../nis/domain/restful/DnsFakeIpSource.java | 125 - .../com/nis/domain/restful/DnsGroupType.java | 245 -- .../domain/restful/DnsGroupTypeSource.java | 124 - .../domain/restful/DnsResponseStrategy.java | 457 --- .../restful/DnsResponseStrategySource.java | 122 - .../domain/restful/EncryptProtoRandom.java | 97 - .../restful/EncryptProtoRandomSource.java | 128 - .../domain/restful/FakeIpConfigCompile.java | 182 -- .../nis/domain/restful/FakeIpConfigGroup.java | 114 - .../java/com/nis/domain/restful/FwqInfo.java | 111 - .../com/nis/domain/restful/FwqInfoSource.java | 120 - .../com/nis/domain/restful/IpRegionTest.java | 25 - .../java/com/nis/domain/restful/JdjInfo.java | 131 - .../com/nis/domain/restful/JdjInfoSource.java | 120 - .../com/nis/domain/restful/NumRegionTest.java | 29 - .../com/nis/restful/RestBusinessCode.java | 50 +- src/main/java/com/nis/util/CompileVal.java | 749 ++--- .../restful/ConfigSourcesController.java | 325 +- .../controller/restful/DmbCkController.java | 223 -- .../controller/restful/DmbPortController.java | 223 -- .../restful/DnsFakeInfoController.java | 250 -- .../restful/DnsFakeIpController.java | 249 -- .../restful/DnsGroupTypeController.java | 249 -- .../DnsResponseStrategyController.java | 262 -- .../restful/EncryptProtoRandomController.java | 223 -- .../controller/restful/FwqInfoController.java | 223 -- .../restful/MaatTestController.java | 90 +- .../com/nis/web/dao/ConfigCompileDao.java | 114 - src/main/java/com/nis/web/dao/DmbCkDao.java | 17 - src/main/java/com/nis/web/dao/DmbCkDao.xml | 119 - src/main/java/com/nis/web/dao/DmbPortDao.java | 19 - src/main/java/com/nis/web/dao/DmbPortDao.xml | 176 - .../java/com/nis/web/dao/DnsFakeInfoDao.java | 25 - .../java/com/nis/web/dao/DnsFakeInfoDao.xml | 182 -- .../java/com/nis/web/dao/DnsFakeIpDao.java | 32 - .../java/com/nis/web/dao/DnsFakeIpDao.xml | 284 -- .../java/com/nis/web/dao/DnsGroupTypeDao.java | 34 - .../java/com/nis/web/dao/DnsGroupTypeDao.xml | 141 - .../nis/web/dao/DnsResponseStrategyDao.java | 36 - .../nis/web/dao/DnsResponseStrategyDao.xml | 377 --- .../nis/web/dao/EncryptProtoRandomDao.java | 9 - .../com/nis/web/dao/EncryptProtoRandomDao.xml | 112 - .../nis/web/dao/FakeIpConfigCompileDao.java | 25 - .../nis/web/dao/FakeIpConfigCompileDao.xml | 170 - .../com/nis/web/dao/FakeIpConfigGroupDao.java | 17 - .../com/nis/web/dao/FakeIpConfigGroupDao.xml | 51 - src/main/java/com/nis/web/dao/FwqInfoDao.java | 19 - src/main/java/com/nis/web/dao/FwqInfoDao.xml | 106 - .../java/com/nis/web/dao/IpRegionDao.java | 58 - src/main/java/com/nis/web/dao/IpRegionDao.xml | 221 -- src/main/java/com/nis/web/dao/JdjInfoDao.java | 19 - src/main/java/com/nis/web/dao/JdjInfoDao.xml | 135 - .../java/com/nis/web/dao/NumRegionDao.java | 62 - .../java/com/nis/web/dao/NumRegionDao.xml | 134 - .../com/nis/web/service/BaseLogService.java | 257 +- .../service/restful/ConfigSourcesService.java | 2896 ++--------------- .../nis/web/service/restful/DmbCkService.java | 53 - .../web/service/restful/DmbPortService.java | 53 - .../service/restful/DnsFakeInfoService.java | 99 - .../web/service/restful/DnsFakeIpService.java | 163 - .../service/restful/DnsGroupTypeService.java | 152 - .../restful/DnsResponseStrategyService.java | 218 -- .../restful/EncryptProtoRandomService.java | 53 - .../restful/FakeIpConfigCompileService.java | 30 - .../restful/FakeIpConfigGroupService.java | 30 - .../web/service/restful/FwqInfoService.java | 53 - .../web/service/restful/JdjInfoService.java | 53 - .../restful/SaveCompileByJDBCThread.java | 665 ---- .../restful/UpdateCompileByJDBCThread.java | 570 ---- .../applicationConfig-parser.xml | 12 +- 83 files changed, 627 insertions(+), 14591 deletions(-) delete mode 100644 src/main/java/com/nis/domain/DfJitLogEntity.java delete mode 100644 src/main/java/com/nis/domain/DfReportEntity.java delete mode 100644 src/main/java/com/nis/domain/StatLogEntity.java delete mode 100644 src/main/java/com/nis/domain/restful/ConfigCompileTest.java delete mode 100644 src/main/java/com/nis/domain/restful/ConfigGroupRelationTest.java delete mode 100644 src/main/java/com/nis/domain/restful/ConfigSourceTest.java delete mode 100644 src/main/java/com/nis/domain/restful/DmbCk.java delete mode 100644 src/main/java/com/nis/domain/restful/DmbCkSource.java delete mode 100644 src/main/java/com/nis/domain/restful/DmbPort.java delete mode 100644 src/main/java/com/nis/domain/restful/DmbPortSource.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsFakeInfo.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsFakeInfoSource.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsFakeIp.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsFakeIpSource.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsGroupType.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsGroupTypeSource.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsResponseStrategy.java delete mode 100644 src/main/java/com/nis/domain/restful/DnsResponseStrategySource.java delete mode 100644 src/main/java/com/nis/domain/restful/EncryptProtoRandom.java delete mode 100644 src/main/java/com/nis/domain/restful/EncryptProtoRandomSource.java delete mode 100644 src/main/java/com/nis/domain/restful/FakeIpConfigCompile.java delete mode 100644 src/main/java/com/nis/domain/restful/FakeIpConfigGroup.java delete mode 100644 src/main/java/com/nis/domain/restful/FwqInfo.java delete mode 100644 src/main/java/com/nis/domain/restful/FwqInfoSource.java delete mode 100644 src/main/java/com/nis/domain/restful/IpRegionTest.java delete mode 100644 src/main/java/com/nis/domain/restful/JdjInfo.java delete mode 100644 src/main/java/com/nis/domain/restful/JdjInfoSource.java delete mode 100644 src/main/java/com/nis/domain/restful/NumRegionTest.java delete mode 100644 src/main/java/com/nis/web/controller/restful/DmbCkController.java delete mode 100644 src/main/java/com/nis/web/controller/restful/DmbPortController.java delete mode 100644 src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java delete mode 100644 src/main/java/com/nis/web/controller/restful/DnsFakeIpController.java delete mode 100644 src/main/java/com/nis/web/controller/restful/DnsGroupTypeController.java delete mode 100644 src/main/java/com/nis/web/controller/restful/DnsResponseStrategyController.java delete mode 100644 src/main/java/com/nis/web/controller/restful/EncryptProtoRandomController.java delete mode 100644 src/main/java/com/nis/web/controller/restful/FwqInfoController.java delete mode 100644 src/main/java/com/nis/web/dao/ConfigCompileDao.java delete mode 100644 src/main/java/com/nis/web/dao/DmbCkDao.java delete mode 100644 src/main/java/com/nis/web/dao/DmbCkDao.xml delete mode 100644 src/main/java/com/nis/web/dao/DmbPortDao.java delete mode 100644 src/main/java/com/nis/web/dao/DmbPortDao.xml delete mode 100644 src/main/java/com/nis/web/dao/DnsFakeInfoDao.java delete mode 100644 src/main/java/com/nis/web/dao/DnsFakeInfoDao.xml delete mode 100644 src/main/java/com/nis/web/dao/DnsFakeIpDao.java delete mode 100644 src/main/java/com/nis/web/dao/DnsFakeIpDao.xml delete mode 100644 src/main/java/com/nis/web/dao/DnsGroupTypeDao.java delete mode 100644 src/main/java/com/nis/web/dao/DnsGroupTypeDao.xml delete mode 100644 src/main/java/com/nis/web/dao/DnsResponseStrategyDao.java delete mode 100644 src/main/java/com/nis/web/dao/DnsResponseStrategyDao.xml delete mode 100644 src/main/java/com/nis/web/dao/EncryptProtoRandomDao.java delete mode 100644 src/main/java/com/nis/web/dao/EncryptProtoRandomDao.xml delete mode 100644 src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.java delete mode 100644 src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.xml delete mode 100644 src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.java delete mode 100644 src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.xml delete mode 100644 src/main/java/com/nis/web/dao/FwqInfoDao.java delete mode 100644 src/main/java/com/nis/web/dao/FwqInfoDao.xml delete mode 100644 src/main/java/com/nis/web/dao/IpRegionDao.java delete mode 100644 src/main/java/com/nis/web/dao/IpRegionDao.xml delete mode 100644 src/main/java/com/nis/web/dao/JdjInfoDao.java delete mode 100644 src/main/java/com/nis/web/dao/JdjInfoDao.xml delete mode 100644 src/main/java/com/nis/web/dao/NumRegionDao.java delete mode 100644 src/main/java/com/nis/web/dao/NumRegionDao.xml delete mode 100644 src/main/java/com/nis/web/service/restful/DmbCkService.java delete mode 100644 src/main/java/com/nis/web/service/restful/DmbPortService.java delete mode 100644 src/main/java/com/nis/web/service/restful/DnsFakeInfoService.java delete mode 100644 src/main/java/com/nis/web/service/restful/DnsFakeIpService.java delete mode 100644 src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java delete mode 100644 src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java delete mode 100644 src/main/java/com/nis/web/service/restful/EncryptProtoRandomService.java delete mode 100644 src/main/java/com/nis/web/service/restful/FakeIpConfigCompileService.java delete mode 100644 src/main/java/com/nis/web/service/restful/FakeIpConfigGroupService.java delete mode 100644 src/main/java/com/nis/web/service/restful/FwqInfoService.java delete mode 100644 src/main/java/com/nis/web/service/restful/JdjInfoService.java delete mode 100644 src/main/java/com/nis/web/service/restful/SaveCompileByJDBCThread.java delete mode 100644 src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java diff --git a/src/main/java/com/nis/domain/DfJitLogEntity.java b/src/main/java/com/nis/domain/DfJitLogEntity.java deleted file mode 100644 index 5d967c0..0000000 --- a/src/main/java/com/nis/domain/DfJitLogEntity.java +++ /dev/null @@ -1,179 +0,0 @@ -/** -* @Title: LogEntity.java -* @Package com.nis.domain -* @Description: TODO(用一句话描述该文件做什么) -* @author (darnell) -* @date 2016年9月1日 上午10:16:54 -* @version V1.0 -*/ -package com.nis.domain; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; -import javax.xml.bind.annotation.XmlTransient; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.google.common.collect.Maps; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; - -/** - * - * @ClassName: DfJitLogEntity - * @Description: TODO(实时统计公共实体部分) - * @author (rkg) - * @date 2016年9月13日下午2:54:12 - * @version V1.0 - */ -public abstract class DfJitLogEntity implements Serializable { - - @ApiModelProperty(value = "id", required = true) - protected Long statId; - @ApiModelProperty(value = "统计时间", required = true) - protected Date reportTime; - @ApiModelProperty(value = "ip所属国家", required = false) - protected String nation; - @ApiModelProperty(value = "ip所属省", required = false) - protected String province; - @ApiModelProperty(value = "ip所属市", required = false) - protected String city; - @ApiModelProperty(value = "日志数量", required = true) - protected Long sum; - @ApiModelProperty(value = "业务类型", required = true) - protected Integer service; - - /** - * 公共查询部分 - */ - protected String searchReportStartTime; - protected String searchReportEndTime; - protected String searchService; - - /** - * 当前实体分页对象 - */ - protected Page page; - - /** - * 自定义SQL(SQL标识,SQL内容) - */ - protected Map sqlMap; - - public DfJitLogEntity() { - super(); - } - - public Long getStatId() { - return statId; - } - - public void setStatId(Long statId) { - this.statId = statId; - } - - @JsonSerialize(using = JsonDateSerializer.class) - public Date getReportTime() { - return reportTime; - } - - public void setReportTime(Date reportTime) { - this.reportTime = reportTime; - } - - public String getNation() { - return nation; - } - - public void setNation(String nation) { - this.nation = nation; - } - - public String getProvince() { - return province; - } - - public void setProvince(String province) { - this.province = province; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - - public Long getSum() { - return sum; - } - - public void setSum(Long sum) { - this.sum = sum; - } - - public Integer getService() { - return service; - } - - public void setService(Integer service) { - this.service = service; - } - - @JsonIgnore - public String getSearchReportStartTime() { - return searchReportStartTime; - } - - public void setSearchReportStartTime(String searchReportStartTime) { - this.searchReportStartTime = searchReportStartTime; - } - - @JsonIgnore - public String getSearchReportEndTime() { - return searchReportEndTime; - } - - public void setSearchReportEndTime(String searchReportEndTime) { - this.searchReportEndTime = searchReportEndTime; - } - - - @JsonIgnore - public String getSearchService() { - return searchService; - } - - public void setSearchService(String searchService) { - this.searchService = searchService; - } - - @JsonIgnore - @XmlTransient - public Page getPage() { - if (page == null) { - page = new Page(); - } - return page; - } - - public void setPage(Page page) { - this.page = page; - } - - @JsonIgnore - @XmlTransient - public Map getSqlMap() { - if (sqlMap == null) { - sqlMap = Maps.newHashMap(); - } - return sqlMap; - } - - public void setSqlMap(Map sqlMap) { - this.sqlMap = sqlMap; - } - -} diff --git a/src/main/java/com/nis/domain/DfReportEntity.java b/src/main/java/com/nis/domain/DfReportEntity.java deleted file mode 100644 index 8d85bb9..0000000 --- a/src/main/java/com/nis/domain/DfReportEntity.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.nis.domain; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; - -import javax.xml.bind.annotation.XmlTransient; - -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.google.common.collect.Maps; -import com.nis.domain.Page; -import com.nis.util.Configurations; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; - -public class DfReportEntity implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 2990823464993846973L; - @ApiModelProperty(value = "A系统", required = true) - protected Long asum; - @ApiModelProperty(value = "B系统", required = true) - protected Long bsum; - @ApiModelProperty(value = "C系统", required = true) - protected Long csum; - @ApiModelProperty(value = "统计时间", required = true) - protected Date reportTime; - - @ApiModelProperty(value = "全A+单B", required = true) - protected Long absum; - - public Long getAsum() { - return asum; - } - - public void setAsum(Long asum) { - this.asum = asum; - } - - public Long getBsum() { - return bsum; - } - - public void setBsum(Long bsum) { - this.bsum = bsum; - } - - @JsonSerialize(using = JsonDateSerializer.class) - public Date getReportTime() { - return reportTime; - } - - public void setReportTime(Date reportTime) { - this.reportTime = reportTime; - } - - protected String searchReportStartTime; - protected String searchReportEndTime; - - @JsonIgnore - public String getSearchReportStartTime() { - return searchReportStartTime; - } - - public void setSearchReportStartTime(String searchReportStartTime) { - this.searchReportStartTime = searchReportStartTime; - } - - @JsonIgnore - public String getSearchReportEndTime() { - return searchReportEndTime; - } - - public void setSearchReportEndTime(String searchReportEndTime) { - this.searchReportEndTime = searchReportEndTime; - } - - /** - * 当前实体分页对象 - */ - protected Page page; - - /** - * 自定义SQL(SQL标识,SQL内容) - */ - protected Map sqlMap; - - @JsonIgnore - @XmlTransient - public Page getPage() { - if (page == null) { - page = new Page(); - } - return page; - } - - public Page setPage(Page page) { - this.page = page; - return page; - } - - @JsonIgnore - @XmlTransient - public Map getSqlMap() { - if (sqlMap == null) { - sqlMap = Maps.newHashMap(); - } - return sqlMap; - } - - public void setSqlMap(Map sqlMap) { - this.sqlMap = sqlMap; - } - - /** - * 获取数据库名称 - */ - @JsonIgnore - public String getDbName() { - return Configurations.getStringProperty("jdbc.type", "mysql"); - } - - @Override - public String toString() { - return ReflectionToStringBuilder.toString(this); - } - - public Long getAbsum() { - return absum; - } - - public void setAbsum(Long absum) { - this.absum = absum; - } - - public Long getCsum() { - return csum; - } - - public void setCsum(Long csum) { - this.csum = csum; - } - -} diff --git a/src/main/java/com/nis/domain/StatLogEntity.java b/src/main/java/com/nis/domain/StatLogEntity.java deleted file mode 100644 index 56da282..0000000 --- a/src/main/java/com/nis/domain/StatLogEntity.java +++ /dev/null @@ -1,203 +0,0 @@ -/** -* @Title: StatLogEntity.java -* @Package com.nis.domain -* @Description: TODO(用一句话描述该文件做什么) -* @author (ddm) -* @date 2016年9月13日 上午10:49:01 -* @version V1.0 -*/ -package com.nis.domain; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; - -import javax.xml.bind.annotation.XmlTransient; - -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.google.common.collect.Maps; -import com.nis.util.Configurations; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; - -/** -* @ClassName: StatLogEntity -* @Description: TODO(日志报表公共实体部分) -* @author (ddm) -* @date 2016年9月1日 上午10:16:54 -* @version V1.0 -*/ -public abstract class StatLogEntity implements Serializable { - - /** - * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么) - */ - private static final long serialVersionUID = -5210683756718456730L; - - @ApiModelProperty(value="私有标签", required=true) - protected Integer service; - @ApiModelProperty(value="生效系统", required=true) - protected Integer activeSys; - @ApiModelProperty(value="A版总计", required=true) - protected Long asum; - @ApiModelProperty(value="B版总计", required=true) - protected Long bsum; - @ApiModelProperty(value="全A+单B数量", required=true) - protected Long absum; - @ApiModelProperty(value="统计时间", required=true) - protected Date statTime; - - protected String searchStatStartTime; - protected String searchStatEndTime; - protected String searchService; - protected String searchStatActiveSys; - - - @JsonSerialize(using=JsonDateSerializer.class) - public Date getStatTime() { - return statTime; - } - public void setStatTime(Date statTime) { - this.statTime = statTime; - } - - public Integer getActiveSys() { - return activeSys; - } - public void setActiveSys(Integer activeSys) { - this.activeSys = activeSys; - } - - public Integer getService() { - return service; - } - - - public void setService(Integer service) { - this.service = service; - } - - - public Long getAbsum() { - return absum; - } - public Long getBsum() { - return bsum; - } - public void setAbsum(Long absum) { - this.absum = absum; - } - public void setBsum(Long bsum) { - this.bsum = bsum; - } - public Long getAsum() { - return asum; - } - public void setAsum(Long asum) { - this.asum = asum; - } - - - @JsonIgnore - public String getSearchStatStartTime() { - return searchStatStartTime; - } - - - public void setSearchStatStartTime(String searchStatStartTime) { - this.searchStatStartTime = searchStatStartTime; - } - - @JsonIgnore - public String getSearchStatEndTime() { - return searchStatEndTime; - } - - - public void setSearchStatEndTime(String searchStatEndTime) { - this.searchStatEndTime = searchStatEndTime; - } - - @JsonIgnore - public String getSearchService() { - return searchService; - } - - - public void setSearchService(String searchService) { - this.searchService = searchService; - } - - @JsonIgnore - public String getSearchStatActiveSys() { - return searchStatActiveSys; - } - public void setSearchStatActiveSys(String searchStatActiveSys) { - this.searchStatActiveSys = searchStatActiveSys; - } - - /** - * 当前实体分页对象 - */ - protected Page page; - - /** - * 自定义SQL(SQL标识,SQL内容) - */ - protected Map sqlMap; - - /** - * @Title: - * @Description: TODO - * @param 入参 - */ - public StatLogEntity() { - super(); - } - - - @JsonIgnore - @XmlTransient - public Page getPage() { - if (page == null){ - page = new Page(); - } - return page; - } - - public Page setPage(Page page) { - this.page = page; - return page; - } - - @JsonIgnore - @XmlTransient - public Map getSqlMap() { - if (sqlMap == null){ - sqlMap = Maps.newHashMap(); - } - return sqlMap; - } - - public void setSqlMap(Map sqlMap) { - this.sqlMap = sqlMap; - } - - /** - * 获取数据库名称 - */ - @JsonIgnore - public String getDbName(){ - return Configurations.getStringProperty("jdbc.type", "mysql"); - } - - - @Override - public String toString() { - return ReflectionToStringBuilder.toString(this); - } - -} diff --git a/src/main/java/com/nis/domain/restful/ConfigCompileTest.java b/src/main/java/com/nis/domain/restful/ConfigCompileTest.java deleted file mode 100644 index 9966bc2..0000000 --- a/src/main/java/com/nis/domain/restful/ConfigCompileTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @Title: DfConfigCompile.java -* @Package com.nis.domain.restful -* @Description: TODO(用一句话描述该文件做什么) -* @author (darnell) -* @date 2016年8月29日 下午9:36:28 -* @version V1.0 -*/ -package com.nis.domain.restful; - -import com.nis.domain.Page; - -/** - * @ClassName: DfConfigCompile - * @Description: TODO(这里用一句话描述这个类的作用) - * @author (darnell) - * @date 2016年8月29日 下午9:36:28 - * @version V1.0 - */ -public class ConfigCompileTest extends ConfigCompile { - - /** - * - */ - private static final long serialVersionUID = 3662236229622771720L; - private Integer pagesNo; // 当前页码 - private Integer pagesSize;// 每页显示条数 - private Long pagesCount;// 总记录数,设置为“-1”表示不查询总数 - private Page page; - private String searchStartTime; - private String searchEndTime; - - public Integer getPagesNo() { - return pagesNo; - } - - public void setPagesNo(Integer pagesNo) { - this.pagesNo = pagesNo; - } - - public Integer getPagesSize() { - return pagesSize; - } - - public void setPagesSize(Integer pagesSize) { - this.pagesSize = pagesSize; - } - - public Long getPagesCount() { - return pagesCount; - } - - public void setPagesCount(Long pagesCount) { - this.pagesCount = pagesCount; - } - - public Page getPage() { - return page; - } - - public void setPage(Page page) { - this.page = page; - } - - public String getSearchStartTime() { - return searchStartTime; - } - - public void setSearchStartTime(String searchStartTime) { - this.searchStartTime = searchStartTime; - } - - public String getSearchEndTime() { - return searchEndTime; - } - - public void setSearchEndTime(String searchEndTime) { - this.searchEndTime = searchEndTime; - } - - -} diff --git a/src/main/java/com/nis/domain/restful/ConfigGroupRelationTest.java b/src/main/java/com/nis/domain/restful/ConfigGroupRelationTest.java deleted file mode 100644 index 0e3ff8e..0000000 --- a/src/main/java/com/nis/domain/restful/ConfigGroupRelationTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.nis.domain.restful; - -public class ConfigGroupRelationTest extends ConfigGroupRelation{ - - /** - * - */ - private static final long serialVersionUID = -1253613918276476050L; - -} diff --git a/src/main/java/com/nis/domain/restful/ConfigSourceTest.java b/src/main/java/com/nis/domain/restful/ConfigSourceTest.java deleted file mode 100644 index 5f6ec62..0000000 --- a/src/main/java/com/nis/domain/restful/ConfigSourceTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/** -* @Title: ConfigSource.java -* @Package com.nis.domain.restful -* @Description: TODO(用一句话描述该文件做什么) -* @author (darnell) -* @date 2016年8月29日 下午9:31:24 -* @version V1.0 -*/ -package com.nis.domain.restful; - -/** - * @ClassName: ConfigSource - * @Description: TODO(这里用一句话描述这个类的作用) - * @author (darnell) - * @date 2016年8月29日 下午9:31:24 - * @version V1.0 - */ -public class ConfigSourceTest extends ConfigSource { - - /** - * - */ - private static final long serialVersionUID = -2641336050368126171L; - -} diff --git a/src/main/java/com/nis/domain/restful/DmbCk.java b/src/main/java/com/nis/domain/restful/DmbCk.java deleted file mode 100644 index a58ddf4..0000000 --- a/src/main/java/com/nis/domain/restful/DmbCk.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; -/** - * - * @ClassName: DmbCk.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:22:14 - * @version V1.0 - */ -public class DmbCk extends BaseEntity{ - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -2268609209854016029L; - @ApiModelProperty(value="国际出口ID", required=true) - private Long id; - @ApiModelProperty(value="出口名称", required=true) - private String name; - @ApiModelProperty(value="出口位置", required=true) - private String position; - @ApiModelProperty(value="通讯方法", required=true) - private String comOption; - @ApiModelProperty(value="操作员", required=true) - private Long czyid; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - private Date lastUpdate; - private Long procSeq; - - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name == null ? null : name.trim(); - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position == null ? null : position.trim(); - } - - public String getComOption() { - return comOption; - } - - public void setComOption(String comOption) { - this.comOption = comOption == null ? null : comOption.trim(); - } - - public Long getCzyid() { - return czyid; - } - - public void setCzyid(Long czyid) { - this.czyid = czyid; - } -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - - public void setOpTime(Date opTime) { - this.opTime = opTime; - } -} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/DmbCkSource.java b/src/main/java/com/nis/domain/restful/DmbCkSource.java deleted file mode 100644 index a29ddd3..0000000 --- a/src/main/java/com/nis/domain/restful/DmbCkSource.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - *@Title: DmbCkSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月9日 上午9:53:04 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: DmbCkSource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:53:04 - * @version V1.0 - */ -public class DmbCkSource extends ConfigCommonSource{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 262835095511967504L; - private static final String DEFAULT_VERSION = "1.0"; - private List dmbCkList; - - - /** - * 创建一个新的实例 DmbCkSource. - * - */ - public DmbCkSource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public DmbCkSource(String version) { - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * dmbCkList - * @return dmbCkList - */ - - public List getDmbCkList() { - return dmbCkList; - } - /** - * @param dmbCkList the dmbCkList to set - */ - public void setDmbCkList(List dmbCkList) { - this.dmbCkList = dmbCkList; - } -} diff --git a/src/main/java/com/nis/domain/restful/DmbPort.java b/src/main/java/com/nis/domain/restful/DmbPort.java deleted file mode 100644 index 5d62777..0000000 --- a/src/main/java/com/nis/domain/restful/DmbPort.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; -/** - * - * @ClassName: DmbPort.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:23:08 - * @version V1.0 - */ -public class DmbPort extends BaseEntity{ - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -6308234862307401069L; - @ApiModelProperty(value="端口ID", required=true) - private Long id; - @ApiModelProperty(value="国际出口ID", required=true) - private Long entranceId; - @ApiModelProperty(value="端口名称", required=true) - private String portName; - @ApiModelProperty(value="是否使用", required=true) - private Integer isUsed; - @ApiModelProperty(value="管理IP", required=true) - private String ipDz; - @ApiModelProperty(value="分流设备", required=true) - private String portEquipment; - @ApiModelProperty(value="ODF端口", required=true) - private String odfPort; - @ApiModelProperty(value="机房地址", required=true) - private String addr; - @ApiModelProperty(value="骨干设备端口", required=true) - private String ckPort; - @ApiModelProperty(value="操作员", required=true) - private Long czyid; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - private Date lastUpdate; - private Long procSeq; - - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getEntranceId() { - return entranceId; - } - - public void setEntranceId(Long entranceId) { - this.entranceId = entranceId; - } - - public String getPortName() { - return portName; - } - - public void setPortName(String portName) { - this.portName = portName == null ? null : portName.trim(); - } - - public Integer getIsUsed() { - return isUsed; - } - - public void setIsUsed(Integer isUsed) { - this.isUsed = isUsed; - } - - public String getIpDz() { - return ipDz; - } - - public void setIpDz(String ipDz) { - this.ipDz = ipDz == null ? null : ipDz.trim(); - } - - public String getPortEquipment() { - return portEquipment; - } - - public void setPortEquipment(String portEquipment) { - this.portEquipment = portEquipment == null ? null : portEquipment.trim(); - } - - public String getOdfPort() { - return odfPort; - } - - public void setOdfPort(String odfPort) { - this.odfPort = odfPort == null ? null : odfPort.trim(); - } - - public String getAddr() { - return addr; - } - - public void setAddr(String addr) { - this.addr = addr == null ? null : addr.trim(); - } - - public String getCkPort() { - return ckPort; - } - - public void setCkPort(String ckPort) { - this.ckPort = ckPort == null ? null : ckPort.trim(); - } - public Long getCzyid() { - return czyid; - } - - public void setCzyid(Long czyid) { - this.czyid = czyid; - } - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - public void setOpTime(Date opTime) { - this.opTime = opTime; - } -} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/DmbPortSource.java b/src/main/java/com/nis/domain/restful/DmbPortSource.java deleted file mode 100644 index 78f1b08..0000000 --- a/src/main/java/com/nis/domain/restful/DmbPortSource.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - *@Title: DmbPortSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月9日 上午9:53:04 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: DmbPortSource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:53:04 - * @version V1.0 - */ -public class DmbPortSource extends ConfigCommonSource{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 262835095511967504L; - private static final String DEFAULT_VERSION = "1.0"; - private List dmbPortList; - - - /** - * 创建一个新的实例 DmbPortSource. - * - */ - public DmbPortSource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public DmbPortSource(String version) { - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * dmbPortList - * @return dmbPortList - */ - - public List getDmbPortList() { - return dmbPortList; - } - /** - * @param dmbPortList the dmbPortList to set - */ - public void setDmbPortList(List dmbPortList) { - this.dmbPortList = dmbPortList; - } -} diff --git a/src/main/java/com/nis/domain/restful/DnsFakeInfo.java b/src/main/java/com/nis/domain/restful/DnsFakeInfo.java deleted file mode 100644 index 97f2490..0000000 --- a/src/main/java/com/nis/domain/restful/DnsFakeInfo.java +++ /dev/null @@ -1,227 +0,0 @@ -/** - *@Title: DnsFakeInfo.java - *@Package com.nis.domain.restful - *@Description TODO - *@author wx - *@date 2016年9月5日 上午10:03:16 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; - -/** - * @ClassName: DnsFakeInfo.java - * @Description: TODO - * @author (wx) - * @date 2016年9月5日 上午10:03:16 - * @version V1.0 - */ -public class DnsFakeInfo extends BaseEntity { - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 2614513161019844185L; - @ApiModelProperty(value="序号", required=true) - private Long id; - @ApiModelProperty(value="组号", required=true) - private Integer groupId; - @ApiModelProperty(value="信息域", required=true) - private String info; - @ApiModelProperty(value="有效标志,0无效,1有效", required=true) - private Integer isValid; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - @ApiModelProperty(value="预留1", required=false) - private Integer yl1; - @ApiModelProperty(value="预留2", required=false) - private Integer yl2; - @ApiModelProperty(value="预留3", required=false) - private String yl3; - @ApiModelProperty(value="预留4", required=false) - private String yl4; - @ApiModelProperty(value="预留5", required=false) - private String yl5; - private Date lastUpdate; - private Long procSeq; - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - /** - * id - * @return id - */ - - public Long getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(Long id) { - this.id = id; - } - /** - * groupId - * @return groupId - */ - - public Integer getGroupId() { - return groupId; - } - /** - * @param groupId the groupId to set - */ - public void setGroupId(Integer groupId) { - this.groupId = groupId; - } - /** - * info - * @return info - */ - - public String getInfo() { - return info; - } - /** - * @param info the info to set - */ - public void setInfo(String info) { - this.info = info; - } - /** - * isValid - * @return isValid - */ - - public Integer getIsValid() { - return isValid; - } - /** - * @param isValid the isValid to set - */ - public void setIsValid(Integer isValid) { - this.isValid = isValid; - } - /** - * opTime - * @return opTime - */ -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - /** - * @param opTime the opTime to set - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - /** - * yl1 - * @return yl1 - */ - - public Integer getYl1() { - return yl1; - } - /** - * @param yl1 the yl1 to set - */ - public void setYl1(Integer yl1) { - this.yl1 = yl1; - } - /** - * yl2 - * @return yl2 - */ - - public Integer getYl2() { - return yl2; - } - /** - * @param yl2 the yl2 to set - */ - public void setYl2(Integer yl2) { - this.yl2 = yl2; - } - /** - * yl3 - * @return yl3 - */ - - public String getYl3() { - return yl3; - } - /** - * @param yl3 the yl3 to set - */ - public void setYl3(String yl3) { - this.yl3 = yl3; - } - /** - * yl4 - * @return yl4 - */ - - public String getYl4() { - return yl4; - } - /** - * @param yl4 the yl4 to set - */ - public void setYl4(String yl4) { - this.yl4 = yl4; - } - /** - * yl5 - * @return yl5 - */ - - public String getYl5() { - return yl5; - } - /** - * @param yl5 the yl5 to set - */ - public void setYl5(String yl5) { - this.yl5 = yl5; - } - -} diff --git a/src/main/java/com/nis/domain/restful/DnsFakeInfoSource.java b/src/main/java/com/nis/domain/restful/DnsFakeInfoSource.java deleted file mode 100644 index 43b6b70..0000000 --- a/src/main/java/com/nis/domain/restful/DnsFakeInfoSource.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - *@Title: DnsFakeInfoSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月7日 下午6:26:06 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: DnsFakeInfoSource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午6:26:06 - * @version V1.0 - */ -public class DnsFakeInfoSource extends ConfigCommonSource{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -4075912540188044069L; - private static final String DEFAULT_VERSION = "1.0"; - private List dnsFakeInfoList; - - - /** - * 创建一个新的实例 DnsFakeInfoSource. - * - */ - public DnsFakeInfoSource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public DnsFakeInfoSource(String version) { - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * - * getDnsFakeInfoList(这里用一句话描述这个方法的作用) - * (这里描述这个方法适用条件 – 可选) - * @return - *List - * @exception - * @since 1.0.0 - */ - public List getDnsFakeInfoList() { - return dnsFakeInfoList; - } - /** - * @param dnsGroupTypeList the dnsGroupTypeList to set - */ - public void setDnsFakeInfoList(List dnsFakeIpList) { - this.dnsFakeInfoList = dnsFakeIpList; - } - -} diff --git a/src/main/java/com/nis/domain/restful/DnsFakeIp.java b/src/main/java/com/nis/domain/restful/DnsFakeIp.java deleted file mode 100644 index 97e2702..0000000 --- a/src/main/java/com/nis/domain/restful/DnsFakeIp.java +++ /dev/null @@ -1,391 +0,0 @@ -/** - *@Title: DnsFakeIp.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月3日 下午7:59:34 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; - -/** - * @ClassName: DnsFakeIp.java - * @Description: TODO - * @author (wx) - * @date 2016年9月3日 下午7:59:34 - * @version V1.0 - */ -public class DnsFakeIp extends BaseEntity { - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -4761419421560750644L; - @ApiModelProperty(value="序号", required=true) - private Long id; - @ApiModelProperty(value="组号", required=true) - private Integer groupId; - @ApiModelProperty(value="地址类型", required=true) - private Integer addrType; - @ApiModelProperty(value="源IP地址", required=true) - private String srcIp; - @ApiModelProperty(value="源IP掩码", required=true) - private String maskSrcIp; - @ApiModelProperty(value="源端口", required=true) - private String srcPort; - @ApiModelProperty(value="源端口掩码", required=true) - private String maskSrcPort; - @ApiModelProperty(value="目的IP", required=true) - private String dstIp; - @ApiModelProperty(value="目的IP掩码", required=true) - private String maskDstIp; - @ApiModelProperty(value="目的端口", required=true) - private String dstPort; - @ApiModelProperty(value="目的端口掩码", required=true) - private String maskDstPort; - @ApiModelProperty(value="协议(tcp/udp)", required=true) - private Integer protocol; - @ApiModelProperty(value="方向,0双向,1单向", required=true) - private Integer direction; - @ApiModelProperty(value="有效标志, 0无效,1有效", required=true) - private Integer isValid; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - @ApiModelProperty(value="预留1", required=false) - private Integer yl1; - @ApiModelProperty(value="预留2", required=false) - private Integer yl2; - @ApiModelProperty(value="预留3", required=false) - private String yl3; - @ApiModelProperty(value="预留4", required=false) - private String yl4; - @ApiModelProperty(value="预留5", required=false) - private String yl5; - private Date lastUpdate; - private Long procSeq; - - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - /** - * id - * @return id - */ - - public Long getId() { - return id; - } - /** - * maskSrcIp - * @return maskSrcIp - */ - - public String getMaskSrcIp() { - return maskSrcIp; - } - /** - * @param maskSrcIp the maskSrcIp to set - */ - public void setMaskSrcIp(String maskSrcIp) { - this.maskSrcIp = maskSrcIp; - } - /** - * @param id the id to set - */ - public void setId(Long id) { - this.id = id; - } - /** - * groupId - * @return groupId - */ - - public Integer getGroupId() { - return groupId; - } - /** - * @param groupId the groupId to set - */ - public void setGroupId(Integer groupId) { - this.groupId = groupId; - } - /** - * addrType - * @return addrType - */ - - public Integer getAddrType() { - return addrType; - } - /** - * @param addrType the addrType to set - */ - public void setAddrType(Integer addrType) { - this.addrType = addrType; - } - /** - * srcIp - * @return srcIp - */ - - public String getSrcIp() { - return srcIp; - } - /** - * @param srcIp the srcIp to set - */ - public void setSrcIp(String srcIp) { - this.srcIp = srcIp; - } - /** - * maskSrcPort - * @return maskSrcPort - */ - - public String getMaskSrcPort() { - return maskSrcPort; - } - /** - * @param maskSrcPort the maskSrcPort to set - */ - public void setMaskSrcPort(String maskSrcPort) { - this.maskSrcPort = maskSrcPort; - } - /** - * srcPort - * @return srcPort - */ - - public String getSrcPort() { - return srcPort; - } - /** - * @param srcPort the srcPort to set - */ - public void setSrcPort(String srcPort) { - this.srcPort = srcPort; - } - /** - * dstIp - * @return dstIp - */ - - public String getDstIp() { - return dstIp; - } - /** - * @param dstIp the dstIp to set - */ - public void setDstIp(String dstIp) { - this.dstIp = dstIp; - } - /** - * maskDstIp - * @return maskDstIp - */ - - public String getMaskDstIp() { - return maskDstIp; - } - /** - * @param maskDstIp the maskDstIp to set - */ - public void setMaskDstIp(String maskDstIp) { - this.maskDstIp = maskDstIp; - } - /** - * dstPort - * @return dstPort - */ - - public String getDstPort() { - return dstPort; - } - /** - * @param dstPort the dstPort to set - */ - public void setDstPort(String dstPort) { - this.dstPort = dstPort; - } - /** - * maskDstPort - * @return maskDstPort - */ - - public String getMaskDstPort() { - return maskDstPort; - } - /** - * @param maskDstPort the maskDstPort to set - */ - public void setMaskDstPort(String maskDstPort) { - this.maskDstPort = maskDstPort; - } - /** - * protocol - * @return protocol - */ - - public Integer getProtocol() { - return protocol; - } - /** - * @param protocol the protocol to set - */ - public void setProtocol(Integer protocol) { - this.protocol = protocol; - } - /** - * direction - * @return direction - */ - - public Integer getDirection() { - return direction; - } - /** - * @param direction the direction to set - */ - public void setDirection(Integer direction) { - this.direction = direction; - } - /** - * isValid - * @return isValid - */ - - public Integer getIsValid() { - return isValid; - } - /** - * @param isValid the isValid to set - */ - public void setIsValid(Integer isValid) { - this.isValid = isValid; - } - /** - * optTime - * @return optTime - */ -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - /** - * @param optTime the optTime to set - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - /** - * yl1 - * @return yl1 - */ - - public Integer getYl1() { - return yl1; - } - /** - * @param yl1 the yl1 to set - */ - public void setYl1(Integer yl1) { - this.yl1 = yl1; - } - /** - * yl2 - * @return yl2 - */ - - public Integer getYl2() { - return yl2; - } - /** - * @param yl2 the yl2 to set - */ - public void setYl2(Integer yl2) { - this.yl2 = yl2; - } - /** - * yl3 - * @return yl3 - */ - - public String getYl3() { - return yl3; - } - /** - * @param yl3 the yl3 to set - */ - public void setYl3(String yl3) { - this.yl3 = yl3; - } - /** - * yl4 - * @return yl4 - */ - - public String getYl4() { - return yl4; - } - /** - * @param yl4 the yl4 to set - */ - public void setYl4(String yl4) { - this.yl4 = yl4; - } - /** - * yl5 - * @return yl5 - */ - - public String getYl5() { - return yl5; - } - /** - * @param yl5 the yl5 to set - */ - public void setYl5(String yl5) { - this.yl5 = yl5; - } - - - - -} diff --git a/src/main/java/com/nis/domain/restful/DnsFakeIpSource.java b/src/main/java/com/nis/domain/restful/DnsFakeIpSource.java deleted file mode 100644 index 5a78d12..0000000 --- a/src/main/java/com/nis/domain/restful/DnsFakeIpSource.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - *@Title: DnsFakeIpSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月7日 下午6:26:06 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: DnsFakeIpSource.java - * @Description: TODO - * @author (dell) - * @date 2016年9月7日 下午6:26:06 - * @version V1.0 - */ -public class DnsFakeIpSource extends ConfigCommonSource{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -6785885766516678348L; - private static final String DEFAULT_VERSION = "1.0"; - private List dnsFakeIpList; - - - /** - * 创建一个新的实例 DnsGroupTypeSource. - * - */ - public DnsFakeIpSource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public DnsFakeIpSource(String version) { - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * dnsResponseStrategyList - * @return dnsResponseStrategyList - */ - /** - * dnsGroupTypeList - * @return dnsGroupTypeList - */ - - public List getDnsFakeIpList() { - return dnsFakeIpList; - } - /** - * @param dnsGroupTypeList the dnsGroupTypeList to set - */ - public void setDnsFakeIpList(List dnsFakeIpList) { - this.dnsFakeIpList = dnsFakeIpList; - } - -} diff --git a/src/main/java/com/nis/domain/restful/DnsGroupType.java b/src/main/java/com/nis/domain/restful/DnsGroupType.java deleted file mode 100644 index f660596..0000000 --- a/src/main/java/com/nis/domain/restful/DnsGroupType.java +++ /dev/null @@ -1,245 +0,0 @@ -/** - *@Title: DnsGroupType.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月3日 下午7:47:28 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; - -/** - * @ClassName: DnsGroupType.java - * @Description: TODO - * @author (wx) - * @date 2016年9月3日 下午7:47:28 - * @version V1.0 - */ -public class DnsGroupType extends BaseEntity { - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -7012538382953700633L; - @ApiModelProperty(value="序号", required=true) - private Long id; - @ApiModelProperty(value="组号", required=true) - private Integer groupId; - @ApiModelProperty(value="组名", required=true) - private String groupName; - @ApiModelProperty(value="应答类型号", required=true) - private Integer resTypeId; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - @ApiModelProperty(value="有效标志", required=true) - private Integer isValid; - @ApiModelProperty(value="预留1", required=false) - private Integer yl1; - @ApiModelProperty(value="预留2", required=false) - private Integer yl2; - @ApiModelProperty(value="预留3", required=false) - private String yl3; - @ApiModelProperty(value="预留4", required=false) - private String yl4; - @ApiModelProperty(value="预留5", required=false) - private String yl5; - - private Date lastUpdate; - private Long procSeq; - - /** - * groupName - * @return groupName - */ - - public String getGroupName() { - return groupName; - } - /** - * @param groupName the groupName to set - */ - public void setGroupName(String groupName) { - this.groupName = groupName; - } - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - /** - * id - * @return id - */ - - public Long getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(Long id) { - this.id = id; - } - /** - * groupId - * @return groupId - */ - - public Integer getGroupId() { - return groupId; - } - /** - * @param groupId the groupId to set - */ - public void setGroupId(Integer groupId) { - this.groupId = groupId; - } - /** - * resTypeId - * @return resTypeId - */ - - public Integer getResTypeId() { - return resTypeId; - } - /** - * @param resTypeId the resTypeId to set - */ - public void setResTypeId(Integer resTypeId) { - this.resTypeId = resTypeId; - } - /** - * opTime - * @return opTime - */ -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - /** - * @param opTime the opTime to set - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - /** - * isValid - * @return isValid - */ - - public Integer getIsValid() { - return isValid; - } - /** - * @param isValid the isValid to set - */ - public void setIsValid(Integer isValid) { - this.isValid = isValid; - } - /** - * yl1 - * @return yl1 - */ - - public Integer getYl1() { - return yl1; - } - /** - * @param yl1 the yl1 to set - */ - public void setYl1(Integer yl1) { - this.yl1 = yl1; - } - /** - * yl2 - * @return yl2 - */ - - public Integer getYl2() { - return yl2; - } - /** - * @param yl2 the yl2 to set - */ - public void setYl2(Integer yl2) { - this.yl2 = yl2; - } - /** - * yl3 - * @return yl3 - */ - - public String getYl3() { - return yl3; - } - /** - * @param yl3 the yl3 to set - */ - public void setYl3(String yl3) { - this.yl3 = yl3; - } - /** - * yl4 - * @return yl4 - */ - - public String getYl4() { - return yl4; - } - /** - * @param yl4 the yl4 to set - */ - public void setYl4(String yl4) { - this.yl4 = yl4; - } - /** - * yl5 - * @return yl5 - */ - - public String getYl5() { - return yl5; - } - /** - * @param yl5 the yl5 to set - */ - public void setYl5(String yl5) { - this.yl5 = yl5; - } - -} diff --git a/src/main/java/com/nis/domain/restful/DnsGroupTypeSource.java b/src/main/java/com/nis/domain/restful/DnsGroupTypeSource.java deleted file mode 100644 index aa43ed6..0000000 --- a/src/main/java/com/nis/domain/restful/DnsGroupTypeSource.java +++ /dev/null @@ -1,124 +0,0 @@ -/** - *@Title: DnsGroupTypeSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月7日 下午3:32:18 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: DnsGroupTypeSource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:32:18 - * @version V1.0 - */ -public class DnsGroupTypeSource extends ConfigCommonSource{ - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 4829973369982149866L; - private static final String DEFAULT_VERSION = "1.0"; - private List dnsGroupTypeList; - - - /** - * 创建一个新的实例 DnsGroupTypeSource. - * - */ - public DnsGroupTypeSource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public DnsGroupTypeSource(String version) { - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * dnsResponseStrategyList - * @return dnsResponseStrategyList - */ - /** - * dnsGroupTypeList - * @return dnsGroupTypeList - */ - - public List getDnsGroupTypeList() { - return dnsGroupTypeList; - } - /** - * @param dnsGroupTypeList the dnsGroupTypeList to set - */ - public void setDnsGroupTypeList(List dnsGroupTypeList) { - this.dnsGroupTypeList = dnsGroupTypeList; - } - -} diff --git a/src/main/java/com/nis/domain/restful/DnsResponseStrategy.java b/src/main/java/com/nis/domain/restful/DnsResponseStrategy.java deleted file mode 100644 index 805b63d..0000000 --- a/src/main/java/com/nis/domain/restful/DnsResponseStrategy.java +++ /dev/null @@ -1,457 +0,0 @@ -/** - *@Title: DnsResponseStrategy.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月3日 下午7:01:02 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModel; -import com.wordnik.swagger.annotations.ApiModelProperty; - -/** - * @ClassName: DnsResponseStrategy.java - * @Description: TODO - * @author (wx) - * @date 2016年9月3日 下午7:01:02 - * @version V1.0 - */ -@ApiModel - -public class DnsResponseStrategy extends BaseEntity { - - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -4484073380296557600L; - @ApiModelProperty(value="序号", required=true) - private Long id; - @ApiModelProperty(value="请求策略号", required=true) - private Integer reqStrateId; - @ApiModelProperty(value="策略名称", required=true) - private String strateName; - @ApiModelProperty(value="应答组1的组号", required=false) - private Integer resGroupOneId; - @ApiModelProperty(value="应答组1的应答数", required=false) - private Integer resGroupOneNum; - @ApiModelProperty(value="应答组2的组号", required=false) - private Integer resGroupTwoId; - @ApiModelProperty(value="应答组2的应答数", required=false) - private Integer resGroupTwoNum; - @ApiModelProperty(value="应答组3的组号", required=false) - private Integer resGroupThreeId; - @ApiModelProperty(value="应答组3的应答数", required=false) - private Integer resGroupThreeNum; - @ApiModelProperty(value="应答组4的组号", required=false) - private Integer resGroupFourId; - @ApiModelProperty(value="应答组4的应答数", required=false) - private Integer resGroupFourNum; - @ApiModelProperty(value="应答组5的组号", required=false) - private Integer resGroupFiveId; - @ApiModelProperty(value="应答组5的应答数", required=false) - private Integer resGroupFiveNum; - @ApiModelProperty(value="Auth记录组号", required=false) - private Integer authGroup; - @ApiModelProperty(value="Additional记录组号", required=false) - private Integer addGroup; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - @ApiModelProperty(value="有效标识", required=true) - private Integer isValid; - @ApiModelProperty(value="预留1", required=false) - private Integer yl1; - @ApiModelProperty(value="预留2", required=false) - private Integer yl2; - @ApiModelProperty(value="预留3", required=false) - private String yl3; - @ApiModelProperty(value="预留4", required=false) - private String yl4; - @ApiModelProperty(value="预留5", required=false) - private String yl5; - private Date lastUpdate; - private Long procSeq; - @ApiModelProperty(value="最小生存时间", required=true) - private Integer minTtl; - @ApiModelProperty(value="最大生存时间", required=true) - private Integer maxTtl; - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - /** - * id - * @return id - */ - - public Long getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(Long id) { - this.id = id; - } - /** - * reqStrateId - * @return reqStrateId - */ - - public Integer getReqStrateId() { - return reqStrateId; - } - /** - * @param reqStrateId the reqStrateId to set - */ - public void setReqStrateId(Integer reqStrateId) { - this.reqStrateId = reqStrateId; - } - /** - * strateName - * @return strateName - */ - - public String getStrateName() { - return strateName; - } - /** - * @param strateName the strateName to set - */ - public void setStrateName(String strateName) { - this.strateName = strateName; - } - /** - * resGroupOneId - * @return resGroupOneId - */ - - public Integer getResGroupOneId() { - return resGroupOneId; - } - /** - * @param resGroupOneId the resGroupOneId to set - */ - public void setResGroupOneId(Integer resGroupOneId) { - this.resGroupOneId = resGroupOneId; - } - /** - * resGroupOneNum - * @return resGroupOneNum - */ - - public Integer getResGroupOneNum() { - return resGroupOneNum; - } - /** - * @param resGroupOneNum the resGroupOneNum to set - */ - public void setResGroupOneNum(Integer resGroupOneNum) { - this.resGroupOneNum = resGroupOneNum; - } - /** - * resGroupTwoId - * @return resGroupTwoId - */ - - public Integer getResGroupTwoId() { - return resGroupTwoId; - } - /** - * @param resGroupTwoId the resGroupTwoId to set - */ - public void setResGroupTwoId(Integer resGroupTwoId) { - this.resGroupTwoId = resGroupTwoId; - } - /** - * resGroupTwoNum - * @return resGroupTwoNum - */ - - public Integer getResGroupTwoNum() { - return resGroupTwoNum; - } - /** - * @param resGroupTwoNum the resGroupTwoNum to set - */ - public void setResGroupTwoNum(Integer resGroupTwoNum) { - this.resGroupTwoNum = resGroupTwoNum; - } - /** - * authGroup - * @return authGroup - */ - - public Integer getAuthGroup() { - return authGroup; - } - /** - * @param authGroup the authGroup to set - */ - public void setAuthGroup(Integer authGroup) { - this.authGroup = authGroup; - } - /** - * addGroup - * @return addGroup - */ - - public Integer getAddGroup() { - return addGroup; - } - /** - * @param addGroup the addGroup to set - */ - public void setAddGroup(Integer addGroup) { - this.addGroup = addGroup; - } - /** - * opTime - * @return opTime - */ -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - /** - * @param opTime the opTime to set - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - /** - * isValid - * @return isValid - */ - - public Integer getIsValid() { - return isValid; - } - /** - * @param isValid the isValid to set - */ - public void setIsValid(Integer isValid) { - this.isValid = isValid; - } - /** - * yl1 - * @return yl1 - */ - - public Integer getYl1() { - return yl1; - } - /** - * @param yl1 the yl1 to set - */ - public void setYl1(Integer yl1) { - this.yl1 = yl1; - } - /** - * yl2 - * @return yl2 - */ - - public Integer getYl2() { - return yl2; - } - /** - * @param yl2 the yl2 to set - */ - public void setYl2(Integer yl2) { - this.yl2 = yl2; - } - /** - * yl3 - * @return yl3 - */ - - public String getYl3() { - return yl3; - } - /** - * @param yl3 the yl3 to set - */ - public void setYl3(String yl3) { - this.yl3 = yl3; - } - /** - * yl4 - * @return yl4 - */ - - public String getYl4() { - return yl4; - } - /** - * @param yl4 the yl4 to set - */ - public void setYl4(String yl4) { - this.yl4 = yl4; - } - /** - * yl5 - * @return yl5 - */ - - public String getYl5() { - return yl5; - } - /** - * @param yl5 the yl5 to set - */ - public void setYl5(String yl5) { - this.yl5 = yl5; - } - /** - * minTtl - * @return minTtl - */ - - public Integer getMinTtl() { - return minTtl; - } - /** - * @param minTtl the minTtl to set - */ - public void setMinTtl(Integer minTtl) { - this.minTtl = minTtl; - } - /** - * maxTtl - * @return maxTtl - */ - - public Integer getMaxTtl() { - return maxTtl; - } - /** - * @param maxTtl the maxTtl to set - */ - public void setMaxTtl(Integer maxTtl) { - this.maxTtl = maxTtl; - } - /** - * resGroupThreeId - * @return resGroupThreeId - */ - - public Integer getResGroupThreeId() { - return resGroupThreeId; - } - /** - * @param resGroupThreeId the resGroupThreeId to set - */ - public void setResGroupThreeId(Integer resGroupThreeId) { - this.resGroupThreeId = resGroupThreeId; - } - /** - * resGroupThreeNum - * @return resGroupThreeNum - */ - - public Integer getResGroupThreeNum() { - return resGroupThreeNum; - } - /** - * @param resGroupThreeNum the resGroupThreeNum to set - */ - public void setResGroupThreeNum(Integer resGroupThreeNum) { - this.resGroupThreeNum = resGroupThreeNum; - } - /** - * resGroupFourId - * @return resGroupFourId - */ - - public Integer getResGroupFourId() { - return resGroupFourId; - } - /** - * @param resGroupFourId the resGroupFourId to set - */ - public void setResGroupFourId(Integer resGroupFourId) { - this.resGroupFourId = resGroupFourId; - } - /** - * resGroupFourNum - * @return resGroupFourNum - */ - - public Integer getResGroupFourNum() { - return resGroupFourNum; - } - /** - * @param resGroupFourNum the resGroupFourNum to set - */ - public void setResGroupFourNum(Integer resGroupFourNum) { - this.resGroupFourNum = resGroupFourNum; - } - /** - * resGroupFiveId - * @return resGroupFiveId - */ - - public Integer getResGroupFiveId() { - return resGroupFiveId; - } - /** - * @param resGroupFiveId the resGroupFiveId to set - */ - public void setResGroupFiveId(Integer resGroupFiveId) { - this.resGroupFiveId = resGroupFiveId; - } - /** - * resGroupFiveNum - * @return resGroupFiveNum - */ - - public Integer getResGroupFiveNum() { - return resGroupFiveNum; - } - /** - * @param resGroupFiveNum the resGroupFiveNum to set - */ - public void setResGroupFiveNum(Integer resGroupFiveNum) { - this.resGroupFiveNum = resGroupFiveNum; - } - - - -} diff --git a/src/main/java/com/nis/domain/restful/DnsResponseStrategySource.java b/src/main/java/com/nis/domain/restful/DnsResponseStrategySource.java deleted file mode 100644 index acbd709..0000000 --- a/src/main/java/com/nis/domain/restful/DnsResponseStrategySource.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - *@Title: DnsResponseStrategySource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月6日 上午9:00:41 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: DnsResponseStrategySource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月6日 上午9:00:41 - * @version V1.0 - */ -public class DnsResponseStrategySource extends ConfigCommonSource { - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 2810461787654112507L; - private static final String DEFAULT_VERSION = "1.0"; - private List dnsResponseStrategyList; - - /** - * 创建一个新的实例 DnsResponseStrategySource. - * - */ - public DnsResponseStrategySource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public DnsResponseStrategySource(String version) { - // TODO Auto-generated constructor stub - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * dnsResponseStrategyList - * @return dnsResponseStrategyList - */ - - public List getDnsResponseStrategyList() { - return dnsResponseStrategyList; - } - - /** - * @param dnsResponseStrategyList the dnsResponseStrategyList to set - */ - public void setDnsResponseStrategyList(List dnsResponseStrategyList) { - this.dnsResponseStrategyList = dnsResponseStrategyList; - } - -} diff --git a/src/main/java/com/nis/domain/restful/EncryptProtoRandom.java b/src/main/java/com/nis/domain/restful/EncryptProtoRandom.java deleted file mode 100644 index bd259b8..0000000 --- a/src/main/java/com/nis/domain/restful/EncryptProtoRandom.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; - -public class EncryptProtoRandom extends BaseEntity{ - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 9207461727413894109L; - @ApiModelProperty(value="序号", required=true) - private Long id; - @ApiModelProperty(value="比例值", required=true) - private Integer randomValue; - @ApiModelProperty(value="协议编号", required=true) - private Integer proto; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - @ApiModelProperty(value="有效标志", required=true) - private Integer isValid; - private Long procSeq; - private Date lastUpdate; - - /* (non-Javadoc) - * @see com.nis.domain.BaseEntity#getId() - */ - @Override - public Long getId() { - // TODO Auto-generated method stub - return super.getId(); - } - - /* (non-Javadoc) - * @see com.nis.domain.BaseEntity#setId(java.lang.Long) - */ - @Override - public void setId(Long id) { - // TODO Auto-generated method stub - super.setId(id); - } - - public Integer getRandomValue() { - return randomValue; - } - - public void setRandomValue(Integer randomValue) { - this.randomValue = randomValue; - } - - public Integer getProto() { - return proto; - } - - public void setProto(Integer proto) { - this.proto = proto; - } - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - public Integer getIsValid() { - return isValid; - } - - public void setIsValid(Integer isValid) { - this.isValid = isValid; - } - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } -} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/EncryptProtoRandomSource.java b/src/main/java/com/nis/domain/restful/EncryptProtoRandomSource.java deleted file mode 100644 index 3979681..0000000 --- a/src/main/java/com/nis/domain/restful/EncryptProtoRandomSource.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - *@Title: EncryptProtoRandomSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月27日 上午8:57:57 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: EncryptProtoRandomSource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月27日 上午8:57:57 - * @version V1.0 - */ -public class EncryptProtoRandomSource extends ConfigCommonSource{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -4303849898919494205L; - private static final String DEFAULT_VERSION = "1.0"; - private List encryptProtoRandomList; - - /** - * 创建一个新的实例 EncryptProtoRandomSource. - * - */ - public EncryptProtoRandomSource() { - super(); - this.version=DEFAULT_VERSION; - } - - - /** - * 创建一个新的实例 EncryptProtoRandomSource. - * - * @param encryptProtoRandomList - */ - public EncryptProtoRandomSource(List encryptProtoRandomList) { - this.encryptProtoRandomList = encryptProtoRandomList; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * encryptProtoRandomList - * @return encryptProtoRandomList - */ - - public List getEncryptProtoRandomList() { - return encryptProtoRandomList; - } - - - /** - * @param encryptProtoRandomList the encryptProtoRandomList to set - */ - public void setEncryptProtoRandomList(List encryptProtoRandomList) { - this.encryptProtoRandomList = encryptProtoRandomList; - } - -} diff --git a/src/main/java/com/nis/domain/restful/FakeIpConfigCompile.java b/src/main/java/com/nis/domain/restful/FakeIpConfigCompile.java deleted file mode 100644 index 8c1ab4b..0000000 --- a/src/main/java/com/nis/domain/restful/FakeIpConfigCompile.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.nis.domain.restful; - -import java.util.Date; - -import com.nis.domain.BaseEntity; - -public class FakeIpConfigCompile extends BaseEntity{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -4840694519393346179L; - - private Long compileId; - - private Integer service; - - private Integer action; - - private Integer doBlacklist; - - private Integer doLog; - - private String effectiveRange; - - private String userRegion; - - private Integer isValid; - - private Date opTime; - - private Integer groupNum; - private Integer activeSys; - private Date lastUpdate; - private Long procSeq; - - /** - * activeSys - * @return activeSys - */ - - public Integer getActiveSys() { - return activeSys; - } - - /** - * @param activeSys the activeSys to set - */ - public void setActiveSys(Integer activeSys) { - this.activeSys = activeSys; - } - - /** - * lastUpdate - * @return lastUpdate - */ - - public Date getLastUpdate() { - return lastUpdate; - } - - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * procSeq - * @return procSeq - */ - - public Long getProcSeq() { - return procSeq; - } - - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - - /** - * 创建一个新的实例 FakeIpConfigCompile. - * - */ - public FakeIpConfigCompile() { - this.service=0; - this.doBlacklist=0; - this.doLog=0; - this.effectiveRange="0"; - this.userRegion="0"; - this.isValid=1; - this.opTime=new Date(); - this.groupNum=1; - } - - public Long getCompileId() { - return compileId; - } - - public void setCompileId(Long compileId) { - this.compileId = compileId; - } - - public Integer getService() { - return service; - } - - public void setService(Integer service) { - this.service = service; - } - - public Integer getAction() { - return action; - } - - public void setAction(Integer action) { - this.action = action; - } - - public Integer getDoBlacklist() { - return doBlacklist; - } - - public void setDoBlacklist(Integer doBlacklist) { - this.doBlacklist = doBlacklist; - } - - public Integer getDoLog() { - return doLog; - } - - public void setDoLog(Integer doLog) { - this.doLog = doLog; - } - - public String getEffectiveRange() { - return effectiveRange; - } - - public void setEffectiveRange(String effectiveRange) { - this.effectiveRange = effectiveRange; - } - - public String getUserRegion() { - return userRegion; - } - - public void setUserRegion(String userRegion) { - this.userRegion = userRegion == null ? null : userRegion.trim(); - } - - 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 Integer getGroupNum() { - return groupNum; - } - - public void setGroupNum(Integer groupNum) { - this.groupNum = groupNum; - } -} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/FakeIpConfigGroup.java b/src/main/java/com/nis/domain/restful/FakeIpConfigGroup.java deleted file mode 100644 index 89d9b3b..0000000 --- a/src/main/java/com/nis/domain/restful/FakeIpConfigGroup.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.nis.domain.BaseEntity; - -public class FakeIpConfigGroup extends BaseEntity{ - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 2903914645692214990L; - - private Integer groupId; - - private Long compileId; - - private Integer isValid; - - private Date opTime; - private Date lastUpdate; - private Long procSeq; - private Long id; - - /** - * id - * @return id - */ - - public Long getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(Long id) { - this.id = id; - } - - /** - * lastUpdate - * @return lastUpdate - */ - public Date getLastUpdate() { - return lastUpdate; - } - - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * procSeq - * @return procSeq - */ - public Long getProcSeq() { - return procSeq; - } - - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - - /** - * 创建一个新的实例 FakeIpConfigGroup. - * - */ - public FakeIpConfigGroup() { - this.isValid=1; - this.opTime=new Date(); - } - - public Integer getGroupId() { - return groupId; - } - - public void setGroupId(Integer groupId) { - this.groupId = groupId; - } - - public Long getCompileId() { - return compileId; - } - - public void setCompileId(Long compileId) { - this.compileId = compileId; - } - - 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; - } -} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/FwqInfo.java b/src/main/java/com/nis/domain/restful/FwqInfo.java deleted file mode 100644 index 37fb07e..0000000 --- a/src/main/java/com/nis/domain/restful/FwqInfo.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; -/** - * - * @ClassName: FwqInfo.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:14:52 - * @version V1.0 - */ -public class FwqInfo extends BaseEntity{ - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = -7679262194839780624L; - @ApiModelProperty(value="配置ID", required=true) - private Long id; - @ApiModelProperty(value="服务器名称", required=true) - private String name; - @ApiModelProperty(value="国际出入口编号", required=true) - private Long entranceId; - @ApiModelProperty(value="操作员", required=true) - private Long czyid; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - private Date lastUpdate; - private Long procSeq; - - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name == null ? null : name.trim(); - } - - public Long getEntranceId() { - return entranceId; - } - - public void setEntranceId(Long entranceId) { - this.entranceId = entranceId; - } - - public Long getCzyid() { - return czyid; - } - - public void setCzyid(Long czyid) { - this.czyid = czyid; - } -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - - public void setOpTime(Date opTime) { - this.opTime = opTime; - } -} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/FwqInfoSource.java b/src/main/java/com/nis/domain/restful/FwqInfoSource.java deleted file mode 100644 index 7dc089e..0000000 --- a/src/main/java/com/nis/domain/restful/FwqInfoSource.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - *@Title: FwqInfoSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月9日 上午9:53:04 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: FwqInfoSource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:53:04 - * @version V1.0 - */ -public class FwqInfoSource extends ConfigCommonSource{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 262835095511967504L; - private static final String DEFAULT_VERSION = "1.0"; - private List fwqInfoList; - - - /** - * 创建一个新的实例 FwqInfoSource. - * - */ - public FwqInfoSource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public FwqInfoSource(String version) { - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * fwqInfoList - * @return fwqInfoList - */ - - public List getFwqInfoList() { - return fwqInfoList; - } - /** - * @param fwqInfoList the fwqInfoList to set - */ - public void setFwqInfoList(List fwqInfoList) { - this.fwqInfoList = fwqInfoList; - } -} diff --git a/src/main/java/com/nis/domain/restful/IpRegionTest.java b/src/main/java/com/nis/domain/restful/IpRegionTest.java deleted file mode 100644 index cea7f4d..0000000 --- a/src/main/java/com/nis/domain/restful/IpRegionTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/** -* @Title: StrRegion.java -* @Package com.nis.domain.restful -* @Description: TODO(用一句话描述该文件做什么) -* @author (darnell) -* @date 2016年8月29日 下午10:29:45 -* @version V1.0 -*/ -package com.nis.domain.restful; - -/** - * @ClassName: StrRegion - * @Description: TODO(这里用一句话描述这个类的作用) - * @author (darnell) - * @date 2016年8月29日 下午10:29:45 - * @version V1.0 - */ -public class IpRegionTest extends IpRegion { - - /** - * - */ - private static final long serialVersionUID = 5051062513980968866L; - -} diff --git a/src/main/java/com/nis/domain/restful/JdjInfo.java b/src/main/java/com/nis/domain/restful/JdjInfo.java deleted file mode 100644 index 71ed44c..0000000 --- a/src/main/java/com/nis/domain/restful/JdjInfo.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.nis.domain.restful; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.nis.domain.BaseEntity; -import com.nis.util.JsonDateSerializer; -import com.wordnik.swagger.annotations.ApiModelProperty; -/** - * - * @ClassName: JdjInfo.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:17:52 - * @version V1.0 - */ -public class JdjInfo extends BaseEntity{ - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 1972462456394453087L; - @ApiModelProperty(value="配置ID", required=true) - private Long id; - @ApiModelProperty(value="节点机名称", required=true) - private String name; - @ApiModelProperty(value="服务器ID", required=true) - private Long fwqId; - @ApiModelProperty(value="监测IP", required=true) - private String jcIp; - @ApiModelProperty(value="封堵IP", required=true) - private String fdIp; - @ApiModelProperty(value="操作员", required=true) - private Long czyid; - @ApiModelProperty(value="操作时间", required=true) - private Date opTime; - private Date lastUpdate; - private Long procSeq; - - /** - * lastUpdate - * @return lastUpdate - */ - @JsonIgnore - public Date getLastUpdate() { - return lastUpdate; - } - - /** - * @param lastUpdate the lastUpdate to set - */ - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * procSeq - * @return procSeq - */ - @JsonIgnore - public Long getProcSeq() { - return procSeq; - } - - /** - * @param procSeq the procSeq to set - */ - public void setProcSeq(Long procSeq) { - this.procSeq = procSeq; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name == null ? null : name.trim(); - } - - public Long getFwqId() { - return fwqId; - } - - public void setFwqId(Long fwqId) { - this.fwqId = fwqId; - } - - public String getJcIp() { - return jcIp; - } - - public void setJcIp(String jcIp) { - this.jcIp = jcIp == null ? null : jcIp.trim(); - } - - public String getFdIp() { - return fdIp; - } - - public void setFdIp(String fdIp) { - this.fdIp = fdIp == null ? null : fdIp.trim(); - } - - public Long getCzyid() { - return czyid; - } - - public void setCzyid(Long czyid) { - this.czyid = czyid; - } -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @JsonSerialize(using=JsonDateSerializer.class) - public Date getOpTime() { - return opTime; - } - - public void setOpTime(Date opTime) { - this.opTime = opTime; - } -} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/JdjInfoSource.java b/src/main/java/com/nis/domain/restful/JdjInfoSource.java deleted file mode 100644 index 62fe796..0000000 --- a/src/main/java/com/nis/domain/restful/JdjInfoSource.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - *@Title: JdjInfoSource.java - *@Package com.nis.domain.restful - *@Description TODO - *@author dell - *@date 2016年9月9日 上午9:53:04 - *@version 版本号 - */ -package com.nis.domain.restful; - -import java.util.Date; -import java.util.List; - -/** - * @ClassName: JdjInfoSource.java - * @Description: TODO - * @author (wx) - * @date 2016年9月9日 上午9:53:04 - * @version V1.0 - */ -public class JdjInfoSource extends ConfigCommonSource{ - - /** - * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) - * - * @since 1.0.0 - */ - - private static final long serialVersionUID = 262835095511967504L; - private static final String DEFAULT_VERSION = "1.0"; - private List jdjInfoList; - - - /** - * 创建一个新的实例 JdjInfoSource. - * - */ - public JdjInfoSource() { - super(); - // TODO Auto-generated constructor stub - this.version=DEFAULT_VERSION; - } - public JdjInfoSource(String version) { - this.version=version; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @param version 要设置的 version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return operator - */ - public String getOperator() { - return operator; - } - - /** - * @param operator 要设置的 operator - */ - public void setOperator(String operator) { - this.operator = operator; - } - - - /** - * @return opTime - */ - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime 要设置的 opTime - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - - - /** - * @return opAction - */ - public Integer getOpAction() { - return opAction; - } - - /** - * @param opAction 要设置的 opAction - */ - public void setOpAction(Integer opAction) { - this.opAction = opAction; - } - - /** - * jdjInfoList - * @return jdjInfoList - */ - - public List getJdjInfoList() { - return jdjInfoList; - } - /** - * @param jdjInfoList the jdjInfoList to set - */ - public void setJdjInfoList(List jdjInfoList) { - this.jdjInfoList = jdjInfoList; - } -} diff --git a/src/main/java/com/nis/domain/restful/NumRegionTest.java b/src/main/java/com/nis/domain/restful/NumRegionTest.java deleted file mode 100644 index 6e8f271..0000000 --- a/src/main/java/com/nis/domain/restful/NumRegionTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @Title: NumRegion.java -* @Package com.nis.domain.restful -* @Description: TODO(用一句话描述该文件做什么) -* @author (darnell) -* @date 2016年8月29日 下午10:46:00 -* @version V1.0 -*/ -package com.nis.domain.restful; - - -/** -* @ClassName: NumRegion -* @Description: TODO(这里用一句话描述这个类的作用) -* @author (darnell) -* @date 2016年8月29日 下午10:46:00 -* @version V1.0 -*/ -public class NumRegionTest extends NumRegion{ - - /** - * - */ - private static final long serialVersionUID = 8992364895523569799L; - - - - -} diff --git a/src/main/java/com/nis/restful/RestBusinessCode.java b/src/main/java/com/nis/restful/RestBusinessCode.java index 15eff0d..c4bf1e4 100644 --- a/src/main/java/com/nis/restful/RestBusinessCode.java +++ b/src/main/java/com/nis/restful/RestBusinessCode.java @@ -32,8 +32,7 @@ public enum RestBusinessCode { /** * 操作行为错误,1-插入2-更新 3-删除4-查询 ,插入时选择了删除这种错误返回该异常代码 */ - - op_action_error (1003,"不正确的操作行为"), + op_action_error (4002000,"不正确的操作行为"), config_integrity_error (1004,"配置完整性错误或数据格式错误"), @@ -79,11 +78,11 @@ public enum RestBusinessCode { ActionIsNull(4001004, "Maat配置的action不能为空"), /** - * 编译配置的的compileId不能为空 + * 编译配置的doBlacklist不能为空 */ DoBlacklistIsNull(4001005, "Maat配置的doBlacklist不能为空"), /** - * 编译配置的的compileId不能为空 + * 编译配置的的doBlacklist不在有效范围 */ DoBlacklistIsWrongRange(4001006, "Maat配置的doBlacklist的值不在有效范围"), @@ -92,7 +91,7 @@ public enum RestBusinessCode { */ DoLogIsNull(4001007, "Maat编译配置的doLog不能为空"), /** - * 编译配置的的doLog不能为空 + * 编译配置的的doLog不在有效范围 */ DoLogIsWrongRange(4001008, "Maat配置的doLog的值不在有效范围"), /** @@ -155,9 +154,9 @@ public enum RestBusinessCode { // GroupsOpTimeIsNull(400137, "编译配置的的配置分组的opTime不能为空"), /** - * 域配置的groupid在配置分组关系中不存在 + * 域配置的groupId在配置分组关系中不存在 */ - RegionsGroupIdIsNotFound(4001103, "域配置的groupid在配置分组关系中不存在"), + RegionsGroupIdIsNotFound(4001103, "域配置的groupId在配置分组关系中不存在"), /** *域配置的regionId不能为空 */ @@ -252,7 +251,7 @@ public enum RestBusinessCode { /** * 字符串类域配置的exprType不能为空 */ - ExprTypeIsNull(4001403,"字符串类域配置的keywords不能为空"), + ExprTypeIsNull(4001403,"字符串类域配置的exprType不能为空"), /** * 字符串类域配置的matchMethod不能为空 @@ -356,12 +355,12 @@ public enum RestBusinessCode { IsValidNonUniq(4002011, "状态更新操作,所有配置的isValid值必须相同"), /** - * 配置分组中同一groupId出现多次 + * 配置分组中同一groupId不能重复出现多次 */ - GroupIdIsRepeat(4002100,"Maat配置分组groupId不能重复"), + GroupIdIsRepeat(4002100,"Maat配置分组中groupId不能重复出现多次"), /** - * tableName与编译配置业务类型不一致 + * 当前编译配置service与域配置tableName的关系不存在 */ TableNameUnmatchService(4002101, "当前编译配置service与域配置tableName的关系不存在"), @@ -374,14 +373,14 @@ public enum RestBusinessCode { */ UpBoundaryIsWrongRange(4002201, "数值域-配置upBoundary值不在有效范围内"), /** - *数值域配置的lowBoundary大于upBoundary值 + *数值域-配置lowBoundary必须小于upBoundary */ LowBoundaryGTUpBoundary(4002202, "数值域-配置lowBoundary必须小于upBoundary"), /** - * IP类域配置的direction的值不在有效范围 + * IP类域配置的direction的值不在有效范围,只能是0或1 */ - DirectionIsWrongRange(4002300,"IP类域-direction的值只能是0或1"), + DirectionIsWrongRange(4002300,"IP类域-direction的值不在有效范围,只能是0或1"), /** * IP类域配置的IP或IpMask与addrType不一致 @@ -423,20 +422,20 @@ public enum RestBusinessCode { ServiceIsWrong(4002600,"service的值配置不正确"), /** - * 回调类ipType属性只能为4(IPV4)、6(IPV6) + * 回调类-ipType属性值不在有效范围 */ - IpTypeIsWrong(4002601,"ipType属性只能为4(IPV4)、6(IPV6)"), + IpTypeIsWrong(4002601,"回调类-ipType属性值不在有效范围"), /** * 回调类的XX属性不是数值类型 */ MastNumberic(4002602,"属性值不是数值类型"), /** - * 回调类的XX属性不是数值类型 + * 回调类的XX属性不是日期类型或不是规范的日期串 */ - MastDate(4002602,"属性值不是日期类型"), + MastDate(4002602,"属性值不是日期类型或不是规范的日期串"), /** - * 回调类的XX属性不是数值类型 + * 回调类的IP或Mask与addrType不一致 */ IpIsUnMatchType(4002603,"配置IP或Mask与addrType不一致"), /** @@ -575,22 +574,9 @@ public enum RestBusinessCode { * 状态更新操作中更新内容Map不能为空 */ ConfigInfoMapIsNull(5004005,"状态更新操作中更新内容Map不能为空"), - - ; - - - - - - - - - - - private final int value; //错误码 private final String errorReason; //错误原因 diff --git a/src/main/java/com/nis/util/CompileVal.java b/src/main/java/com/nis/util/CompileVal.java index 0af63d7..50aae70 100644 --- a/src/main/java/com/nis/util/CompileVal.java +++ b/src/main/java/com/nis/util/CompileVal.java @@ -14,23 +14,11 @@ import com.nis.domain.restful.NumRegion; import com.nis.domain.restful.StrRegion; import com.nis.listener.SystemConfigListener; import com.nis.restful.RestBusinessCode; +import com.nis.restful.RestServiceException; import com.nis.web.service.restful.ConfigSourcesService; public class CompileVal { - private static Integer businessCode = null; - /** - * @param businessCode the businessCode to set - */ - public static void setBusinessCode(Integer businessCode) { - CompileVal.businessCode = businessCode; - } - /** - * @return the businessCode - */ - public static Integer getBusinessCode() { - return businessCode; - } /** * 判断当前编译配置中的groupNum属性值与配置分组groupList大小是否小于等于8且大于0 * @@ -42,52 +30,40 @@ public class CompileVal { * */ @SuppressWarnings("null") - public static String groupNumAndListIsOk(ConfigCompile configCompile, boolean isUpdate) { + public static void groupNumAndListIsOk(ConfigCompile configCompile, boolean isUpdate) throws Exception{ if (null != configCompile) { if (!isUpdate && Constants.BASE_VALIDATE) { - String valCompile = valCompile(configCompile); - if (!valCompile.equals("ok")) { - return valCompile; - } + valCompile(configCompile); } if (null != configCompile.getGroupNum() && configCompile.getGroupNum() <= 0) { - businessCode = RestBusinessCode.GroupNumIsZero.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中" - + RestBusinessCode.GroupNumIsZero.getErrorReason(); + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中" + + RestBusinessCode.GroupNumIsZero.getErrorReason(),RestBusinessCode.GroupNumIsZero.getValue()); } if (null != configCompile.getGroupNum() && configCompile.getGroupNum() > 8) { - businessCode = RestBusinessCode.GroupNumGtEight.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中" - + RestBusinessCode.GroupNumGtEight.getErrorReason(); + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中" + + RestBusinessCode.GroupNumGtEight.getErrorReason(),RestBusinessCode.GroupNumGtEight.getValue()); } if (null == configCompile.getGroupRelationList()||configCompile.getGroupRelationList().size()==0) { - businessCode = RestBusinessCode.CompileGroupIsNull.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中" - + RestBusinessCode.CompileGroupIsNull.getErrorReason(); + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中" + + RestBusinessCode.CompileGroupIsNull.getErrorReason(),RestBusinessCode.CompileGroupIsNull.getValue()); } if (configCompile.getGroupRelationList().size() != configCompile.getGroupNum()) { - businessCode = RestBusinessCode.GroupNumNEQGroupList.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中" - + RestBusinessCode.GroupNumNEQGroupList.getErrorReason(); + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中" + + RestBusinessCode.GroupNumNEQGroupList.getErrorReason(),RestBusinessCode.GroupNumNEQGroupList.getValue()); } if (!isUpdate) { - if (configCompile.getIsValid() != 1) { - businessCode = RestBusinessCode.IsValidIsT.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置在添加时不能为无效"; + if (configCompile.getIsValid() != 1) + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置在添加时不能为无效",RestBusinessCode.IsValidIsT.getValue());{ } } else { - businessCode = RestBusinessCode.IsValidIsF.getValue(); - if (configCompile.getIsValid() != 0) { - return "编译配置id为" + configCompile.getCompileId() + "的配置在修改时不能为有效"; - } + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } - return "ok"; } else { - return RestBusinessCode.CompileIsNull.getErrorReason(); + throw new RestServiceException(RestBusinessCode.CompileIsNull.getErrorReason(),RestBusinessCode.CompileIsNull.getValue()); } } @@ -100,14 +76,11 @@ public class CompileVal { * @return CompileGroupSizeGtZero CompileGroupSizeEqZero * CompileGroupIdNotExist CompileGroupIdIsRepeat GroupListEQZero */ - public static String compileGroupSizeIsGtZero(ConfigCompile configCompile, boolean isUpdate, StringBuffer sb) { + public static void compileGroupSizeIsGtZero(ConfigCompile configCompile, boolean isUpdate, StringBuffer sb) throws Exception { Long compileId = configCompile.getCompileId(); if (!isUpdate && Constants.SERVICE_VALIDATE) { - String serviceConfigCompileVal = serviceConfigCompileVal(configCompile); - if (!serviceConfigCompileVal.equals("ok")) { - return serviceConfigCompileVal; - } + serviceConfigCompileVal(configCompile); } List groupList = new ArrayList();// 配置分组中groupId集合 @@ -115,34 +88,27 @@ public class CompileVal { if (groupRelationList.size() > 0) { for (ConfigGroupRelation configGroupRelation : groupRelationList) { if (!isUpdate && (null == configGroupRelation.getIsValid() || configGroupRelation.getIsValid() != 1)) { - businessCode = RestBusinessCode.IsValidIsT.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置groupRelationList字段中的groupId为" - + configGroupRelation.getGroupId() + "的配置在添加时不能为无效"; + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置groupRelationList字段中的groupId为" + + configGroupRelation.getGroupId() + "的配置在添加时不能为无效",RestBusinessCode.IsValidIsT.getValue()); } if (isUpdate && (null == configGroupRelation.getIsValid() || configGroupRelation.getIsValid() != 0)) { - businessCode = RestBusinessCode.IsValidIsF.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置groupRelationList字段中的groupId为" - + configGroupRelation.getGroupId() + "的配置在修改时不能为有效"; + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置groupRelationList字段中的groupId为" + + configGroupRelation.getGroupId() + "的配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } if (!isUpdate && Constants.BASE_VALIDATE) { - String valCompileGroup = valCompileGroup(configGroupRelation, compileId); - if (!valCompileGroup.equals("ok")) { - return valCompileGroup; - } + valCompileGroup(configGroupRelation, compileId); } if (!configGroupRelation.getCompileId().equals(compileId)) { - businessCode = RestBusinessCode.CompileIdIsNeq.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中groupRelationList字段中的groupId为" - + configGroupRelation.getGroupId() + "的配置分组与编译配置id不一致"; + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中groupRelationList字段中的groupId为" + + configGroupRelation.getGroupId() + "的配置分组与编译配置id不一致", RestBusinessCode.CompileIdIsNeq.getValue()); } if (!groupList.contains(configGroupRelation.getGroupId())) { groupList.add(configGroupRelation.getGroupId()); } else { - businessCode = RestBusinessCode.GroupIdIsRepeat.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中groupRelationList存在多个groupId为" - + configGroupRelation.getGroupId() + "的配置分组"; + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中groupRelationList存在多个groupId为" + + configGroupRelation.getGroupId() + "的配置分组",RestBusinessCode.GroupIdIsRepeat.getValue()); } } } @@ -150,9 +116,8 @@ public class CompileVal { List regionGroupIdList = new ArrayList();// 所有域配置中groupId的集合,不重复 List numRegionList = configCompile.getNumRegionList(); if (numRegionList == null) { - businessCode = RestBusinessCode.NumRegionIsNull.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中" - + RestBusinessCode.NumRegionIsNull.getErrorReason(); + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中" + + RestBusinessCode.NumRegionIsNull.getErrorReason(),RestBusinessCode.NumRegionIsNull.getValue()); } if (numRegionList.size() > 0) { for (NumRegion numRegion : numRegionList) { @@ -161,25 +126,21 @@ public class CompileVal { if (!StringUtil.isEmpty(numRegion.getTableName()) && !type2TableNameIsOk(configCompile.getService(), numRegion.getTableName())) { - businessCode = RestBusinessCode.TableNameUnmatchService.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为" - + numRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionId为" + + numRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致",RestBusinessCode.TableNameUnmatchService.getValue()); } if (!isUpdate && numRegion.getIsValid() != 1) { - businessCode = RestBusinessCode.IsValidIsT.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为" - + numRegion.getRegionId() + "的域配置在添加时不能为无效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionId为" + + numRegion.getRegionId() + "的域配置在添加时不能为无效",RestBusinessCode.IsValidIsT.getValue()); } if (isUpdate && numRegion.getIsValid() != 0) { - businessCode = RestBusinessCode.IsValidIsF.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为" - + numRegion.getRegionId() + "的域配置在修改时不能为有效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionId为" + + numRegion.getRegionId() + "的域配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } if (groupList.size() > 0 && !groupList.contains(numRegion.getGroupId())) { - businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为" - + numRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionId为" + + numRegion.getRegionId() + "的配置的groupId在配置分组关系中不存在",RestBusinessCode.RegionsGroupIdIsNotFound.getValue()); } if (!regionGroupIdList.contains(numRegion.getGroupId())) { @@ -187,25 +148,18 @@ public class CompileVal { } if (!isUpdate && Constants.BASE_VALIDATE) { - String valNumRegion = valNumRegion(numRegion, compileId); - if (!valNumRegion.equals("ok")) { - return valNumRegion; - } + valNumRegion(numRegion, compileId); } if (!isUpdate && Constants.SERVICE_VALIDATE) { - String serviceNumRegionVal = serviceNumRegionVal(numRegion, compileId); - if (!serviceNumRegionVal.equals("ok")) { - return serviceNumRegionVal; - } + serviceNumRegionVal(numRegion, compileId); } } } List strRegionList = configCompile.getStrRegionList(); if (strRegionList == null) { - businessCode = RestBusinessCode.StrRegionIsNull.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中" - + RestBusinessCode.StrRegionIsNull.getErrorReason(); + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中" + + RestBusinessCode.StrRegionIsNull.getErrorReason(),RestBusinessCode.StrRegionIsNull.getValue()); } if (strRegionList != null && strRegionList.size() > 0) { for (StrRegion strRegion : strRegionList) { @@ -213,25 +167,21 @@ public class CompileVal { // !regionGroupIdList.contains(strRegion.getGroupId())) { if (!StringUtil.isEmpty(strRegion.getTableName()) && !type2TableNameIsOk(configCompile.getService(), strRegion.getTableName())) { - businessCode = RestBusinessCode.TableNameUnmatchService.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为" - + strRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionId为" + + strRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致",RestBusinessCode.TableNameUnmatchService.getValue()); } if (!isUpdate && strRegion.getIsValid() != 1) { - businessCode = RestBusinessCode.IsValidIsT.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为" - + strRegion.getRegionId() + "的域配置在添加时不能为无效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionId为" + + strRegion.getRegionId() + "的域配置在添加时不能为无效",RestBusinessCode.IsValidIsT.getValue()); } if (isUpdate && strRegion.getIsValid() != 0) { - businessCode = RestBusinessCode.IsValidIsF.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为" - + strRegion.getRegionId() + "的域配置在修改时不能为有效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionId为" + + strRegion.getRegionId() + "的域配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } if (groupList.size() > 0 && !groupList.contains(strRegion.getGroupId())) { - businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为" - + strRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionId为" + + strRegion.getRegionId() + "的配置的groupId在配置分组关系中不存在",RestBusinessCode.RegionsGroupIdIsNotFound.getValue()); } if (!regionGroupIdList.contains(strRegion.getGroupId())) { @@ -239,72 +189,54 @@ public class CompileVal { } if (!isUpdate && Constants.BASE_VALIDATE) { - String valStrRegion = valStrRegion(strRegion, compileId, + valStrRegion(strRegion, compileId, ConfigSourcesService.isStrStrongRegion(strRegion.getTableName(),configCompile.getService())); - if (!valStrRegion.equals("ok")) { - return valStrRegion; - } } if (!isUpdate && Constants.SERVICE_VALIDATE) { - String serviceStrRegionVal = serviceStrRegionVal(strRegion, compileId, + serviceStrRegionVal(strRegion, compileId, ConfigSourcesService.isStrStrongRegion(strRegion.getTableName(),configCompile.getService())); - if (!serviceStrRegionVal.equals("ok")) { - return serviceStrRegionVal; - } } } } List ipRegionList = configCompile.getIpRegionList(); - if (ipRegionList == null) { - businessCode = RestBusinessCode.IpRegionIsNull.getValue(); - return "编译配置id为" + configCompile.getCompileId() + "的配置中" - + RestBusinessCode.IpRegionIsNull.getErrorReason(); - } - if (ipRegionList != null && ipRegionList.size() > 0) { + if (ipRegionList == null || ipRegionList.size() == 0) { + throw new RestServiceException("编译配置id为" + configCompile.getCompileId() + "的配置中" + + RestBusinessCode.IpRegionIsNull.getErrorReason(),RestBusinessCode.IpRegionIsNull.getValue()); + } else { for (IpRegion ipRegion : ipRegionList) { // if (configCompile.getIsValid() != 0 && // !regionGroupIdList.contains(ipRegion.getGroupId())) { if (!StringUtil.isEmpty(ipRegion.getTableName()) && !type2TableNameIsOk(configCompile.getService(), ipRegion.getTableName())) { - businessCode = RestBusinessCode.TableNameUnmatchService.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为" - + ipRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionId为" + + ipRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致",RestBusinessCode.TableNameUnmatchService.getValue()); } if (!isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 1)) { - businessCode = RestBusinessCode.IsValidIsT.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为" - + ipRegion.getRegionId() + "的域配置在添加时不能为无效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionId为" + + ipRegion.getRegionId() + "的域配置在添加时不能为无效",RestBusinessCode.IsValidIsT.getValue()); } if (isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 0)) { - businessCode = RestBusinessCode.IsValidIsF.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为" - + ipRegion.getRegionId() + "的域配置在修改时不能为有效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionId为" + + ipRegion.getRegionId() + "的域配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } if (groupList.size() > 0 && !groupList.contains(ipRegion.getGroupId())) { - businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为" - + ipRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在"; + throw new RestServiceException( "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionId为" + + ipRegion.getRegionId() + "的配置的groupId在配置分组关系中不存在",RestBusinessCode.RegionsGroupIdIsNotFound.getValue()); } if (!regionGroupIdList.contains(ipRegion.getGroupId())) { regionGroupIdList.add(ipRegion.getGroupId()); } if (!isUpdate && Constants.BASE_VALIDATE) { - String valIpRegion = valIpRegion(ipRegion, compileId); - if (!valIpRegion.equals("ok")) { - return valIpRegion; - } + valIpRegion(ipRegion, compileId); } if (!isUpdate && Constants.SERVICE_VALIDATE) { - String serviceIpRegionVal = serviceIpRegionVal(ipRegion, compileId); - if (!serviceIpRegionVal.equals("ok")) { - return serviceIpRegionVal; - } + serviceIpRegionVal(ipRegion, compileId,"ipRegionList"); } } } @@ -319,37 +251,28 @@ public class CompileVal { // 不验证表名和业务类型是否对应 if (!isUpdate && digestRegion.getIsValid() != 1) { - businessCode = RestBusinessCode.IsValidIsT.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为" - + digestRegion.getRegionId() + "的域配置在添加时不能为无效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionId为" + + digestRegion.getRegionId() + "的域配置在添加时不能为无效",RestBusinessCode.IsValidIsT.getValue()); } if (isUpdate && digestRegion.getIsValid() != 0) { - businessCode = RestBusinessCode.IsValidIsF.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为" - + digestRegion.getRegionId() + "的域配置在修改时不能为有效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionId为" + + digestRegion.getRegionId() + "的域配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } if (groupList.size() > 0 && !groupList.contains(digestRegion.getGroupId())) { - businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中digestRegion中的regionid为" - + digestRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中digestRegion中的regionId为" + + digestRegion.getRegionId() + "的配置的groupId在配置分组关系中不存在",RestBusinessCode.RegionsGroupIdIsNotFound.getValue()); } 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; - } + valDigestRegion(digestRegion, compileId); } if (!isUpdate && Constants.SERVICE_VALIDATE) { - String serviceDigestRegionVal = serviceDigestRegionVal(digestRegion, compileId); - if (!serviceDigestRegionVal.equals("ok")) { - return serviceDigestRegionVal; - } + serviceDigestRegionVal(digestRegion, compileId); } } } @@ -362,47 +285,36 @@ public class CompileVal { // !regionGroupIdList.contains(ipRegion.getGroupId())) { if (!StringUtil.isEmpty(ipRegion.getTableName()) && !type2TableNameIsOk(configCompile.getService(), ipRegion.getTableName())) { - businessCode = RestBusinessCode.TableNameUnmatchService.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为" - + ipRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionId为" + + ipRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致",RestBusinessCode.TableNameUnmatchService.getValue()); } if (!isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 1)) { - businessCode = RestBusinessCode.IsValidIsT.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为" - + ipRegion.getRegionId() + "的域配置在添加时不能为无效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionId为" + + ipRegion.getRegionId() + "的域配置在添加时不能为无效",RestBusinessCode.IsValidIsT.getValue()); } if (isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 0)) { - businessCode = RestBusinessCode.IsValidIsF.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为" - + ipRegion.getRegionId() + "的域配置在修改时不能为有效"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionId为" + + ipRegion.getRegionId() + "的域配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } if (groupList.size() > 0 && !groupList.contains(ipRegion.getGroupId())) { - businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue(); - return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为" - + ipRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在"; + throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionId为" + + ipRegion.getRegionId() + "的配置的groupId在配置分组关系中不存在",RestBusinessCode.RegionsGroupIdIsNotFound.getValue()); } if (!regionGroupIdList.contains(ipRegion.getGroupId())) { regionGroupIdList.add(ipRegion.getGroupId()); } if (!isUpdate && Constants.BASE_VALIDATE) { - String valIpRegion = valIpRegion(ipRegion, compileId); - if (!valIpRegion.equals("ok")) { - return valIpRegion; - } + valIpRegion(ipRegion, compileId); } if (!isUpdate && Constants.SERVICE_VALIDATE) { - String serviceIpRegionVal = serviceIpClientRegionVal(ipRegion, compileId); - if (!serviceIpRegionVal.equals("ok")) { - return serviceIpRegionVal; - } + serviceIpRegionVal(ipRegion, compileId,"ipClientRangeList"); } } } - return "ok"; } /** @@ -450,25 +362,19 @@ public class CompileVal { * GroupNumEQZero GroupListEQZero CompileGroupSizeEqZero * CompileGroupIdNotExist CompileGroupIdIsRepeat CompileIsOk * 只有返回CompileIsOk才说明该条配置正常否则该条配置不正常,可根据枚举中成员的注释具体在返回错误信息 + * @throws Exception */ - public static String compileIsOk(ConfigCompile configCompile, boolean isUpdate, StringBuffer sb) { + public static void compileIsOk(ConfigCompile configCompile, boolean isUpdate, StringBuffer sb) throws Exception { - String msg1 = groupNumAndListIsOk(configCompile, isUpdate); - if (!"ok".equals(msg1)) { - return msg1; - } - - String msg2 = compileGroupSizeIsGtZero(configCompile, isUpdate, sb); - if (!"ok".equals(msg2)) { - return msg2; - } + groupNumAndListIsOk(configCompile, isUpdate); + compileGroupSizeIsGtZero(configCompile, isUpdate, sb); String latentMsg = ",数据中可能存在的问题:"; if (sb.length() > 0 && !sb.toString().contains(latentMsg)) { latentMsg = latentMsg + sb.toString(); sb.setLength(0); sb.append(latentMsg); } - return "ok"; + } public static void setSbStr(String str, StringBuffer sb) { @@ -477,601 +383,376 @@ public class CompileVal { } } - public static String valCompile(ConfigCompile configCompile) { + public static void valCompile(ConfigCompile configCompile) throws Exception { Long compileId = configCompile.getCompileId(); if (null == compileId) { - businessCode = RestBusinessCode.CompileIdIsNull.getValue(); - return RestBusinessCode.CompileIdIsNull.getErrorReason(); + throw new RestServiceException(RestBusinessCode.CompileIdIsNull.getErrorReason(),RestBusinessCode.CompileIdIsNull.getValue()); } if (null == configCompile.getService()) { - businessCode = RestBusinessCode.ServiceIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中service不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中service不能为空",RestBusinessCode.ServiceIsNull.getValue()); } if (null == configCompile.getAction()) { - businessCode = RestBusinessCode.ActionIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中action不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中action不能为空",RestBusinessCode.ActionIsNull.getValue()); } if (null == configCompile.getDoBlacklist()) { - businessCode = RestBusinessCode.DoBlacklistIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中doBlacklist不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中doBlacklist不能为空",RestBusinessCode.DoBlacklistIsNull.getValue()); } if (null == configCompile.getDoLog()) { - businessCode = RestBusinessCode.DoLogIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中doLog不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中doLog不能为空",RestBusinessCode.DoLogIsNull.getValue()); } if (null == configCompile.getEffectiveRange() || configCompile.getEffectiveRange().equals("")) { - businessCode = RestBusinessCode.EffectiveRangeIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中effectiveRange不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中effectiveRange不能为空",RestBusinessCode.EffectiveRangeIsNull.getValue()); } if (null == configCompile.getStartTime()) { - businessCode = RestBusinessCode.StartTimeIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中startTime不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中startTime不能为空",RestBusinessCode.StartTimeIsNull.getValue()); } if (null == configCompile.getEndTime()) { - businessCode = RestBusinessCode.EndTimeIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中endTime不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中endTime不能为空",RestBusinessCode.EndTimeIsNull.getValue()); } // if (null == configCompile.getUserRegion() || configCompile.getUserRegion().equals("")) { // return "编译配置id为" + compileId + "的编译配置中userRegion不能为空"; // } if (null == configCompile.getIsValid()) { - businessCode = RestBusinessCode.IsValidIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中isValid不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中isValid不能为空", RestBusinessCode.IsValidIsNull.getValue()); } if (null == configCompile.getGroupNum()) { - businessCode = RestBusinessCode.GroupNumIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中groupNum不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中groupNum不能为空",RestBusinessCode.GroupNumIsNull.getValue()); } if (null == configCompile.getFatherCfgId()) { - businessCode = RestBusinessCode.FatherCfgIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中fatherCfgId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中fatherCfgId不能为空",RestBusinessCode.FatherCfgIdIsNull.getValue()); } if (null == configCompile.getOpTime()) { - businessCode = RestBusinessCode.OpTimeIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中opTime不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中opTime不能为空",RestBusinessCode.OpTimeIsNull.getValue()); } - return "ok"; } - public static String valCompileGroup(ConfigGroupRelation configGroupRelation, Long compileId) { + public static void valCompileGroup(ConfigGroupRelation configGroupRelation, Long compileId) throws Exception{ Long groupId = configGroupRelation.getGroupId(); if (null == groupId) { - businessCode = RestBusinessCode.GroupIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的配置分组的groupId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的配置分组的groupId不能为空",RestBusinessCode.GroupIdIsNull.getValue()); } if (null == configGroupRelation.getCompileId()) { - businessCode = RestBusinessCode.GroupsCompileIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置compileId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置compileId不能为空",RestBusinessCode.GroupsCompileIdIsNull.getValue()); } if (null == configGroupRelation.getIsValid()) { - businessCode = RestBusinessCode.GroupsIsValidIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置isValid不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置isValid不能为空",RestBusinessCode.GroupsIsValidIsNull.getValue()); } if (null == configGroupRelation.getOpTime()) { - businessCode = RestBusinessCode.OpTimeIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置opTime不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置opTime不能为空",RestBusinessCode.OpTimeIsNull.getValue()); } - return "ok"; } - public static String valIpRegion(IpRegion ipRegion, Long compileId) { + public static void valIpRegion(IpRegion ipRegion, Long compileId) { Long regionId = ipRegion.getRegionId(); if (null == regionId) { - businessCode = RestBusinessCode.RegionIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置的regionId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置的regionId不能为空",RestBusinessCode.RegionIdIsNull.getValue()); } if (null == ipRegion.getGroupId()) { - businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置groupId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置groupId不能为空",RestBusinessCode.RegionsGroupIdIsNull.getValue()); } if (null == ipRegion.getAddrType()) { - businessCode = RestBusinessCode.AddrTypeIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置addrType不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置addrType不能为空",RestBusinessCode.AddrTypeIsNull.getValue()); } if (null == ipRegion.getSrcIp() || ipRegion.getSrcIp().equals("")) { - businessCode = RestBusinessCode.SrcIpIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcIp不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcIp不能为空",RestBusinessCode.SrcIpIsNull.getValue()); } if (null == ipRegion.getMaskSrcIp() || ipRegion.getMaskSrcIp().equals("")) { - businessCode = RestBusinessCode.MaskSrcIpIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcIp不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcIp不能为空",RestBusinessCode.MaskSrcIpIsNull.getValue()); } if (null == ipRegion.getSrcPort() || ipRegion.getSrcPort().equals("")) { - businessCode = RestBusinessCode.SrcPortIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcPort不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcPort不能为空",RestBusinessCode.SrcPortIsNull.getValue()); } if (null == ipRegion.getMaskSrcPort() || ipRegion.getMaskSrcPort().equals("")) { - businessCode = RestBusinessCode.MaskSrcPortIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcPort不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcPort不能为空",RestBusinessCode.MaskSrcPortIsNull.getValue()); } if (null == ipRegion.getDstIp() || ipRegion.getDstIp().equals("")) { - businessCode = RestBusinessCode.DstIpIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstIp不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstIp不能为空",RestBusinessCode.DstIpIsNull.getValue()); } if (null == ipRegion.getMaskDstIp() || ipRegion.getMaskDstIp().equals("")) { - businessCode = RestBusinessCode.MaskDstIpIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstIp不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstIp不能为空",RestBusinessCode.MaskDstIpIsNull.getValue()); } if (null == ipRegion.getDstPort() || ipRegion.getDstPort().equals("")) { - businessCode = RestBusinessCode.DstPortIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstPort不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstPort不能为空",RestBusinessCode.DstPortIsNull.getValue()); } if (null == ipRegion.getMaskDstPort() || ipRegion.getMaskDstPort().equals("")) { - businessCode = RestBusinessCode.MaskDstPortIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstPort不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstPort不能为空",RestBusinessCode.MaskDstPortIsNull.getValue()); } if (null == ipRegion.getProtocol()) { - businessCode = RestBusinessCode.ProtocolIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置protocol不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置protocol不能为空",RestBusinessCode.ProtocolIsNull.getValue()); } if (null == ipRegion.getDirection()) { - businessCode = RestBusinessCode.DirectionIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置direction不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置direction不能为空",RestBusinessCode.DirectionIsNull.getValue()); } if (null == ipRegion.getIsValid()) { - businessCode = RestBusinessCode.IsValidIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置isValid不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置isValid不能为空",RestBusinessCode.IsValidIsNull.getValue()); } - return "ok"; } - public static String valNumRegion(NumRegion numRegion, Long compileId) { + public static void valNumRegion(NumRegion numRegion, Long compileId) throws Exception{ Long regionId = numRegion.getRegionId(); if (null == regionId) { - businessCode = RestBusinessCode.RegionIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的数值类域配置的regionId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的数值类域配置的regionId不能为空",RestBusinessCode.RegionIdIsNull.getValue()); } if (null == numRegion.getGroupId()) { - businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置groupId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置groupId不能为空",RestBusinessCode.RegionsGroupIdIsNull.getValue()); } if (null == numRegion.getLowBoundary()) { - businessCode = RestBusinessCode.LowBoundaryIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置lowBoundary不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置lowBoundary不能为空",RestBusinessCode.LowBoundaryIsNull.getValue()); } if (null == numRegion.getUpBoundary()) { - businessCode = RestBusinessCode.UpBoundaryIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置upBoundary不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置upBoundary不能为空",RestBusinessCode.UpBoundaryIsNull.getValue()); } - return "ok"; } - public static String valStrRegion(StrRegion strRegion, Long compileId, boolean isDirtrict) { + public static void valStrRegion(StrRegion strRegion, Long compileId, boolean isDirtrict) throws Exception{ Long regionId = strRegion.getRegionId(); if (null == regionId) { - businessCode = RestBusinessCode.RegionIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置的regionId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置的regionId不能为空",RestBusinessCode.RegionIdIsNull.getValue()); } if (null == strRegion.getGroupId()) { - businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置groupId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置groupId不能为空",RestBusinessCode.RegionsGroupIdIsNull.getValue()); } if (isDirtrict && (null == strRegion.getDistrict() || strRegion.getDistrict().equals(""))) { - businessCode = RestBusinessCode.DistrictIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置district不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置district不能为空",RestBusinessCode.DistrictIsNull.getValue()); } if (null == strRegion.getKeywords() || strRegion.getKeywords().equals("")) { - businessCode = RestBusinessCode.KeywordsIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置keywords不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置keywords不能为空",RestBusinessCode.KeywordsIsNull.getValue()); } if (null == strRegion.getExprType()) { - businessCode = RestBusinessCode.ExprTypeIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置exprType不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置exprType不能为空", RestBusinessCode.ExprTypeIsNull.getValue()); } if (null == strRegion.getMatchMethod()) { - businessCode = RestBusinessCode.MatchMethodIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置matchMethod不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置matchMethod不能为空",RestBusinessCode.MatchMethodIsNull.getValue()); } if (null == strRegion.getIsHexbin()) { - businessCode = RestBusinessCode.MatchMethodIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置isHexbin不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置isHexbin不能为空",RestBusinessCode.MatchMethodIsNull.getValue()); } - return "ok"; } - public static String valDigestRegion(DigestRegion digestRegion, Long compileId) { + public static void valDigestRegion(DigestRegion digestRegion, Long compileId) throws Exception { Long regionId = digestRegion.getRegionId(); if (null == regionId) { - businessCode = RestBusinessCode.RegionIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的摘要类域配置的regionId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的摘要类域配置的regionId不能为空",RestBusinessCode.RegionIdIsNull.getValue()); } if (null == digestRegion.getGroupId()) { - businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置groupId不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置groupId不能为空",RestBusinessCode.RegionsGroupIdIsNull.getValue()); } if (null == digestRegion.getRawLen()) { - businessCode = RestBusinessCode.RawLenIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置rawLen不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置rawLen不能为空",RestBusinessCode.RawLenIsNull.getValue()); } if (null == digestRegion.getDigest() || digestRegion.getDigest().equals("")) { - businessCode = RestBusinessCode.DigestIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置digest不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置digest不能为空",RestBusinessCode.DigestIsNull.getValue()); } if (null == digestRegion.getCfdsLevel()) { - businessCode = RestBusinessCode.CfdsLevelIsNull.getValue(); - return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置cfdsLevel不能为空"; + throw new RestServiceException("编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置cfdsLevel不能为空",RestBusinessCode.CfdsLevelIsNull.getValue()); } - return "ok"; } - public static String serviceIpClientRegionVal(IpRegion ipRegion, Long compileId) { + + private static void validateIpAndMask(IpRegion ipRegion, Long compileId,String listName) throws Exception{ //源IP信息和目的IP信息格式为IPV4或IPV6 if (ipRegion.getAddrType().intValue()==4||ipRegion.getAddrType().intValue()==6) { if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置srcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskSrcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置dstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskDstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } }else if (ipRegion.getAddrType().intValue()==46) {//4OVER6:源IP信息格式为IPV4、目的IP信息格式IPV6 if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置srcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskSrcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置dstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskDstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } }else if (ipRegion.getAddrType().intValue()==64) {//6OVER4:源IP信息格式为IPV6、目的IP信息格式IPV4 if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置srcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskSrcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置dstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskDstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } }else if (ipRegion.getAddrType().intValue()==10) {//all:符合IP格式即可 if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置srcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskSrcIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置dstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskDstIp的格式不正确或与addrType不一致",RestBusinessCode.IPUnMatchAddrType.getValue()); } } - - if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getSrcPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() + "的域配置srcPort的格式不正确"; - } - - if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskSrcPort())) { - // if (!BasicProvingUtil.isIntType(ipRegion.getMaskSrcPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcPort的格式不正确"; - } - if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getDstPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() + "的域配置dstPort的格式不正确"; - } - - if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskDstPort())) { - // if (!BasicProvingUtil.isIntType(ipRegion.getMaskDstPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstPort的格式不正确"; - } - - if (ipRegion.getSrcIp().equals(ipRegion.getDstIp())) { - businessCode = RestBusinessCode.SrcIpEQDstIp.getValue(); - return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp和dstIp不能相同"; - } - if (ipRegion.getDirection() != 1 && ipRegion.getDirection() != 0) { - businessCode = RestBusinessCode.DirectionIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() - + "的域配置direction的值不正确,只能是0或1"; - } - - // zdx protocol验证? - // if (ipRegion.getTableName().toLowerCase().equals("dj_ip_port")) { - // if (ipRegion.getProtocol() < 0 || ipRegion.getProtocol() > 255) { - // return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + - // ipRegion.getRegionId() - // + "的域配置tableName为dj_ip_port时,protocol的取值范围只能是0-255"; - // } - // } else { - // if (ipRegion.getProtocol() != 0) { - // return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + - // ipRegion.getRegionId() + "的域配置tableName为" - // + ipRegion.getTableName() + "时,protocol的值只能是0"; - // } - // - // } - return "ok"; + } - public static String serviceIpRegionVal(IpRegion ipRegion, Long compileId) { - //源IP信息和目的IP信息格式为IPV4或IPV6 - if (ipRegion.getAddrType().intValue()==4||ipRegion.getAddrType().intValue()==6) { - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), ipRegion.getAddrType())) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; - } - }else if (ipRegion.getAddrType().intValue()==46) {//4OVER6:源IP信息格式为IPV4、目的IP信息格式IPV6 - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; - } - }else if (ipRegion.getAddrType().intValue()==64) {//6OVER4:源IP信息格式为IPV6、目的IP信息格式IPV4 - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), 6)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), 4)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; - } - }else if (ipRegion.getAddrType().intValue()==10) {//all:符合IP格式即可 - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置dstIp的格式不正确或与addrType不一致"; - } - if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), null)) { - businessCode = RestBusinessCode.IPUnMatchAddrType.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstIp的格式不正确或与addrType不一致"; - } - } + public static void serviceIpRegionVal(IpRegion ipRegion, Long compileId,String listName) throws Exception { + + + validateIpAndMask(ipRegion, compileId,listName); + if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getSrcPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() + "的域配置srcPort的格式不正确"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + "的域配置srcPort的格式不正确",RestBusinessCode.PortIsNotVal.getValue()); } if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskSrcPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - // if (!BasicProvingUtil.isIntType(ipRegion.getMaskSrcPort())) { - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskSrcPort的格式不正确"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskSrcPort的格式不正确",RestBusinessCode.PortIsNotVal.getValue()); } if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getDstPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() + "的域配置dstPort的格式不正确"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + "的域配置dstPort的格式不正确",RestBusinessCode.PortIsNotVal.getValue()); } if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskDstPort())) { // if (!BasicProvingUtil.isIntType(ipRegion.getMaskDstPort())) { - businessCode = RestBusinessCode.PortIsNotVal.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置maskDstPort的格式不正确"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置maskDstPort的格式不正确",RestBusinessCode.PortIsNotVal.getValue()); } if (ipRegion.getSrcIp().equals(ipRegion.getDstIp())) { - businessCode = RestBusinessCode.SrcIpEQDstIp.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置srcIp和dstIp不能相同"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置srcIp和dstIp不能相同",RestBusinessCode.SrcIpEQDstIp.getValue()); } if (ipRegion.getDirection() != 1 && ipRegion.getDirection() != 0) { - businessCode = RestBusinessCode.DirectionIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() - + "的域配置direction的值不正确,只能是0或1"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + ipRegion.getRegionId() + + "的域配置direction的值不正确,只能是0或1",RestBusinessCode.DirectionIsWrongRange.getValue()); } // zdx protocol验证? // if (ipRegion.getTableName().toLowerCase().equals("dj_ip_port")) { // if (ipRegion.getProtocol() < 0 || ipRegion.getProtocol() > 255) { - // return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + + // return "编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + // ipRegion.getRegionId() // + "的域配置tableName为dj_ip_port时,protocol的取值范围只能是0-255"; // } // } else { // if (ipRegion.getProtocol() != 0) { - // return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + + // return "编译配置id为" + compileId + "的配置中"+listName+"中regionId为" + // ipRegion.getRegionId() + "的域配置tableName为" // + ipRegion.getTableName() + "时,protocol的值只能是0"; // } // // } - return "ok"; } - public static String serviceNumRegionVal(NumRegion numRegion, Long compileId) { + public static void serviceNumRegionVal(NumRegion numRegion, Long compileId) throws Exception { Long lowBoundary = numRegion.getLowBoundary(); Long upBoundary = numRegion.getUpBoundary(); if (lowBoundary <= upBoundary) { if (lowBoundary > 4294967295l || lowBoundary < 0l) { - businessCode = RestBusinessCode.LowBoundaryIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId() - + "的域配置lowBoundary的值不能大于2的32次方减一(4294967295)或者小于0"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId() + + "的域配置lowBoundary的值不能大于2的32次方减一(4294967295)或者小于0", RestBusinessCode.LowBoundaryIsWrongRange.getValue()); } if (upBoundary > 4294967295l || upBoundary < 0l) { - businessCode = RestBusinessCode.UpBoundaryIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId() - + "的域配置upBoundary的值不能大于2的32次方减一(4294967295)或者小于0"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId() + + "的域配置upBoundary的值不能大于2的32次方减一(4294967295)或者小于0",RestBusinessCode.UpBoundaryIsWrongRange.getValue()); } } else { - businessCode = RestBusinessCode.LowBoundaryGTUpBoundary.getValue(); - return "编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId() - + "的域配置lowBoundary的值大于upBoundary,应该是小于或等于"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId() + + "的域配置lowBoundary的值大于upBoundary,应该是小于或等于",RestBusinessCode.LowBoundaryGTUpBoundary.getValue()); } - - return "ok"; } - public static String serviceConfigCompileVal(ConfigCompile configCompile) { + public static void serviceConfigCompileVal(ConfigCompile configCompile) throws Exception { Long compileId = configCompile.getCompileId(); Integer action = ServiceAndRDBIndexReal.getActionByService(configCompile.getService()); if (StringUtil.isEmpty(action)) { - businessCode = RestBusinessCode.Service2ActionIsNull.getValue(); - return "编译配置id为" + compileId + "的配置中service与action的关系不存在"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中service与action的关系不存在",RestBusinessCode.Service2ActionIsNull.getValue()); } if (action.compareTo(configCompile.getAction()) != 0) { - businessCode = RestBusinessCode.ServiceUnmatchAction.getValue(); - return "编译配置id为" + compileId + "的配置中service的值为" + configCompile.getService() + "时action只能为" + action; + throw new RestServiceException("编译配置id为" + compileId + "的配置中service的值为" + configCompile.getService() + "时action只能为" + action,RestBusinessCode.ServiceUnmatchAction.getValue()); } if (configCompile.getDoBlacklist() != 1) { - businessCode = RestBusinessCode.DoBlacklistIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中doBlacklist的值只能是1"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中doBlacklist的值只能是1",RestBusinessCode.DoBlacklistIsWrongRange.getValue()); } if (configCompile.getDoLog() != 0 && configCompile.getDoLog() != 1 && configCompile.getDoLog() != 2) { - businessCode = RestBusinessCode.DoLogIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中doLog的值只能是0(不需要),1(需要),2(只记录结构化日志,不记录非结构化日志)"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中doLog的值只能是0(不需要),1(需要),2(只记录结构化日志,不记录非结构化日志)",RestBusinessCode.DoLogIsWrongRange.getValue()); } if (configCompile.getFatherCfgId() != 0) { - businessCode = RestBusinessCode.FatherCfgIdIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中fatherCfgId的值只能是0"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中fatherCfgId的值只能是0",RestBusinessCode.FatherCfgIdIsWrongRange.getValue()); } if (configCompile.getStartTime().getTime() > configCompile.getEndTime().getTime()) { - businessCode = RestBusinessCode.EndTimeGTStartTime.getValue(); - return "编译配置id为" + compileId + "的配置中startTime不能比endTime晚"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中startTime不能比endTime晚",RestBusinessCode.EndTimeGTStartTime.getValue()); } - return "ok"; } - public static String serviceStrRegionVal(StrRegion strRegion, Long compileId, boolean isDirtrict) { + public static void serviceStrRegionVal(StrRegion strRegion, Long compileId, boolean isDirtrict) throws Exception { Integer exprType = strRegion.getExprType(); Integer matchMethod = strRegion.getMatchMethod(); Integer isHexbin = strRegion.getIsHexbin(); if (exprType != 0 && exprType != 1) { - businessCode = RestBusinessCode.ExprTypeIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId() - + "的域配置exprType的值只能是0(无表达式)或者1(与表达式)"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId() + + "的域配置exprType的值只能是0(无表达式)或者1(与表达式)",RestBusinessCode.ExprTypeIsWrongRange.getValue()); } if (matchMethod != 0 && matchMethod != 1 && matchMethod != 2 && matchMethod != 3) { - businessCode = RestBusinessCode.MatchMethodIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId() - + "的域配置matchMethod的值只能是0(子串匹配),1(右匹配),2(左匹配),3(完全匹配)"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId() + + "的域配置matchMethod的值只能是0(子串匹配),1(右匹配),2(左匹配),3(完全匹配)",RestBusinessCode.MatchMethodIsWrongRange.getValue()); } if (isHexbin != 0 && isHexbin != 1 && isHexbin != 2) { - businessCode = RestBusinessCode.IsHexbinIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId() - + "的域配置isHexbin的值只能是0(大小写不敏感,且非HEX)或者1(HEX)或者2(大小写敏感,且非HEX)"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId() + + "的域配置isHexbin的值只能是0(大小写不敏感,且非HEX)或者1(HEX)或者2(大小写敏感,且非HEX)",RestBusinessCode.IsHexbinIsWrongRange.getValue()); } // strRegProhibitConfigWord(strRegion,compileId); - return "ok"; } - public static String serviceDigestRegionVal(DigestRegion digestRegion, Long compileId) { + public static void serviceDigestRegionVal(DigestRegion digestRegion, Long compileId) throws Exception { Integer cfdsLevel = digestRegion.getCfdsLevel(); if (!(cfdsLevel >= 1 && cfdsLevel <= 10)) { - businessCode = RestBusinessCode.CfdsLevelIsWrongRange.getValue(); - return "编译配置id为" + compileId + "的配置中digestRegionList中regionId为" + digestRegion.getRegionId() - + "的域配置cfdsLevel的值只能是1到10"; + throw new RestServiceException("编译配置id为" + compileId + "的配置中digestRegionList中regionId为" + digestRegion.getRegionId() + + "的域配置cfdsLevel的值只能是1到10",RestBusinessCode.CfdsLevelIsWrongRange.getValue()); } - return "ok"; } diff --git a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java index 25a94ec..c5beda3 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java @@ -63,43 +63,43 @@ public class ConfigSourcesController extends BaseRestController { @Autowired ConfigRedisService configRedisService; - - - + @RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.POST) @ApiOperation(value = "MAAT规则存储接口", httpMethod = "POST", response = Map.class, notes = "接收MAAT规则数据,存储到流量处理平台配置线中") @ApiParam(value = "MAAT规则对象", name = "configSource", required = true) public Map createMaatConfigSource(@RequestBody ConfigSource configSource, HttpServletRequest request, HttpServletResponse response) { - CompileVal.setBusinessCode(null); - ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 + long start = System.currentTimeMillis(); AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, configSource); StringBuffer sb = new StringBuffer(); - if (null != configSource && null != configSource.getConfigCompileList() - && configSource.getConfigCompileList().size() > 0) { - checkOpAction(thread, System.currentTimeMillis() - start, configSource.getOpAction(), Constants.OPACTION_POST); - // 验证配置编译数据 - validateConfigSource(thread, start, configSource); - String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb); - - if ("error".equals(msg)) { - Exception exception = ConfigSourcesService.getMsgList().get(0); - if (exception instanceof RestServiceException) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, - "Maat 规则存储异常:" + exception.getMessage(), CompileVal.getBusinessCode()); - }else{ - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "Maat 规则存储异常:" + exception.getMessage(), CompileVal.getBusinessCode()); - } - + try { + if (null != configSource && null != configSource.getConfigCompileList() + && configSource.getConfigCompileList().size() > 0) { + checkOpAction(thread, System.currentTimeMillis() - start, configSource.getOpAction(), Constants.OPACTION_POST); + // 验证配置编译数据 + validateConfigSource(thread, start, configSource); + configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb); + } else { + throw new RestServiceException("Maat规则不能为空", + RestBusinessCode.ConfigSourceIsNull.getValue()); } - } else { - thread.setExceptionInfo("Maat规则不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "Maat规则不能为空", - RestBusinessCode.missing_args.getValue()); + } catch (Exception e) { + // TODO: handle exception + thread.setExceptionInfo("Maat 规则存储异常:" + e.getMessage()); + if (e instanceof RestServiceException) { + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "Maat 规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + }else if(e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + "Maat 规则存储异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + }else{ + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + "Maat 规则存储异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } + } return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, @@ -111,171 +111,44 @@ public class ConfigSourcesController extends BaseRestController { @ApiParam(value = "MAAT规则对象", name = "configSource", required = true) public Map updateConfigSource(@RequestBody ConfigSource configSource, HttpServletRequest request, HttpServletResponse response) { - CompileVal.setBusinessCode(null); - ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, configSource); StringBuffer sb = new StringBuffer(); - if (null == configSource.getOpTime()) { - configSource.setOpTime(new Date()); - } - if (null != configSource && null != configSource.getConfigCompileList() - && configSource.getConfigCompileList().size() > 0) { - int opAction = configSource.getOpAction(); - checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2); - String msg = ""; - ConfigCompile compile = configSource.getConfigCompileList().get(0); - // zdx 20180528改为调用rkg接口取消配置 - msg = configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(), - configSource.getOpTime(), sb); - - if (msg.equals("error")) { - Exception exception = ConfigSourcesService.getMsgList().get(0); - if (exception instanceof RestServiceException) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, - "MAAT规则状态更新时出现异常:" + exception.getMessage(),CompileVal.getBusinessCode()); - }else { - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "MAAT规则状态更新时出现异常:" + exception.getMessage(),CompileVal.getBusinessCode()); - } - + try { + if (null == configSource.getOpTime()) { + configSource.setOpTime(new Date()); + } + if (null != configSource && null != configSource.getConfigCompileList() + && configSource.getConfigCompileList().size() > 0) { + int opAction = configSource.getOpAction(); + checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2); + configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(), + configSource.getOpTime(), sb); + + } else { + throw new RestServiceException("Maat规则不能为空" + sb.toString(), + RestBusinessCode.ConfigSourceIsNull.getValue()); + } + } catch (Exception e) { + // TODO: handle exception + thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + e.getMessage()); + if (e instanceof RestServiceException) { + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "MAAT规则状态更新时出现异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + }else if(e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + "MAAT规则状态更新时出现异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + }else{ + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + "MAAT规则状态更新时出现异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } - // configSourcesService.updateConfigSource(thread, start, - // configSource.getConfigCompileList(), - // configSource.getOpTime(), sb); - - } else { - thread.setExceptionInfo("Maat规则不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "Maat规则不能为空" + sb.toString(), - RestBusinessCode.missing_args.getValue()); } + return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "Maat规则状态更新成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null); } - @RequestMapping(value = "/cfg/v1/configModifySources", method = RequestMethod.PUT) - @ApiOperation(value = "MAAT规则修改接口", httpMethod = "PUT", response = Map.class, notes = "接收Maat规则,对其规则内容进行修改") - @ApiParam(value = "MAAT规则对象", name = "configSource", required = true) - public Map configModifySources(@RequestBody ConfigSource configSource, HttpServletRequest request, - HttpServletResponse response) { - ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 - long start = System.currentTimeMillis(); - AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, - configSource); - StringBuffer sb = new StringBuffer(); - if (null != configSource && null != configSource.getConfigCompileList() - && configSource.getConfigCompileList().size() > 0) { - int opAction = configSource.getOpAction(); - checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2); - // 验证配置编译数据 - validateConfigSource(thread, start, configSource); - try { - List configCompileList = configSource.getConfigCompileList(); - if (null != configCompileList && configCompileList.size() > 0) { - int count = 0; - for (ConfigCompile configCompile : configCompileList) { - Long compileId = configCompile.getCompileId(); - if (null == compileId) { - thread.setExceptionInfo("编译配置id不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置id不能为空", - RestBusinessCode.missing_args.getValue()); - } - // if ((configCompile.getActiveSys() != null) || - // (configCompile.getEffectiveRange() != null - // && !configCompile.getEffectiveRange().equals(""))) { - // count++; - // configSourcesService.setCompileInvalid(configCompile); - // } - } - if (count > 0) { - Thread.sleep(14000); - } - String str = configSourcesService.configModifySources(configCompileList); - if (str.equals("idIsNull")) { - thread.setExceptionInfo("编译配置id不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置id不能为空", - RestBusinessCode.missing_args.getValue()); - } - - } else { - thread.setExceptionInfo("编译配置数据不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置数据不能为空", - RestBusinessCode.missing_args.getValue()); - } - - } catch (Exception e) { - List configCompileList = configSource.getConfigCompileList(); - if (null != configCompileList && configCompileList.size() > 0) { - for (ConfigCompile configCompile : configCompileList) { - Long compileId = configCompile.getCompileId(); - if (null == compileId) { - thread.setExceptionInfo("编译配置id不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置id不能为空", - RestBusinessCode.missing_args.getValue()); - } - // if ((configCompile.getActiveSys() != null) || - // (configCompile.getEffectiveRange() != null - // && !configCompile.getEffectiveRange().equals(""))) { - // try { - // configSourcesService.setCompileValid(configCompile); - // } catch (Exception e1) { - // String errorCode = ""; - // String message = e.getMessage(); - // if (null != message && message.length() > 0) { - // int index = message.toUpperCase().indexOf("ORA-"); - // if (index != -1) { - // errorCode = message.substring(index + 4, index + 9); - // - // } - // } - // Map throwExceptionInfo = OracleErrorCodeUtil - // .throwExceptionInfo(errorCode); - // for (int errorNum : throwExceptionInfo.keySet()) { - // if (errorNum == 998) { - // thread.setExceptionInfo(e.toString()); - // } else { - // thread.setExceptionInfo(throwExceptionInfo.get(errorNum)); - // } - // throw new RestServiceException(thread, System.currentTimeMillis() - start, - // throwExceptionInfo.get(errorNum), errorNum); - // } - // } - // } - } - } - - String errorCode = ""; - String message = e.getMessage(); - if (null != message && message.length() > 0) { - int index = message.toUpperCase().indexOf("ORA-"); - if (index != -1) { - errorCode = message.substring(index + 4, index + 9); - - } - } - Map throwExceptionInfo = OracleErrorCodeUtil.throwExceptionInfo(errorCode); - for (int errorNum : throwExceptionInfo.keySet()) { - if (errorNum == 998) { - thread.setExceptionInfo(e.toString()); - } else { - thread.setExceptionInfo(throwExceptionInfo.get(errorNum)); - } - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - throwExceptionInfo.get(errorNum), errorNum); - - } - } - } else { - thread.setExceptionInfo("编译配置数据不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置数据不能为空", - RestBusinessCode.missing_args.getValue()); - } - - return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, - "修改编译配置数据成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null); - } - private void validateConfigSource(AuditLogThread thread, long start, ConfigSource configSource) { String errorInfo = ""; @@ -294,7 +167,7 @@ public class ConfigSourcesController extends BaseRestController { if (configCompileList.size() <= 0) { errorInfo = "Maat规则不能为空"; - } + } if (!errorInfo.equals("")) { thread.setExceptionInfo(errorInfo); throw new RestServiceException(thread, System.currentTimeMillis() - start, errorInfo, @@ -307,24 +180,27 @@ public class ConfigSourcesController extends BaseRestController { @ApiOperation(value = "回调(通用)规则存储接口", httpMethod = "POST", response = Map.class, notes = "接收回调规则数据,格式为结构化行列式JSON,存储到流量处理平台配置线中") public Map createCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request, HttpServletResponse response) { - CompileVal.setBusinessCode(null); - ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); - String msg = configSourcesService.saveCommonSources(thread, start, jsonString); - if (msg.equals("error")) { - Exception exception = ConfigSourcesService.getMsgList().get(0); - if (exception instanceof RestServiceException) { + try { + configSourcesService.saveCommonSources(thread, start, jsonString); + } catch (Exception e) { + // TODO: handle exception + thread.setExceptionInfo("回调规则存储异常:" + e.getMessage()); + if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "回调规则存储异常:" + exception.getMessage(), CompileVal.getBusinessCode()); + "回调规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + }else if (e instanceof ServiceRuntimeException) { + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "回调规则存储异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); }else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "回调规则存储异常:" + exception.getMessage(), CompileVal.getBusinessCode()); + "回调规则存储异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } - } + return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "回调规则下发成功", Constants.IS_DEBUG ? jsonString : null); } @@ -334,23 +210,27 @@ public class ConfigSourcesController extends BaseRestController { @ApiOperation(value = "回调(通用)规则状态更新接口", httpMethod = "PUT", response = Map.class, notes = "接收回调规则,对其状态置为失效") public Map updateCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request, HttpServletResponse response) { - CompileVal.setBusinessCode(null); - ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, jsonString); StringBuffer sb = new StringBuffer(); - String msg = configSourcesService.updateCommonSources(thread, start, jsonString, new Date(), sb); - if (msg.equals("error")) { - Exception exception = ConfigSourcesService.getMsgList().get(0); - if (exception instanceof RestServiceException) { + try { + configSourcesService.updateCommonSources(thread, start, jsonString, new Date(), sb); + } catch (Exception e) { + // TODO: handle exception + thread.setExceptionInfo("回调规则状态更新异常:" + e.getMessage()); + if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "回调规则状态更新异常:" + exception.getMessage(), CompileVal.getBusinessCode()); + "回调规则状态更新异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + }else if (e instanceof ServiceRuntimeException) { + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "回调规则状态更新异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); }else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "回调规则状态更新异常:" + exception.getMessage(), CompileVal.getBusinessCode()); + "回调规则状态更新异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } + return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "回调规则状态更新成功", Constants.IS_DEBUG ? jsonString : null); } @@ -360,7 +240,6 @@ public class ConfigSourcesController extends BaseRestController { @ApiParam(value = "样例文件上传服务", name = "MultipartFile", required = true) public Map fileUploadSource(@RequestBody MultipartFile file, HttpServletRequest request, HttpServletResponse response) { - ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); @@ -369,9 +248,7 @@ public class ConfigSourcesController extends BaseRestController { FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")), FileDesc.class); if (null == file) { - thread.setExceptionInfo("请选择上传文件到file参数"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "请选择上传文件到file参数", - RestBusinessCode.FileIsNull.getValue()); + throw new RestServiceException("请选择上传文件到file参数", RestBusinessCode.FileIsNull.getValue()); } if (!StringUtil.isEmpty(fileDesc.getChecksum())) { @@ -380,9 +257,7 @@ public class ConfigSourcesController extends BaseRestController { // String md5 = DigestUtils.md5Hex(file.getBytes()); System.out.println("----------------------------MD5:'" + md5 + "'==='" + fileDesc.getChecksum() + "'"); if (!md5.equals(fileDesc.getChecksum())) { - thread.setExceptionInfo("checksum与文件MD5值不一致"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致", - RestBusinessCode.CheckSumIsWrong.getValue()); + throw new RestServiceException("checksum与文件MD5值不一致", RestBusinessCode.CheckSumIsWrong.getValue()); } String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext); @@ -399,11 +274,13 @@ public class ConfigSourcesController extends BaseRestController { }catch (IOException e) { // TODO Auto-generated catch block logger.error(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+e.getMessage()); + thread.setExceptionInfo(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+e.getMessage()); throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, RestBusinessCode.FileUploadFailure.getErrorReason()+":"+ e.getMessage(), RestBusinessCode.FileUploadFailure.getValue()); }catch (Exception e) { // TODO: handle exception - logger.error(e.getMessage()); + logger.error("文件上传异常:" +e.getMessage()); + thread.setExceptionInfo("文件上传异常:" + e.getMessage()); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -430,47 +307,38 @@ public class ConfigSourcesController extends BaseRestController { long start = System.currentTimeMillis(); AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, file, null); - if (file == null) { - thread.setExceptionInfo("请上传获取摘要的文件到file"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "请上传获取摘要的文件到file参数", - RestBusinessCode.FileIsNull.getValue()); - } JSONObject resultObject = new JSONObject(); - FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")), - FileDesc.class); try { + if (file == null) { + throw new RestServiceException("请上传获取摘要的文件到file参数", RestBusinessCode.FileIsNull.getValue()); + } + FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")), + FileDesc.class); if (!StringUtil.isEmpty(fileDesc.getChecksum())) { // 验证Md5 String md5 = DigestUtils.md5Hex(file.getInputStream()); System.out.println("----------------------------MD5:'" + md5 + "'==='" + fileDesc.getChecksum() + "'"); if (!md5.equals(fileDesc.getChecksum())) { - thread.setExceptionInfo("checksum与文件MD5值不一致"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致", + throw new RestServiceException("checksum与文件MD5值不一致", RestBusinessCode.CheckSumIsWrong.getValue()); } String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext); - // NameValuePair[] meta_list = new NameValuePair[5]; - // meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename()); - // meta_list[1] = new NameValuePair("fileLength", - // String.valueOf(file.getSize())); - // meta_list[2] = new NameValuePair("fileExt", ext); - // meta_list[3] = new NameValuePair("fileAuthor", "rkg"); - // meta_list[4] = new NameValuePair("fileMd5", md5); logger.info("-----------------调用接口上传文件---------------"); String filePath = FileManager.upload(fdsfile, null); - // resultObject.put("path", filePath.substring(filePath.indexOf("group"))); resultObject.put("accessUrl", filePath); } }catch (IOException e) { // TODO Auto-generated catch block logger.error(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+e.getMessage()); + thread.setExceptionInfo(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+ e.getMessage()); throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, RestBusinessCode.FileUploadFailure.getErrorReason()+":"+ e.getMessage(), RestBusinessCode.FileUploadFailure.getValue()); }catch (Exception e) { // TODO: handle exception - logger.error(e.getMessage()); + logger.error(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+e.getMessage()); + thread.setExceptionInfo(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+ e.getMessage()); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -481,16 +349,15 @@ public class ConfigSourcesController extends BaseRestController { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, e.getMessage(), RestBusinessCode.FileUploadFailure.getValue()); } - } try { String tempFilePath = request.getRealPath(File.separator) + "upload" + File.separator + (new Date()).getTime() + file.getOriginalFilename(); file.transferTo(new File(tempFilePath)); //System.out.println("------------" + tempFilePath); - System.out.println("摘要获取开始:---------------"); + logger.info("摘要获取开始:---------------"); String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath); - System.out.println("摘要获取结束:---------------:"+digestStr); + logger.info("摘要获取结束:---------------:"+digestStr); resultObject.put("digest", digestStr); resultObject.put("rawLen", file.getSize()); FileUtils.deleteFile(tempFilePath); @@ -498,7 +365,7 @@ public class ConfigSourcesController extends BaseRestController { // TODO Auto-generated catch block e.printStackTrace(); logger.error(RestBusinessCode.GetFileDigestFailure.getValue()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功"); -// thread.setExceptionInfo("摘要获取过程中出现异常"); + thread.setExceptionInfo("摘要获取过程中出现异常:"+e.getMessage()+",请检查摘要获取工具是否安装成功"); throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, RestBusinessCode.GetFileDigestFailure.getValue()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功", RestBusinessCode.GetFileDigestFailure.getValue()); } diff --git a/src/main/java/com/nis/web/controller/restful/DmbCkController.java b/src/main/java/com/nis/web/controller/restful/DmbCkController.java deleted file mode 100644 index eb63e51..0000000 --- a/src/main/java/com/nis/web/controller/restful/DmbCkController.java +++ /dev/null @@ -1,223 +0,0 @@ -/** - *@Title: DmbCkController.java - *@Package com.nis.web.controller.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:58:16 - *@version 版本号 - */ -package com.nis.web.controller.restful; - -import java.util.Date; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.nis.web.service.AuditLogThread; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.nis.domain.restful.DmbCk; -import com.nis.domain.restful.DmbCkSource; -import com.nis.restful.RestBusinessCode; -import com.nis.restful.RestServiceException; -import com.nis.util.Constants; -import com.nis.util.OracleErrorCodeUtil; -import com.nis.util.StringUtil; -import com.nis.web.controller.BaseRestController; -import com.nis.web.service.ServicesRequestLogService; -import com.nis.web.service.restful.DmbCkService; -import com.wordnik.swagger.annotations.ApiOperation; - -/** - * @ClassName: DmbCkController.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:58:16 - * @version V1.0 - */ -@RestController -//@RequestMapping("${servicePath}/cfg/v1") -public class DmbCkController extends BaseRestController { - protected final Logger logger = Logger.getLogger(this.getClass()); - @Autowired - protected DmbCkService dmbCkService; - @Autowired - protected ServicesRequestLogService servicesRequestLogService; -// @Autowired -// protected CommonConfigService commonConfigService; -// @Autowired -// protected RedisDao redisDao; - /** - * saveDmbCkBatch(多条新增) - * (这里描述这个方法适用条件 – 可选) - * @param DmbCkSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbCkSources", method = RequestMethod.POST) - @ApiOperation(value = "保存运营商信息", httpMethod = "POST", notes = "save provider info") - public Map saveDmbCkBatch(@RequestBody DmbCkSource dmbCkSource, HttpServletRequest request, HttpServletResponse response) { - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dmbCkSource); - super.checkOpAction(thread,System.currentTimeMillis()-start, dmbCkSource.getOpAction(), Constants.OPACTION_POST); - try{ - this.chekckData(dmbCkSource); - dmbCkService.saveDmbCkBatch(dmbCkSource.getDmbCkList()); -// commonConfigService.saveOrUpdateConfigState("DMB_CK", dmbCkSource.getOpTime()); -// redisDao.saveMaps(dmbCkSource.getDmbCkList(), "DMB_CK", DmbCk.class, "id"); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"保存运营商信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"保存运营商信息成功",dmbCkSource.getDmbCkList()); - } - /** - * - * updateDmbCkBatch(多条更新) - * (这里描述这个方法适用条件 – 可选) - * @param DmbCkSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbCkSources", method = RequestMethod.PUT) - @ApiOperation(value = "更新运营商信息", httpMethod = "PUT", notes = "update provider info") - public Map updateDmbCkBatch(@RequestBody DmbCkSource dmbCkSource, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dmbCkSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dmbCkSource.getOpAction(), Constants.OPACTION_PUT); - try{ - this.chekckData(dmbCkSource); - dmbCkService.updateDmbCkBatch(dmbCkSource.getDmbCkList()); -// commonConfigService.saveOrUpdateConfigState("DMB_CK", dmbCkSource.getOpTime()); -// redisDao.updateMaps(dmbCkSource.getDmbCkList(), "DMB_CK", DmbCk.class, "id"); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"更新运营商信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"更新运营商信息成功",dmbCkSource.getDmbCkList()); - } - /** - * - * deleteDmbCk(单条删除) - * (这里描述这个方法适用条件 – 可选) - * @param id - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbCkSources/{id}", method = RequestMethod.DELETE) - @ApiOperation(value = "删除运营商信息", httpMethod = "DELETE", notes = "delete provider info") - public Map deleteDmbCk(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); - try{ - dmbCkService.removeDmbCk(id); -// commonConfigService.saveOrUpdateConfigState("DMB_CK", new Date()); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除运营商信息失败", RestBusinessCode.unknow_error.getValue()); - - } - - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"删除成功",id); - } - /** - * - * deleteDmbCk(多条删除) - * (这里描述这个方法适用条件 – 可选) - * @param DmbCkSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbCkSources", method = RequestMethod.DELETE) - @ApiOperation(value = "删除运营商信息", httpMethod = "DELETE", notes = "delete provider info") - public Map deleteDmbCk(@RequestBody DmbCkSource dmbCkSource, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dmbCkSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dmbCkSource.getOpAction(), Constants.OPACTION_DELETE); - try{ - dmbCkService.removeDmbCkBatch(dmbCkSource.getDmbCkList()); -// commonConfigService.saveOrUpdateConfigState("DMB_CK", dmbCkSource.getOpTime()); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除运营商信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"批量删除成功",dmbCkSource.getDmbCkList()); - } - /** - * - * chekckData(操作验证时间) - * (这里描述这个方法适用条件 – 可选) - * @param entity - * @return - *boolean - * @exception - * @since 1.0.0 - */ - private void chekckData(DmbCkSource entity){ - Date now=new Date(); - for(DmbCk dmbCk :entity.getDmbCkList()){ - dmbCk.setLastUpdate(now); - if(dmbCk.getOpTime()==null) - dmbCk.setOpTime(entity.getOpTime()); - } - } -} diff --git a/src/main/java/com/nis/web/controller/restful/DmbPortController.java b/src/main/java/com/nis/web/controller/restful/DmbPortController.java deleted file mode 100644 index 41ecc48..0000000 --- a/src/main/java/com/nis/web/controller/restful/DmbPortController.java +++ /dev/null @@ -1,223 +0,0 @@ -/** - *@Title: DmbPortController.java - *@Package com.nis.web.controller.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:58:16 - *@version 版本号 - */ -package com.nis.web.controller.restful; - -import java.util.Date; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.nis.domain.restful.DmbPort; -import com.nis.domain.restful.DmbPortSource; -import com.nis.restful.RestBusinessCode; -import com.nis.restful.RestServiceException; -import com.nis.util.Constants; -import com.nis.util.OracleErrorCodeUtil; -import com.nis.util.StringUtil; -import com.nis.web.controller.BaseRestController; -import com.nis.web.service.AuditLogThread; -import com.nis.web.service.ServicesRequestLogService; -import com.nis.web.service.restful.DmbPortService; -import com.wordnik.swagger.annotations.ApiOperation; - -/** - * @ClassName: DmbPortController.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:58:16 - * @version V1.0 - */ -@RestController -//@RequestMapping("${servicePath}/cfg/v1") -public class DmbPortController extends BaseRestController { - protected final Logger logger = Logger.getLogger(this.getClass()); - @Autowired - protected DmbPortService dmbPortService; - @Autowired - protected ServicesRequestLogService servicesRequestLogService; -// @Autowired -// protected CommonConfigService commonConfigService; -// @Autowired -// protected RedisDao redisDao; - /** - * saveDmbPortBatch(多条新增) - * (这里描述这个方法适用条件 – 可选) - * @param DmbPortSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbPortSources", method = RequestMethod.POST) - @ApiOperation(value = "保存运营商端口信息", httpMethod = "POST", notes = "save provider port info") - public Map saveDmbPortBatch(@RequestBody DmbPortSource dmbPortSource, HttpServletRequest request, HttpServletResponse response) { - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dmbPortSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dmbPortSource.getOpAction(), Constants.OPACTION_POST); - try{ - this.chekckData(dmbPortSource); - dmbPortService.saveDmbPortBatch(dmbPortSource.getDmbPortList()); -// commonConfigService.saveOrUpdateConfigState("DMB_PORT", dmbPortSource.getOpTime()); -// redisDao.saveMaps(dmbPortSource.getDmbPortList(), "DMB_PORT", DmbPort.class, "id"); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"保存运营商端口信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"保存运营商端口信息成功",dmbPortSource.getDmbPortList()); - } - /** - * - * updateDmbPortBatch(多条更新) - * (这里描述这个方法适用条件 – 可选) - * @param DmbPortSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbPortSources", method = RequestMethod.PUT) - @ApiOperation(value = "更新运营商端口信息", httpMethod = "PUT", notes = "update provider port info") - public Map updateDmbPortBatch(@RequestBody DmbPortSource dmbPortSource, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dmbPortSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dmbPortSource.getOpAction(), Constants.OPACTION_PUT); - try{ - this.chekckData(dmbPortSource); - dmbPortService.updateDmbPortBatch(dmbPortSource.getDmbPortList()); -// commonConfigService.saveOrUpdateConfigState("DMB_PORT", dmbPortSource.getOpTime()); -// redisDao.updateMaps(dmbPortSource.getDmbPortList(), "DMB_PORT", DmbPort.class, "id"); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"更新运营商端口信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"更新运营商端口信息成功",dmbPortSource.getDmbPortList()); - } - /** - * - * deleteDmbPort(单条删除) - * (这里描述这个方法适用条件 – 可选) - * @param id - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbPortSources/{id}", method = RequestMethod.DELETE) - @ApiOperation(value = "删除运营商端口信息", httpMethod = "DELETE", notes = "delete provider port info") - public Map deleteDmbPort(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); - try{ - dmbPortService.removeDmbPort(id); -// commonConfigService.saveOrUpdateConfigState("DMB_PORT", new Date()); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除运营商端口信息失败", RestBusinessCode.unknow_error.getValue()); - - } - - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"删除成功",id); - } - /** - * - * deleteDmbPort(多条删除) - * (这里描述这个方法适用条件 – 可选) - * @param DmbPortSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dmbPortSources", method = RequestMethod.DELETE) - @ApiOperation(value = "删除运营商端口信息", httpMethod = "DELETE", notes = "delete provider port info") - public Map deleteDmbPort(@RequestBody DmbPortSource dmbPortSource, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dmbPortSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dmbPortSource.getOpAction(), Constants.OPACTION_DELETE); - try{ - dmbPortService.removeDmbPortBatch(dmbPortSource.getDmbPortList()); -// commonConfigService.saveOrUpdateConfigState("DMB_PORT", dmbPortSource.getOpTime()); - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - if(e instanceof RestServiceException) throw e; - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除运营商端口信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"批量删除成功",dmbPortSource.getDmbPortList()); - } - /** - * - * chekckData(操作验证时间) - * (这里描述这个方法适用条件 – 可选) - * @param entity - * @return - *boolean - * @exception - * @since 1.0.0 - */ - private void chekckData(DmbPortSource entity){ - Date now=new Date(); - for(DmbPort dmbPort :entity.getDmbPortList()){ - dmbPort.setLastUpdate(now); - if(dmbPort.getOpTime()==null) - dmbPort.setOpTime(entity.getOpTime()); - } - } -} diff --git a/src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java b/src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java deleted file mode 100644 index da2e746..0000000 --- a/src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java +++ /dev/null @@ -1,250 +0,0 @@ -/** - *@Title: DnsFakeInfoController.java - *@Package com.nis.web.controller.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:58:16 - *@version 版本号 - */ -package com.nis.web.controller.restful; - -import java.util.Date; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.nis.web.service.AuditLogThread; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.nis.domain.restful.DnsFakeInfo; -import com.nis.domain.restful.DnsFakeInfoSource; -import com.nis.restful.RestBusinessCode; -import com.nis.restful.RestServiceException; -import com.nis.util.Constants; -import com.nis.util.OracleErrorCodeUtil; -import com.nis.util.StringUtil; -import com.nis.web.controller.BaseRestController; -import com.nis.web.service.ServicesRequestLogService; -import com.nis.web.service.restful.DnsFakeInfoService; -import com.wordnik.swagger.annotations.ApiOperation; - -/** - * @ClassName: DnsFakeInfoController.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:58:16 - * @version V1.0 - */ -@RestController -//@RequestMapping("${servicePath}/cfg/v1") -public class DnsFakeInfoController extends BaseRestController { - protected final Logger logger = Logger.getLogger(this.getClass()); - @Autowired - protected DnsFakeInfoService dnsFakeInfoService; - @Autowired - protected ServicesRequestLogService servicesRequestLogService; -// @Autowired -// protected CommonConfigService commonConfigService; -// @Autowired -// protected RedisDao redisDao; - /** - * saveDnsFakeInfoBatch(多条新增) - * (这里描述这个方法适用条件 – 可选) - * @param DnsFakeInfoSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dnsFakeInfoSources", method = RequestMethod.POST) - @ApiOperation(value = "保存DNS欺骗信息", httpMethod = "POST", notes = "save dns fake info") - public Map saveDnsFakeInfoBatch(@RequestBody DnsFakeInfoSource dnsFakeInfoSource, HttpServletRequest request, HttpServletResponse response) { - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsFakeInfoSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeInfoSource.getOpAction(), Constants.OPACTION_POST); - try{ - if(chekckData(dnsFakeInfoSource,false)){ - dnsFakeInfoService.saveDnsFakeInfoBatch(dnsFakeInfoSource.getDnsFakeInfoList()); -// commonConfigService.saveOrUpdateConfigState("DNS_FAKE_INFO", dnsFakeInfoSource.getOpTime()); -// redisDao.saveMaps(dnsFakeInfoSource.getDnsFakeInfoList(), "DNS_FAKE_INFO", DnsFakeInfo.class, "id"); - }else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"保存DNS欺骗信息失败,组号不能小于0且2-100组号不可使用",RestBusinessCode.unknow_error.getValue()); - }catch(RestServiceException e){ - throw e; - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"保存DNS欺骗信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"保存DNS欺骗信息成功",dnsFakeInfoSource.getDnsFakeInfoList()); - } - /** - * - * updateDnsFakeInfoBatch(多条更新) - * (这里描述这个方法适用条件 – 可选) - * @param DnsFakeInfoSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dnsFakeInfoSources", method = RequestMethod.PUT) - @ApiOperation(value = "更新DNS欺骗信息", httpMethod = "PUT", notes = "update dns fake info") - public Map updateDnsFakeInfoBatch(@RequestBody DnsFakeInfoSource dnsFakeInfoSource, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsFakeInfoSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeInfoSource.getOpAction(), Constants.OPACTION_PUT); - try{ - if(chekckData(dnsFakeInfoSource,true)){ - dnsFakeInfoService.updateDnsFakeInfoBatch(dnsFakeInfoSource.getDnsFakeInfoList()); -// commonConfigService.saveOrUpdateConfigState("DNS_FAKE_INFO", dnsFakeInfoSource.getOpTime()); -// redisDao.updateMaps(dnsFakeInfoSource.getDnsFakeInfoList(), "DNS_FAKE_INFO", DnsFakeInfo.class, "id"); - }else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"更新DNS欺骗信息失败,组号不能小于0且2-100组号不可使用",RestBusinessCode.unknow_error.getValue()); - }catch(RestServiceException e){ - throw e; - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"更新DNS欺骗信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"更新DNS欺骗信息成功",dnsFakeInfoSource.getDnsFakeInfoList()); - } - /** - * - * deleteDnsFakeInfo(单条删除) - * (这里描述这个方法适用条件 – 可选) - * @param id - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dnsFakeInfoSources/{id}", method = RequestMethod.DELETE) - @ApiOperation(value = "删除DNS欺骗信息", httpMethod = "DELETE", notes = "delete dns fake info") - public Map deleteDnsFakeInfo(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); - try{ - boolean isValid=dnsFakeInfoService.isValid(id); - if(!isValid){ - dnsFakeInfoService.removeDnsFakeInfo(id); -// commonConfigService.saveOrUpdateConfigState("DNS_FAKE_INFO", new Date()); - }else{ - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除DNS欺骗信息失败,不能删除有效的DNS欺骗信息",RestBusinessCode.unknow_error.getValue()); - } - }catch(RestServiceException e){ - throw e; - - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除DNS欺骗信息失败", RestBusinessCode.unknow_error.getValue()); - - } - - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"删除成功",id); - } - /** - * - * deleteDnsFakeInfo(多条删除) - * (这里描述这个方法适用条件 – 可选) - * @param DnsFakeInfoSource - * @param request - * @param response - * @return - *Map - * @exception - * @since 1.0.0 - */ - @SuppressWarnings("rawtypes") - @RequestMapping(value = "/dnsFakeInfoSources", method = RequestMethod.DELETE) - @ApiOperation(value = "删除DNS欺骗信息", httpMethod = "DELETE", notes = "delete dns fake info") - public Map deleteDnsFakeInfo(@RequestBody DnsFakeInfoSource dnsFakeInfoSource, HttpServletRequest request, HttpServletResponse response){ - long start=System.currentTimeMillis(); - AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsFakeInfoSource); - super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeInfoSource.getOpAction(), Constants.OPACTION_DELETE); - try{ - boolean isValid=dnsFakeInfoService.isValid(dnsFakeInfoSource.getDnsFakeInfoList()); - if(isValid){ - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除DNS欺骗信息失败,包含有效的DNS欺骗信息",RestBusinessCode.unknow_error.getValue()); - }else{ - dnsFakeInfoService.removeDnsFakeInfoBatch(dnsFakeInfoSource.getDnsFakeInfoList()); -// commonConfigService.saveOrUpdateConfigState("DNS_FAKE_INFO", dnsFakeInfoSource.getOpTime()); - } - }catch(RestServiceException e){ - throw e; - }catch(Exception e){ - thread.setExceptionInfo(e.getMessage()+" "+e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - logger.error(e.getCause()); - String info=OracleErrorCodeUtil.getOraCode(e); - if(!StringUtil.isEmpty(info)) - OracleErrorCodeUtil.throwExceptionInfo(thread,System.currentTimeMillis()-start,info); - else - throw new RestServiceException(thread,System.currentTimeMillis()-start,"删除DNS欺骗信息失败", RestBusinessCode.unknow_error.getValue()); - } - return serviceResponse(thread,System.currentTimeMillis()-start,request,response,"批量删除成功",dnsFakeInfoSource.getDnsFakeInfoList()); - } - /** - * - * chekckData(0-1组号以及100以外的组号可以使用) - * (这里描述这个方法适用条件 – 可选) - * @param entityList - * @param update 是否是更新请求 - * @return - *boolean - * @exception - * @since 1.0.0 - */ - private boolean chekckData(DnsFakeInfoSource entity,boolean update){ - int ok=1; - Date now=new Date(); - for(DnsFakeInfo dnsFakeInfo :entity.getDnsFakeInfoList()){ - dnsFakeInfo.setLastUpdate(now); - if(dnsFakeInfo.getOpTime()==null) - dnsFakeInfo.setOpTime(entity.getOpTime()); -// if(update&&dnsFakeInfo.getGroupId()==null)continue; -// if(dnsFakeInfo.getGroupId().intValue()<0||(2 list = new ArrayList(); - for (int a = 0; a < forCount; a++) { - long start = System.currentTimeMillis(); - AuditLogThread thread = new AuditLogThread(); - StringBuffer sb = new StringBuffer(); - List configCompileList = new ArrayList(); - for (int i = 0; i < saveCount; i++) { - configCompileList.add(getConfigCompile(service)); + try { + + for (int a = 0; a < forCount; a++) { + long start = System.currentTimeMillis(); + AuditLogThread thread = new AuditLogThread(); + StringBuffer sb = new StringBuffer(); + List configCompileList = new ArrayList(); + for (int i = 0; i < saveCount; i++) { + configCompileList.add(getConfigCompile(service)); + } + // 保存测试配置 + configSourcesService.saveMaatConfig(thread, start, configCompileList, sb); + List compileIdList = new ArrayList(); + for (ConfigCompile configCompile : configCompileList) { + compileIdList.add(configCompile.getCompileId()); + } + FileUtils.addStrToFile( + sdf.format(new Date()) + "\t" + "业务类型" + service + "添加" + saveCount + "条数据成功,配置id是" + compileIdList + + "\n" + sdf.format(new Date()) + "\t开始验证添加的数据各字段是否正确\n", + Configurations.getStringProperty("maatTestLogPath", ""), true); + // 验证数据是否在正确 + maatTestServiceimpl.getKeys(configCompileList); + list.add(testDelMaat(compileIdList.toString().replace("[", "").replace("]", ""), service)); } - // 保存测试配置 - configSourcesService.saveMaatConfig(thread, start, configCompileList, sb); - List compileIdList = new ArrayList(); - for (ConfigCompile configCompile : configCompileList) { - compileIdList.add(configCompile.getCompileId()); - } - FileUtils.addStrToFile( - sdf.format(new Date()) + "\t" + "业务类型" + service + "添加" + saveCount + "条数据成功,配置id是" + compileIdList - + "\n" + sdf.format(new Date()) + "\t开始验证添加的数据各字段是否正确\n", - Configurations.getStringProperty("maatTestLogPath", ""), true); - // 验证数据是否在正确 - maatTestServiceimpl.getKeys(configCompileList); - list.add(testDelMaat(compileIdList.toString().replace("[", "").replace("]", ""), service)); + + // return "http://127.0.0.1:8080/galaxy/service/cfg/v1/testDelMaat?serviceType=" + // + service + "&configId=" + // + compileIdList.toString().replace("[", "").replace("]", ""); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); } return list.toString(); - // return "http://127.0.0.1:8080/galaxy/service/cfg/v1/testDelMaat?serviceType=" - // + service + "&configId=" - // + compileIdList.toString().replace("[", "").replace("]", ""); } @RequestMapping(value = "/cfg/v1/testSaveMaat", method = RequestMethod.GET) @@ -415,22 +423,30 @@ public class MaatTestController { long start = System.currentTimeMillis(); AuditLogThread thread = new AuditLogThread(); StringBuffer sb = new StringBuffer(); - List configCompileList = new ArrayList(); - for (int i = 0; i < saveCount; i++) { - configCompileList.add(getConfigCompile(service)); - } - // 保存测试配置 - configSourcesService.saveMaatConfig(thread, start, configCompileList, sb); List compileIdList = new ArrayList(); - for (ConfigCompile configCompile : configCompileList) { - compileIdList.add(configCompile.getCompileId()); + try { + List configCompileList = new ArrayList(); + for (int i = 0; i < saveCount; i++) { + configCompileList.add(getConfigCompile(service)); + } + // 保存测试配置 + + configSourcesService.saveMaatConfig(thread, start, configCompileList, sb); + + + for (ConfigCompile configCompile : configCompileList) { + compileIdList.add(configCompile.getCompileId()); + } + FileUtils.addStrToFile( + sdf.format(new Date()) + "\t" + "业务类型" + service + "添加" + saveCount + "条数据成功,配置id是" + compileIdList + + "\n" + sdf.format(new Date()) + "\t开始验证添加的数据各字段是否正确\n", + Configurations.getStringProperty("maatTestLogPath", ""), true); + // 验证数据是否在正确 + maatTestServiceimpl.getKeys(configCompileList); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - FileUtils.addStrToFile( - sdf.format(new Date()) + "\t" + "业务类型" + service + "添加" + saveCount + "条数据成功,配置id是" + compileIdList - + "\n" + sdf.format(new Date()) + "\t开始验证添加的数据各字段是否正确\n", - Configurations.getStringProperty("maatTestLogPath", ""), true); - // 验证数据是否在正确 - maatTestServiceimpl.getKeys(configCompileList); return "http://127.0.0.1:8080/galaxy/service/cfg/v1/testDelMaat?serviceType=" + service + "&configId=" + compileIdList.toString().replace("[", "").replace("]", ""); } diff --git a/src/main/java/com/nis/web/dao/ConfigCompileDao.java b/src/main/java/com/nis/web/dao/ConfigCompileDao.java deleted file mode 100644 index 54be07b..0000000 --- a/src/main/java/com/nis/web/dao/ConfigCompileDao.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.nis.web.dao; - -import java.util.Date; -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.nis.domain.restful.ConfigCompile; -import com.nis.domain.restful.ConfigCompileTest; -import com.nis.domain.restful.ConfigState; - -/** - * - * @ClassName: ConfigCompileDao - * @Description: TODO(编译配置dao) - * @author (rkg) - * @date 2016年9月6日下午8:45:58 - * @version V1.0 - */ -@MyBatisDao -public interface ConfigCompileDao { - /** - * 添加编译配置信息,并返回主键id - * - * @param configCompileDao - * 编译配置对象 - * @return 主键id - */ - public Long saveConfigCompile(ConfigCompile configCompile); - - /** - * 根据主键id修改编译配置信息 - * - * @param configCompileDao - * 编译配置对象 - */ - public void updateConfigCompile(ConfigCompile configCompile); - - - - /** - * 根据compileId设置配置有效或无效 - * @param configCompile - * @param valid - */ - public void setCompileInvalid(@Param("compileId")Long compileId,@Param("valid")Integer valid); - - - - - /** - * 根据主键compileId查询对应的ConfigCompile - * - * @param compileId - * @return - */ - public ConfigCompile queryConfigCompileById(Long compileId); - - /** - * 根据tableName查询是否有对应的配置状态记录 - * - * @param tableName - * @return - */ - public List queryConfigStateByTN(@Param("tableName") String tableName); - - /** - * 根据表名更新配置状态操作时间 - * - * @param tableName - * @param opTime - */ - public void updateConfigState(@Param("tableName") String tableName, @Param("opTime") Date opTime); - - /** - * 新增配置状态 - * - * @param tableName - * @param opTime - */ - public void saveConfigState(@Param("tableName") String tableName, @Param("opTime") Date opTime); - - /** - * 批量新增配置 - * - * @param configCompileList - */ - public void saveCompileBatch(List configCompileList); - - /** - * - * 条件查询配置信息 - * - * @param configCompile - * @return - */ - public List queryAllCompile(@Param("searchEndTime") String searchEndTime, - @Param("searchStartTime") String searchStartTime, @Param("service") Integer service, - @Param("compileId") Long compileId); - - /** - * 根据主键compileId查询对应的ConfigCompile - * - * @param compileIdArr - * @return - */ - public List queryConfigCompileByIdArr(@Param("compileIdArr") String compileIdArr); - - public Long getCompileSeq(); - - public Long getGroupSeq(); - - public Long getRegionSeq(); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DmbCkDao.java b/src/main/java/com/nis/web/dao/DmbCkDao.java deleted file mode 100644 index 76564ee..0000000 --- a/src/main/java/com/nis/web/dao/DmbCkDao.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.nis.web.dao; - -import com.nis.domain.restful.DmbCk; -/** - * - * @ClassName: DmbCkDao.java - * @Description: TODO - * @author (dell) - * @date 2016年9月9日 上午10:03:33 - * @version V1.0 - */ -@MyBatisDao -public interface DmbCkDao extends CrudDao{ - int delete(long id); - int insert(DmbCk record); - int update(DmbCk record); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DmbCkDao.xml b/src/main/java/com/nis/web/dao/DmbCkDao.xml deleted file mode 100644 index 0dfd732..0000000 --- a/src/main/java/com/nis/web/dao/DmbCkDao.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - ID, NAME, POSITION, COM_OPTION, CZYID, OP_TIME,LAST_UPDATE - - - - delete from DMB_CK - where ID = #{id,jdbcType=BIGINT} - - - - insert into DMB_CK (ID, NAME, POSITION, - COM_OPTION, CZYID, OP_TIME,LAST_UPDATE - ) - values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, - #{comOption,jdbcType=VARCHAR}, #{czyid,jdbcType=BIGINT}, #{opTime,jdbcType=TIMESTAMP}, - #{lastUpdate,jdbcType=TIMESTAMP} - ) - - - - update DMB_CK - - - NAME = #{name,jdbcType=VARCHAR}, - - - POSITION = #{position,jdbcType=VARCHAR}, - - - COM_OPTION = #{comOption,jdbcType=VARCHAR}, - - - CZYID = #{czyid,jdbcType=BIGINT}, - - - OP_TIME = #{opTime,jdbcType=TIMESTAMP}, - - - LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id,jdbcType=BIGINT} - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DmbPortDao.java b/src/main/java/com/nis/web/dao/DmbPortDao.java deleted file mode 100644 index febf8fb..0000000 --- a/src/main/java/com/nis/web/dao/DmbPortDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.nis.web.dao; - -import com.nis.domain.restful.DmbPort; -/** - * - * @ClassName: DmbPortDao.java - * @Description: TODO - * @author (dell) - * @date 2016年9月9日 上午10:04:55 - * @version V1.0 - */ -@MyBatisDao -public interface DmbPortDao extends CrudDao{ - int delete(long id); - - int insert(DmbPort record); - - int update(DmbPort record); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DmbPortDao.xml b/src/main/java/com/nis/web/dao/DmbPortDao.xml deleted file mode 100644 index 0d621a0..0000000 --- a/src/main/java/com/nis/web/dao/DmbPortDao.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - - - - - - - - - - ID, ENTRANCE_ID, PORT_NAME, IS_USED, IP_DZ, PORT_EQUIPMENT, ODF_PORT, ADDR, CK_PORT, - CZYID, OP_TIME,LAST_UPDATE - - - - delete from DMB_PORT - where ID = #{id,jdbcType=BIGINT} - - - - insert into DMB_PORT (ID, ENTRANCE_ID, PORT_NAME, - IS_USED, IP_DZ, PORT_EQUIPMENT, - ODF_PORT, ADDR, CK_PORT, - CZYID, OP_TIME,LAST_UPDATE) - values (#{id,jdbcType=BIGINT}, #{entranceId,jdbcType=BIGINT}, #{portName,jdbcType=VARCHAR}, - #{isUsed,jdbcType=INTEGER}, #{ipDz,jdbcType=VARCHAR}, #{portEquipment,jdbcType=VARCHAR}, - #{odfPort,jdbcType=VARCHAR}, #{addr,jdbcType=VARCHAR}, #{ckPort,jdbcType=VARCHAR}, - #{czyid,jdbcType=BIGINT}, #{opTime,jdbcType=TIMESTAMP}, #{lastUpdate,jdbcType=TIMESTAMP}) - - - - update DMB_PORT - - - ENTRANCE_ID = #{entranceId,jdbcType=BIGINT}, - - - PORT_NAME = #{portName,jdbcType=VARCHAR}, - - - IS_USED = #{isUsed,jdbcType=INTEGER}, - - - IP_DZ = #{ipDz,jdbcType=VARCHAR}, - - - PORT_EQUIPMENT = #{portEquipment,jdbcType=VARCHAR}, - - - ODF_PORT = #{odfPort,jdbcType=VARCHAR}, - - - ADDR = #{addr,jdbcType=VARCHAR}, - - - CK_PORT = #{ckPort,jdbcType=VARCHAR}, - - - CZYID = #{czyid,jdbcType=BIGINT}, - - - OP_TIME = #{opTime,jdbcType=TIMESTAMP}, - - - LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id,jdbcType=BIGINT} - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DnsFakeInfoDao.java b/src/main/java/com/nis/web/dao/DnsFakeInfoDao.java deleted file mode 100644 index e55704d..0000000 --- a/src/main/java/com/nis/web/dao/DnsFakeInfoDao.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.nis.web.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.nis.domain.restful.DnsFakeInfo; -/** - * - * @ClassName: DnsFakeInfoDao.java - * @Description: TODO - * @author (dell) - * @date 2016年9月8日 下午8:31:24 - * @version V1.0 - */ -@MyBatisDao -public interface DnsFakeInfoDao extends CrudDao{ - int delete(long id); - int insert(DnsFakeInfo record); - DnsFakeInfo selectByPrimaryKey(long id); - int update(DnsFakeInfo record); - int updateByPrimaryKey(DnsFakeInfo record); - int isValid(long id); - int isValidBatch(@Param("idsList")List idsList,@Param("isValid")int isValid); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DnsFakeInfoDao.xml b/src/main/java/com/nis/web/dao/DnsFakeInfoDao.xml deleted file mode 100644 index c8c89e0..0000000 --- a/src/main/java/com/nis/web/dao/DnsFakeInfoDao.xml +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - ID, GROUP_ID, INFO, IS_VALID, OP_TIME, YL1, YL2, YL3, YL4, YL5,LAST_UPDATE - - - - delete from DNS_FAKE_INFO - where ID = #{id,jdbcType=BIGINT} - - - - insert into DNS_FAKE_INFO (ID, GROUP_ID, INFO, - IS_VALID, OP_TIME, YL1, - YL2, YL3, YL4, YL5,LAST_UPDATE - ) - values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=INTEGER}, #{info,jdbcType=VARCHAR}, - #{isValid,jdbcType=INTEGER}, #{opTime,jdbcType=TIMESTAMP}, #{yl1,jdbcType=INTEGER}, - #{yl2,jdbcType=INTEGER}, #{yl3,jdbcType=VARCHAR}, #{yl4,jdbcType=VARCHAR}, #{yl5,jdbcType=VARCHAR} - , #{lastUpdate,jdbcType=TIMESTAMP} - ) - - - insert into DNS_FAKE_INFO - - - ID, - - - GROUP_ID, - - - INFO, - - - IS_VALID, - - - OP_TIME, - - - YL1, - - - YL2, - - - YL3, - - - YL4, - - - YL5, - - - LAST_UPDATE, - - - - - #{id,jdbcType=BIGINT}, - - - #{groupId,jdbcType=INTEGER}, - - - #{info,jdbcType=VARCHAR}, - - - #{isValid,jdbcType=INTEGER}, - - - #{opTime,jdbcType=TIMESTAMP}, - - - #{yl1,jdbcType=INTEGER}, - - - #{yl2,jdbcType=INTEGER}, - - - #{yl3,jdbcType=VARCHAR}, - - - #{yl4,jdbcType=VARCHAR}, - - - #{yl5,jdbcType=VARCHAR}, - - - #{lastUpdate,jdbcType=TIMESTAMP}, - - - - - update DNS_FAKE_INFO - - - GROUP_ID = #{groupId,jdbcType=INTEGER}, - - - INFO = #{info,jdbcType=VARCHAR}, - - - IS_VALID = #{isValid,jdbcType=INTEGER}, - - - OP_TIME = #{opTime,jdbcType=TIMESTAMP}, - - - YL1 = #{yl1,jdbcType=INTEGER}, - - - YL2 = #{yl2,jdbcType=INTEGER}, - - - YL3 = #{yl3,jdbcType=VARCHAR}, - - - YL4 = #{yl4,jdbcType=VARCHAR}, - - - YL5 = #{yl5,jdbcType=VARCHAR}, - - - LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id,jdbcType=BIGINT} - - - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DnsFakeIpDao.java b/src/main/java/com/nis/web/dao/DnsFakeIpDao.java deleted file mode 100644 index 1c7222f..0000000 --- a/src/main/java/com/nis/web/dao/DnsFakeIpDao.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - *@Title: DnsGroupTypeDao.java - *@Package com.nis.web.dao - *@Description TODO - *@author dell - *@date 2016年9月7日 下午3:14:24 - *@version 版本号 - */ -package com.nis.web.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.nis.domain.restful.DnsFakeIp; - -/** - * @ClassName: DnsGroupTypeDao.java - * @Description: TODO - * @author (dell) - * @date 2016年9月7日 下午3:14:24 - * @version V1.0 - */ -@MyBatisDao -public interface DnsFakeIpDao extends CrudDao { - void save(DnsFakeIp dnsFakeIp); - void saveBatch(List dnsFakeIpList); - void updateBatch(List dnsFakeIpList); - void delete(long id); - int isValid(long id); - int isValidBatch(@Param("idsList")List idsList,@Param("isValid")int isValid); -} diff --git a/src/main/java/com/nis/web/dao/DnsFakeIpDao.xml b/src/main/java/com/nis/web/dao/DnsFakeIpDao.xml deleted file mode 100644 index de506c8..0000000 --- a/src/main/java/com/nis/web/dao/DnsFakeIpDao.xml +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, - groupId, - addrType, - srcIp, - maskSrcIp, - srcPort, - maskSrcPort, - dstIp, - maskDstIp, - dstPort, - maskDstPort, - protocol, - direction, - opTime, - isValid, - yl1, - yl2, - yl3, - yl4, - yl5, - lastUpdate - - - - - insert into DNS_FAKE_IP - - ID, - - GROUP_ID, - - - ADDR_TYPE, - - - SRC_IP, - - - MASK_SRC_IP, - - - SRC_PORT, - - - MASK_SRC_PORT, - - - DST_IP, - - - MASK_DST_IP, - - - DST_PORT, - - - MASK_DST_PORT, - - - PROTOCOL, - - - DIRECTION, - - - IS_VALID, - - - OP_TIME, - - - YL1, - - - YL2, - - - YL3, - - - YL4, - - - YL5, - - - LAST_UPDATE, - - - - #{id,jdbcType=BIGINT}, - - #{groupId,jdbcType=INTEGER}, - - - #{addrType,jdbcType=INTEGER}, - - - #{srcIp,jdbcType=VARCHAR}, - - - #{maskSrcIp,jdbcType=VARCHAR}, - - - #{srcPort,jdbcType=VARCHAR}, - - - #{maskSrcPort,jdbcType=VARCHAR}, - - - #{dstIp,jdbcType=VARCHAR}, - - - #{maskDstIp,jdbcType=VARCHAR}, - - - #{dstPort,jdbcType=VARCHAR}, - - - #{maskDstPort,jdbcType=VARCHAR}, - - - #{protocol,jdbcType=INTEGER}, - - - #{direction,jdbcType=INTEGER}, - - - #{isValid,jdbcType=INTEGER}, - - - #{opTime,jdbcType=TIMESTAMP}, - - - #{yl1,jdbcType=INTEGER}, - - - #{yl2,jdbcType=INTEGER}, - - - #{yl3,jdbcType=VARCHAR}, - - - #{yl4,jdbcType=VARCHAR}, - - - #{yl5,jdbcType=VARCHAR}, - - - #{lastUpdate,jdbcType=TIMESTAMP}, - - - - - UPDATE DNS_FAKE_IP - - - GROUP_ID=#{groupId,jdbcType=INTEGER}, - - - ADDR_TYPE=#{addrType,jdbcType=INTEGER}, - - - SRC_IP=#{srcIp,jdbcType=VARCHAR}, - - - MASK_SRC_IP=#{maskSrcIp,jdbcType=VARCHAR}, - - - SRC_PORT=#{srcPort,jdbcType=VARCHAR}, - - - MASK_SRC_PORT=#{maskSrcPort,jdbcType=VARCHAR}, - - - DST_IP=#{dstIp,jdbcType=VARCHAR}, - - - MASK_DST_IP=#{maskDstIp,jdbcType=VARCHAR}, - - - DST_PORT=#{dstPort,jdbcType=VARCHAR}, - - - MASK_DST_PORT=#{maskDstPort,jdbcType=VARCHAR}, - - - PROTOCOL=#{protocol,jdbcType=INTEGER}, - - - DIRECTION=#{direction,jdbcType=INTEGER}, - - - OP_TIME=#{opTime,jdbcType=TIMESTAMP}, - - - IS_VALID=#{isValid,jdbcType=INTEGER}, - - - YL1=#{yl1,jdbcType=INTEGER}, - - - YL2=#{yl2,jdbcType=INTEGER}, - - - YL3=#{yl3,jdbcType=VARCHAR}, - - - YL4=#{yl4,jdbcType=VARCHAR}, - - - YL5=#{yl5,jdbcType=VARCHAR}, - - - LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id ,jdbcType=BIGINT } - - - DELETE FROM DNS_FAKE_IP - WHERE ID = #{id,jdbcType=BIGINT} - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DnsGroupTypeDao.java b/src/main/java/com/nis/web/dao/DnsGroupTypeDao.java deleted file mode 100644 index 87fa959..0000000 --- a/src/main/java/com/nis/web/dao/DnsGroupTypeDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - *@Title: DnsGroupTypeDao.java - *@Package com.nis.web.dao - *@Description TODO - *@author dell - *@date 2016年9月7日 下午3:14:24 - *@version 版本号 - */ -package com.nis.web.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.nis.domain.restful.DnsGroupType; - -/** - * @ClassName: DnsGroupTypeDao.java - * @Description: TODO - * @author (dell) - * @date 2016年9月7日 下午3:14:24 - * @version V1.0 - */ -@MyBatisDao -public interface DnsGroupTypeDao extends CrudDao { - List getDnsGroupType(DnsGroupType DnsGroupType); - void save(DnsGroupType DnsGroupType); - void saveBatch(List DnsGroupTypeList); - void updateBatch(List DnsGroupTypeList); - void delete(long id); - int isValid(long id); - int isValidBatch(@Param("idsList")List idsList,@Param("isValid")int isValid); - int isGroupIdUnique(@Param("idsList")List idsList); -} diff --git a/src/main/java/com/nis/web/dao/DnsGroupTypeDao.xml b/src/main/java/com/nis/web/dao/DnsGroupTypeDao.xml deleted file mode 100644 index b2bd8b8..0000000 --- a/src/main/java/com/nis/web/dao/DnsGroupTypeDao.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - id, - groupId, - groupName, - resTypeId, - opTime, - isValid, - yl1, - yl2, - yl3, - yl4, - yl5, - lastUpdate - - - - - insert into DNS_GROUP_TYPE(ID,GROUP_ID,GROUP_NAME,RES_TYPE_ID,OP_TIME,IS_VALID,YL1,YL2,YL3,YL4,YL5,LAST_UPDATE) - values (#{id},#{groupId},#{groupName},#{resTypeId},#{opTime},#{isValid},#{yl1},#{yl2},#{yl3},#{yl4},#{yl5},#{lastUpdate}) - - - UPDATE DNS_GROUP_TYPE - - - GROUP_ID=#{groupId,jdbcType=INTEGER}, - - - GROUP_NAME=#{groupName,jdbcType=VARCHAR}, - - - RES_TYPE_ID=#{resTypeId,jdbcType=INTEGER}, - - - OP_TIME=#{opTime,jdbcType=TIMESTAMP}, - - - IS_VALID=#{isValid,jdbcType=INTEGER}, - - - YL1=#{yl1,jdbcType=INTEGER}, - - - YL2=#{yl2,jdbcType=INTEGER}, - - - YL3=#{yl3,jdbcType=VARCHAR}, - - - YL4=#{yl4,jdbcType=VARCHAR}, - - - YL5=#{yl5,jdbcType=VARCHAR}, - - - LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id ,jdbcType=BIGINT } - - - DELETE FROM DNS_GROUP_TYPE - WHERE ID = #{id,jdbcType=BIGINT} - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/DnsResponseStrategyDao.java b/src/main/java/com/nis/web/dao/DnsResponseStrategyDao.java deleted file mode 100644 index 94933cc..0000000 --- a/src/main/java/com/nis/web/dao/DnsResponseStrategyDao.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - *@Title: DnsResponseStrategyDao.java - *@Package com.nis.web.dao - *@Description TODO - *@author dell - *@date 2016年9月5日 下午5:45:51 - *@version 版本号 - */ -package com.nis.web.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.nis.domain.restful.DnsResponseStrategy; - -/** - * @ClassName: DnsResponseStrategyDao.java - * @Description: TODO - * @author (wx) - * @date 2016年9月5日 下午5:45:51 - * @version V1.0 - */ -@MyBatisDao -public interface DnsResponseStrategyDao extends CrudDao { - - List getDnsResponseStrategy(DnsResponseStrategy dnsResponseStrategy); - - void save(DnsResponseStrategy dnsResponseStrategy); - void saveBatch(List dnsResponseStrategyList); - void updateBatch(List dnsResponseStrategyList); - void delete(long id); - int isValid(long id); - int isValidBatch(@Param("idsList")List idsList,@Param("isValid")int isValid); - int isReqStrateIdUnique(@Param("idsList")List idsList); -} diff --git a/src/main/java/com/nis/web/dao/DnsResponseStrategyDao.xml b/src/main/java/com/nis/web/dao/DnsResponseStrategyDao.xml deleted file mode 100644 index 254aa82..0000000 --- a/src/main/java/com/nis/web/dao/DnsResponseStrategyDao.xml +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, - reqStrateId, - strateName, - resGroupOneId, - resGroupOneNum, - resGroupTwoId, - resGroupTwoNum, - resGroupThreeId, - resGroupThreeNum, - resGroupFourId, - resGroupFourNum, - resGroupFiveId, - resGroupFiveNum, - authGroup, - addGroup, - opTime, - isValid, - yl1, - yl2, - yl3, - yl4, - yl5, - lastUpdate, - minTtl, - maxTtl - - - - - - insert into DNS_RESPONSE_STRATEGY - - ID, - - REQ_STRATE_ID, - - - STRATE_NAME, - - - RES_GROUP_1_ID, - - - RES_GROUP_1_NUM, - - - RES_GROUP_2_ID, - - - RES_GROUP_2_NUM, - - - RES_GROUP_3_ID, - - - RES_GROUP_3_NUM, - - - RES_GROUP_4_ID, - - - RES_GROUP_4_NUM, - - - RES_GROUP_5_ID, - - - RES_GROUP_5_NUM, - - - AUTH_GROUP, - - - ADD_GROUP, - - - OP_TIME, - - - IS_VALID, - - - YL1, - - - YL2, - - - YL3, - - - YL4, - - - YL5, - - - LAST_UPDATE, - - - MIN_TTL, - - - MAX_TTL, - - - - #{id,jdbcType=BIGINT}, - - #{reqStrateId,jdbcType=INTEGER}, - - - #{strateName,jdbcType=VARCHAR}, - - - #{resGroupOneId,jdbcType=INTEGER}, - - - #{resGroupOneNum,jdbcType=INTEGER}, - - - #{resGroupTwoId,jdbcType=INTEGER}, - - - #{resGroupTwoNum,jdbcType=INTEGER}, - - - #{resGroupThreeId,jdbcType=INTEGER}, - - - #{resGroupThreeNum,jdbcType=INTEGER}, - - - #{resGroupFourId,jdbcType=INTEGER}, - - - #{resGroupFourNum,jdbcType=INTEGER}, - - - #{resGroupFiveId,jdbcType=INTEGER}, - - - #{resGroupFiveNum,jdbcType=INTEGER}, - - - #{authGroup,jdbcType=INTEGER}, - - - #{addGroup,jdbcType=INTEGER}, - - - #{opTime,jdbcType=TIMESTAMP}, - - - #{isValid,jdbcType=INTEGER}, - - - #{yl1,jdbcType=INTEGER}, - - - #{yl2,jdbcType=INTEGER}, - - - #{yl3,jdbcType=VARCHAR}, - - - #{yl4,jdbcType=VARCHAR}, - - - #{yl5,jdbcType=VARCHAR}, - - - #{lastUpdate,jdbcType=TIMESTAMP}, - - - #{minTtl,jdbcType=INTEGER}, - - - #{maxTtl,jdbcType=INTEGER}, - - - - - - UPDATE DNS_RESPONSE_STRATEGY - - - REQ_STRATE_ID=#{reqStrateId,jdbcType=INTEGER}, - - - STRATE_NAME=#{strateName,jdbcType=VARCHAR}, - - - RES_GROUP_1_ID=#{resGroupOneId,jdbcType=INTEGER}, - - - RES_GROUP_1_NUM=#{resGroupOneNum,jdbcType=INTEGER}, - - - RES_GROUP_2_ID=#{resGroupTwoId,jdbcType=INTEGER}, - - - RES_GROUP_2_NUM=#{resGroupTwoNum,jdbcType=INTEGER}, - - - RES_GROUP_3_ID=#{resGroupThreeId,jdbcType=INTEGER}, - - - RES_GROUP_3_NUM=#{resGroupThreeNum,jdbcType=INTEGER}, - - - RES_GROUP_4_ID=#{resGroupFourId,jdbcType=INTEGER}, - - - RES_GROUP_4_NUM=#{resGroupFourNum,jdbcType=INTEGER}, - - - RES_GROUP_5_ID=#{resGroupFiveId,jdbcType=INTEGER}, - - - RES_GROUP_5_NUM=#{resGroupFiveNum,jdbcType=INTEGER}, - - - AUTH_GROUP=#{authGroup,jdbcType=INTEGER}, - - - ADD_GROUP=#{addGroup,jdbcType=INTEGER}, - - - OP_TIME=#{opTime,jdbcType=TIMESTAMP}, - - - IS_VALID=#{isValid,jdbcType=INTEGER}, - - - YL1=#{yl1,jdbcType=INTEGER}, - - - YL2=#{yl2,jdbcType=INTEGER}, - - - YL3=#{yl3,jdbcType=VARCHAR}, - - - YL4=#{yl4,jdbcType=VARCHAR}, - - - YL5=#{yl5,jdbcType=VARCHAR}, - - - LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP}, - - - MIN_TTL=#{minTtl,jdbcType=INTEGER}, - - - MAX_TTL=#{maxTtl,jdbcType=INTEGER}, - - - where ID = #{id ,jdbcType=BIGINT } - - - DELETE FROM DNS_RESPONSE_STRATEGY - WHERE ID = #{id,jdbcType=BIGINT} - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/EncryptProtoRandomDao.java b/src/main/java/com/nis/web/dao/EncryptProtoRandomDao.java deleted file mode 100644 index f60b743..0000000 --- a/src/main/java/com/nis/web/dao/EncryptProtoRandomDao.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.nis.web.dao; - -import com.nis.domain.restful.EncryptProtoRandom; -@MyBatisDao -public interface EncryptProtoRandomDao extends CrudDao{ - int delete(Long id); - int insert(EncryptProtoRandom record); - int update(EncryptProtoRandom record); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/EncryptProtoRandomDao.xml b/src/main/java/com/nis/web/dao/EncryptProtoRandomDao.xml deleted file mode 100644 index c753d27..0000000 --- a/src/main/java/com/nis/web/dao/EncryptProtoRandomDao.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - ID, RANDOM_VALUE, PROTO, OP_TIME, IS_VALID, PROC_SEQ, LAST_UPDATE - - - - delete from ENCRYPT_PROTO_RANDOM - where ID = #{id,jdbcType=BIGINT} - - - - - insert into ENCRYPT_PROTO_RANDOM - - ID, - - RANDOM_VALUE, - - - PROTO, - - - OP_TIME, - - - IS_VALID, - - - LAST_UPDATE, - - - - #{id,jdbcType=BIGINT}, - - #{randomValue,jdbcType=INTEGER}, - - - #{proto,jdbcType=INTEGER}, - - - #{opTime,jdbcType=TIMESTAMP}, - - - #{isValid,jdbcType=INTEGER}, - - - #{lastUpdate,jdbcType=TIMESTAMP}, - - - - - update ENCRYPT_PROTO_RANDOM - - - RANDOM_VALUE = #{randomValue,jdbcType=INTEGER}, - - - PROTO = #{proto,jdbcType=INTEGER}, - - - OP_TIME = #{opTime,jdbcType=TIMESTAMP}, - - - IS_VALID = #{isValid,jdbcType=INTEGER}, - - - LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id,jdbcType=BIGINT} - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.java b/src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.java deleted file mode 100644 index c660a7e..0000000 --- a/src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.nis.web.dao; - -import com.nis.domain.restful.FakeIpConfigCompile; -/** - * - * @ClassName: FakeIpConfigCompileDao.java - * @Description: TODO - * @author (wx) - * @date 2016年9月8日 下午3:23:07 - * @version V1.0 - */ -@MyBatisDao -public interface FakeIpConfigCompileDao extends CrudDao { - int delete(Long compileId); - long getCompileId(); - int insert(FakeIpConfigCompile record); - - int insertSelective(FakeIpConfigCompile record); - - FakeIpConfigCompile selectByPrimaryKey(Long compileId); - - int updateByPrimaryKeySelective(FakeIpConfigCompile record); - - int updateByPrimaryKey(FakeIpConfigCompile record); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.xml b/src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.xml deleted file mode 100644 index c597eb5..0000000 --- a/src/main/java/com/nis/web/dao/FakeIpConfigCompileDao.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - COMPILE_ID, SERVICE, ACTION, DO_BLACKLIST, DO_LOG, EFFECTIVE_RANGE, USER_REGION, - IS_VALID, OP_TIME, GROUP_NUM,LAST_UPDATE,ACTIVE_SYS - - - - delete from FAKE_IP_CONFIG_COMPILE - where COMPILE_ID = #{compileId,jdbcType=BIGINT} - - - - insert into FAKE_IP_CONFIG_COMPILE (COMPILE_ID, SERVICE, ACTION, - DO_BLACKLIST, DO_LOG, EFFECTIVE_RANGE, - USER_REGION, IS_VALID, OP_TIME, - GROUP_NUM,LAST_UPDATE,ACTIVE_SYS) - values (#{compileId,jdbcType=BIGINT}, #{service,jdbcType=INTEGER}, #{action,jdbcType=INTEGER}, - #{doBlacklist,jdbcType=INTEGER}, #{doLog,jdbcType=INTEGER}, #{effectiveRange,jdbcType=VARCHAR}, - #{userRegion,jdbcType=VARCHAR}, #{isValid,jdbcType=INTEGER}, #{opTime,jdbcType=TIMESTAMP}, - #{groupNum,jdbcType=INTEGER}, #{lastUpdate,jdbcType=TIMESTAMP},#{activeSys,jdbcType=INTEGER}) - - - - update FAKE_IP_CONFIG_COMPILE - - - SERVICE = #{service,jdbcType=INTEGER}, - - - ACTION = #{action,jdbcType=INTEGER}, - - - DO_BLACKLIST = #{doBlacklist,jdbcType=INTEGER}, - - - DO_LOG = #{doLog,jdbcType=INTEGER}, - - - EFFECTIVE_RANGE = #{effectiveRange,jdbcType=VARCHAR}, - - - USER_REGION = #{userRegion,jdbcType=VARCHAR}, - - - IS_VALID = #{isValid,jdbcType=INTEGER}, - - - OP_TIME = #{opTime,jdbcType=TIMESTAMP}, - - - GROUP_NUM = #{groupNum,jdbcType=INTEGER}, - - - LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}, - - - ACTIVE_SYS = #{activeSys,jdbcType=INTEGER}, - - - where COMPILE_ID = #{compileId,jdbcType=BIGINT} - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.java b/src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.java deleted file mode 100644 index cd96b52..0000000 --- a/src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.nis.web.dao; - -import com.nis.domain.restful.FakeIpConfigGroup; -/** - * - * @ClassName: FakeIpConfigGroupDao.java - * @Description: TODO - * @author (wx) - * @date 2016年9月8日 下午3:25:17 - * @version V1.0 - */ -@MyBatisDao -public interface FakeIpConfigGroupDao extends CrudDao{ - int insert(FakeIpConfigGroup record); -// int delete(long record); - int insertSelective(FakeIpConfigGroup record); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.xml b/src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.xml deleted file mode 100644 index 658a324..0000000 --- a/src/main/java/com/nis/web/dao/FakeIpConfigGroupDao.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - insert into FAKE_IP_CONFIG_GROUP (GROUP_ID, COMPILE_ID, IS_VALID, - OP_TIME,LAST_UPDATE,ID) - values (#{groupId,jdbcType=BIGINT}, #{compileId,jdbcType=BIGINT}, #{isValid,jdbcType=INTEGER}, - #{opTime,jdbcType=TIMESTAMP},#{lastUpdate,jdbcType=TIMESTAMP},SEQ_CONFIG_GROUP.Nextval) - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/FwqInfoDao.java b/src/main/java/com/nis/web/dao/FwqInfoDao.java deleted file mode 100644 index f5fc0ad..0000000 --- a/src/main/java/com/nis/web/dao/FwqInfoDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.nis.web.dao; - -import com.nis.domain.restful.FwqInfo; -/** - * - * @ClassName: FwqInfoDao.java - * @Description: TODO - * @author (dell) - * @date 2016年9月9日 上午10:01:09 - * @version V1.0 - */ -@MyBatisDao -public interface FwqInfoDao extends CrudDao{ - int delete(long id); - - int insert(FwqInfo record); - - int update(FwqInfo record); -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/FwqInfoDao.xml b/src/main/java/com/nis/web/dao/FwqInfoDao.xml deleted file mode 100644 index b25886a..0000000 --- a/src/main/java/com/nis/web/dao/FwqInfoDao.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - ID, NAME, ENTRANCE_ID, CZYID, OP_TIME,LAST_UPDATE - - - - delete from FWQ_INFO - where ID = #{id,jdbcType=BIGINT} - - - - insert into FWQ_INFO (ID, NAME, ENTRANCE_ID, - CZYID, OP_TIME,LAST_UPDATE) - values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{entranceId,jdbcType=BIGINT}, - #{czyid,jdbcType=BIGINT}, #{opTime,jdbcType=TIMESTAMP},#{lastUpdate,jdbcType=TIMESTAMP}) - - - - update FWQ_INFO - - - NAME = #{name,jdbcType=VARCHAR}, - - - ENTRANCE_ID = #{entranceId,jdbcType=BIGINT}, - - - CZYID = #{czyid,jdbcType=BIGINT}, - - - OP_TIME = #{opTime,jdbcType=TIMESTAMP}, - - - LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id,jdbcType=BIGINT} - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/IpRegionDao.java b/src/main/java/com/nis/web/dao/IpRegionDao.java deleted file mode 100644 index 65d7b46..0000000 --- a/src/main/java/com/nis/web/dao/IpRegionDao.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.nis.web.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.nis.domain.restful.IpRegion; - -/** - * - * @ClassName: IpRegionDao - * @Description: TODO(ip类域配置dao) - * @author (rkg) - * @date 2016年9月6日下午8:49:52 - * @version V1.0 - */ -@MyBatisDao -public interface IpRegionDao { - - /** - * 保存ip类域配置信息,并返回主键id - * - * @param ipRegion - * ip类域配置 - * @return - */ - public Long saveIpRegion(IpRegion ipRegion); - - /** - * 根据主键id修改ip类域配置信息 - * - * @param ipRegion - */ - public void updateIpRegion(IpRegion ipRegion); - - /** - * 根据主键regionId查询ip域配置 - * - * @param ipRegion - * @return - */ - public IpRegion queryIpRegionById(IpRegion ipRegion); - /** - * 根据groupId获取该分组下所有的ip类域配置 - * @param tableName - * @param groupIdArr - * @return - */ - public List queryIpRegionByGroupId(@Param("tableName")String tableName,@Param("groupIdArr")Long[] groupIdArr); - - - /** - * 往指定ip域表中批量添加数据 - * @param tableName - * @param ipRegionList - */ - public void saveIpRegionBatch(@Param("tableName")String tableName,@Param("ipRegionList")List ipRegionList); -} diff --git a/src/main/java/com/nis/web/dao/IpRegionDao.xml b/src/main/java/com/nis/web/dao/IpRegionDao.xml deleted file mode 100644 index 5a46d22..0000000 --- a/src/main/java/com/nis/web/dao/IpRegionDao.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - REGION_ID,GROUP_ID, - ADDR_TYPE,SRC_IP,MASK_SRC_IP,SRC_PORT,MASK_SRC_PORT,DST_IP, - MASK_DST_IP,DST_PORT,MASK_DST_PORT,PROTOCOL,DIRECTION,IS_VALID,OP_TIME,LAST_UPDATE,PROC_SEQ - - - - - - - - - - - insert into ${tableName} - (REGION_ID, - GROUP_ID, - ADDR_TYPE, - SRC_IP, - MASK_SRC_IP, - SRC_PORT, - MASK_SRC_PORT, - DST_IP, - MASK_DST_IP, - DST_PORT, - MASK_DST_PORT, - PROTOCOL, - DIRECTION, - IS_VALID, - OP_TIME,LAST_UPDATE - - ) - - select - #{item.regionId,jdbcType=BIGINT}, - #{item.groupId,jdbcType=BIGINT}, - #{item.addrType,jdbcType=INTEGER}, - #{item.srcIp,jdbcType=VARCHAR}, - #{item.maskSrcIp,jdbcType=VARCHAR}, - #{item.srcPort,jdbcType=VARCHAR}, - #{item.maskSrcPort,jdbcType=VARCHAR}, - #{item.dstIp,jdbcType=VARCHAR}, - #{item.maskDstIp,jdbcType=VARCHAR}, - #{item.dstPort,jdbcType=VARCHAR}, - #{item.maskDstPort,jdbcType=VARCHAR}, - #{item.protocol,jdbcType=INTEGER}, - #{item.direction,jdbcType=INTEGER}, - #{item.isValid,jdbcType=INTEGER}, - #{item.opTime,jdbcType=TIMESTAMP}, - sysdate - - from dual - - - - - - - - - - - - - - - - - - - - - - insert into ${tableName} - (REGION_ID, - GROUP_ID, - ADDR_TYPE, - SRC_IP, - MASK_SRC_IP, - SRC_PORT, - MASK_SRC_PORT, - DST_IP, - MASK_DST_IP, - DST_PORT, - MASK_DST_PORT, - PROTOCOL, - DIRECTION, - IS_VALID, - - LAST_UPDATE, - - OP_TIME - ) - values - (#{regionId,jdbcType=BIGINT}, - #{groupId,jdbcType=BIGINT}, - #{addrType,jdbcType=INTEGER}, - #{srcIp,jdbcType=VARCHAR}, - #{maskSrcIp,jdbcType=VARCHAR}, - #{srcPort,jdbcType=VARCHAR}, - #{maskSrcPort,jdbcType=VARCHAR}, - #{dstIp,jdbcType=VARCHAR}, - #{maskDstIp,jdbcType=VARCHAR}, - #{dstPort,jdbcType=VARCHAR}, - #{maskDstPort,jdbcType=VARCHAR}, - #{protocol,jdbcType=INTEGER}, - #{direction,jdbcType=INTEGER}, - #{isValid,jdbcType=INTEGER}, - - #{lastUpdate,jdbcType=TIMESTAMP}, - - #{opTime,jdbcType=TIMESTAMP} - ) - - - - UPDATE ${tableName} - - - IS_VALID=#{isValid,jdbcType=INTEGER}, - - - OP_TIME=#{opTime,jdbcType=TIMESTAMP}, - - - LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP}, - - - where REGION_ID=#{regionId} - - - - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/JdjInfoDao.java b/src/main/java/com/nis/web/dao/JdjInfoDao.java deleted file mode 100644 index 872c3f2..0000000 --- a/src/main/java/com/nis/web/dao/JdjInfoDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.nis.web.dao; - -import com.nis.domain.restful.JdjInfo; -/** - * @ClassName: JdjInfoDao.java - * @Description: TODO - * @author (dell) - * @date 2016年9月9日 上午10:02:33 - * @version V1.0 - */ -@MyBatisDao -public interface JdjInfoDao extends CrudDao{ - int delete(long id); - - int insert(JdjInfo record); - - int update(JdjInfo record); - -} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/JdjInfoDao.xml b/src/main/java/com/nis/web/dao/JdjInfoDao.xml deleted file mode 100644 index 04a6a09..0000000 --- a/src/main/java/com/nis/web/dao/JdjInfoDao.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - ID, NAME, FWQ_ID, JC_IP, FD_IP, CZYID, OP_TIME,LAST_UPDATE - - - - delete from JDJ_INFO - where ID = #{id,jdbcType=BIGINT} - - - - - insert into JDJ_INFO - - ID, - - NAME, - - - FWQ_ID, - - - JC_IP, - - - FD_IP, - - - CZYID, - - - OP_TIME, - - - LAST_UPDATE, - - - - #{id,jdbcType=BIGINT}, - - #{name,jdbcType=VARCHAR}, - - - #{fwqId,jdbcType=BIGINT}, - - - #{jcIp,jdbcType=VARCHAR}, - - - #{fdIp,jdbcType=VARCHAR}, - - - #{czyid,jdbcType=BIGINT}, - - - #{opTime,jdbcType=TIMESTAMP}, - - - #{lastUpdate,jdbcType=TIMESTAMP}, - - - - - - update JDJ_INFO - - - NAME = #{name,jdbcType=VARCHAR}, - - - FWQ_ID = #{fwqId,jdbcType=BIGINT}, - - - JC_IP = #{jcIp,jdbcType=VARCHAR}, - - - FD_IP = #{fdIp,jdbcType=VARCHAR}, - - - CZYID = #{czyid,jdbcType=BIGINT}, - - - OP_TIME = #{opTime,jdbcType=TIMESTAMP}, - - - LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}, - - - where ID = #{id,jdbcType=BIGINT} - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/NumRegionDao.java b/src/main/java/com/nis/web/dao/NumRegionDao.java deleted file mode 100644 index f5b3f42..0000000 --- a/src/main/java/com/nis/web/dao/NumRegionDao.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.nis.web.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.nis.domain.restful.NumRegion; - -/** - * - * @ClassName: NumRegionDao - * @Description: TODO(数值类域配置dao) - * @author (rkg) - * @date 2016年9月6日下午8:50:11 - * @version V1.0 - */ -@MyBatisDao -public interface NumRegionDao { - - /** - * 保存数值类域配置信息,并返回主键id - * - * @param numRegion - * 数值类域配置 - * @return - */ - public Long saveNumRegion(NumRegion numRegion); - - /** - * 根据主键id修改数值类域配置信息 - * - * @param numRegion - * 数值类域配置 - */ - public void updateNumRegion(NumRegion numRegion); - - /** - * 根据主键regionId查询NumRegion - * - * @param numRegion - * @return - */ - public NumRegion queryNumRegionById(NumRegion numRegion); - - /** - * 根据groupId获取该分组下所有的数值类域配置 - * - * @param tableName获取表名 - * @param groupIdArr - * @return - */ - public List queryNumRegionByGroupId(@Param("tableName")String tableName,@Param("groupIdArr")Long[] groupIdArr); - - - - /** - * 向数值域配置表中批量添加数据 - * @param tableName - * @param numRegionList - */ - public void saveNumRegionBatch(@Param("tableName")String tableName,@Param("numRegionList")List numRegionList); -} diff --git a/src/main/java/com/nis/web/dao/NumRegionDao.xml b/src/main/java/com/nis/web/dao/NumRegionDao.xml deleted file mode 100644 index bcf2d06..0000000 --- a/src/main/java/com/nis/web/dao/NumRegionDao.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE,PROC_SEQ - - - - - - - - - - insert into ${tableName} - (REGION_ID , - GROUP_ID , - LOW_BOUNDARY , - UP_BOUNDARY , - IS_VALID , - OP_TIME,LAST_UPDATE - - ) - - select - #{item.regionId,jdbcType=BIGINT}, - #{item.groupId,jdbcType=BIGINT}, - #{item.lowBoundary,jdbcType=BIGINT}, - #{item.upBoundary,jdbcType=BIGINT}, - #{item.isValid,jdbcType=INTEGER}, - #{item.opTime,jdbcType=TIMESTAMP}, - sysdate - - from dual - - - - - - - - insert into ${tableName} - (REGION_ID , - GROUP_ID , - LOW_BOUNDARY , - UP_BOUNDARY , - IS_VALID , - - LAST_UPDATE, - - OP_TIME - ) - values - (#{regionId,jdbcType=BIGINT}, - #{groupId,jdbcType=BIGINT}, - #{lowBoundary,jdbcType=BIGINT}, - #{upBoundary,jdbcType=BIGINT}, - #{isValid,jdbcType=INTEGER}, - - #{lastUpdate,jdbcType=TIMESTAMP}, - - #{opTime,jdbcType=TIMESTAMP} - ) - - - - - UPDATE ${tableName} - - - IS_VALID=#{isValid , jdbcType=INTEGER }, - - - OP_TIME= #{ opTime , jdbcType=TIMESTAMP }, - - - LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP}, - - - where REGION_ID=#{regionId} - - - - - - \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/BaseLogService.java b/src/main/java/com/nis/web/service/BaseLogService.java index 9cc0292..1f40d64 100644 --- a/src/main/java/com/nis/web/service/BaseLogService.java +++ b/src/main/java/com/nis/web/service/BaseLogService.java @@ -17,11 +17,8 @@ import org.apache.ibatis.session.SqlSessionFactory; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import com.nis.domain.DfJitLogEntity; -import com.nis.domain.DfReportEntity; import com.nis.domain.LogEntity; import com.nis.domain.Page; -import com.nis.domain.StatLogEntity; import com.nis.domain.restful.NtcReportEntity; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; @@ -342,259 +339,7 @@ public abstract class BaseLogService { } } } - /** - * wx 报表查询条件检查 - * - * @param clazz - * 需要检验的实体名称[需要保证resultMap的id命名方式为[className]Map] - * @param page - * 需要校验的page对象 - */ - public void queryConditionCheck(AuditLogThread thread, long start, StatLogEntity entity, Class clazz, - Page page) { - - try { - if (!StringUtil.isBlank(entity.getSearchStatStartTime())) { - sdf.parse(entity.getSearchStatStartTime()); - } - } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatStartTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatStartTime参数格式错误"); - } - - try { - if (!StringUtil.isBlank(entity.getSearchStatEndTime())) { - sdf.parse(entity.getSearchStatEndTime()); - } - } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatEndTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatEndTime参数错误"); - } - try { - if (!StringUtil.isBlank(entity.getSearchService())) { - Integer.parseInt(entity.getSearchService()); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数错误"); - } - - try { - checkCloumnIsExist(thread, start, clazz, page); - } catch (RestServiceException e) { - logger.error(e); - throw e; - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误"); - } - - } - - /** - * 管控实时统计公共查询字段验证 - * - * @param entity - */ - public void queryConditionCheck(AuditLogThread thread, long start, DfJitLogEntity entity, Class clazz, - Page page) { - try { - if (!StringUtil.isBlank(entity.getSearchReportEndTime())) { - sdf.parse(entity.getSearchReportEndTime()); - } - } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式格式"); - } - try { - if (!StringUtil.isBlank(entity.getSearchReportStartTime())) { - sdf.parse(entity.getSearchReportStartTime()); - } - } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数错误"); - } - - try { - if (!StringUtil.isBlank(entity.getSearchService())) { - Integer.parseInt(entity.getSearchService()); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数错误"); - } - - try { - String searchAttrType = getSearchField(clazz, entity, "searchAttrType"); - if (!StringUtil.isBlank(searchAttrType)) { - Integer.parseInt(searchAttrType); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchAttrType参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchAttrType参数错误"); - } - try { - String searchLwhh = getSearchField(clazz, entity, "searchLwhh"); - if (!StringUtil.isBlank(searchLwhh)) { - Integer.parseInt(searchLwhh); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchLwhh参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchLwhh参数错误"); - } - - try { - checkCloumnIsExist(thread, start, clazz, page); - } catch (RestServiceException e) { - logger.error(e); - throw e; - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误"); - } - - } - - /** - * 实时统计公共查询字段验证 - * - * @param entity - */ - public void queryConditionCheck(AuditLogThread thread, long start, DfReportEntity entity, Class clazz, - Page page) { - try { - if (!StringUtil.isBlank(entity.getSearchReportEndTime())) { - sdf.parse(entity.getSearchReportEndTime()); - } - } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchReportEndTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchReportEndTime参数格式格式"); - } - - try { - if (!StringUtil.isBlank(entity.getSearchReportStartTime())) { - sdf.parse(entity.getSearchReportStartTime()); - } - } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchReportStartTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchReportStartTime参数错误"); - } - - try { - String searchAttrType = getSearchField(clazz, entity, "searchAttrType"); - if (!StringUtil.isBlank(searchAttrType)) { - Integer.parseInt(searchAttrType); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchAttrType参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchAttrType参数错误"); - } - try { - String searchLwhh = getSearchField(clazz, entity, "searchLwhh"); - if (!StringUtil.isBlank(searchLwhh)) { - Integer.parseInt(searchLwhh); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchLwhh参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchLwhh参数错误"); - } - try { - String searchId = getSearchField(clazz, entity, "searchId"); - if (!StringUtil.isBlank(searchId)) { - Integer.parseInt(searchId); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchId参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchId参数错误"); - } - - try { - String searchService = getSearchField(clazz, entity, "searchService"); - if (!StringUtil.isBlank(searchService)) { - Integer.parseInt(searchService); - } - } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchService参数格式错误", - RestBusinessCode.param_formate_error.getValue()); - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - throw new RestServiceException(thread, start, "searchService参数错误"); - } - - try { - checkCloumnIsExist(thread, start, clazz, page); - } catch (RestServiceException e) { - logger.error(e); - throw e; - } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, start, "请求参数错误"); - } - - } - + /** * * @Title: getJedisKey diff --git a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java index f44eb6b..f85c835 100644 --- a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java +++ b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java @@ -1,12 +1,8 @@ package com.nis.web.service.restful; -import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.sql.Connection; -import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -15,25 +11,19 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.concurrent.CountDownLatch; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sf.json.JSONObject; -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSession; -import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.nis.domain.Page; import com.nis.domain.restful.CommonSourceFieldCfg; import com.nis.domain.restful.ConfigCompile; -import com.nis.domain.restful.ConfigCompileTest; import com.nis.domain.restful.ConfigGroupRelation; import com.nis.domain.restful.DigestRegion; import com.nis.domain.restful.IpRegion; @@ -46,22 +36,13 @@ import com.nis.restful.ServiceRuntimeException; import com.nis.util.BasicProvingUtil; import com.nis.util.CamelUnderlineUtil; import com.nis.util.CompileVal; -import com.nis.util.Configurations; import com.nis.util.Constants; import com.nis.util.JsonMapper; -import com.nis.util.OracleErrorCodeUtil; import com.nis.util.ReadCommSourceXmlUtil; import com.nis.util.ServiceAndRDBIndexReal; import com.nis.util.StringUtil; -import com.nis.util.StringUtils; -import com.nis.web.dao.ConfigCompileDao; -import com.nis.web.dao.ConfigGroupRelationDao; -import com.nis.web.dao.IpRegionDao; -import com.nis.web.dao.NumRegionDao; -import com.nis.web.dao.StrRegionDao; import com.nis.web.service.AuditLogThread; import com.nis.web.service.BaseService; -import com.nis.web.service.SpringContextHolder; /** * @ClassName: ControlService @@ -72,884 +53,15 @@ import com.nis.web.service.SpringContextHolder; */ @Service public class ConfigSourcesService extends BaseService { - /** - * 存放多线程异常信息 - */ - private static List msgList = new ArrayList(); - - public static List getMsgList() { - return msgList; - } - - public static void setMsgList(List msgList) { - ConfigSourcesService.msgList = msgList; - } private Map> map; - @Autowired - private ConfigCompileDao configCompileDao; - - @Autowired - private IpRegionDao ipRegionDao; - @Autowired - private NumRegionDao numRegionDao; - - @Autowired - private ConfigGroupRelationDao configGroupRelationDao; - @Autowired - private StrRegionDao strRegionDao; - + private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @Autowired ConfigRedisService configRedisService; - - /** - * 批量(mybatis方式)修改配置业务逻辑-->1:先进行基础配置验证传过来的json串是否符合格式(配置分组关系前端不能设置为无效, - * 程序会根据传过来的编译配置和域配置等信息自动设置为无效). 符合要求调用updateConfigCompile方法继续验证 - * - * @param thread - * 保存异常信息入库对象 - * @param start - * 进入controller的时间 - * @param configSource - * 编译配置集合 - * @return - * @throws Exception - */ - public void updateConfigSource(AuditLogThread thread, long start, - List configSource, Date opTime, StringBuffer sb) { - SqlSessionFactory sqlSessionFactory = SpringContextHolder - .getBean(SqlSessionFactory.class); - SqlSession batchSqlSession = null; - try { - batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, - false); - if (null != configSource && configSource.size() > 0) { - for (ConfigCompile config : configSource) { - String msg = CompileVal.compileIsOk(config, true, sb); - if (!"ok".equals(msg)) { - throw new RestServiceException(msg - + sb.toString(), - CompileVal.getBusinessCode()); - } - updateConfigCompile(thread, start, config, batchSqlSession, - opTime, sb); - } - - } else { - throw new RestServiceException("编译配置不能为空" - + sb.toString(), - CompileVal.getBusinessCode()); - } - logger.info("数据保存到数据库提交事务开始"); - batchSqlSession.commit(); - logger.info("数据保存到数据库成功"); - } catch (RestServiceException e) { - logger.error("RestServiceException", e); - thread.setExceptionInfo(e.getMessage() + " " + e.getCause() - + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - start, e.getMessage() + sb.toString(), e.getErrorCode()); - } catch (Exception e) { - logger.error("Exception", e); - String errorCode = OracleErrorCodeUtil.getOraCode(e); - if (!StringUtils.isEmpty(errorCode)) { - logger.error("数据更新发生异常!"); - thread.setExceptionInfo(e.getMessage() + " " + e.getCause() - + sb.toString()); - OracleErrorCodeUtil.throwExceptionInfo(thread, - System.currentTimeMillis() - start, errorCode); - } else { - thread.setExceptionInfo("数据更新发生异常" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, "数据更新发生异常" - + sb.toString(), - RestBusinessCode.unknow_error.getValue()); - } - } finally { - if (batchSqlSession != null) { - batchSqlSession.close(); - } - } - - } - - /** - * 批量(mybatis方式)修改配置业务逻辑-->2:判断配置在数据库中是否已经是无效了如果是无效则提示不能修改无效的配置为有效( - * 因为如果数据库中的编译配置与配置分组关系以及域配置均是无效 - * ,传过来的数据是编译配置和配置分组关系是有效,域配置是无效,这样会将数据库中无效的编译配置置为有效,这是不允许的) - * 3:如果编译配置置为无效将所有的配置分组关系置为无效,不修改域配置状态(分组复用考虑,域可能被其他的组引用) - * 4:如果编译配置为有效,域配置为无效,则先获取该编译配置下各个配置分组关系下的所有有效的域配置信息和所有无效的域配置信息, - * 如果数据库中有效的域配置信息和前端传过来置为无效的的域配置信息个数,id都相等,则将对应域配置,配置分组关系,编译配置均置为无效 - * - * 20161124讨论暂时先去掉2步骤,因为界面目前传过来的数据编译配置,配置分组关系,域配置均是无效,所以就不执行第2步骤了影响性能( - * 方法内注释的代码,如果以后业务需要调整打开下面代码即可) - * - * @param thread - * 保存异常信息入库对象 - * @param start - * 进入controller的时间 - * @param config - * 编译配置 - * @return - * @throws Exception - */ - - public void updateConfigCompile(AuditLogThread thread, long start, - ConfigCompile config, SqlSession batchSqlSession, Date opTime, - StringBuffer sb) throws Exception { - List ipRegionList = config.getIpRegionList(); - List strRegionList = config.getStrRegionList(); - List numRegionList = config.getNumRegionList(); - List groupRelationList = config - .getGroupRelationList(); - if (config.getIsValid() == 1) { - if (groupRelationList == null || groupRelationList.size() == 0) { - thread.setExceptionInfo("配置分组数量不能为空" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, "配置分组数量不能为空" - + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - if ((ipRegionList == null || ipRegionList.size() == 0) - && (strRegionList == null || strRegionList.size() == 0) - && (numRegionList == null || numRegionList.size() == 0)) { - thread.setExceptionInfo("域配置数量不能全部为空" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, "域配置数量不能全部为空" - + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - } - - // ConfigCompile configCompile = - // configCompileDao.queryConfigCompileById(config.getCompileId());// - // 先判断该条编译配置数据库中状态是否为无效,如果无效则提示用户不能将无效状态改为有效状态 - // if (configCompile.getIsValid() == 1) {// 数据库中编译配置为有效状态才可以进行修改操作 - /** - * 1:编译配置置为无效,需要将其下所有配置分组置为无效,如果数据中将域配置置为了无效则将域配置置为无效,否则不修改域配置是否生效标志 - * 2:编译配置置为有效,不修改编译配置状态(编译配置不能从无效变有效,只能从有效变无效)仅修改编译配置其他属性, - */ - - List queryCompileGroupByPID = configGroupRelationDao - .queryCompileGroupByPID(config.getCompileId()); - - if (null == queryCompileGroupByPID - || queryCompileGroupByPID.size() == 0) { - throw new RestServiceException(thread, System.currentTimeMillis() - - start, "配置id为" + config.getCompileId() - + "的配置,在数据库中找不到对应的配置分组关系,请检查json串是否正确。" + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - if (config.getIsValid() == 0) {// 编译配置修改为无效,需要将所有的配置分组置为无效 - if (null != queryCompileGroupByPID - && queryCompileGroupByPID.size() > 0) { - for (ConfigGroupRelation configGroupRelation : queryCompileGroupByPID) { - configGroupRelation.setIsValid(0); - configGroupRelation.setOpTime(opTime); - - if (Configurations.getStringProperty("isCommit", "false") - .equals("true")) { - batchSqlSession.getMapper(ConfigGroupRelationDao.class) - .updateConfigGroupRelation(configGroupRelation); - } - } - } - // config.setLastUpdate(new Date()); - if (Configurations.getStringProperty("isCommit", "false").equals( - "true")) { - batchSqlSession.getMapper(ConfigCompileDao.class) - .updateConfigCompile(config); - } - - } else { - regionUpdate(thread, start, config, queryCompileGroupByPID, - batchSqlSession, opTime, sb); - } - - // } else {// 数据库中编译配置为无效状态不能进行操作 - // throw new RestServiceException(thread, System.currentTimeMillis() - - // start, "不能修改无效的编译配置信息", - // RestBusinessCode.missing_args.getValue()); - // } - - } - - /** - * 获取编译配置下所有的配置分组关系对应的有效,无效域配置id - * - * @param thread - * 保存异常信息入库对象 - * @param start - * 进入controller的时间 - * @param config - * 编译配置对象 - * @param queryCompileGroupByPID - * 当前编译下所有的配置分组关系 - * @return - */ - public void regionUpdate(AuditLogThread thread, long start, - ConfigCompile config, - List queryCompileGroupByPID, - SqlSession batchSqlSession, Date opTime, StringBuffer sb) - throws Exception { - Map>> regionMap = getRegionList(thread, - System.currentTimeMillis() - start, config, - queryCompileGroupByPID, batchSqlSession, sb); - Map> validMap = regionMap.get("validMap");// 获取该编译配置下所有的配置分组关系及组下有效的域配置id - Map> noValidMap = regionMap.get("noValidMap");// 获取该编译配置下所有的配置分组关系及组下无效的域配置id - List ipRegionList = config.getIpRegionList();// 获取编译下所有ip类域配置(要修改的数据) - List strRegionList = config.getStrRegionList();// 获取编译下所有字符串类域配置(要修改的数据 - List numRegionList = config.getNumRegionList();// 获取编译下所有数值类域配置(要修改的数据 - int num = 0; - for (Long regionId : validMap.keySet()) {// 遍历配置分组 - List validList = validMap.get(regionId);// 获取配置分组下有效的域配置id - List noValidList = noValidMap.get(regionId);// 获取配置分组下无效的域配置id - int count = 0; - if (null != ipRegionList && ipRegionList.size() > 0) { - List tableList = new ArrayList(); - for (IpRegion ipRegion : ipRegionList) { - if (ipRegion.getGroupId().equals(regionId)) { - if (null != validList - && validList.contains(ipRegion.getRegionId())) { - if (ipRegion.getIsValid() == 0) { - ipRegion.setOpTime(opTime); - ipRegion.setLastUpdate(new Date()); - if (Configurations.getStringProperty( - "isCommit", "false").equals("true")) { - batchSqlSession - .getMapper(IpRegionDao.class) - .updateIpRegion(ipRegion); - } - count++; - if (!tableList - .contains(ipRegion.getTableName())) { - tableList.add(ipRegion.getTableName()); - } - } - } else if (null != noValidList - && noValidList.contains(ipRegion.getRegionId())) { - String msg = "不能修改无效的ip类域配置compile为" - + config.getCompileId() + "regionid为" - + ipRegion.getRegionId() + sb.toString(); - thread.setExceptionInfo(msg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg, - RestBusinessCode.missing_args.getValue()); - } else { - String msg = "找不到对应的的ip类域配置compile为" - + config.getCompileId() + "regionid为" - + ipRegion.getRegionId() + sb.toString(); - thread.setExceptionInfo(msg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg, - RestBusinessCode.missing_args.getValue()); - } - } - } - - } - - if (null != strRegionList && strRegionList.size() > 0) { - List tableList = new ArrayList(); - for (StrRegion strRegion : strRegionList) { - if (strRegion.getGroupId().equals(regionId)) { - if (null != validList - && validList.contains(strRegion.getRegionId())) { - if (strRegion.getIsValid() == 0) { - strRegion.setOpTime(opTime); - strRegion.setLastUpdate(new Date()); - if (Configurations.getStringProperty( - "isCommit", "false").equals("true")) { - batchSqlSession.getMapper( - StrRegionDao.class) - .updateStrRegion(strRegion); - } - count++; - if (!tableList.contains(strRegion - .getTableName())) { - tableList.add(strRegion.getTableName()); - } - } - } else if (null != noValidList - && noValidList - .contains(strRegion.getRegionId())) { - String msg = "不能修改无效的字符串类域配置compile为" - + config.getCompileId() + "regionid为" - + strRegion.getRegionId() + sb.toString(); - thread.setExceptionInfo(msg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg, - RestBusinessCode.missing_args.getValue()); - } else { - String msg = "找不到对应的的字符串类域配置compile为" - + config.getCompileId() + "regionid为" - + strRegion.getRegionId() + sb.toString(); - thread.setExceptionInfo(msg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg, - RestBusinessCode.missing_args.getValue()); - } - } - } - - } - if (null != numRegionList && numRegionList.size() > 0) { - List tableList = new ArrayList(); - for (NumRegion numRegion : numRegionList) { - if (numRegion.getGroupId().equals(regionId)) { - if (null != validList - && validList.contains(numRegion.getRegionId())) { - if (numRegion.getIsValid() == 0) { - numRegion.setOpTime(opTime); - numRegion.setLastUpdate(new Date()); - if (Configurations.getStringProperty( - "isCommit", "false").equals("true")) { - batchSqlSession.getMapper( - NumRegionDao.class) - .updateNumRegion(numRegion); - } - count++; - if (!tableList.contains(numRegion - .getTableName())) { - tableList.add(numRegion.getTableName()); - } - - } - } else if (null != noValidList - && noValidList - .contains(numRegion.getRegionId())) { - String msg = "不能修改无效的数值类域配置compile为" - + config.getCompileId() + "regionid为" - + numRegion.getRegionId() + sb.toString(); - thread.setExceptionInfo(msg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg, - RestBusinessCode.missing_args.getValue()); - } else { - String msg = "找不到对应的的数值类域配置compile为" - + config.getCompileId() + "regionid为" - + numRegion.getRegionId() + sb.toString(); - thread.setExceptionInfo(msg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg, - RestBusinessCode.missing_args.getValue()); - } - } - } - - } - if (count == validList.size()) {// 数据库中当前配置分组下有效的域配置,均被修改为无效,所以要将该配置分组置为无效 - List groupRelationList = config - .getGroupRelationList(); - for (ConfigGroupRelation configGroupRelation : groupRelationList) { - if (configGroupRelation.getGroupId().equals(regionId)) { - num++; - configGroupRelation.setIsValid(0); - configGroupRelation.setOpTime(opTime); - if (Configurations.getStringProperty("isCommit", - "false").equals("true")) { - batchSqlSession.getMapper( - ConfigGroupRelationDao.class) - .updateConfigGroupRelation( - configGroupRelation); - } - } - } - - } - } - - if (num == validMap.size()) {// 所有的域均是无效的所有的组均是无效,需要将编译配置置为无效 - config.setIsValid(0); - if (Configurations.getStringProperty("isCommit", "false").equals( - "true")) { - batchSqlSession.getMapper(ConfigCompileDao.class) - .updateConfigCompile(config); - } - } - } - - public Map>> getRegionList( - AuditLogThread thread, long start, ConfigCompile config, - List queryCompileGroupByPID, - SqlSession batchSqlSession, StringBuffer sb) { - Map>> map = new HashMap>>(); - Map updateTableMap = new HashMap(); - Map> sercieNameMap = ServiceAndRDBIndexReal.getSercieNameMap().get(config - .getService().intValue()); - if (sercieNameMap != null && sercieNameMap.size() > 0) { - for (Integer type : sercieNameMap.keySet()) { - String typeStr=""; -// 12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置, - if ("12".equals(type.toString())) { - typeStr="ip"; - }else if ("13".equals(type.toString())) { - typeStr="str"; - }else if ("14".equals(type.toString())||"15".equals(type.toString())) { - typeStr="num"; - } - if (!"".equals(typeStr)) { - List tableList = sercieNameMap.get(type); - if (tableList != null && tableList.size() > 0) { - for (String table : tableList) { - updateTableMap.put(table.toUpperCase(),typeStr); - } - } - } - } - }else{ - thread.setExceptionInfo("找不到编译对应的service" + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - start, "找不到编译对应的service" + sb.toString(), - RestBusinessCode.missing_args.getValue()); - } - - Long[] groupId = new Long[queryCompileGroupByPID.size()]; - for (int i = 0; i < queryCompileGroupByPID.size(); i++) { - groupId[i] = queryCompileGroupByPID.get(i).getGroupId(); - } - // 获取当前编译下所有的域配置信息 - List ipRegionExistList = new ArrayList(); - List strRegionExistList = new ArrayList(); - List numRegionExistList = new ArrayList(); - for (String tableName : updateTableMap.keySet()) { - if (updateTableMap.get(tableName).equals("ip")) { - List queryIpRegionByGroupId = ipRegionDao - .queryIpRegionByGroupId(tableName, groupId); - ipRegionExistList.addAll(queryIpRegionByGroupId); - } - if (updateTableMap.get(tableName).equals("num")) { - numRegionExistList.addAll(numRegionDao.queryNumRegionByGroupId( - tableName, groupId)); - } - if (updateTableMap.get(tableName).equals("str")) { - strRegionExistList.addAll(strRegionDao.queryStrRegionByGroupId( - tableName, groupId)); - } - } - - Map> validMap = new HashMap>();// 获取当前编译下所有的组,及每个组下面的有效域配置 - Map> noValidMap = new HashMap>();// 获取当前编译下所有的组,及每个组下面的无效域配置 - for (IpRegion ipRegion : ipRegionExistList) { - if (ipRegion.getIsValid() == 1) { - List validRegionList = null; - if (validMap.get(ipRegion.getGroupId()) == null) { - validRegionList = new ArrayList(); - validRegionList.add(ipRegion.getRegionId()); - validMap.put(ipRegion.getGroupId(), validRegionList); - } else { - validRegionList = validMap.get(ipRegion.getGroupId()); - // if (!validRegionList.contains(ipRegion.getRegionId())) { - validRegionList.add(ipRegion.getRegionId()); - validMap.put(ipRegion.getGroupId(), validRegionList); - // } - } - } - if (ipRegion.getIsValid() == 0) { - List noValidRegionList = null; - if (noValidMap.get(ipRegion.getGroupId()) == null) { - noValidRegionList = new ArrayList(); - noValidRegionList.add(ipRegion.getRegionId()); - noValidMap.put(ipRegion.getGroupId(), noValidRegionList); - } else { - noValidRegionList = noValidMap.get(ipRegion.getGroupId()); - // if (!noValidRegionList.contains(ipRegion.getRegionId())) - // { - noValidRegionList.add(ipRegion.getRegionId()); - noValidMap.put(ipRegion.getGroupId(), noValidRegionList); - // } - } - } - } - - for (StrRegion strRegion : strRegionExistList) { - if (strRegion.getIsValid() == 1) { - List validRegionList = null; - if (validMap.get(strRegion.getGroupId()) == null) { - validRegionList = new ArrayList(); - - validRegionList.add(strRegion.getRegionId()); - - validMap.put(strRegion.getGroupId(), validRegionList); - } else { - validRegionList = validMap.get(strRegion.getGroupId()); - // if (!validRegionList.contains(strRegion.getRegionId())) { - validRegionList.add(strRegion.getRegionId()); - validMap.put(strRegion.getGroupId(), validRegionList); - - // } - } - } - if (strRegion.getIsValid() == 0) { - List noValidRegionList = null; - if (noValidMap.get(strRegion.getGroupId()) == null) { - noValidRegionList = new ArrayList(); - noValidRegionList.add(strRegion.getRegionId()); - noValidMap.put(strRegion.getGroupId(), noValidRegionList); - } else { - noValidRegionList = noValidMap.get(strRegion.getGroupId()); - // if (!noValidRegionList.contains(strRegion.getRegionId())) - // { - noValidRegionList.add(strRegion.getRegionId()); - noValidMap.put(strRegion.getGroupId(), noValidRegionList); - // } - } - } - } - for (NumRegion numRegion : numRegionExistList) { - if (numRegion.getIsValid() == 1) { - List validRegionList = null; - if (validMap.get(numRegion.getGroupId()) == null) { - validRegionList = new ArrayList(); - validRegionList.add(numRegion.getRegionId()); - validMap.put(numRegion.getGroupId(), validRegionList); - - } else { - validRegionList = validMap.get(numRegion.getGroupId()); - // if (!validRegionList.contains(numRegion.getRegionId())) { - validRegionList.add(numRegion.getRegionId()); - validMap.put(numRegion.getGroupId(), validRegionList); - // } - - } - } - if (numRegion.getIsValid() == 0) { - List noValidRegionList = null; - if (noValidMap.get(numRegion.getGroupId()) == null) { - noValidRegionList = new ArrayList(); - noValidRegionList.add(numRegion.getRegionId()); - noValidMap.put(numRegion.getGroupId(), noValidRegionList); - } else { - noValidRegionList = noValidMap.get(numRegion.getGroupId()); - // if (!noValidRegionList.contains(numRegion.getRegionId())) - // { - noValidRegionList.add(numRegion.getRegionId()); - noValidMap.put(numRegion.getGroupId(), noValidRegionList); - // } - } - } - } - - map.put("noValidMap", noValidMap); - map.put("validMap", validMap); - return map; - - } - - // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * 批量插入配置编译数据在数据库中循环 - * - * @param configSource - * @throws Exception - */ - public void insertConfigSourceData(AuditLogThread thread, - long _start, List configSource, StringBuffer sb) { - SqlSessionFactory sqlSessionFactory = SpringContextHolder - .getBean(SqlSessionFactory.class); - SqlSession batchSqlSession = null; - try { - // batchSqlSession = - // sqlSessionFactory.openSession(ExecutorType.SIMPLE, false); - batchSqlSession = sqlSessionFactory.openSession(); - int index = 150; - int count = configSource.size() % index == 0 ? configSource.size() - / index : configSource.size() / index + 1; - for (int i = 0; i < count; i++) { - int start = i * index; - int end = i * index + index; - if (end > configSource.size()) { - end = configSource.size(); - } - List compileList = configSource.subList(start, - end); - insertConfigComLileData(thread, _start, compileList, sb); - // logger.info(insertConfigComLile); - } - - logger.info("数据保存到数据库提交事务开始"); - batchSqlSession.commit(); - logger.info("数据保存到数据库成功"); - - } catch (RestServiceException e) { - logger.error("RestServiceException", e); - thread.setExceptionInfo(e.getMessage() + " " + e.getCause() - + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - _start, e.getMessage() + sb.toString(), e.getErrorCode()); - - } catch (Exception e) { - logger.error("Exception", e); - String errorCode = OracleErrorCodeUtil.getOraCode(e); - if (!StringUtils.isEmpty(errorCode)) { - thread.setExceptionInfo("数据保存发生异常" + sb.toString()); - OracleErrorCodeUtil.throwExceptionInfo(thread, - System.currentTimeMillis() - _start, errorCode); - } else { - thread.setExceptionInfo("数据保存发生异常" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - _start, "数据保存发生异常" - + sb.toString(), - RestBusinessCode.unknow_error.getValue()); - } - - } finally { - if (batchSqlSession != null) { - batchSqlSession.close(); - } - } - - } - - /** - * 验证数据是否符合要求 插入编译配置数据 验证分组配置数据 验证域配置数据 方法二 数据库中循环 - * - * @param configCompileList - * @param configCompileList - * @return - * @throws Exception - */ - private String insertConfigComLileData(AuditLogThread thread, - long start, List configCompileList, StringBuffer sb) - throws Exception { - - List groupRelationList = new ArrayList(); - Map> strRegionMap = new HashMap>(); - Map> strStongRegionMap = new HashMap>(); - Map> ipRegionMap = new HashMap>(); - Map> numRegionMap = new HashMap>(); - - for (ConfigCompile configCompile : configCompileList) { - String msg = CompileVal.compileIsOk(configCompile, false, sb); - if (!"ok".equals(msg)) { - logger.error(msg); - thread.setExceptionInfo(msg + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - msg + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - if (null != configCompile.getGroupRelationList() - && configCompile.getGroupRelationList().size() > 0) { - groupRelationList.addAll(configCompile.getGroupRelationList()); - } else { - logger.error("配置分组数量不能为空" + sb.toString()); - thread.setExceptionInfo("配置分组数量不能为空" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, "配置分组数量不能为空" - + sb.toString(), - RestBusinessCode.missing_args.getValue()); - } - if (null != configCompile.getStrRegionList() - && configCompile.getStrRegionList().size() > 0) { - for (StrRegion strRegion : configCompile.getStrRegionList()) { - if (!isStrStrongRegion(strRegion.getTableName(),configCompile.getService())) { - if (strRegion.getRegionId() == null) { - String errorMsg = "字符类域配置id不能为空 ,表名---" - + strRegion.getTableName() + "" - + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - errorMsg, - RestBusinessCode.missing_args.getValue()); - } - if (strRegionMap.containsKey(strRegion.getTableName())) { - strRegionMap.get(strRegion.getTableName()).add( - strRegion); - } else { - List strRegionList = new ArrayList(); - strRegionList.add(strRegion); - strRegionMap.put(strRegion.getTableName(), - strRegionList); - } - } else { - if (strRegion.getRegionId() == null) { - String errorMsg = "增强字符类域配置id不能为空 ,表名---" - + strRegion.getTableName() + "" - + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - errorMsg, - RestBusinessCode.missing_args.getValue()); - } - if (strStongRegionMap.containsKey(strRegion - .getTableName())) { - strStongRegionMap.get(strRegion.getTableName()) - .add(strRegion); - } else { - List strStrongRegionList = new ArrayList(); - strStrongRegionList.add(strRegion); - strStongRegionMap.put(strRegion.getTableName(), - strStrongRegionList); - } - - } - } - } - - if (null != configCompile.getIpRegionList() - && configCompile.getIpRegionList().size() > 0) { - for (IpRegion ipRegion : configCompile.getIpRegionList()) { - if (!ipRegion.getTableName().toUpperCase() - .equals("DJ_IP_PORT")) { - ipRegion.setProtocol(0); - } - - if (ipRegion.getRegionId() == null) { - String errorMsg = "ip类域配置id不能为空 ,表名---" - + ipRegion.getTableName() + "" + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, errorMsg, - RestBusinessCode.missing_args.getValue()); - } - - if (ipRegionMap.containsKey(ipRegion.getTableName())) { - ipRegionMap.get(ipRegion.getTableName()).add(ipRegion); - } else { - List ipRegionList = new ArrayList(); - ipRegionList.add(ipRegion); - ipRegionMap.put(ipRegion.getTableName(), ipRegionList); - } - } - } - - if (null != configCompile.getNumRegionList() - && configCompile.getNumRegionList().size() > 0) { - for (NumRegion numRegion : configCompile.getNumRegionList()) { - if (numRegion.getRegionId() == null) { - String errorMsg = "数值类域配置id不能为空 ,表名---" - + numRegion.getTableName() + "" + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, errorMsg, - RestBusinessCode.missing_args.getValue()); - } - - if (numRegionMap.containsKey(numRegion.getTableName())) { - numRegionMap.get(numRegion.getTableName()).add( - numRegion); - } else { - List numRegionList = new ArrayList(); - numRegionList.add(numRegion); - numRegionMap.put(numRegion.getTableName(), - numRegionList); - } - } - } - } - if (Configurations.getStringProperty("isCommit", "false") - .equals("true")) { - configCompileDao.saveCompileBatch(configCompileList); - if (groupRelationList.size() > 0) { - for (ConfigGroupRelation group : groupRelationList) { - configGroupRelationDao.saveConfigGroupRelation(group); - } - } - for (String str : strRegionMap.keySet()) { - strRegionDao.saveStrRegionBatch(strRegionMap.get(str).get(0) - .getTableName(), strRegionMap.get(str)); - } - for (String strStrong : strStongRegionMap.keySet()) { - strRegionDao.saveStrStrongRegionBatch( - strStongRegionMap.get(strStrong).get(0).getTableName(), - strStongRegionMap.get(strStrong)); - } - for (String ip : ipRegionMap.keySet()) { - ipRegionDao.saveIpRegionBatch(ipRegionMap.get(ip).get(0) - .getTableName(), ipRegionMap.get(ip)); - } - for (String num : numRegionMap.keySet()) { - numRegionDao.saveNumRegionBatch(numRegionMap.get(num).get(0) - .getTableName(), numRegionMap.get(num)); - } - } - return "编译配置数据验证成功"; - - } - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - public Page queryAllCompile( - Page page, ConfigCompileTest entity) - throws SQLException { - entity.setPage(page); - page.setList(configCompileDao.queryAllCompile( - entity.getSearchEndTime(), entity.getSearchStartTime(), - entity.getService(), entity.getCompileId())); - return page; - } - - public List queryAllCompile(ConfigCompileTest entity) { - return configCompileDao.queryAllCompile(entity.getSearchEndTime(), - entity.getSearchStartTime(), entity.getService(), - entity.getCompileId()); - } - - public List queryConfigCompileByIdArr(String compileIdArr) { - return configCompileDao.queryConfigCompileByIdArr(compileIdArr); - } - - public List getGroupByCompile(long compileId) { - return configGroupRelationDao.queryCompileGroupByPID(compileId); - } - -// public List getStrRegionByGId(List tableList, -// Long[] groupId) { -// List strRegionList = new ArrayList(); -// if (null != tableList && tableList.size() > 0) { -// for (String tableName : tableList) { -// List queryStrRegionByGroupId = null; -// if (isStrStrongRegion(tableName)) { -// queryStrRegionByGroupId = strRegionDao -// .queryStrStrongRegionByGroupId(tableName, groupId); -// } else { -// queryStrRegionByGroupId = strRegionDao -// .queryStrRegionByGroupId(tableName, groupId); -// } -// -// if (null != queryStrRegionByGroupId -// && queryStrRegionByGroupId.size() > 0) { -// for (StrRegion strRegion : queryStrRegionByGroupId) { -// strRegion.setTableName(tableName); -// strRegionList.add(strRegion); -// } -// } -// -// } -// } -// -// return strRegionList; -// } - - public List getIpRegionByGId(String table, Long[] groupId) { - List queryIpRegionByGroupId = ipRegionDao - .queryIpRegionByGroupId(table, groupId); - for (IpRegion ipRegion : queryIpRegionByGroupId) { - ipRegion.setTableName(table); - } - return queryIpRegionByGroupId; - } - - public List getNumRegionByGId(String table, Long[] groupId) { - List queryNumRegionByGroupId = numRegionDao - .queryNumRegionByGroupId(table, groupId); - for (NumRegion numRegion : queryNumRegionByGroupId) { - numRegion.setTableName(table); - } - return queryNumRegionByGroupId; - } - - public static boolean isStrStrongRegion(String tableName,Integer service) { + public static boolean isStrStrongRegion(String tableName,Integer service) throws Exception{ if (null != tableName && !tableName.equals("")) { List tableList = new ArrayList(); Map> sercieNameMap = ServiceAndRDBIndexReal.getSercieNameMap().get(service); @@ -978,13 +90,6 @@ public class ConfigSourcesService extends BaseService { } -// public Map getTableMap(Integer service) { -// if (map == null || map.size() == 0) { -// map = getTableRelation(); -// } -// return map.get(service); -// } - public Map> getMap() { return map; } @@ -1004,330 +109,214 @@ public class ConfigSourcesService extends BaseService { * @param sb * @return */ - public String saveMaatConfig(AuditLogThread thread, long start, - List configCompileList, StringBuffer sb) { - // List maatConfigList = new ArrayList(); - // List serviceList = new ArrayList(); + public void saveMaatConfig(AuditLogThread thread, long start, + List configCompileList, StringBuffer sb) throws Exception { Map> maatMap = new HashMap>(); Map> configMap = new HashMap>(); - CompileVal.setBusinessCode(null); - try { - for (ConfigCompile configCompile : configCompileList) { - Integer service = Integer.valueOf(configCompile.getService() - .toString()); - MaatConfig maatConfig = new MaatConfig(); - String msg = CompileVal.compileIsOk(configCompile, false, sb); - if (!"ok".equals(msg)) { - throw new RestServiceException(msg - + sb.toString(), - CompileVal.getBusinessCode()); - } + for (ConfigCompile configCompile : configCompileList) { + Integer service = Integer.valueOf(configCompile.getService() + .toString()); + MaatConfig maatConfig = new MaatConfig(); + CompileVal.compileIsOk(configCompile, false, sb); - if (!(null != configCompile.getGroupRelationList() && configCompile - .getGroupRelationList().size() > 0)) { - throw new RestServiceException("配置分组列表不能为空" - + sb.toString(), - RestBusinessCode.CompileGroupIsNull.getValue()); + maatConfig.setService(service); + // 编译 + maatConfig.setCompileMap(convertObjectToMap(configCompile, + ConfigCompile.class)); + // 分组 + List> dstMaplList = null; + if (!StringUtil.isEmpty(configCompile.getGroupRelationList())) { + dstMaplList = new ArrayList>(); + for (ConfigGroupRelation group : configCompile + .getGroupRelationList()) { + dstMaplList.add(convertObjectToMap(group, + ConfigGroupRelation.class)); } - if (null != configCompile.getStrRegionList() - && configCompile.getStrRegionList().size() > 0) { - for (StrRegion strRegion : configCompile.getStrRegionList()) { - if (strRegion.getRegionId() == null) { - String errorMsg = "字符类域配置id不能为空 ,表名---" - + strRegion.getTableName() + "" - + sb.toString(); - throw new RestServiceException(errorMsg, - RestBusinessCode.RegionIdIsNull.getValue()); - } - } - } - - if (null != configCompile.getIpRegionList() - && configCompile.getIpRegionList().size() > 0) { - for (IpRegion ipRegion : configCompile.getIpRegionList()) { - if (ipRegion.getRegionId() == null) { - String errorMsg = "ip类域配置id不能为空 ,表名---" - + ipRegion.getTableName() + "" - + sb.toString(); - throw new RestServiceException( - errorMsg, - RestBusinessCode.RegionIdIsNull.getValue()); - } - } - } - - if (null != configCompile.getNumRegionList() - && configCompile.getNumRegionList().size() > 0) { - for (NumRegion numRegion : configCompile.getNumRegionList()) { - if (numRegion.getRegionId() == null) { - String errorMsg = "数值类域配置id不能为空 ,表名---" - + numRegion.getTableName() + "" - + sb.toString(); - throw new RestServiceException(errorMsg, - RestBusinessCode.RegionIdIsNull.getValue()); - } - } - } - if (null != configCompile.getDigestRegionList() - && configCompile.getDigestRegionList().size() > 0) { - for (DigestRegion digestRegion : configCompile - .getDigestRegionList()) { - if (digestRegion.getRegionId() == null) { - String errorMsg = "摘要类域配置id不能为空 ,表名---" - + digestRegion.getTableName() + "" - + sb.toString(); - throw new RestServiceException(errorMsg, - RestBusinessCode.RegionIdIsNull.getValue()); - } - } - } - - if (null != configCompile.getIpClientRangeList() - && configCompile.getIpClientRangeList().size() > 0) { - for (IpRegion ipRegion : configCompile - .getIpClientRangeList()) { - if (ipRegion.getRegionId() == null) { - String errorMsg = "生效范围IP域类域配置id不能为空 ,表名---" - + ipRegion.getTableName() + "" - + sb.toString(); - throw new RestServiceException(errorMsg, - RestBusinessCode.RegionIdIsNull.getValue()); - } - } - } - - maatConfig.setService(service); - // 编译 - maatConfig.setCompileMap(convertObjectToMap(configCompile, - ConfigCompile.class)); - // 分组 - List> dstMaplList = null; - if (!StringUtil.isEmpty(configCompile.getGroupRelationList())) { - dstMaplList = new ArrayList>(); - for (ConfigGroupRelation group : configCompile - .getGroupRelationList()) { - dstMaplList.add(convertObjectToMap(group, - ConfigGroupRelation.class)); - } - } - maatConfig.setGroupMapList(dstMaplList); - // 字符串域 - dstMaplList = null; - List> strongMapList = null; - if (!StringUtil.isEmpty(configCompile.getStrRegionList())) { - dstMaplList = new ArrayList>(); - for (StrRegion region : configCompile.getStrRegionList()) { - if (StringUtil.isEmpty(region.getDistrict())) { - dstMaplList.add(convertObjectToMap(region, - StrRegion.class)); - } else { - if (StringUtil.isEmpty(strongMapList)) { - strongMapList = new ArrayList>(); - } - strongMapList.add(convertObjectToMap(region, - StrRegion.class)); - } - } - } - maatConfig.setStrRegionMapList(dstMaplList); - // 增强字符串域 - if (!StringUtil.isEmpty(strongMapList) - && strongMapList.size() > 0) { - maatConfig.setStrStrRegionMapList((strongMapList)); - } - // 数值域 - dstMaplList = null; - if (!StringUtil.isEmpty(configCompile.getNumRegionList())) { - dstMaplList = new ArrayList>(); - for (NumRegion region : configCompile.getNumRegionList()) { + } + maatConfig.setGroupMapList(dstMaplList); + // 字符串域 + dstMaplList = null; + List> strongMapList = null; + if (!StringUtil.isEmpty(configCompile.getStrRegionList())) { + dstMaplList = new ArrayList>(); + for (StrRegion region : configCompile.getStrRegionList()) { + if (StringUtil.isEmpty(region.getDistrict())) { dstMaplList.add(convertObjectToMap(region, - NumRegion.class)); + StrRegion.class)); + } else { + if (StringUtil.isEmpty(strongMapList)) { + strongMapList = new ArrayList>(); + } + strongMapList.add(convertObjectToMap(region, + StrRegion.class)); } } - maatConfig.setNumRegionMapList(dstMaplList); - - // Ip域 - dstMaplList = null; - if (!StringUtil.isEmpty(configCompile.getIpRegionList())) { - dstMaplList = new ArrayList>(); - for (IpRegion region : configCompile.getIpRegionList()) { - dstMaplList.add(convertObjectToMap(region, - IpRegion.class)); - } + } + maatConfig.setStrRegionMapList(dstMaplList); + // 增强字符串域 + if (!StringUtil.isEmpty(strongMapList) + && strongMapList.size() > 0) { + maatConfig.setStrStrRegionMapList((strongMapList)); + } + // 数值域 + dstMaplList = null; + if (!StringUtil.isEmpty(configCompile.getNumRegionList())) { + dstMaplList = new ArrayList>(); + for (NumRegion region : configCompile.getNumRegionList()) { + dstMaplList.add(convertObjectToMap(region, + NumRegion.class)); } - maatConfig.setIpRegionMapList(dstMaplList); + } + maatConfig.setNumRegionMapList(dstMaplList); - // 摘要类域 - dstMaplList = null; - if (!StringUtil.isEmpty(configCompile.getDigestRegionList())) { - dstMaplList = new ArrayList>(); - for (DigestRegion region : configCompile - .getDigestRegionList()) { - dstMaplList.add(convertObjectToMap(region, - DigestRegion.class)); - } + // Ip域 + dstMaplList = null; + if (!StringUtil.isEmpty(configCompile.getIpRegionList())) { + dstMaplList = new ArrayList>(); + for (IpRegion region : configCompile.getIpRegionList()) { + dstMaplList.add(convertObjectToMap(region, + IpRegion.class)); } + } + maatConfig.setIpRegionMapList(dstMaplList); - maatConfig.setFileDigestRegionMapList(dstMaplList); - - // 文本相似性域 - // dstMaplList = null; - // maatConfig.setFileLikeRegionMapList(dstMaplList); - - // 生效范围IP域 - dstMaplList = null; - if (!StringUtil.isEmpty(configCompile.getIpClientRangeList())) { - dstMaplList = new ArrayList>(); - for (IpRegion region : configCompile.getIpClientRangeList()) { - dstMaplList.add(convertObjectToMap(region, - IpRegion.class)); - } - } - maatConfig.setIpClientRangeMapList(dstMaplList); - - if (maatMap.containsKey(service)) { - maatMap.get(service).add(maatConfig); - } else { - List maatCfgList = new ArrayList(); - maatCfgList.add(maatConfig); - maatMap.put(service, maatCfgList); - + // 摘要类域 + dstMaplList = null; + if (!StringUtil.isEmpty(configCompile.getDigestRegionList())) { + dstMaplList = new ArrayList>(); + for (DigestRegion region : configCompile + .getDigestRegionList()) { + dstMaplList.add(convertObjectToMap(region, + DigestRegion.class)); } } - // 调用接口入redis + maatConfig.setFileDigestRegionMapList(dstMaplList); - Iterator serviceIterator = maatMap.keySet().iterator(); - while (serviceIterator.hasNext()) { - Integer service = Integer.valueOf(serviceIterator.next() - .toString()); - List dbIndexList = ServiceAndRDBIndexReal - .getRedisDBByService(service); - if (!StringUtil.isEmpty(dbIndexList) && dbIndexList.size() > 0) { - for (Integer dbIndex : dbIndexList) { - // 分发到阀门有些业务需要添加编译属性到域配置 - List newMaatConfigList = new ArrayList(); - newMaatConfigList.addAll(maatMap.get(service)); - if (dbIndex.intValue() == ServiceAndRDBIndexReal - .getValveDBIndex().intValue()) { - Map> maatToValueMap = ServiceAndRDBIndexReal - .getMaatToValveMap(); - if (maatToValueMap.containsKey(service)) { + // 文本相似性域 + // dstMaplList = null; + // maatConfig.setFileLikeRegionMapList(dstMaplList); - Map regionAndFiledMap = maatToValueMap - .get(service); - // for (MaatConfig maatConfig : - // newMaatConfigList) { - for (int i = 0; i < newMaatConfigList.size(); i++) { - MaatConfig maatConfig = newMaatConfigList - .get(i); - MaatConfig newMaatConfig = (MaatConfig) JsonMapper - .fromJsonString(JsonMapper - .toJsonString(maatConfig), - MaatConfig.class); - Iterator iterator = regionAndFiledMap - .keySet().iterator(); - while (iterator.hasNext()) { - String regionName = iterator.next() - .toString(); - PropertyDescriptor pd; - try { - pd = new PropertyDescriptor( - regionName + "MapList", - MaatConfig.class); - Method method = pd.getReadMethod(); - Object object = method - .invoke(newMaatConfig); + // 生效范围IP域 + dstMaplList = null; + if (!StringUtil.isEmpty(configCompile.getIpClientRangeList())) { + dstMaplList = new ArrayList>(); + for (IpRegion region : configCompile.getIpClientRangeList()) { + dstMaplList.add(convertObjectToMap(region, + IpRegion.class)); + } + } + maatConfig.setIpClientRangeMapList(dstMaplList); - if (object != null) { + if (maatMap.containsKey(service)) { + maatMap.get(service).add(maatConfig); + } else { + List maatCfgList = new ArrayList(); + maatCfgList.add(maatConfig); + maatMap.put(service, maatCfgList); - List> listMaps = new ArrayList>(); - listMaps.addAll((List>) object); - String[] fields = regionAndFiledMap - .get(regionName); - for (String fieldName : fields) { - String value = newMaatConfig - .getCompileMap() - .get(fieldName - .toLowerCase()); - if (!StringUtil - .isEmpty(value)) { - for (Map map : listMaps) { - map.put(fieldName - .toLowerCase(), - value); - } + } + } + + // 调用接口入redis + + Iterator serviceIterator = maatMap.keySet().iterator(); + while (serviceIterator.hasNext()) { + Integer service = Integer.valueOf(serviceIterator.next() + .toString()); + List dbIndexList = ServiceAndRDBIndexReal + .getRedisDBByService(service); + if (!StringUtil.isEmpty(dbIndexList) && dbIndexList.size() > 0) { + for (Integer dbIndex : dbIndexList) { + // 分发到阀门有些业务需要添加编译属性到域配置 + List newMaatConfigList = new ArrayList(); + newMaatConfigList.addAll(maatMap.get(service)); + if (dbIndex.intValue() == ServiceAndRDBIndexReal + .getValveDBIndex().intValue()) { + Map> maatToValueMap = ServiceAndRDBIndexReal + .getMaatToValveMap(); + if (maatToValueMap.containsKey(service)) { + + Map regionAndFiledMap = maatToValueMap + .get(service); + // for (MaatConfig maatConfig : + // newMaatConfigList) { + for (int i = 0; i < newMaatConfigList.size(); i++) { + MaatConfig maatConfig = newMaatConfigList + .get(i); + MaatConfig newMaatConfig = (MaatConfig) JsonMapper + .fromJsonString(JsonMapper + .toJsonString(maatConfig), + MaatConfig.class); + Iterator iterator = regionAndFiledMap + .keySet().iterator(); + while (iterator.hasNext()) { + String regionName = iterator.next() + .toString(); + PropertyDescriptor pd; + try { + pd = new PropertyDescriptor( + regionName + "MapList", + MaatConfig.class); + Method method = pd.getReadMethod(); + Object object = method + .invoke(newMaatConfig); + + if (object != null) { + + List> listMaps = new ArrayList>(); + listMaps.addAll((List>) object); + String[] fields = regionAndFiledMap + .get(regionName); + for (String fieldName : fields) { + String value = newMaatConfig + .getCompileMap() + .get(fieldName + .toLowerCase()); + if (!StringUtil + .isEmpty(value)) { + for (Map map : listMaps) { + map.put(fieldName + .toLowerCase(), + value); } } - method = pd.getWriteMethod(); - method.invoke(newMaatConfig, - listMaps); } - newMaatConfigList.set(i, - newMaatConfig); - } catch (Exception e) { - // TODO Auto-generated catch block - logger.error("未找到域列表,请检查配置文件中域类型是否正确!"); - CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue()); - e = new ServiceRuntimeException("未找到域列表,请检查域类型是否正确!",RestBusinessCode.service_runtime_error.getValue()); - msgList.add(e); - return "error"; + method = pd.getWriteMethod(); + method.invoke(newMaatConfig, + listMaps); } - + newMaatConfigList.set(i, + newMaatConfig); + } catch (Exception e) { + // TODO Auto-generated catch block + throw new RestServiceException("未找到域列表,请检查配置文件中域类型是否正确!:"+e.getMessage(),RestBusinessCode.service_runtime_error.getValue()); } + } } } - - if (configMap.containsKey(dbIndex)) { - configMap.get(dbIndex).addAll(newMaatConfigList); - } else { - List list = new ArrayList(); - list.addAll(newMaatConfigList); - configMap.put(dbIndex, list); - } - } - } else { - ServiceRuntimeException e = new ServiceRuntimeException(RestBusinessCode.ServiceNoFoundDBIndex.getErrorReason(),RestBusinessCode.ServiceNoFoundDBIndex.getValue()); - CompileVal.setBusinessCode(RestBusinessCode.ServiceNoFoundDBIndex.getValue()); - msgList.add(e); - return "error"; + + if (configMap.containsKey(dbIndex)) { + configMap.get(dbIndex).addAll(newMaatConfigList); + } else { + List list = new ArrayList(); + list.addAll(newMaatConfigList); + configMap.put(dbIndex, list); + } + } + } else { + throw new ServiceRuntimeException(RestBusinessCode.ServiceNoFoundDBIndex.getErrorReason(),RestBusinessCode.ServiceNoFoundDBIndex.getValue()); } - }catch (RuntimeException e){ - logger.error(e.getMessage()); - msgList.add(e); - return "error"; - }catch (Exception e) { - // TODO: handle exception - e = new ServiceRuntimeException("服务器内部异常:"+e.getMessage(),RestBusinessCode.service_runtime_error.getValue()); - msgList.add(e); - CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue()); - return "error"; } - try { - logger.info("---------------调用maat配置新增接口---------------------"); - configRedisService.saveMaatConfig(configMap); - } catch (Exception e) { - // TODO: handle exception - CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue()); - if (e instanceof RestServiceException) { - CompileVal.setBusinessCode(((RestServiceException)e).getErrorCode()); - }else if (e instanceof ServiceRuntimeException ) { - CompileVal.setBusinessCode(((ServiceRuntimeException)e).getErrorCode()); - } - logger.error(e.getMessage()); - msgList.add(e); - return "error"; - } - return "ok"; + logger.info("---------------调用Redis maat配置新增接口---------------------"); + configRedisService.saveMaatConfig(configMap); } - private Map convertObjectToMap(Object obj, Class clazz) - throws IntrospectionException, IllegalAccessException, - IllegalArgumentException, InvocationTargetException { + private Map convertObjectToMap(Object obj, Class clazz) throws Exception { Map dstMap = new HashMap(); Field[] fields = obj.getClass().getDeclaredFields(); for (Field field : fields) { @@ -1351,22 +340,15 @@ public class ConfigSourcesService extends BaseService { return dstMap; } - public String updateConfigSources(AuditLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { + public void updateConfigSources(AuditLogThread thread, long start, + List compileList, Date opTime, StringBuffer sb) throws Exception { Map> compileMap = new HashMap>(); if (null != compileList && compileList.size() > 0) { for (ConfigCompile config : compileList) { - String msg = checkCompileOptForUpdate(config); + checkCompileOptForUpdate(config); if (config.getOpTime() == null) { config.setOpTime(opTime); } - if (!msg.equals("ok")) { - thread.setExceptionInfo(msg + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg - + sb.toString(), - CompileVal.getBusinessCode()); - } // compileAllList.add(config); if (compileMap.containsKey(config.getService())) { @@ -1380,9 +362,7 @@ public class ConfigSourcesService extends BaseService { } } else { - thread.setExceptionInfo("编译配置不能为空" + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - start, "编译配置不能为空" + sb.toString(), + throw new RestServiceException("编译配置不能为空" + sb.toString(), RestBusinessCode.CompileIsNull.getValue()); } //Map> @@ -1407,317 +387,12 @@ public class ConfigSourcesService extends BaseService { } else { ServiceRuntimeException e = new ServiceRuntimeException("service值为" + service + ",与写入数据库序号映射关系不存在",RestBusinessCode.ServiceNoFoundDBIndex.getValue()); - CompileVal.setBusinessCode(RestBusinessCode.ServiceNoFoundDBIndex.getValue()); - msgList.add(e); - return "error"; } } - try { - if (!configRedisService.delMaatConfig(restMap)) { - CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue()); - ServiceRuntimeException e = new ServiceRuntimeException("取消MAAT配置时出现异常,具体原因不详,请联系管理员",RestBusinessCode.service_runtime_error.getValue()); - msgList.add(e); - return "error"; - } - } catch (RuntimeException e) { - // TODO: handle exception - logger.error(e.getMessage()); - CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue()); - if (e instanceof RestServiceException) { - CompileVal.setBusinessCode(((RestServiceException) e).getErrorCode()); - }else if (e instanceof ServiceRuntimeException) { - CompileVal.setBusinessCode(((ServiceRuntimeException) e).getErrorCode()); - } - msgList.add(e); - return "error"; + //所有的都删除成功返回true + if (!configRedisService.delMaatConfig(restMap)) { + throw new ServiceRuntimeException("取消MAAT配置时出现异常,具体原因不详,请联系管理员",RestBusinessCode.service_runtime_error.getValue()); } - return "ok"; - } - - public String saveByJDBCThread(AuditLogThread thread, long start, - List configCompileList, StringBuffer sb) { - List groupRelationList = new ArrayList(); - Map> strRegionMap = new HashMap>(); - Map> strStongRegionMap = new HashMap>(); - Map> ipRegionMap = new HashMap>(); - Map> numRegionMap = new HashMap>(); - Map> digestRegionMap = new HashMap>(); - - for (ConfigCompile configCompile : configCompileList) { - String msg = CompileVal.compileIsOk(configCompile, false, sb); - if (!"ok".equals(msg)) { - logger.error(msg); - thread.setExceptionInfo(msg + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - msg + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - if (null != configCompile.getGroupRelationList() - && configCompile.getGroupRelationList().size() > 0) { - groupRelationList.addAll(configCompile.getGroupRelationList()); - } else { - logger.error("配置分组数量不能为空" + sb.toString()); - thread.setExceptionInfo("配置分组数量不能为空" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, "配置分组数量不能为空" - + sb.toString(), - RestBusinessCode.missing_args.getValue()); - } - if (null != configCompile.getStrRegionList() - && configCompile.getStrRegionList().size() > 0) { - for (StrRegion strRegion : configCompile.getStrRegionList()) { - if (!isStrStrongRegion(strRegion.getTableName(),configCompile.getService())) { - if (strRegion.getRegionId() == null) { - String errorMsg = "字符类域配置id不能为空 ,表名---" - + strRegion.getTableName() + "" - + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - errorMsg, - RestBusinessCode.missing_args.getValue()); - } - if (strRegionMap.containsKey(strRegion.getTableName())) { - strRegionMap.get(strRegion.getTableName()).add( - strRegion); - } else { - List strRegionList = new ArrayList(); - strRegionList.add(strRegion); - strRegionMap.put(strRegion.getTableName(), - strRegionList); - } - } else { - if (strRegion.getRegionId() == null) { - String errorMsg = "增强字符类域配置id不能为空 ,表名---" - + strRegion.getTableName() + "" - + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - errorMsg, - RestBusinessCode.missing_args.getValue()); - } - if (strStongRegionMap.containsKey(strRegion - .getTableName())) { - strStongRegionMap.get(strRegion.getTableName()) - .add(strRegion); - } else { - List strStrongRegionList = new ArrayList(); - strStrongRegionList.add(strRegion); - strStongRegionMap.put(strRegion.getTableName(), - strStrongRegionList); - } - - } - } - } - - if (null != configCompile.getIpRegionList() - && configCompile.getIpRegionList().size() > 0) { - for (IpRegion ipRegion : configCompile.getIpRegionList()) { - if (!ipRegion.getTableName().toUpperCase() - .equals("DJ_IP_PORT")) { - ipRegion.setProtocol(0); - } - - if (ipRegion.getRegionId() == null) { - String errorMsg = "ip类域配置id不能为空 ,表名---" - + ipRegion.getTableName() + "" + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, errorMsg, - RestBusinessCode.missing_args.getValue()); - } - - if (ipRegionMap.containsKey(ipRegion.getTableName())) { - ipRegionMap.get(ipRegion.getTableName()).add(ipRegion); - } else { - List ipRegionList = new ArrayList(); - ipRegionList.add(ipRegion); - ipRegionMap.put(ipRegion.getTableName(), ipRegionList); - } - } - } - - if (null != configCompile.getNumRegionList() - && configCompile.getNumRegionList().size() > 0) { - for (NumRegion numRegion : configCompile.getNumRegionList()) { - if (numRegion.getRegionId() == null) { - String errorMsg = "数值类域配置id不能为空 ,表名---" - + numRegion.getTableName() + "" + sb.toString(); - logger.error(errorMsg); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, errorMsg, - RestBusinessCode.missing_args.getValue()); - } - - if (numRegionMap.containsKey(numRegion.getTableName())) { - numRegionMap.get(numRegion.getTableName()).add( - numRegion); - } else { - List numRegionList = new ArrayList(); - numRegionList.add(numRegion); - numRegionMap.put(numRegion.getTableName(), - numRegionList); - } - } - } - - if (null != configCompile.getDigestRegionList() - && configCompile.getDigestRegionList().size() > 0) { - for (DigestRegion digestRegion : configCompile - .getDigestRegionList()) { - if (digestRegion.getRegionId() == null) { - String errorMsg = "摘要类域配置id不能为空 ,表名---" - + digestRegion.getTableName() + "" - + sb.toString(); - logger.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 digestRegionList = new ArrayList(); - digestRegionList.add(digestRegion); - digestRegionMap.put(digestRegion.getTableName(), - digestRegionList); - } - } - } - } - - if (Configurations.getStringProperty("isCommit", "false") - .equals("true")) { - int count = 0; - if (null != configCompileList && configCompileList.size() > 0) { - count += 1; - } - if (null != groupRelationList && groupRelationList.size() > 0) { - count += 1; - } - if (null != strRegionMap && strRegionMap.size() > 0) { - count += strRegionMap.size(); - } - if (null != strStongRegionMap && strStongRegionMap.size() > 0) { - count += strStongRegionMap.size(); - } - if (null != ipRegionMap && ipRegionMap.size() > 0) { - count += ipRegionMap.size(); - } - if (null != numRegionMap && numRegionMap.size() > 0) { - count += numRegionMap.size(); - } - - if (null != digestRegionMap && digestRegionMap.size() > 0) { - count += digestRegionMap.size(); - } - - SqlSessionFactory sqlSessionFactory = SpringContextHolder - .getBean(SqlSessionFactory.class); - Connection conn = sqlSessionFactory.openSession().getConnection(); - - CountDownLatch latch = new CountDownLatch(count); - SaveCompileByJDBCThread compile = new SaveCompileByJDBCThread(conn, - latch, start); - compile.setCompileList(configCompileList); - Thread compileThread = new Thread(compile); - compileThread.start(); - if (groupRelationList.size() > 0) { - - SaveCompileByJDBCThread group = new SaveCompileByJDBCThread( - conn, latch, start); - group.setGroupList(groupRelationList); - - Thread groupThread = new Thread(group); - groupThread.start(); - - } - if (strRegionMap.size() > 0) { - for (String str : strRegionMap.keySet()) { - - SaveCompileByJDBCThread strRegion = new SaveCompileByJDBCThread( - false, str, conn, latch, start); - strRegion.setStrRegionList(strRegionMap.get(str)); - Thread strThread = new Thread(strRegion); - strThread.start(); - - } - } - if (strStongRegionMap.size() > 0) { - for (String strStrong : strStongRegionMap.keySet()) { - SaveCompileByJDBCThread strongRegion = new SaveCompileByJDBCThread( - true, strStrong, conn, latch, start); - strongRegion.setStrRegionList(strStongRegionMap - .get(strStrong)); - Thread strongStrThread = new Thread(strongRegion); - strongStrThread.start(); - - } - } - if (ipRegionMap.size() > 0) { - for (String ip : ipRegionMap.keySet()) { - SaveCompileByJDBCThread ipRegion = new SaveCompileByJDBCThread( - ip, conn, latch, start); - ipRegion.setIpRegionList(ipRegionMap.get(ip)); - Thread ipThread = new Thread(ipRegion); - ipThread.start(); - - } - } - if (numRegionMap.size() > 0) { - for (String num : numRegionMap.keySet()) { - SaveCompileByJDBCThread numRegion = new SaveCompileByJDBCThread( - num, conn, latch, start); - numRegion.setNumRegionList(numRegionMap.get(num)); - Thread numThread = new Thread(numRegion); - numThread.start(); - - } - } - 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 { - latch.await(); - if (msgList.size() > 0) { - conn.rollback(); - return "error"; - } else { - conn.commit(); - } - } catch (Exception e) { - thread.setExceptionInfo(e.toString()); - e.printStackTrace(); - logger.error("Exception", e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(thread, - System.currentTimeMillis() - start, "编译配置数据插入失败", - RestBusinessCode.unknow_error.getValue()); - } - throw ((RestServiceException) e); - } - } - return "ok"; } private String convertToTimeStamp16(Date date) { @@ -1725,754 +400,6 @@ public class ConfigSourcesService extends BaseService { return date.getTime() + "000"; } - // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * 批量(jdbc多线程方式)修改配置业务逻辑-->1:先进行基础配置验证传过来的json串是否符合格式(配置分组关系前端不能设置为无效, - * 程序会根据传过来的编译配置和域配置等信息自动设置为无效). - * 2:判断配置在数据库中是否已经是无效了如果是无效则提示不能修改无效的配置为有效(因为如果数据库中的编译配置与配置分组关系以及域配置均是无效 - * ,传过来的数据是编译配置和配置分组关系是有效,域配置是无效,这样会将数据库中无效的编译配置置为有效,这是不允许的) - * 3:如果编译配置置为无效将所有的配置分组关系置为无效,不修改域配置状态(分组复用考虑,域可能被其他的组引用) - * 4:如果编译配置为有效,域配置为无效,则先获取该编译配置下各个配置分组关系下的所有有效的域配置信息和所有无效的域配置信息, - * 如果数据库中有效的域配置信息和前端传过来置为无效的的域配置信息个数,id都相等,则将对应域配置,配置分组关系,编译配置均置为无效 - * - * - * - * 20161124讨论暂时先去掉2步骤,因为界面目前传过来的数据编译配置,配置分组关系,域配置均是无效,所以就不执行第2步骤了影响性能( - * 方法内注释的代码,如果以后业务需要调整打开下面代码即可) - * - * @param thread - * 保存异常信息入库对象 - * @param start - * 进入controller的时间 - * @param compileList - * 编译配置集合 - * @return - * @throws Exception - */ - public String updateByJDBCThread(AuditLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { - List compileAllList = new ArrayList(); - List groupRelationAllList = new ArrayList(); - Map> strRegionMap = new HashMap>(); - Map> ipRegionMap = new HashMap>(); - Map> numRegionMap = new HashMap>(); - if (null != compileList && compileList.size() > 0) { - for (ConfigCompile config : compileList) { - String msg = CompileVal.compileIsOk(config, true, sb); - if (!"ok".equals(msg)) { - thread.setExceptionInfo(msg + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg - + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - List ipRegionList = config.getIpRegionList();// 获取编译下所有ip类域配置(要修改的数据) - List strRegionList = config.getStrRegionList();// 获取编译下所有字符串类域配置(要修改的数据 - List numRegionList = config.getNumRegionList();// 获取编译下所有数值类域配置(要修改的数据 - List groupRelationList = config - .getGroupRelationList(); - if (config.getIsValid() == 1) { - if (groupRelationList == null - || groupRelationList.size() == 0) { - thread.setExceptionInfo("配置分组数量不能为空" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "配置分组数量不能为空" + sb.toString(), - RestBusinessCode.config_integrity_error - .getValue()); - } - if ((ipRegionList == null || ipRegionList.size() == 0) - && (strRegionList == null || strRegionList.size() == 0) - && (numRegionList == null || numRegionList.size() == 0)) { - thread.setExceptionInfo("域配置数量不能全部为空" + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "域配置数量不能全部为空" + sb.toString(), - RestBusinessCode.config_integrity_error - .getValue()); - } - } - - // ConfigCompile configCompile = - // configCompileDao.queryConfigCompileById(config.getCompileId());// - // 先判断该条编译配置数据库中状态是否为无效,如果无效则提示用户不能将无效状态改为有效状态 - // if (configCompile.getIsValid() == 1) {// - // 数据库中编译配置为有效状态才可以进行修改操作 - /** - * 1:编译配置置为无效,需要将其下所有配置分组置为无效,如果数据中将域配置置为了无效则将域配置置为无效, - * 否则不修改域配置是否生效标志 - * 2:编译配置置为有效,不修改编译配置状态(编译配置不能从无效变有效,只能从有效变无效)仅修改编译配置其他属性, - */ - List queryCompileGroupByPID = configGroupRelationDao - .queryCompileGroupByPID(config.getCompileId()); - - if (null == queryCompileGroupByPID - || queryCompileGroupByPID.size() == 0) { - throw new RestServiceException(thread, - System.currentTimeMillis() - start, "配置id为" - + config.getCompileId() - + "的配置在数据库中找不到对应的配置分组关系,请检查json串是否正确" - + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - - if (config.getIsValid() == 0) {// 编译配置修改为无效,需要将所有的配置分组置为无效 - if (null != queryCompileGroupByPID - && queryCompileGroupByPID.size() > 0) { - for (ConfigGroupRelation configGroupRelation : queryCompileGroupByPID) { - configGroupRelation.setIsValid(0); - - groupRelationAllList.add(configGroupRelation); - } - - } - } else { - - Map>> regionMap = getRegionList( - thread, System.currentTimeMillis() - start, config, - queryCompileGroupByPID, sb); - Map> validMap = regionMap.get("validMap");// 获取该编译配置下所有的配置分组关系及组下有效的域配置id - Map> noValidMap = regionMap - .get("noValidMap");// 获取该编译配置下所有的配置分组关系及组下无效的域配置id - - int num = 0; - for (Long regionId : validMap.keySet()) {// 遍历配置分组 - List validList = validMap.get(regionId);// 获取配置分组下有效的域配置id - List noValidList = noValidMap.get(regionId);// 获取配置分组下无效的域配置id - int count = 0; - if (null != ipRegionList && ipRegionList.size() > 0) { - for (IpRegion ipRegion : ipRegionList) { - if (ipRegion.getGroupId().equals(regionId)) { - if (null != validList - && validList.contains(ipRegion - .getRegionId())) { - if (ipRegion.getIsValid() == 0) { - ipRegion.setLastUpdate(new Date()); - if (ipRegionMap - .containsKey(ipRegion - .getTableName())) { - ipRegionMap - .get(ipRegion - .getTableName()) - .add(ipRegion); - } else { - List ipList = new ArrayList(); - ipList.add(ipRegion); - ipRegionMap - .put(ipRegion - .getTableName(), - ipList); - } - count++; - } - } else if (null != noValidList - && noValidList.contains(ipRegion - .getRegionId())) { - String errorMsg = "不能修改无效的ip类域配置compile为" - + config.getCompileId() - + "regionid为" - + ipRegion.getRegionId() - + sb.toString(); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - - start, errorMsg, - RestBusinessCode.missing_args - .getValue()); - } else { - String errorMsg = "找不到对应的的ip类域配置compile为" - + config.getCompileId() - + "regionid为" - + ipRegion.getRegionId() - + sb.toString(); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - - start, errorMsg, - RestBusinessCode.missing_args - .getValue()); - } - } - } - - } - - if (null != strRegionList && strRegionList.size() > 0) { - for (StrRegion strRegion : strRegionList) { - if (strRegion.getGroupId().equals(regionId)) { - if (null != validList - && validList.contains(strRegion - .getRegionId())) { - if (strRegion.getIsValid() == 0) { - - strRegion.setLastUpdate(new Date()); - if (strRegionMap - .containsKey(strRegion - .getTableName())) { - strRegionMap - .get(strRegion - .getTableName()) - .add(strRegion); - } else { - List strList = new ArrayList(); - strList.add(strRegion); - strRegionMap.put(strRegion - .getTableName(), - strList); - } - count++; - } - } else if (null != noValidList - && noValidList.contains(strRegion - .getRegionId())) { - String errorMsg = "不能修改无效的字符串类域配置compile为" - + config.getCompileId() - + "regionid为" - + strRegion.getRegionId() - + sb.toString(); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - - start, errorMsg, - RestBusinessCode.missing_args - .getValue()); - } else { - String errorMsg = "找不到对应的的字符串类域配置compile为" - + config.getCompileId() - + "regionid为" - + strRegion.getRegionId() - + sb.toString(); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - - start, errorMsg, - RestBusinessCode.missing_args - .getValue()); - } - } - } - - } - if (null != numRegionList && numRegionList.size() > 0) { - for (NumRegion numRegion : numRegionList) { - if (numRegion.getGroupId().equals(regionId)) { - if (null != validList - && validList.contains(numRegion - .getRegionId())) { - if (numRegion.getIsValid() == 0) { - - numRegion.setLastUpdate(new Date()); - if (numRegionMap - .containsKey(numRegion - .getTableName())) { - numRegionMap - .get(numRegion - .getTableName()) - .add(numRegion); - } else { - List numList = new ArrayList(); - numList.add(numRegion); - numRegionMap.put(numRegion - .getTableName(), - numList); - } - count++; - - } - } else if (null != noValidList - && noValidList.contains(numRegion - .getRegionId())) { - String errorMsg = "不能修改无效的数值类域配置compile为" - + config.getCompileId() - + "regionid为" - + numRegion.getRegionId() - + sb.toString(); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - - start, errorMsg, - RestBusinessCode.missing_args - .getValue()); - } else { - String errorMsg = "找不到对应的的数值类域配置compile为" - + config.getCompileId() - + "regionid为" - + numRegion.getRegionId() - + sb.toString(); - thread.setExceptionInfo(errorMsg); - throw new RestServiceException(thread, - System.currentTimeMillis() - - start, errorMsg, - RestBusinessCode.missing_args - .getValue()); - } - } - } - } - if (count == validList.size()) {// 数据库中当前配置分组下有效的域配置,均被修改为无效,所以要将该配置分组置为无效 - for (ConfigGroupRelation configGroupRelation : groupRelationList) { - if (configGroupRelation.getGroupId().equals( - regionId)) { - num++; - configGroupRelation.setIsValid(0); - - groupRelationAllList - .add(configGroupRelation); - } - } - - } - } - if (num == validMap.size()) {// 所有的域均是无效的所有的组均是无效,需要将编译配置置为无效 - config.setIsValid(0); - } - } - - // } else {// 数据库中编译配置为无效状态不能进行操作 - // throw new RestServiceException(thread, - // System.currentTimeMillis() - start,"不能修改无效的编译配置信息,配置id为" + - // configCompile.getCompileId(),RestBusinessCode.missing_args.getValue()); - // } - compileAllList.add(config); - } - - } else { - thread.setExceptionInfo("编译配置不能为空" + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - start, "编译配置不能为空" + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - // 程序是否入库,测试分析数据的时间 - if (Configurations.getStringProperty("isCommit", "false") - .equals("true")) { - int count = 0; - if (null != compileAllList && compileAllList.size() > 0) { - count += 1; - } - if (null != groupRelationAllList && groupRelationAllList.size() > 0) { - count += 1; - } - if (null != strRegionMap && strRegionMap.size() > 0) { - count += strRegionMap.size(); - } - if (null != ipRegionMap && ipRegionMap.size() > 0) { - count += ipRegionMap.size(); - } - if (null != numRegionMap && numRegionMap.size() > 0) { - count += numRegionMap.size(); - } - - SqlSessionFactory sqlSessionFactory = SpringContextHolder - .getBean(SqlSessionFactory.class); - Connection conn = sqlSessionFactory.openSession().getConnection(); - CountDownLatch latch = new CountDownLatch(count); - UpdateCompileByJDBCThread compileThread = new UpdateCompileByJDBCThread( - conn, latch, start, opTime); - compileThread.setCompileList(compileAllList); - Thread compile = new Thread(compileThread); - compile.start(); - - if (null != groupRelationAllList && groupRelationAllList.size() > 0) { - UpdateCompileByJDBCThread groupThread = new UpdateCompileByJDBCThread( - conn, latch, start, opTime); - groupThread.setGroupList(groupRelationAllList); - Thread group = new Thread(groupThread); - group.start(); - - } - if (null != strRegionMap && strRegionMap.size() > 0) { - for (String str : strRegionMap.keySet()) { - UpdateCompileByJDBCThread strRegion = new UpdateCompileByJDBCThread( - str, conn, latch, start, opTime); - strRegion.setStrRegionList(strRegionMap.get(str)); - Thread strThread = new Thread(strRegion); - strThread.start(); - } - } - - if (null != ipRegionMap && ipRegionMap.size() > 0) { - for (String ip : ipRegionMap.keySet()) { - UpdateCompileByJDBCThread ipRegion = new UpdateCompileByJDBCThread( - ip, conn, latch, start, opTime); - ipRegion.setIpRegionList(ipRegionMap.get(ip)); - Thread ipThread = new Thread(ipRegion); - ipThread.start(); - - } - } - if (null != numRegionMap && numRegionMap.size() > 0) { - for (String num : numRegionMap.keySet()) { - UpdateCompileByJDBCThread numRegion = new UpdateCompileByJDBCThread( - num, conn, latch, start, opTime); - numRegion.setNumRegionList(numRegionMap.get(num)); - Thread numThread = new Thread(numRegion); - numThread.start(); - } - } - - try { - latch.await(); - if (msgList.size() > 0) { - conn.rollback(); - return "error"; - } else { - conn.commit(); - } - } catch (Exception e) { - thread.setExceptionInfo(e.toString()); - e.printStackTrace(); - logger.error("Exception" ,e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(thread, - System.currentTimeMillis() - start, "编译配置数据修改失败", - RestBusinessCode.unknow_error.getValue()); - } - throw ((RestServiceException) e); - } - - } - return "ok"; - } - - /** - * 批量(jdbc多线程方式)修改配置业务逻辑-->1:先进行基础配置验证传过来的json串是否符合格式(配置分组关系前端不能设置为无效, - * 程序会根据传过来的编译配置和域配置等信息自动设置为无效). - * 2:判断配置在数据库中是否已经是无效了如果是无效则提示不能修改无效的配置为有效(因为如果数据库中的编译配置与配置分组关系以及域配置均是无效 - * ,传过来的数据是编译配置和配置分组关系是有效,域配置是无效,这样会将数据库中无效的编译配置置为有效,这是不允许的) - * 3:如果编译配置置为无效将所有的配置分组关系置为无效,不修改域配置状态(分组复用考虑,域可能被其他的组引用) - * 4:如果编译配置为有效,域配置为无效,则先获取该编译配置下各个配置分组关系下的所有有效的域配置信息和所有无效的域配置信息, - * 如果数据库中有效的域配置信息和前端传过来置为无效的的域配置信息个数,id都相等,则将对应域配置,配置分组关系,编译配置均置为无效 - * - * - * - * 20161124讨论暂时先去掉2步骤,因为界面目前传过来的数据编译配置,配置分组关系,域配置均是无效,所以就不执行第2步骤了影响性能( - * 方法内注释的代码,如果以后业务需要调整打开下面代码即可) - * - * - * - * 20161215讨论确定修改时前端发过来的配置都是无效的不会存在即有无效又有有效的情况,且配置中的个数与添加时保持一致, - * 即添加时插入了1条编译配置2条配置分组关系3条域配置,在修改时也会传过来1条编译配置2条配置分组关系3条域配置,不会多或者少配置 - * - * - * - * - * 2017-1-16:和杨老师讨论确定存在分组复用情况,当编译配置置为无效,需要将其下所有配置分组置为无效, - * 如果数据中将域配置置为了无效则将域配置置为无效,否则不修改域配置是否生效标志 - * - * @param thread - * 保存异常信息入库对象 - * @param start - * 进入controller的时间 - * @param compileList - * 编译配置集合 - * @return - * @throws Exception - */ - public String updateByJDBCThread12(AuditLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { - List compileAllList = new ArrayList(); - List groupRelationAllList = new ArrayList(); - Map> strRegionMap = new HashMap>(); - Map> ipRegionMap = new HashMap>(); - Map> numRegionMap = new HashMap>(); - Map> digestRegionMap = new HashMap>(); - if (null != compileList && compileList.size() > 0) { - for (ConfigCompile config : compileList) { - String msg = CompileVal.compileIsOk(config, true, sb); - if (!"ok".equals(msg)) { - thread.setExceptionInfo(msg + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg - + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - - /** - * 1:编译配置置为无效,需要将其下所有配置分组置为无效,如果数据中将域配置置为了无效则将域配置置为无效, - * 否则不修改域配置是否生效标志 - * 2:编译配置置为有效,不修改编译配置状态(编译配置不能从无效变有效,只能从有效变无效)仅修改编译配置其他属性, - */ - List groupRelationList = config - .getGroupRelationList(); - if (config.getIsValid() == 0) {// 编译配置修改为无效,需要将所有的配置分组置为无效 - if (null != groupRelationList - && groupRelationList.size() > 0) { - for (ConfigGroupRelation configGroupRelation : groupRelationList) { - configGroupRelation.setIsValid(0); - groupRelationAllList.add(configGroupRelation); - } - } - List ipRegionList = config.getIpRegionList();// 获取编译下所有ip类域配置(要修改的数据) - if (null != ipRegionList && ipRegionList.size() > 0) { - for (IpRegion ipRegion : ipRegionList) { - if (ipRegion.getIsValid() == 0) { - if (ipRegionMap.containsKey(ipRegion - .getTableName())) { - ipRegionMap.get(ipRegion.getTableName()) - .add(ipRegion); - } else { - List ipList = new ArrayList(); - ipList.add(ipRegion); - ipRegionMap.put(ipRegion.getTableName(), - ipList); - } - } - } - } - List strRegionList = config.getStrRegionList();// 获取编译下所有字符串类域配置(要修改的数据 - if (null != strRegionList && strRegionList.size() > 0) { - for (StrRegion strRegion : strRegionList) { - if (strRegion.getIsValid() == 0) { - if (strRegionMap.containsKey(strRegion - .getTableName())) { - strRegionMap.get(strRegion.getTableName()) - .add(strRegion); - } else { - List strList = new ArrayList(); - strList.add(strRegion); - strRegionMap.put(strRegion.getTableName(), - strList); - } - } - } - } - List numRegionList = config.getNumRegionList();// 获取编译下所有数值类域配置(要修改的数据 - if (null != numRegionList && numRegionList.size() > 0) { - for (NumRegion numRegion : numRegionList) { - if (numRegion.getIsValid() == 0) { - if (numRegionMap.containsKey(numRegion - .getTableName())) { - numRegionMap.get(numRegion.getTableName()) - .add(numRegion); - } else { - List numList = new ArrayList(); - numList.add(numRegion); - numRegionMap.put(numRegion.getTableName(), - numList); - } - } - } - } - - List 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 digestList = new ArrayList(); - digestList.add(digestRegion); - digestRegionMap.put( - digestRegion.getTableName(), - digestList); - } - } - } - } - compileAllList.add(config); - } - } - - } else { - thread.setExceptionInfo("编译配置不能为空" + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - start, "编译配置不能为空" + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - // 程序是否入库,测试分析数据的时间 - if (Configurations.getStringProperty("isCommit", "false") - .equals("true")) { - int count = 0; - if (null != compileAllList && compileAllList.size() > 0) { - count += 1; - } - if (null != groupRelationAllList && groupRelationAllList.size() > 0) { - count += 1; - } - if (null != strRegionMap && strRegionMap.size() > 0) { - count += strRegionMap.size(); - } - if (null != ipRegionMap && ipRegionMap.size() > 0) { - count += ipRegionMap.size(); - } - if (null != numRegionMap && numRegionMap.size() > 0) { - count += numRegionMap.size(); - } - SqlSessionFactory sqlSessionFactory = SpringContextHolder - .getBean(SqlSessionFactory.class); - Connection conn = sqlSessionFactory.openSession().getConnection(); - CountDownLatch latch = new CountDownLatch(count); - UpdateCompileByJDBCThread compileThread = new UpdateCompileByJDBCThread( - conn, latch, start, opTime); - compileThread.setCompileList(compileAllList); - Thread compile = new Thread(compileThread); - compile.start(); - - if (null != groupRelationAllList && groupRelationAllList.size() > 0) { - UpdateCompileByJDBCThread groupThread = new UpdateCompileByJDBCThread( - conn, latch, start, opTime); - groupThread.setGroupList(groupRelationAllList); - Thread group = new Thread(groupThread); - group.start(); - - } - if (null != strRegionMap && strRegionMap.size() > 0) { - for (String str : strRegionMap.keySet()) { - UpdateCompileByJDBCThread strRegion = new UpdateCompileByJDBCThread( - str, conn, latch, start, opTime); - strRegion.setStrRegionList(strRegionMap.get(str)); - Thread strThread = new Thread(strRegion); - strThread.start(); - } - } - - if (null != ipRegionMap && ipRegionMap.size() > 0) { - for (String ip : ipRegionMap.keySet()) { - UpdateCompileByJDBCThread ipRegion = new UpdateCompileByJDBCThread( - ip, conn, latch, start, opTime); - ipRegion.setIpRegionList(ipRegionMap.get(ip)); - Thread ipThread = new Thread(ipRegion); - ipThread.start(); - - } - } - if (null != numRegionMap && numRegionMap.size() > 0) { - for (String num : numRegionMap.keySet()) { - UpdateCompileByJDBCThread numRegion = new UpdateCompileByJDBCThread( - num, conn, latch, start, opTime); - numRegion.setNumRegionList(numRegionMap.get(num)); - Thread numThread = new Thread(numRegion); - 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 { - latch.await(); - if (msgList.size() > 0) { - conn.rollback(); - return "error"; - } else { - conn.commit(); - } - } catch (Exception e) { - thread.setExceptionInfo(e.toString()); - e.printStackTrace(); - logger.error("Exception" ,e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(thread, - System.currentTimeMillis() - start, "编译配置数据修改失败", - RestBusinessCode.unknow_error.getValue()); - } - throw ((RestServiceException) e); - } - - } - return "ok"; - } - - /** - * - * @Description:只填写compile信息,根据compileId对compile以及与Group的对应关系进行配置状态更新操作 - * @author (zdx) - * @date 2017年8月16日 上午11:21:53 - * @param thread - * @param start - * @param compileList - * @param opTime - * @param sb - * @return - */ - public String updateByJDBCThread3(AuditLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { - List compileAllList = new ArrayList(); - if (null != compileList && compileList.size() > 0) { - for (ConfigCompile config : compileList) { - String msg = checkCompileOptForUpdate(config); - if (config.getOpTime() == null) { - config.setOpTime(opTime); - } - if (!msg.equals("ok")) { - thread.setExceptionInfo(msg + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, msg - + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - - compileAllList.add(config); - } - - } else { - thread.setExceptionInfo("编译配置不能为空" + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - start, "编译配置不能为空" + sb.toString(), - RestBusinessCode.config_integrity_error.getValue()); - } - // 程序是否入库,测试分析数据的时间 - if (Configurations.getStringProperty("isCommit", "false") - .equals("true")) { - int count = 0; - if (null != compileAllList && compileAllList.size() > 0) { - count += 1; - count += 1; // 将所有compile与Group的对应关系都置为失效 zdx20170814 - } - - SqlSessionFactory sqlSessionFactory = SpringContextHolder - .getBean(SqlSessionFactory.class); - Connection conn = sqlSessionFactory.openSession().getConnection(); - CountDownLatch latch = new CountDownLatch(count); - - UpdateCompileByJDBCThread compileThread = new UpdateCompileByJDBCThread( - conn, latch, start, opTime); - compileThread.setCompileList(compileAllList); - Thread compile = new Thread(compileThread); - compile.start(); - - UpdateCompileByJDBCThread groupThread = new UpdateCompileByJDBCThread( - conn, latch, start, opTime); - groupThread.setCompileList(compileAllList); - // 仅用做判定线程执行时选择执行方法 zdx20170816 - groupThread.setGroupList(new ArrayList()); - Thread group = new Thread(groupThread); - group.start(); - - try { - latch.await(); - if (msgList.size() > 0) { - conn.rollback(); - return "error"; - } else { - conn.commit(); - } - } catch (Exception e) { - thread.setExceptionInfo(e.toString()); - e.printStackTrace(); - logger.error("Exception" ,e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(thread, - System.currentTimeMillis() - start, "编译配置数据修改失败", - RestBusinessCode.unknow_error.getValue()); - } - throw ((RestServiceException) e); - } - - } - return "ok"; - } - /** * * @Description:验证compileId+isValid @@ -2481,238 +408,31 @@ public class ConfigSourcesService extends BaseService { * @param config * @return */ - private String checkCompileOptForUpdate(ConfigCompile config) { + private void checkCompileOptForUpdate(ConfigCompile config) throws Exception{ if (StringUtil.isEmpty(config.getCompileId())) { - CompileVal.setBusinessCode(RestBusinessCode.CompileIdIsNull.getValue()); - return RestBusinessCode.CompileIdIsNull.getErrorReason(); + throw new RestServiceException(RestBusinessCode.CompileIdIsNull.getErrorReason(),RestBusinessCode.CompileIdIsNull.getValue()); } - if (StringUtil.isEmpty(config.getService())) { - - CompileVal.setBusinessCode(RestBusinessCode.ServiceIsNull.getValue()); - return RestBusinessCode.ServiceIsNull.getErrorReason(); + throw new RestServiceException(RestBusinessCode.ServiceIsNull.getErrorReason(),RestBusinessCode.ServiceIsNull.getValue()); } - if (StringUtil.isEmpty(config.getIsValid())) { - CompileVal.setBusinessCode(RestBusinessCode.IsValidIsNull.getValue()); - return "编译配置id为" + config.getCompileId() + "的IsValid字段不能为空"; + throw new RestServiceException("编译配置id为" + config.getCompileId() + "的IsValid字段不能为空",RestBusinessCode.IsValidIsNull.getValue()); } if (config.getIsValid() != 0) { - CompileVal.setBusinessCode(RestBusinessCode.IsValidIsF.getValue()); - return "编译配置id为" + config.getCompileId() + "的配置在修改时不能为有效"; + throw new RestServiceException("编译配置id为" + config.getCompileId() + "的配置在修改时不能为有效",RestBusinessCode.IsValidIsF.getValue()); } - - return "ok"; } - /** - * 获取编译配置下所有的配置分组关系对应的有效,无效域配置id - * - * @param thread - * 保存异常信息入库对象 - * @param start - * 进入controller的时间 - * @param config - * 编译配置对象 - * @param queryCompileGroupByPID - * 当前编译下所有的配置分组关系 - * @return - */ - public Map>> getRegionList( - AuditLogThread thread, long start, ConfigCompile config, - List queryCompileGroupByPID, StringBuffer sb) { - Map>> map = new HashMap>>(); - Map updateTableMap = new HashMap(); - Map> sercieNameMap = ServiceAndRDBIndexReal.getSercieNameMap().get(config - .getService().intValue()); - if (sercieNameMap != null && sercieNameMap.size() > 0) { - for (Integer type : sercieNameMap.keySet()) { - String typeStr=""; -// 12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置, - if ("12".equals(type.toString())) { - typeStr="ip"; - }else if ("13".equals(type.toString())) { - typeStr="str"; - }else if ("14".equals(type.toString())||"15".equals(type.toString())) { - typeStr="num"; - } - if (!"".equals(typeStr)) { - List tableList = sercieNameMap.get(type); - if (tableList != null && tableList.size() > 0) { - for (String table : tableList) { - updateTableMap.put(table.toUpperCase(),typeStr); - } - } - } - } - }else{ - thread.setExceptionInfo("找不到编译对应的service" + sb.toString()); - throw new RestServiceException(thread, System.currentTimeMillis() - - start, "找不到编译对应的service" + sb.toString(), - RestBusinessCode.missing_args.getValue()); - } - - Long[] groupId = new Long[queryCompileGroupByPID.size()]; - for (int i = 0; i < queryCompileGroupByPID.size(); i++) { - groupId[i] = queryCompileGroupByPID.get(i).getGroupId(); - } - // 获取当前编译下所有的域配置信息 - List ipRegionExistList = new ArrayList(); - List strRegionExistList = new ArrayList(); - List numRegionExistList = new ArrayList(); - for (String tableName : updateTableMap.keySet()) { - if (updateTableMap.get(tableName).equals("ip")) { - ipRegionExistList.addAll(ipRegionDao.queryIpRegionByGroupId( - tableName, groupId)); - } - if (updateTableMap.get(tableName).equals("num")) { - numRegionExistList.addAll(numRegionDao.queryNumRegionByGroupId( - tableName, groupId)); - } - if (updateTableMap.get(tableName).equals("str")) { - strRegionExistList.addAll(strRegionDao.queryStrRegionByGroupId( - tableName, groupId)); - } - } - - Map> validMap = new HashMap>();// 获取当前编译下所有的组,及每个组下面的有效域配置 - Map> noValidMap = new HashMap>();// 获取当前编译下所有的组,及每个组下面的无效域配置 - for (IpRegion ipRegion : ipRegionExistList) { - if (ipRegion.getIsValid() == 1) { - List validRegionList = null; - if (validMap.get(ipRegion.getGroupId()) == null) { - validRegionList = new ArrayList(); - validRegionList.add(ipRegion.getRegionId()); - validMap.put(ipRegion.getGroupId(), validRegionList); - } else { - validRegionList = validMap.get(ipRegion.getGroupId()); - // if (!validRegionList.contains(ipRegion.getRegionId())) { - validRegionList.add(ipRegion.getRegionId()); - validMap.put(ipRegion.getGroupId(), validRegionList); - // } - } - } - if (ipRegion.getIsValid() == 0) { - List noValidRegionList = null; - if (noValidMap.get(ipRegion.getGroupId()) == null) { - noValidRegionList = new ArrayList(); - noValidRegionList.add(ipRegion.getRegionId()); - noValidMap.put(ipRegion.getGroupId(), noValidRegionList); - } else { - noValidRegionList = noValidMap.get(ipRegion.getGroupId()); - // if (!noValidRegionList.contains(ipRegion.getRegionId())) - // { - noValidRegionList.add(ipRegion.getRegionId()); - noValidMap.put(ipRegion.getGroupId(), noValidRegionList); - // } - } - } - } - - for (StrRegion strRegion : strRegionExistList) { - if (strRegion.getIsValid() == 1) { - List validRegionList = null; - if (validMap.get(strRegion.getGroupId()) == null) { - validRegionList = new ArrayList(); - - validRegionList.add(strRegion.getRegionId()); - - validMap.put(strRegion.getGroupId(), validRegionList); - } else { - validRegionList = validMap.get(strRegion.getGroupId()); - // if (!validRegionList.contains(strRegion.getRegionId())) { - validRegionList.add(strRegion.getRegionId()); - validMap.put(strRegion.getGroupId(), validRegionList); - - // } - } - } - if (strRegion.getIsValid() == 0) { - List noValidRegionList = null; - if (noValidMap.get(strRegion.getGroupId()) == null) { - noValidRegionList = new ArrayList(); - noValidRegionList.add(strRegion.getRegionId()); - noValidMap.put(strRegion.getGroupId(), noValidRegionList); - } else { - noValidRegionList = noValidMap.get(strRegion.getGroupId()); - // if (!noValidRegionList.contains(strRegion.getRegionId())) - // { - noValidRegionList.add(strRegion.getRegionId()); - noValidMap.put(strRegion.getGroupId(), noValidRegionList); - // } - } - } - } - for (NumRegion numRegion : numRegionExistList) { - if (numRegion.getIsValid() == 1) { - List validRegionList = null; - if (validMap.get(numRegion.getGroupId()) == null) { - validRegionList = new ArrayList(); - validRegionList.add(numRegion.getRegionId()); - validMap.put(numRegion.getGroupId(), validRegionList); - - } else { - validRegionList = validMap.get(numRegion.getGroupId()); - // if (!validRegionList.contains(numRegion.getRegionId())) { - validRegionList.add(numRegion.getRegionId()); - validMap.put(numRegion.getGroupId(), validRegionList); - // } - - } - } - if (numRegion.getIsValid() == 0) { - List noValidRegionList = null; - if (noValidMap.get(numRegion.getGroupId()) == null) { - noValidRegionList = new ArrayList(); - noValidRegionList.add(numRegion.getRegionId()); - noValidMap.put(numRegion.getGroupId(), noValidRegionList); - } else { - noValidRegionList = noValidMap.get(numRegion.getGroupId()); - // if (!noValidRegionList.contains(numRegion.getRegionId())) - // { - noValidRegionList.add(numRegion.getRegionId()); - noValidMap.put(numRegion.getGroupId(), noValidRegionList); - // } - } - } - } - map.put("noValidMap", noValidMap); - map.put("validMap", validMap); - return map; - - } - - // //////////////////////////////////////////////////////////////////////////// - - public String configModifySources(List configCompileList) - throws Exception { - - for (ConfigCompile configCompile : configCompileList) { - Long compileId = configCompile.getCompileId(); - if (null != compileId) { - configCompileDao.updateConfigCompile(configCompile); - } else { - return "idIsNull"; - } - } - return "ok"; - } - - public String saveCommonSources(AuditLogThread thread, long start, - String jsonString) { - CompileVal.setBusinessCode(null); + public void saveCommonSources(AuditLogThread thread, long start, + String jsonString) throws Exception{ JsonArray jsonObjectList = null; try { jsonObjectList = new JsonParser().parse(jsonString) .getAsJsonArray(); } catch (Exception e) { // TODO: handle exception - logger.error(RestBusinessCode.CBParamFormateError.getErrorReason()+","+e.getMessage()); - CompileVal.setBusinessCode(RestBusinessCode.CBParamFormateError.getValue()); - e =new RestServiceException (RestBusinessCode.CBParamFormateError.getErrorReason()+","+e.getMessage(),RestBusinessCode.CBParamFormateError.getValue()); - msgList.add(e); - return "error"; + throw new RestServiceException(RestBusinessCode.CBParamFormateError.getErrorReason()+","+e.getMessage(),RestBusinessCode.CBParamFormateError.getValue()); } Map>> dstMaps = new HashMap>>(); @@ -2726,12 +446,7 @@ public class ConfigSourcesService extends BaseService { .getCommonSourceCfgByService(srcMap.get("service") .toString().trim()); if (StringUtil.isEmpty(commonSourceFieldCfgList)) { - logger.error(RestBusinessCode.ServiceIsWrong.getErrorReason()+",请检查service配置是否正确"); - thread.setExceptionInfo("请检查service配置是否正确"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "请检查service配置是否正确", - RestBusinessCode.ServiceIsWrong.getValue()); + throw new RestServiceException(RestBusinessCode.ServiceIsWrong.getErrorReason()+",请检查service配置是否正确",RestBusinessCode.ServiceIsWrong.getValue()); } // 获取IP类型 Integer ipType = null; @@ -2753,16 +468,8 @@ public class ConfigSourcesService extends BaseService { valFlag = valFlag & matcher.matches(); } if (!valFlag) { - logger.error(RestBusinessCode.IpTypeIsWrong - .getErrorReason()); - thread.setExceptionInfo(RestBusinessCode.IpTypeIsWrong - .getErrorReason()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - RestBusinessCode.IpTypeIsWrong - .getErrorReason(), - RestBusinessCode.IpTypeIsWrong - .getValue()); + throw new RestServiceException(RestBusinessCode.IpTypeIsWrong + .getErrorReason(),RestBusinessCode.IpTypeIsWrong.getValue()); } ipType = Integer.parseInt(dstVal); } @@ -2772,13 +479,7 @@ public class ConfigSourcesService extends BaseService { commonSourceFieldCfg.getSrcName()).toString().trim(); if (Integer.valueOf(dstVal).compareTo(ServiceAndRDBIndexReal.getActionByService(Integer.valueOf(srcMap.get("service") .toString().trim())))!=0) { - logger.error(RestBusinessCode.ServiceUnmatchAction - .getErrorReason()); - thread.setExceptionInfo(RestBusinessCode.ServiceUnmatchAction - .getErrorReason()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - RestBusinessCode.ServiceUnmatchAction + throw new RestServiceException(RestBusinessCode.ServiceUnmatchAction .getErrorReason(), RestBusinessCode.ServiceUnmatchAction .getValue()); @@ -2793,13 +494,7 @@ public class ConfigSourcesService extends BaseService { if (commonSourceFieldCfg.getIsRequired() && !srcMap.containsKey(commonSourceFieldCfg .getSrcName())) { - logger.error(commonSourceFieldCfg.getSrcName() - + "参数不能为空"); - thread.setExceptionInfo(commonSourceFieldCfg - .getSrcName() + "参数不能为空"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - commonSourceFieldCfg.getSrcName() + "参数不能为空", + throw new RestServiceException(commonSourceFieldCfg.getSrcName() + "参数不能为空", RestBusinessCode.FieldIsNull.getValue()); } // 字段类型 String Number Date Ip Port @@ -2831,13 +526,7 @@ public class ConfigSourcesService extends BaseService { switch (commonSourceFieldCfg.getFieldType()) { case "Number": if (!StringUtil.isNumeric(dstStr)) { - logger.error(commonSourceFieldCfg.getSrcName() - + "参数不能格式不正确,必需是数值型"); - thread.setExceptionInfo(commonSourceFieldCfg - .getSrcName() + "参数不能格式不正确,必需是数值型"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - commonSourceFieldCfg.getSrcName() + throw new RestServiceException(commonSourceFieldCfg.getSrcName() + "参数不能格式不正确,必需是数值型", RestBusinessCode.MastNumberic.getValue()); } @@ -2845,20 +534,15 @@ public class ConfigSourcesService extends BaseService { case "Date": try { // sdf.setTimeZone(TimeZone.getTimeZone("UTC")); - System.out.println("--------------------TimeZone:" - + sdf.getTimeZone()); +// System.out.println("--------------------TimeZone:" +// + sdf.getTimeZone()); + sdf.setLenient(false); Date date = sdf.parse(dstStr); dstStr = date.getTime() + "000"; } catch (ParseException e) { // TODO Auto-generated catch block - logger.error(commonSourceFieldCfg.getSrcName() - + "参数格式不正确,必须是日期型"); - thread.setExceptionInfo(commonSourceFieldCfg - .getSrcName() + "参数格式不正确,必须是日期型"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - commonSourceFieldCfg.getSrcName() - + "参数不能格式不正确,必须是日期型", + throw new RestServiceException(commonSourceFieldCfg.getSrcName() + + "参数格式不正确或不是规范的日期串", RestBusinessCode.MastDate.getValue()); } break; @@ -2873,31 +557,14 @@ public class ConfigSourcesService extends BaseService { valAddrType=null; } if (!BasicProvingUtil.isIpOrIpMask(dstStr, valAddrType)) { - logger.error(commonSourceFieldCfg.getSrcName() - + "参数格式不正确或与" + ipTypeName + "不一致"); - thread.setExceptionInfo(commonSourceFieldCfg - .getSrcName() - + "参数格式不正确或与" - + ipTypeName - + "不一致"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - commonSourceFieldCfg.getSrcName() - + "参数格式不正确或与" + ipTypeName + "不一致", - RestBusinessCode.IpIsUnMatchType.getValue()); + throw new RestServiceException(commonSourceFieldCfg.getSrcName() + + "参数格式不正确或与" + ipTypeName + "不一致",RestBusinessCode.IpIsUnMatchType.getValue()); } break; case "Port": if (!BasicProvingUtil.isPortOrPortMask(dstStr)) { - logger.error(commonSourceFieldCfg.getSrcName() - + "参数格式不正确,不是合法的Port"); - thread.setExceptionInfo(commonSourceFieldCfg - .getSrcName() + "参数格式不正确,不是合法的Port"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - commonSourceFieldCfg.getSrcName() - + "参数不能格式不正确,不是合法的Port", - RestBusinessCode.PortIsNotVal.getValue()); + throw new RestServiceException(commonSourceFieldCfg.getSrcName() + + "参数不能格式不正确,不是合法的Port", RestBusinessCode.PortIsNotVal.getValue()); } break; @@ -2928,20 +595,9 @@ public class ConfigSourcesService extends BaseService { } } if (flag) { - logger.error(commonSourceFieldCfg.getSrcName() - + "参数不在有效范围(" - + commonSourceFieldCfg.getRange() + ")"); - thread.setExceptionInfo(commonSourceFieldCfg - .getSrcName() - + "参数不在有效范围(" - + commonSourceFieldCfg.getRange() + ")"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - commonSourceFieldCfg.getSrcName() - + "参数不在有效范围(" - + commonSourceFieldCfg.getRange() - + ")", - RestBusinessCode.ValueInWrongRange.getValue()); + throw new RestServiceException( commonSourceFieldCfg.getSrcName() + + "参数不在有效范围("+ commonSourceFieldCfg.getRange() + + ")",RestBusinessCode.ValueInWrongRange.getValue()); } } // regexp 特殊格式正则验证 @@ -2955,19 +611,8 @@ public class ConfigSourcesService extends BaseService { if (valFlag) { dstMap.put(commonSourceFieldCfg.getDstName(), dstStr); } else { - logger.error(commonSourceFieldCfg.getSrcName() - + "参数格式与正则(" + commonSourceFieldCfg.getRegexp() - + ")不匹配"); - thread.setExceptionInfo(commonSourceFieldCfg - .getSrcName() - + "参数格式与正则(" - + commonSourceFieldCfg.getRegexp() + ")不匹配"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - commonSourceFieldCfg.getSrcName() + "参数格式与正则(" - + commonSourceFieldCfg.getRegexp() - + ")不匹配", - RestBusinessCode.ValueInWrongRegexp.getValue()); + throw new RestServiceException(commonSourceFieldCfg.getSrcName() + "参数格式与正则(" + + commonSourceFieldCfg.getRegexp()+ ")不匹配",RestBusinessCode.ValueInWrongRegexp.getValue()); } } if (StringUtil.isEmpty(dstMaps.get(Integer.valueOf(srcMap.get( @@ -2984,10 +629,7 @@ public class ConfigSourcesService extends BaseService { } } else { - thread.setExceptionInfo("service参数不能为空"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, "service参数不能为空", - RestBusinessCode.ServiceIsNull.getValue()); + throw new RestServiceException("service参数不能为空",RestBusinessCode.ServiceIsNull.getValue()); } } logger.info("------------------调用非maat配置新增接口-------------------"); @@ -3010,42 +652,22 @@ public class ConfigSourcesService extends BaseService { } } } else { - RuntimeException e = new RuntimeException( - "service与写入数据库序号映射关系不存在"); - CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue()); - msgList.add(e); - return "error"; + throw new ServiceRuntimeException("service与写入数据库序号映射关系不存在",RestBusinessCode.ServiceNoFoundDBIndex.getValue()); } } - try { - configRedisService.saveUnMaatConfig(configMap); - } catch (Exception e) { - logger.error(e.getMessage()); - CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue()); - if (e instanceof ServiceRuntimeException) { - CompileVal.setBusinessCode(((ServiceRuntimeException) e).getErrorCode()); - } - msgList.add(e); - return "error"; - } - - return "ok"; + configRedisService.saveUnMaatConfig(configMap); } - public String updateCommonSources(AuditLogThread thread, long start, - String jsonString, Date opTime, StringBuffer sb) { + public void updateCommonSources(AuditLogThread thread, long start, + String jsonString, Date opTime, StringBuffer sb) throws Exception{ JsonArray jsonObjectList = null; try { jsonObjectList = new JsonParser().parse(jsonString) .getAsJsonArray(); } catch (Exception e) { // TODO: handle exception - logger.error(RestBusinessCode.CBParamFormateError.getErrorReason()+","+e.getMessage()); - CompileVal.setBusinessCode(RestBusinessCode.CBParamFormateError.getValue()); - e =new RestServiceException (RestBusinessCode.CBParamFormateError.getErrorReason()+","+e.getMessage(),RestBusinessCode.CBParamFormateError.getValue()); - msgList.add(e); - return "error"; + throw new RestServiceException (RestBusinessCode.CBParamFormateError.getErrorReason()+","+e.getMessage(),RestBusinessCode.CBParamFormateError.getValue()); } // Map> cfgMap = new HashMap>(); @@ -3055,14 +677,7 @@ public class ConfigSourcesService extends BaseService { JsonObject jsonObj = (JsonObject) jsonObjectList.get(i); Map srcMap = JSONObject.fromObject(JSONObject .fromObject((jsonObj.toString()))); - String msg = checkOptForUpdate(srcMap); - if (!msg.equals("ok")) { - thread.setExceptionInfo(msg + sb.toString()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - msg + sb.toString(), - CompileVal.getBusinessCode()); - } + checkOptForUpdate(srcMap); validIdMap.put(srcMap.get("isValid").toString(), srcMap.get("isValid").toString()); Integer service = Integer.valueOf(srcMap.get("service").toString()); Long cfgId = Long.valueOf(srcMap.get("cfgId").toString()); @@ -3076,11 +691,7 @@ public class ConfigSourcesService extends BaseService { } if (validIdMap.size()>1) { - thread.setExceptionInfo(RestBusinessCode.IsValidNonUniq.getErrorReason()); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - RestBusinessCode.IsValidNonUniq.getErrorReason(), - RestBusinessCode.IsValidNonUniq.getValue()); + throw new RestServiceException(RestBusinessCode.IsValidNonUniq.getErrorReason(), RestBusinessCode.IsValidNonUniq.getValue()); } Map>> restMap = new HashMap>>(); Iterator serviceIterator = cfgMap.keySet().iterator(); @@ -3100,56 +711,46 @@ public class ConfigSourcesService extends BaseService { } } } else { - RuntimeException e = new RuntimeException( - "service与写入数据库序号映射关系不存在"); - CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue()); - msgList.add(e); - return "error"; + throw new ServiceRuntimeException("service与写入数据库序号映射关系不存在",RestBusinessCode.ServiceNoFoundDBIndex.getValue()); } } try { - configRedisService.delUnMaatConfig(restMap,validIdMap.containsKey("0")?true:false); } catch (Exception e) { // TODO: handle exception - logger.error(e.getMessage()); - CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue()); - if (e.getMessage().startsWith("后台错误:")) { - CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue()); - } - msgList.add(e); - return "error"; + throw new ServiceRuntimeException(RestBusinessCode.service_runtime_error.getErrorReason(),RestBusinessCode.service_runtime_error.getValue()); } - return "ok"; } - private String checkOptForUpdate(Map srcMap) { + /** + * + * @Description:对回调类配置状态更新操作数据进行格式验证 + * @author (zdx) + * @date 2018年8月10日 下午3:00:13 + * @param srcMap + * @throws Exception + */ + private void checkOptForUpdate(Map srcMap) throws Exception{ String cfgId = srcMap.get("cfgId").toString(); String service = srcMap.get("service").toString(); String isValid = srcMap.get("isValid").toString(); if (StringUtil.isEmpty(cfgId)) { - CompileVal.setBusinessCode(RestBusinessCode.CfgIdIsNull.getValue()); - return RestBusinessCode.CfgIdIsNull.getErrorReason(); + throw new RestServiceException(RestBusinessCode.CfgIdIsNull.getErrorReason(),RestBusinessCode.CfgIdIsNull.getValue()); } else if (!StringUtil.isNumeric(cfgId)) { - CompileVal.setBusinessCode(RestBusinessCode.MastNumberic.getValue()); - return "cfgId字段格式不正确,"+RestBusinessCode.MastNumberic.getErrorReason(); + throw new RestServiceException("cfgId字段格式不正确,"+RestBusinessCode.MastNumberic.getErrorReason(),RestBusinessCode.MastNumberic.getValue()); } if (StringUtil.isEmpty(service)) { - CompileVal.setBusinessCode(RestBusinessCode.ServiceIsNull.getValue()); - return RestBusinessCode.ServiceIsNull.getErrorReason(); + throw new RestServiceException(RestBusinessCode.ServiceIsNull.getErrorReason(),RestBusinessCode.ServiceIsNull.getValue()); } else if (!StringUtil.isNumeric(service)) { - CompileVal.setBusinessCode(RestBusinessCode.MastNumberic.getValue()); - return "service字段格式不正确,"+RestBusinessCode.MastNumberic.getErrorReason(); + throw new RestServiceException("service字段格式不正确,"+RestBusinessCode.MastNumberic.getErrorReason(),RestBusinessCode.MastNumberic.getValue()); } if (StringUtil.isEmpty(isValid)) { - CompileVal.setBusinessCode(RestBusinessCode.IsValidIsNull.getValue()); - return "配置id为" + srcMap.get("cfgId") + "的isValid字段不能为空"; + throw new RestServiceException("配置id为" + srcMap.get("cfgId") + "的isValid字段不能为空",RestBusinessCode.IsValidIsNull.getValue()); } else { if (!StringUtil.isNumeric(service)) { - CompileVal.setBusinessCode(RestBusinessCode.IsValidInWrongRange.getValue()); - return RestBusinessCode.IsValidInWrongRange.getErrorReason(); + throw new RestServiceException(RestBusinessCode.IsValidInWrongRange.getErrorReason(),RestBusinessCode.IsValidInWrongRange.getValue()); } //配置取消改为状态更新(停/启用) // else if (!isValid.equals("0")) { @@ -3157,32 +758,11 @@ public class ConfigSourcesService extends BaseService { // return RestBusinessCode.IsValidIsF.getErrorReason(); // } } - return "ok"; - } - - private boolean isIp(String ipStr) { - if (!(BasicProvingUtil.isIpOrIpMask(ipStr, 4) || BasicProvingUtil - .isIpOrIpMask(ipStr, 6))) { - return false; - } - return true; - - } - - public String setCompileInvalid(ConfigCompile configCompile) - throws Exception { - configCompileDao.setCompileInvalid(configCompile.getCompileId(), 0); - return "ok"; - } - - public String setCompileValid(ConfigCompile configCompile) throws Exception { - configCompileDao.setCompileInvalid(configCompile.getCompileId(), 1); - return "ok"; } public String getDigestGen(String realPath, String filePath) throws Exception { - System.out.println("----------------getDigestGen"); + logger.info("----------------开始获取摘要:getDigestGen"); String content = ""; String digestGenToolPath = Constants.DIGEST_GEN_TOOL_PATH; String chmodCommond = "chmod +x " + realPath + digestGenToolPath;// 执行权限命令 diff --git a/src/main/java/com/nis/web/service/restful/DmbCkService.java b/src/main/java/com/nis/web/service/restful/DmbCkService.java deleted file mode 100644 index a9f1b2c..0000000 --- a/src/main/java/com/nis/web/service/restful/DmbCkService.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - *@Title: DmbCkService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.DmbCk; -import com.nis.web.dao.DmbCkDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: DmbCkService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class DmbCkService extends CrudService { - @Autowired - public DmbCkDao dmbCkDao; - public Page getDmbCk(Page page, DmbCk entity) { - return findPage(page, entity); - } - - public DmbCk findById(long id) { - return get(id); - } - public void saveDmbCkBatch(List entity) { - // TODO Auto-generated method stub - super.saveBatch(entity,DmbCkDao.class); - } - public void updateDmbCkBatch(List entity) { - // TODO Auto-generated method stub - super.updateBatch(entity, DmbCkDao.class); - } - public void removeDmbCk(long id) { - dmbCkDao.delete(id); - } - public void removeDmbCkBatch(List entity) { - super.deleteBatch(entity, DmbCkDao.class); - } -} diff --git a/src/main/java/com/nis/web/service/restful/DmbPortService.java b/src/main/java/com/nis/web/service/restful/DmbPortService.java deleted file mode 100644 index 96cc952..0000000 --- a/src/main/java/com/nis/web/service/restful/DmbPortService.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - *@Title: DmbPortService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.DmbPort; -import com.nis.web.dao.DmbPortDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: DmbPortService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class DmbPortService extends CrudService { - @Autowired - public DmbPortDao dmbPortDao; - public Page getDmbPort(Page page, DmbPort entity) { - return findPage(page, entity); - } - - public DmbPort findById(long id) { - return get(id); - } - public void saveDmbPortBatch(List entity) { - // TODO Auto-generated method stub - super.saveBatch(entity,DmbPortDao.class); - } - public void updateDmbPortBatch(List entity) { - // TODO Auto-generated method stub - super.updateBatch(entity, DmbPortDao.class); - } - public void removeDmbPort(long id) { - dmbPortDao.delete(id); - } - public void removeDmbPortBatch(List entity) { - super.deleteBatch(entity, DmbPortDao.class); - } -} diff --git a/src/main/java/com/nis/web/service/restful/DnsFakeInfoService.java b/src/main/java/com/nis/web/service/restful/DnsFakeInfoService.java deleted file mode 100644 index f9b6d8c..0000000 --- a/src/main/java/com/nis/web/service/restful/DnsFakeInfoService.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - *@Title: DnsFakeInfoService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.DnsFakeInfo; -import com.nis.util.Constants; -import com.nis.web.dao.DnsFakeInfoDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: DnsFakeInfoService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class DnsFakeInfoService extends CrudService { - @Autowired - public DnsFakeInfoDao dnsFakeInfoDao; - public Page getDnsFakeInfo(Page page, DnsFakeInfo entity) { - return findPage(page, entity); - } - - public DnsFakeInfo findById(long id) { - return get(id); - } - public void saveDnsFakeInfoBatch(List entity) { - // TODO Auto-generated method stub - super.saveBatch(entity,DnsFakeInfoDao.class); - } - public void updateDnsFakeInfoBatch(List entity) { - // TODO Auto-generated method stub - super.updateBatch(entity, DnsFakeInfoDao.class); - } - public void removeDnsFakeInfo(long id) { - dnsFakeInfoDao.delete(id); - } - public void removeDnsFakeInfoBatch(List entity) { - super.deleteBatch(entity, DnsFakeInfoDao.class); - } - /** - * - * isValid(单条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param id - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(long id){ - return dnsFakeInfoDao.isValid(id)==Integer.parseInt(Constants.YES); - } - /** - * - * isValid(多条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param entity - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(List entity){ - boolean vaild=false; - List idsList=new ArrayList(); - for(DnsFakeInfo DnsFakeInfo : entity){ - idsList.add(DnsFakeInfo.getId()); - if(idsList.size()%1000==0&&idsList.size()!=0){ - int count=dnsFakeInfoDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0){ - vaild=true; - break; - } - } - } - if(idsList.size()>0){ - int count=dnsFakeInfoDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0)vaild=true; - } - return vaild; - } -} diff --git a/src/main/java/com/nis/web/service/restful/DnsFakeIpService.java b/src/main/java/com/nis/web/service/restful/DnsFakeIpService.java deleted file mode 100644 index 216b155..0000000 --- a/src/main/java/com/nis/web/service/restful/DnsFakeIpService.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - *@Title: DnsFakeIpService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSession; -import org.apache.ibatis.session.SqlSessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.DnsFakeIp; -import com.nis.domain.restful.FakeIpConfigCompile; -import com.nis.domain.restful.FakeIpConfigGroup; -import com.nis.util.Constants; -import com.nis.web.dao.CrudDao; -import com.nis.web.dao.DnsFakeIpDao; -import com.nis.web.dao.FakeIpConfigCompileDao; -import com.nis.web.dao.FakeIpConfigGroupDao; -import com.nis.web.service.CrudService; -import com.nis.web.service.SpringContextHolder; - -/** - * @ClassName: DnsFakeIpService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class DnsFakeIpService extends CrudService { - @Autowired - public DnsFakeIpDao dnsFakeIpDao; - @Autowired - public FakeIpConfigCompileDao fakeIpConfigCompileDao; - @Autowired - public FakeIpConfigGroupDao fakeIpConfigGroupDao; - public Page getDnsFakeIp(Page page, DnsFakeIp entity) { - return findPage(page, entity); - } - - public DnsFakeIp findById(long id) { - return get(id); - } - public void saveDnsFakeIpBatch(List entity) { - // TODO Auto-generated method stub - this.saveBatch(entity,DnsFakeIpDao.class); - } - public void updateDnsFakeIpBatch(List entity) { - // TODO Auto-generated method stub - super.updateBatch(entity, DnsFakeIpDao.class); - } - public void removeDnsFakeIp(long id) { - dnsFakeIpDao.delete(id); - } - public void removeDnsFakeIpBatch(List entity) { - super.deleteBatch(entity, DnsFakeIpDao.class); - } - /** - * - * isValid(单条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param id - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(long id){ - return dnsFakeIpDao.isValid(id)==Integer.parseInt(Constants.YES); - } - /** - * - * isValid(多条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param entity - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(List entity){ - boolean vaild=false; - List idsList=new ArrayList(); - for(DnsFakeIp DnsFakeIp : entity){ - idsList.add(DnsFakeIp.getId()); - if(idsList.size()%1000==0&&idsList.size()!=0){ - int count=dnsFakeIpDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0){ - vaild=true; - break; - } - } - } - if(idsList.size()>0){ - int count=dnsFakeIpDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0)vaild=true; - } - return vaild; - } - - /* (non-Javadoc) - * @see com.nis.web.service.CrudService#saveBatch(java.util.List, java.lang.Class) - */ - @SuppressWarnings("unchecked") - @Override - public void saveBatch(List data, @SuppressWarnings("rawtypes") Class mClass) { - Date now=new Date(); - SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class); - SqlSession batchSqlSession = null; - try{ - batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); - for(int index = 0; index < data.size();index++){ - DnsFakeIp t = data.get(index); - ((DnsFakeIpDao) batchSqlSession.getMapper(mClass)).insert(t); - if(t.getGroupId()==0||t.getGroupId()==1){ - //先生成编译,获得编译号 - FakeIpConfigCompile fakeIpConfigCompile=new FakeIpConfigCompile(); - long compileId=fakeIpConfigCompileDao.getCompileId(); - fakeIpConfigCompile.setLastUpdate(now); - System.out.println(compileId); - fakeIpConfigCompile.setCompileId(compileId); - if(t.getGroupId()==0){ - fakeIpConfigCompile.setAction(2); - }else if(t.getGroupId()==1) - fakeIpConfigCompile.setAction(1); - fakeIpConfigCompile.setOpTime(t.getOpTime()); - fakeIpConfigCompile.setActiveSys(3); - ((FakeIpConfigCompileDao) batchSqlSession.getMapper(FakeIpConfigCompileDao.class)).insert(fakeIpConfigCompile); - //生成分组 - FakeIpConfigGroup fakeIpConfigGroup=new FakeIpConfigGroup(); - fakeIpConfigGroup.setLastUpdate(now); - fakeIpConfigGroup.setGroupId(t.getGroupId()); - fakeIpConfigGroup.setCompileId(compileId); - fakeIpConfigGroup.setOpTime(t.getOpTime()); - ((FakeIpConfigGroupDao) batchSqlSession.getMapper(FakeIpConfigGroupDao.class)).insert(fakeIpConfigGroup); - } - - } - batchSqlSession.commit(); - // }catch (Exception e){ - // batchSqlSession.rollback(); - // throw e; - }finally { - if(batchSqlSession != null){ - batchSqlSession.close(); - } - } - } - -} diff --git a/src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java b/src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java deleted file mode 100644 index a86c7b1..0000000 --- a/src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - *@Title: DnsGroupTypeService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author dell - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.ArrayList; -import java.util.List; - -import com.nis.web.service.AuditLogThread; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.DnsGroupType; -import com.nis.restful.RestBusinessCode; -import com.nis.restful.RestServiceException; -import com.nis.util.Constants; -import com.nis.web.dao.DnsGroupTypeDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: DnsGroupTypeService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class DnsGroupTypeService extends CrudService { - @Autowired - public DnsGroupTypeDao dnsGroupTypeDao; - public Page getDnsGroupType(Page page, DnsGroupType entity) { - return findPage(page, entity); - } - - public DnsGroupType findById(long id) { - return get(id); - } - public void saveDnsGroupTypeBatch(AuditLogThread thread, long start, List entity) { - // TODO Auto-generated method stub - List idsList=new ArrayList<>(); - for(DnsGroupType e:entity){ - if(e.getGroupId()!=null) - idsList.add(e.getGroupId()); - } - if(idsList.size()>0){ - boolean unique=this.groupIdValidation(idsList); - if(!unique) - throw new RestServiceException(thread, System.currentTimeMillis(), "分组号不唯一", RestBusinessCode.not_unique.getValue()); - } - super.saveBatch(entity,DnsGroupTypeDao.class); - } - public void updateDnsGroupTypeBatch(AuditLogThread thread, long start, List entity) { - // TODO Auto-generated method stub -// List idsList=new ArrayList<>(); -// for(DnsGroupType e:entity){ -// if(e.getGroupId()!=null) -// idsList.add(e.getGroupId()); -// } -// if(idsList.size()>0){ -// boolean unique=this.groupIdValidation(idsList); -// if(!unique) -// throw new RestServiceException(thread, System.currentTimeMillis(), "分组号不唯一", RestBusinessCode.not_unique.getValue()); -// -// } - super.updateBatch(entity, DnsGroupTypeDao.class); - } - public void removeDnsGroupType(long id) { - dnsGroupTypeDao.delete(id); - } - public void removeDnsGroupTypeBatch(List entity) { - super.deleteBatch(entity, DnsGroupTypeDao.class); - } - /** - * - * isValid(单条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param id - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(long id){ - return dnsGroupTypeDao.isValid(id)==Integer.parseInt(Constants.YES); - } - /** - * - * isValid(多条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param entity - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(List entity){ - boolean vaild=false; - List idsList=new ArrayList(); - for(DnsGroupType dnsGroupType : entity){ - idsList.add(dnsGroupType.getId()); - if(idsList.size()%1000==0&&idsList.size()!=0){ - int count=dnsGroupTypeDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0){ - vaild=true; - break; - } - } - } - if(idsList.size()>0){ - int count=dnsGroupTypeDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0)vaild=true; - } - return vaild; - } - /** - * 验证字段唯一性 - * reqStrateIdValidation(这里用一句话描述这个方法的作用) - * (这里描述这个方法适用条件 – 可选) - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean groupIdValidation(List idsList){ - int count=0; - if(idsList.size()>=1000){ - int i=0; - for(;i subList=idsList.subList(i*1000,(i+1)*1000); - count=dnsGroupTypeDao.isGroupIdUnique(subList); - if(count>0){ - return false; - } - } - if(idsList.size()>(i*1000)){ - List subList=idsList.subList(i*1000,idsList.size()); - count=dnsGroupTypeDao.isGroupIdUnique(subList); - } - }else{ - count=dnsGroupTypeDao.isGroupIdUnique(idsList); - } - return count==0; - } -} diff --git a/src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java b/src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java deleted file mode 100644 index 9619c74..0000000 --- a/src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java +++ /dev/null @@ -1,218 +0,0 @@ -/** - *@Title: DnsResponseStrategy.java - *@Package com.nis.web.controller.restful - *@Description TODO - *@author dell - *@date 2016年9月5日 下午3:37:54 - *@version 1.0 - */ -package com.nis.web.service.restful; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.DnsResponseStrategy; -import com.nis.restful.RestBusinessCode; -import com.nis.restful.RestServiceException; -import com.nis.util.Constants; -import com.nis.web.dao.DnsResponseStrategyDao; -import com.nis.web.service.CrudService; -import com.nis.web.service.AuditLogThread; - -/** - * @ClassName: DnsResponseStrategy.java - * @Description: TODO - * @author (dell) - * @date 2016年9月5日 下午3:37:54 - * @version V1.0 - */ -@Service -public class DnsResponseStrategyService extends CrudService { - @Autowired - public DnsResponseStrategyDao dnsResponseStrategyDao; - public Page getDnsResponseStrategy(Page page, DnsResponseStrategy dnsResponseStrategy) { - return findPage(page, dnsResponseStrategy); - } - - public DnsResponseStrategy findById(long id) { - return get(id); - } - /** - * - * saveDnsResponseStrategyBatch(多条插入) - * (这里描述这个方法适用条件 – 可选) - * @param entity - *void - * @exception - * @since 1.0.0 - */ - public void saveDnsResponseStrategyBatch(List entity) { - // TODO Auto-generated method stub - super.saveBatch(entity,DnsResponseStrategyDao.class); - } - /** - * - * saveDnsResponseStrategyBatch(多条插入) - * (这里描述这个方法适用条件 – 可选) - * @param entity - *void - * @exception - * @since 1.0.0 - */ - public void saveDnsResponseStrategyBatch(AuditLogThread thread, long start, List entity) { - // TODO Auto-generated method stub - List idsList=new ArrayList<>(); - for(DnsResponseStrategy e:entity){ - if(e.getReqStrateId()!=null) - idsList.add(e.getReqStrateId()); - } - if(idsList.size()>0){ - boolean uinque=this.reqStrateIdValidation(idsList); - if(!uinque){ - throw new RestServiceException(thread, System.currentTimeMillis(), "请求策略号不唯一", RestBusinessCode.not_unique.getValue()); - } - } - - super.saveBatch(entity,DnsResponseStrategyDao.class); - } - /** - * - * updateDnsResponseStrategyBatch(多条更新) - * (这里描述这个方法适用条件 – 可选) - * @param entity - *void - * @exception - * @since 1.0.0 - */ - public void updateDnsResponseStrategyBatch(List entity) { - // TODO Auto-generated method stub - - super.updateBatch(entity, DnsResponseStrategyDao.class); - } - /** - * - * updateDnsResponseStrategyBatch(多条更新) - * (这里描述这个方法适用条件 – 可选) - * @param entity - *void - * @exception - * @since 1.0.0 - */ - public void updateDnsResponseStrategyBatch(AuditLogThread thread, long start, List entity) { -// List idsList=new ArrayList<>(); -// for(DnsResponseStrategy e:entity){ -// if(e.getReqStrateId()!=null) -// idsList.add(e.getReqStrateId()); -// } -// if(idsList.size()>0){ -// boolean uinque=this.reqStrateIdValidation(idsList); -// if(!uinque){ -// throw new RestServiceException(thread, System.currentTimeMillis(), "请求策略号不唯一", RestBusinessCode.not_unique.getValue()); -// } -// } - - // TODO Auto-generated method stub - super.updateBatch(entity, DnsResponseStrategyDao.class); - } - /** - * - * removeDnsResponseStrategy(单条删除) - * (这里描述这个方法适用条件 – 可选) - * @param id - *void - * @exception - * @since 1.0.0 - */ - public void removeDnsResponseStrategy(long id) { - dnsResponseStrategyDao.delete(id); - } - /** - * - * removeDnsResponseStrategyBatch(多条删除) - * (这里描述这个方法适用条件 – 可选) - * @param entity - *void - * @exception - * @since 1.0.0 - */ - public void removeDnsResponseStrategyBatch(List entity) { - super.deleteBatch(entity, DnsResponseStrategyDao.class); - } - /** - * - * isValid(单条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param id - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(long id){ - return dnsResponseStrategyDao.isValid(id)==Integer.parseInt(Constants.YES); - } - /** - * - * isValid(多条有效验证) - * (这里描述这个方法适用条件 – 可选) - * @param entity - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean isValid(List entity){ - boolean vaild=false; - List idsList=new ArrayList(); - for(DnsResponseStrategy dnsResponseStrategy : entity){ - idsList.add(dnsResponseStrategy.getId()); - if(idsList.size()%1000==0&&idsList.size()!=0){ - int count=dnsResponseStrategyDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0){ - vaild=true; - break; - } - } - } - if(idsList.size()>0){ - int count=dnsResponseStrategyDao.isValidBatch(idsList,Integer.parseInt(Constants.YES)); - idsList.clear(); - if(count>0)vaild=true; - } - return vaild; - } - /** - * 验证字段唯一性 - * reqStrateIdValidation(这里用一句话描述这个方法的作用) - * (这里描述这个方法适用条件 – 可选) - * @return - *boolean - * @exception - * @since 1.0.0 - */ - public boolean reqStrateIdValidation(List idsList){ - int count=0; - if(idsList.size()>=1000){ - int i=0; - for(;i subList=idsList.subList(i*1000,(i+1)*1000); - count=dnsResponseStrategyDao.isReqStrateIdUnique(subList); - if(count>0){ - return false; - } - } - if(idsList.size()>(i*1000)){ - List subList=idsList.subList(i*1000,idsList.size()); - count=dnsResponseStrategyDao.isReqStrateIdUnique(subList); - } - }else{ - count=dnsResponseStrategyDao.isReqStrateIdUnique(idsList); - } - return count==0; - } -} diff --git a/src/main/java/com/nis/web/service/restful/EncryptProtoRandomService.java b/src/main/java/com/nis/web/service/restful/EncryptProtoRandomService.java deleted file mode 100644 index 61501f9..0000000 --- a/src/main/java/com/nis/web/service/restful/EncryptProtoRandomService.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - *@Title: EncryptProtoRandomService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.EncryptProtoRandom; -import com.nis.web.dao.EncryptProtoRandomDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: EncryptProtoRandomService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class EncryptProtoRandomService extends CrudService { - @Autowired - public EncryptProtoRandomDao encryptProtoRandomDao; - public Page getEncryptProtoRandom(Page page, EncryptProtoRandom entity) { - return findPage(page, entity); - } - - public EncryptProtoRandom findById(long id) { - return get(id); - } - public void saveEncryptProtoRandomBatch(List entity) { - // TODO Auto-generated method stub - super.saveBatch(entity,EncryptProtoRandomDao.class); - } - public void updateEncryptProtoRandomBatch(List entity) { - // TODO Auto-generated method stub - super.updateBatch(entity, EncryptProtoRandomDao.class); - } - public void removeEncryptProtoRandom(Long id) { - encryptProtoRandomDao.delete(id); - } - public void removeEncryptProtoRandomBatch(List entity) { - super.deleteBatch(entity, EncryptProtoRandomDao.class); - } -} diff --git a/src/main/java/com/nis/web/service/restful/FakeIpConfigCompileService.java b/src/main/java/com/nis/web/service/restful/FakeIpConfigCompileService.java deleted file mode 100644 index 2d35403..0000000 --- a/src/main/java/com/nis/web/service/restful/FakeIpConfigCompileService.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - *@Title: DnsFakeIpService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.restful.FakeIpConfigCompile; -import com.nis.web.dao.FakeIpConfigCompileDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: DnsFakeIpService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class FakeIpConfigCompileService extends CrudService { - @Autowired - public FakeIpConfigCompileDao fakeIpConfigCompileDao; - -} diff --git a/src/main/java/com/nis/web/service/restful/FakeIpConfigGroupService.java b/src/main/java/com/nis/web/service/restful/FakeIpConfigGroupService.java deleted file mode 100644 index 00f1c14..0000000 --- a/src/main/java/com/nis/web/service/restful/FakeIpConfigGroupService.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - *@Title: DnsFakeIpService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.restful.FakeIpConfigGroup; -import com.nis.web.dao.FakeIpConfigGroupDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: DnsFakeIpService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class FakeIpConfigGroupService extends CrudService { - @Autowired - public FakeIpConfigGroupDao fakeIpConfigGroupDao; - -} diff --git a/src/main/java/com/nis/web/service/restful/FwqInfoService.java b/src/main/java/com/nis/web/service/restful/FwqInfoService.java deleted file mode 100644 index 6209eba..0000000 --- a/src/main/java/com/nis/web/service/restful/FwqInfoService.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - *@Title: FwqInfoService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.FwqInfo; -import com.nis.web.dao.FwqInfoDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: FwqInfoService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class FwqInfoService extends CrudService { - @Autowired - public FwqInfoDao fwqInfoDao; - public Page getFwqInfo(Page page, FwqInfo entity) { - return findPage(page, entity); - } - - public FwqInfo findById(long id) { - return get(id); - } - public void saveFwqInfoBatch(List entity) { - // TODO Auto-generated method stub - super.saveBatch(entity,FwqInfoDao.class); - } - public void updateFwqInfoBatch(List entity) { - // TODO Auto-generated method stub - super.updateBatch(entity, FwqInfoDao.class); - } - public void removeFwqInfo(long id) { - fwqInfoDao.delete(id); - } - public void removeFwqInfoBatch(List entity) { - super.deleteBatch(entity, FwqInfoDao.class); - } -} diff --git a/src/main/java/com/nis/web/service/restful/JdjInfoService.java b/src/main/java/com/nis/web/service/restful/JdjInfoService.java deleted file mode 100644 index 74fe88a..0000000 --- a/src/main/java/com/nis/web/service/restful/JdjInfoService.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - *@Title: JdjInfoService.java - *@Package com.nis.web.service.restful - *@Description TODO - *@author wx - *@date 2016年9月7日 下午3:28:44 - *@version 版本号 - */ -package com.nis.web.service.restful; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.nis.domain.Page; -import com.nis.domain.restful.JdjInfo; -import com.nis.web.dao.JdjInfoDao; -import com.nis.web.service.CrudService; - -/** - * @ClassName: JdjInfoService.java - * @Description: TODO - * @author (wx) - * @date 2016年9月7日 下午3:28:44 - * @version V1.0 - */ -@Service -public class JdjInfoService extends CrudService { - @Autowired - public JdjInfoDao jdjInfoDao; - public Page getJdjInfo(Page page, JdjInfo entity) { - return findPage(page, entity); - } - - public JdjInfo findById(long id) { - return get(id); - } - public void saveJdjInfoBatch(List entity) { - // TODO Auto-generated method stub - super.saveBatch(entity,JdjInfoDao.class); - } - public void updateJdjInfoBatch(List entity) { - // TODO Auto-generated method stub - super.updateBatch(entity, JdjInfoDao.class); - } - public void removeJdjInfo(long id) { - jdjInfoDao.delete(id); - } - public void removeJdjInfoBatch(List entity) { - super.deleteBatch(entity, JdjInfoDao.class); - } -} diff --git a/src/main/java/com/nis/web/service/restful/SaveCompileByJDBCThread.java b/src/main/java/com/nis/web/service/restful/SaveCompileByJDBCThread.java deleted file mode 100644 index ef51c4b..0000000 --- a/src/main/java/com/nis/web/service/restful/SaveCompileByJDBCThread.java +++ /dev/null @@ -1,665 +0,0 @@ -package com.nis.web.service.restful; - -import java.lang.reflect.Method; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.util.Date; -import java.util.List; -import java.util.concurrent.CountDownLatch; - -import org.apache.log4j.Logger; - -import com.nis.domain.restful.ConfigCompile; -import com.nis.domain.restful.ConfigGroupRelation; -import com.nis.domain.restful.DigestRegion; -import com.nis.domain.restful.IpRegion; -import com.nis.domain.restful.NumRegion; -import com.nis.domain.restful.StrRegion; -import com.nis.util.Configurations; - -/** - * jdbc测试批量插入 - * - * @author RenKaiGe-Office - * - */ -public class SaveCompileByJDBCThread implements Runnable { - private static Logger logger = Logger.getLogger(SaveCompileByJDBCThread.class); - private static Long start; - private CountDownLatch latch; - private Boolean isStrongStr; - private String tableName; - private Connection conn; - private List compileList; - private List groupList; - private List ipRegionList; - private List numRegionList; - private List strRegionList; - private List digestRegionList; - - private Method method = null; - public SaveCompileByJDBCThread() { - super(); - } - - public SaveCompileByJDBCThread(Connection conn, CountDownLatch latch, Long start) { - super(); - this.conn = conn; - this.latch = latch; - this.start = start; - } - - public SaveCompileByJDBCThread(String tableName, Connection conn, CountDownLatch latch, Long start) { - super(); - this.tableName = tableName; - this.conn = conn; - this.latch = latch; - this.start = start; - } - - public SaveCompileByJDBCThread(boolean isStrongStr, String tableName, Connection conn, CountDownLatch latch, - Long start) { - super(); - this.isStrongStr = isStrongStr; - this.tableName = tableName; - this.conn = conn; - this.latch = latch; - this.start = start; - } - - public Long getStart() { - return start; - } - - public void setStart(Long start) { - this.start = start; - } - - public CountDownLatch getLatch() { - return latch; - } - - public void setLatch(CountDownLatch latch) { - this.latch = latch; - } - - public Boolean getIsStrongStr() { - return isStrongStr; - } - - public void setIsStrongStr(Boolean isStrongStr) { - this.isStrongStr = isStrongStr; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public Connection getConn() { - return conn; - } - - public void setConn(Connection conn) { - this.conn = conn; - } - - public List getCompileList() { - return compileList; - } - - public void setCompileList(List compileList) { - this.compileList = compileList; - } - - public List getGroupList() { - return groupList; - } - - public void setGroupList(List groupList) { - this.groupList = groupList; - } - - public List getIpRegionList() { - return ipRegionList; - } - - public void setIpRegionList(List ipRegionList) { - this.ipRegionList = ipRegionList; - } - - public List getNumRegionList() { - return numRegionList; - } - - public void setNumRegionList(List numRegionList) { - this.numRegionList = numRegionList; - } - - public List getStrRegionList() { - return strRegionList; - } - - public void setStrRegionList(List strRegionList) { - this.strRegionList = strRegionList; - } - - public List getDigestRegionList() { - return digestRegionList; - } - - public void setDigestRegionList(List digestRegionList) { - this.digestRegionList = digestRegionList; - } - - public static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) { - java.sql.Timestamp sqlDate = null; - long t = udate.getTime(); - sqlDate = new java.sql.Timestamp(t); - return sqlDate; - - } - - public static void saveCompile(List compileList, Connection conn, List msgList) { - if (null != compileList && compileList.size() > 0) { - try { - String tabName = Configurations.getStringProperty("compileTabName", "CONFIG_COMPILE"); - String fieldName = Configurations.getStringProperty("compileFieldName", "COMPILE_ID"); - - conn.setAutoCommit(false); - PreparedStatement ps = conn.prepareStatement(getSqlStr(tabName, fieldName)); - for (ConfigCompile compile : compileList) { - setPsParams(fieldName.split(","),ps,compile); - ps.addBatch(); - } - -//zdx2017-10-25 -// sb.append( -// "insert into CONFIG_COMPILE (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,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate)"); -// conn.setAutoCommit(false); -// PreparedStatement ps = conn.prepareStatement(sb.toString()); -// for (ConfigCompile compile : compileList) { -// Object[] obj = new Object[] { compile.getCompileId(), compile.getService(), compile.getAction(), -// compile.getContType(), compile.getAttrType(), compile.getContLabel(), compile.getTaskId(), -// compile.getGuaranteeId(), compile.getAffAirId(), compile.getTopIcId(), -// compile.getDoBlackList(), compile.getDoLog(), compile.getEffectiveRange(), -// compile.getActiveSys(), compile.getConfigPercent(), compile.getConfigOption(), -// compile.getStartTime(), compile.getEndTime(), compile.getUserRegion(), compile.getIsValid(), -// compile.getGroupNum(), compile.getFatherCfgId(), compile.getOpTime() }; -// -// for (int x = 0; x < obj.length; x++) { -// if (x == 16) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getStartTime())); -// } else if (x == 17) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getEndTime())); -// } else if (x == 22) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getOpTime())); -// } else { -// ps.setObject(x + 1, obj[x]); -// } -// } -// ps.addBatch(); -// } - ps.executeBatch(); - } catch (Exception e) { - logger.error(e); - msgList.add(e); - } - } - } - - public static void saveGroup(List groupList, Connection conn, List msgList) { - - if (null != groupList && groupList.size() > 0) { - try { - StringBuffer sb = new StringBuffer(); - String tabName = Configurations.getStringProperty("groupTabName", "CONFIG_GROUP"); - String fieldName = Configurations.getStringProperty("groupFieldName", "ID"); - String groupSeqName = Configurations.getStringProperty("groupSeqName", "SEQ_CONFIG_GROUP"); - sb.append("insert into ").append(tabName); - sb.append("(").append(fieldName); - //是否包含更新时间字段 值为数据库当前时间 - if (Configurations.getBooleanProperty("hasLastUpdate", true)) { - sb.append(", LAST_UPDATE"); - } - sb.append(") values ( "); - conn.setAutoCommit(false); - String fieldNameObj [] = fieldName.split(","); - for (int i = 0; i < fieldNameObj.length; i++) { - //第一个字段必须是分组表主键 - if (i==0) { - sb.append(groupSeqName).append(".nextval"); - }else{ - sb.append("?"); - } - if (i+1-1) { -// name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2); -// } - - while (name.indexOf("_")>-1) { - name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2); - } - } - - Method method = group.getClass().getMethod("get"+name); - obj[i]= method.invoke(group); - } - for (int x = 1; x < obj.length; x++) { - - if (obj[x] instanceof Date) { - ps.setObject(x, utileDate2TimeStamp((Date) obj[x])); - }else { - ps.setObject(x , obj[x]); - } - } - ps.addBatch(); - } - ps.executeBatch(); - } catch (Exception e) { - logger.error(e); - e.printStackTrace(); - msgList.add(e); - } - } - - -//zdx2017-10-25 -// if (null != groupList && groupList.size() > 0) { -// try { -// StringBuffer sb = new StringBuffer(); -// sb.append( -// "insert into CONFIG_GROUP (ID,GROUP_ID, COMPILE_ID, IS_VALID, LAST_UPDATE, OP_TIME ) values ( seq_config_group.nextval, ?, ?, ?, sysdate, ?) "); -// conn.setAutoCommit(false); -// PreparedStatement ps = conn.prepareStatement(sb.toString()); -// for (ConfigGroupRelation group : groupList) { -// Object[] obj = new Object[] { group.getGroupId(), group.getCompileId(), group.getIsValid(), -// group.getOpTime() }; -// for (int x = 0; x < obj.length; x++) { -// if (x == 3) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(group.getOpTime())); -// } else { -// ps.setObject(x + 1, obj[x]); -// } -// } -// ps.addBatch(); -// } -// ps.executeBatch(); -// } catch (Exception e) { -// logger.error(e); -// msgList.add(e); -// } -// } - } - - public static void saveIPRegion(String name, List ipRegionList, Connection conn, - List msgList) { - - if (null != ipRegionList && ipRegionList.size() > 0) { - try { - String fieldName = Configurations.getStringProperty("ipRegionFieldName", "REGION_ID"); - conn.setAutoCommit(false); - PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName)); - for (IpRegion ipRegion : ipRegionList) { - setPsParams(fieldName.split(","),ps,ipRegion); - ps.addBatch(); - } - ps.executeBatch(); - } catch (Exception e) { - logger.error(e); - msgList.add(e); - } - } - - -//zdx2017-10-25 -// if (null != ipRegionList && ipRegionList.size() > 0) { -// try { -// StringBuffer sb = new StringBuffer(); -// sb.append("insert into "); -// sb.append(name); -// sb.append( -// "(REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP, DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) "); -// conn.setAutoCommit(false); -// PreparedStatement ps = conn.prepareStatement(sb.toString()); -// for (IpRegion ipRegion : ipRegionList) { -// Object[] obj = new Object[] { ipRegion.getRegionId(), ipRegion.getGroupId(), ipRegion.getAddrType(), -// ipRegion.getSrcIp(), ipRegion.getMaskSrcIp(), ipRegion.getSrcPort(), -// ipRegion.getMaskSrcPort(), ipRegion.getDstIp(), ipRegion.getMaskDstIp(), -// ipRegion.getDstPort(), ipRegion.getMaskDstPort(), ipRegion.getProtocol(), -// ipRegion.getDirection(), ipRegion.getIsValid(), ipRegion.getOpTime() -// -// }; -// for (int x = 0; x < obj.length; x++) { -// if (x == 14) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(ipRegion.getOpTime())); -// } else { -// ps.setObject(x + 1, obj[x]); -// } -// } -// ps.addBatch(); -// } -// ps.executeBatch(); -// } catch (Exception e) { -// logger.error(e); -// msgList.add(e); -// } -// } - } - - public static void saveNumRegion(String name, List numRegionList, Connection conn, - List msgList) { - if (null != numRegionList && numRegionList.size() > 0) { - try { - String fieldName = Configurations.getStringProperty("numRegionFieldName", "REGION_ID"); - conn.setAutoCommit(false); - PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName)); - for (NumRegion numRegion : numRegionList) { - setPsParams(fieldName.split(","),ps,numRegion); - ps.addBatch(); - } - - ps.executeBatch(); - } catch (Exception e) { - logger.error(e); - msgList.add(e); - } - } - - -//zdx2017-10-25 -// if (null != numRegionList && numRegionList.size() > 0) { -// try { -// StringBuffer sb = new StringBuffer(); -// sb.append("insert into "); -// sb.append(name); -// sb.append( -// " (REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE) values(?, ?, ?, ?, ?, ?, sysdate)"); -// conn.setAutoCommit(false); -// PreparedStatement ps = conn.prepareStatement(sb.toString()); -// for (NumRegion numRegion : numRegionList) { -// Object[] obj = new Object[] { numRegion.getRegionId(), numRegion.getGroupId(), -// numRegion.getLowBoundary(), numRegion.getUpBoundary(), numRegion.getIsValid(), -// numRegion.getOpTime() }; -// for (int x = 0; x < obj.length; x++) { -// if (x == 5) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(numRegion.getOpTime())); -// } else { -// ps.setObject(x + 1, obj[x]); -// } -// } -// ps.addBatch(); -// } -// ps.executeBatch(); -// } catch (Exception e) { -// logger.error(e); -// msgList.add(e); -// } -// } - } - - public static void saveStrongStrRegion(String name, List strRegionList, Connection conn, - List msgList) { - - if (null != strRegionList && strRegionList.size() > 0) { - try { - String fieldName = Configurations.getStringProperty("strongStrRegionFieldName", "REGION_ID"); - conn.setAutoCommit(false); - PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName)); - for (StrRegion strRegion : strRegionList) { - setPsParams(fieldName.split(","),ps,strRegion); - ps.addBatch(); - } - ps.executeBatch(); - } catch (Exception e) { - logger.error(e); - msgList.add(e); - } - } - - - - - - - -//zdx2017-10-25 -// if (null != strRegionList && strRegionList.size() > 0) { -// try { -// StringBuffer sb = new StringBuffer(); -// sb.append("insert into "); -// sb.append(name); -// sb.append( -// "(REGION_ID, GROUP_ID, DISTRICT, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) "); -// conn.setAutoCommit(false); -// PreparedStatement ps = conn.prepareStatement(sb.toString()); -// -// for (StrRegion strRegion : strRegionList) { -// Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), -// strRegion.getDistrict(), strRegion.getKeywords(), strRegion.getExprType(), -// strRegion.getMatchMethod(), strRegion.getIsHexbin(), strRegion.getIsValid(), -// strRegion.getOpTime() }; -// for (int x = 0; x < obj.length; x++) { -// if (x == 8) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime())); -// } else { -// ps.setObject(x + 1, obj[x]); -// } -// } -// ps.addBatch(); -// } -// ps.executeBatch(); -// } catch (Exception e) { -// logger.error(e); -// msgList.add(e); -// } -// } - } - - public static void saveStrRegion(String name, List strRegionList, Connection conn, - List msgList) { - - if (null != strRegionList && strRegionList.size() > 0) { - try { - String fieldName = Configurations.getStringProperty("strRegionFieldName", "REGION_ID"); - conn.setAutoCommit(false); - PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName)); - for (StrRegion strRegion : strRegionList) { - setPsParams(fieldName.split(","),ps,strRegion); - ps.addBatch(); - } - ps.executeBatch(); - } catch (Exception e) { - logger.error(e); - msgList.add(e); - } - } - -// -//zdx2017-10-25 -// if (null != strRegionList && strRegionList.size() > 0) { -// try { -// StringBuffer sb = new StringBuffer(); -// sb.append("insert into "); -// sb.append(name); -// sb.append( -// "(REGION_ID, GROUP_ID, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, sysdate) "); -// conn.setAutoCommit(false); -// PreparedStatement ps = conn.prepareStatement(sb.toString()); -// -// for (StrRegion strRegion : strRegionList) { -// Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), -// strRegion.getKeywords(), strRegion.getExprType(), strRegion.getMatchMethod(), -// strRegion.getIsHexbin(), strRegion.getIsValid(), strRegion.getOpTime() }; -// for (int x = 0; x < obj.length; x++) { -// if (x == 7) { -// ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime())); -// } else { -// ps.setObject(x + 1, obj[x]); -// } -// } -// ps.addBatch(); -// } -// ps.executeBatch(); -// } catch (Exception e) { -// logger.error(e); -// msgList.add(e); -// } -// } - } - - public static void saveDigestRegion(String name, List digestRegionList, Connection conn, - List 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 - * @author (zdx) - * @date 2017年10月26日 上午9:50:16 - * @param tabName - * @param fieldName - * @return - */ - private static String getSqlStr(String tabName,String fieldName){ - - StringBuffer sb = new StringBuffer(); - sb.append("insert into "); - sb.append(tabName); - sb.append("(").append(fieldName); - - //是否包含更新时间字段 值为数据库当前时间 - if (Configurations.getBooleanProperty("hasLastUpdate", true)) { - sb.append(", LAST_UPDATE"); - } - sb.append(") values ("); - - String fieldNameObj [] = fieldName.split(","); - for (int i = 0; i < fieldNameObj.length; i++) { - sb.append("?"); - if (i+1-1) { -// name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2); -// } - - while (name.indexOf("_")>-1) { - name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2); - } - } - - //需要特殊处理字段名 - if (name.equals("DoBlacklist")) { - name = "DoBlackList"; - }else if (name.equals("AffairId")) { - name = "AffAirId"; - }else if (name.equals("TopicId")) { - name = "TopIcId"; - } - - Method method = object.getClass().getMethod("get"+name); - obj[i]= method.invoke(object); - } - for (int x = 0; x < obj.length; x++) { - - if (obj[x] instanceof Date) { - ps.setObject(x + 1, utileDate2TimeStamp((Date) obj[x])); - }else { - ps.setObject(x + 1, obj[x]); - } - } - } - @Override - public void run() { - List msgList = ConfigSourcesService.getMsgList(); - synchronized (msgList) { - try { - if (null != compileList && compileList.size() > 0) { - saveCompile(compileList, conn, msgList); - } else if (null != groupList && groupList.size() > 0) { - saveGroup(groupList, conn, msgList); - } else if (null != ipRegionList && ipRegionList.size() > 0) { - saveIPRegion(tableName, ipRegionList, conn, msgList); - } else if (null != strRegionList && strRegionList.size() > 0) { - if (null != isStrongStr && isStrongStr) { - saveStrongStrRegion(tableName, strRegionList, conn, msgList); - } else { - saveStrRegion(tableName, strRegionList, conn, msgList); - } - } else if (null != numRegionList && numRegionList.size() > 0) { - saveNumRegion(tableName, numRegionList, conn, msgList); - } else if (null != digestRegionList && digestRegionList.size() > 0) { - saveDigestRegion(tableName, digestRegionList, conn, msgList); - } - latch.countDown(); - System.out.println("latchCount=======================" + latch.getCount()); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - -} diff --git a/src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java b/src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java deleted file mode 100644 index acd698e..0000000 --- a/src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java +++ /dev/null @@ -1,570 +0,0 @@ -package com.nis.web.service.restful; - -import java.lang.reflect.Method; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.util.Date; -import java.util.List; -import java.util.concurrent.CountDownLatch; - -import org.apache.log4j.Logger; - -import com.nis.domain.restful.ConfigCompile; -import com.nis.domain.restful.ConfigGroupRelation; -import com.nis.domain.restful.DigestRegion; -import com.nis.domain.restful.IpRegion; -import com.nis.domain.restful.NumRegion; -import com.nis.domain.restful.StrRegion; -import com.nis.util.Configurations; - -/** - * jdbc测试批量插入 - * - * @author RenKaiGe-Office - * - */ -public class UpdateCompileByJDBCThread implements Runnable { - private static Logger logger = Logger.getLogger(SaveCompileByJDBCThread.class); - private static Long start; - private CountDownLatch latch; - private String tableName; - private Connection conn; - private List compileList; - private List groupList; - private List ipRegionList; - private List numRegionList; - private List strRegionList; - private List digestRegionList; - private Date opTime; - - public UpdateCompileByJDBCThread() { - super(); - } - - public UpdateCompileByJDBCThread(Connection conn, CountDownLatch latch, Long start, Date opTime) { - super(); - this.conn = conn; - this.latch = latch; - this.start = start; - this.opTime = opTime; - } - - public UpdateCompileByJDBCThread(String tableName, Connection conn, CountDownLatch latch, Long start, Date opTime) { - super(); - this.tableName = tableName; - this.conn = conn; - this.latch = latch; - this.start = start; - this.opTime = opTime; - } - - public Date getOpTime() { - return opTime; - } - - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - public Long getStart() { - return start; - } - - public void setStart(Long start) { - this.start = start; - } - - public CountDownLatch getLatch() { - return latch; - } - - public void setLatch(CountDownLatch latch) { - this.latch = latch; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public Connection getConn() { - return conn; - } - - public void setConn(Connection conn) { - this.conn = conn; - } - - public List getCompileList() { - return compileList; - } - - public void setCompileList(List compileList) { - this.compileList = compileList; - } - - public List getGroupList() { - return groupList; - } - - public void setGroupList(List groupList) { - this.groupList = groupList; - } - - public List getIpRegionList() { - return ipRegionList; - } - - public void setIpRegionList(List ipRegionList) { - this.ipRegionList = ipRegionList; - } - - public List getNumRegionList() { - return numRegionList; - } - - public void setNumRegionList(List numRegionList) { - this.numRegionList = numRegionList; - } - - public List getStrRegionList() { - return strRegionList; - } - - public void setStrRegionList(List strRegionList) { - this.strRegionList = strRegionList; - } - - public List getDigestRegionList() { - return digestRegionList; - } - - public void setDigestRegionList(List digestRegionList) { - this.digestRegionList = digestRegionList; - } - - public synchronized static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) { - java.sql.Timestamp sqlDate = null; - long t = udate.getTime(); - sqlDate = new java.sql.Timestamp(t); - return sqlDate; - - } - - public static void updateCompile(List compileList, Connection conn, Date opTime, - List msgList) { - if (null != compileList && compileList.size() > 0) { - try { - StringBuffer sb = new StringBuffer(); - String tabName = Configurations.getStringProperty("compileTabName", "CONFIG_COMPILE"); - String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID"); - String condition= Configurations.getStringProperty("compileUpdateCondition", "COMPILE_ID"); - sb.append("update ").append(tabName).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 groupList, Connection conn, Date opTime, - List msgList) { - if (null != groupList && groupList.size() > 0) { - try { - StringBuffer sb = new StringBuffer(); - - String tabName = Configurations.getStringProperty("groupTabName", "CONFIG_GROUP"); - String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID"); - String condition = Configurations.getStringProperty("groupUpdateCondition", "GROUP_ID"); - - sb.append(" update ").append(tabName); - 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 ipRegionList, Connection conn, Date opTime, - List msgList) { - if (null != ipRegionList && ipRegionList.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 numRegionList, Connection conn, Date opTime, - List msgList) { - if (null != numRegionList && numRegionList.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 strRegionList, Connection conn, Date opTime, - List msgList) { - if (null != strRegionList && strRegionList.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 digestRegionList, Connection conn, Date opTime, - List 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-1) { -// name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2); -// } - - while (name.indexOf("_")>-1) { - name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2); - } - } - - //需要特殊处理字段名 - if (name.equals("DoBlacklist")) { - name = "DoBlackList"; - }else if (name.equals("AffairId")) { - name = "AffAirId"; - }else if (name.equals("TopicId")) { - name = "TopIcId"; - } - - Method method = object.getClass().getMethod("get"+name); - obj[i]= method.invoke(object); - } - for (int x = 0; x < obj.length; x++) { - - if (obj[x] instanceof Date) { - ps.setObject(x + 1, utileDate2TimeStamp((Date) obj[x])); - }else { - ps.setObject(x + 1, obj[x]); - } - } - } - - /** - * - * @Description: 根据compileId更新与之对应的group关系表的生效状态 - * @author (zdx) - * @date 2017年8月16日 上午9:46:44 - * @param compileList - * @param conn - * @param opTime - * @param msgList - */ - public static void updateGroupByCompileId(List compileList, Connection conn, Date opTime, - List msgList) { - if (null != compileList && compileList.size() > 0) { - try { - StringBuffer sb = new StringBuffer(); - String tabName = Configurations.getStringProperty("groupTabName", "CONFIG_GROUP"); - sb.append("update "+tabName+" set IS_VALID=?,op_time=?,LAST_UPDATE=sysdate where COMPILE_ID=? "); - conn.setAutoCommit(false); - PreparedStatement ps = conn.prepareStatement(sb.toString()); - for (ConfigCompile compile : compileList) { - Object[] obj = new Object[] { compile.getIsValid(), opTime,compile.getCompileId() }; - for (int x = 0; x < obj.length; x++) { - if (x == 1) { - ps.setTimestamp(x + 1, utileDate2TimeStamp(opTime)); - } else { - ps.setObject(x + 1, obj[x]); - } - } - ps.addBatch(); - } - ps.executeBatch(); - } catch (Exception e) { - logger.error(e); - msgList.add(e); - } - } - } - @Override - public void run() { - List msgList = ConfigSourcesService.getMsgList(); - synchronized (msgList) { - try { - if (null != compileList && compileList.size() > 0) { - updateCompile(compileList, conn, opTime, msgList); - } else if (null != groupList && groupList.size() > 0) { - updateGroup(groupList, conn, opTime, msgList); - } else if (null != ipRegionList && ipRegionList.size() > 0) { - updateIPRegion(tableName, ipRegionList, conn, opTime, msgList); - } else if (null != strRegionList && strRegionList.size() > 0) { - updateStrRegion(tableName, strRegionList, conn, opTime, msgList); - } else if (null != numRegionList && numRegionList.size() > 0) { - 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)){ - updateGroupByCompileId(compileList, conn, opTime, msgList); - } - - if((null !=compileList && compileList.size() > 0)&&(null != groupList && groupList.size()==0)){ - updateGroupByCompileId(compileList, conn, opTime, msgList); - } - latch.countDown(); - // System.out.println("latchCount=======================" + - // latch.getCount()); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - -} diff --git a/src/main/resources/commonSources/applicationConfig-parser.xml b/src/main/resources/commonSources/applicationConfig-parser.xml index 4577c39..6f66ac1 100644 --- a/src/main/resources/commonSources/applicationConfig-parser.xml +++ b/src/main/resources/commonSources/applicationConfig-parser.xml @@ -26,7 +26,7 @@ - +