(1)maat配置转换后台提交

(2)maat-tools jar包提交
(3)maat相关接口url写入配置文件
This commit is contained in:
wangxin
2018-03-27 14:42:22 +08:00
parent 8faf83ba36
commit d50b17da90
9 changed files with 30 additions and 28 deletions

Binary file not shown.

View File

@@ -19,7 +19,6 @@ import com.google.gson.annotations.SerializedName;
* @version V1.0 * @version V1.0
*/ */
public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
protected String tableName;
/** /**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么 * @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
* *
@@ -33,12 +32,14 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
@Expose @Expose
@SerializedName("district") @SerializedName("district")
protected String district ; protected String district ;
protected String districtShowName;
/** /**
* 关键字 * 关键字
*/ */
@Expose @Expose
@SerializedName("keywords") @SerializedName("keywords")
protected String keywords; protected String keywords;
protected String keywordsShowName;
/** /**
* 表达式类型 * 表达式类型
*/ */
@@ -140,19 +141,4 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
this.isHexbin = 0 ; this.isHexbin = 0 ;
this.matchMethod=3; this.matchMethod=3;
} }
/**
* tableName
* @return tableName
*/
public String getTableName() {
return tableName;
}
/**
* @param tableName the tableName to set
*/
public void setTableName(String tableName) {
this.tableName = tableName;
}
} }

View File

@@ -9,15 +9,11 @@
package com.nis.domain.maat; package com.nis.domain.maat;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.nis.domain.configuration.AreaIpCfg; import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.IpPortCfg;
/** /**
* @ClassName: ToMaatBean.java * @ClassName: ToMaatBean.java
@@ -37,7 +33,7 @@ public class ToMaatBean implements Serializable{
private static final long serialVersionUID = 5123156423588372849L; private static final long serialVersionUID = 5123156423588372849L;
@Expose @Expose
@SerializedName("serviceCfg") @SerializedName("serviceCfg")
private List<List<MaatCfg>> serviceCfg; private List<MaatCfg> serviceCfg;
@Expose @Expose
@SerializedName("areaCfg") @SerializedName("areaCfg")
private List<AreaIpCfg> areaCfg; private List<AreaIpCfg> areaCfg;
@@ -78,13 +74,13 @@ public class ToMaatBean implements Serializable{
* @return serviceCfg * @return serviceCfg
*/ */
public List<List<MaatCfg>> getServiceCfg() { public List<MaatCfg> getServiceCfg() {
return serviceCfg; return serviceCfg;
} }
/** /**
* @param serviceCfg the serviceCfg to set * @param serviceCfg the serviceCfg to set
*/ */
public void setServiceCfg(List<List<MaatCfg>> serviceCfg) { public void setServiceCfg(List<MaatCfg> serviceCfg) {
this.serviceCfg = serviceCfg; this.serviceCfg = serviceCfg;
} }
/** /**

View File

@@ -236,6 +236,7 @@ public class ComplexStringCfgController extends BaseController{
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1 }else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1
cfg.setIsValid(Constants.VALID_YES); cfg.setIsValid(Constants.VALID_YES);
bean.setIsValid(Constants.VALID_YES); bean.setIsValid(Constants.VALID_YES);
bean.setMaatTable(maatTable);
} }
int result=complexStringCfgService.auditStringCfg(bean,cfg); int result=complexStringCfgService.auditStringCfg(bean,cfg);
if(result!=0){ if(result!=0){

View File

@@ -307,6 +307,7 @@ public class IpCfgController extends BaseController{
}else if(ipCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1 }else if(ipCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1
ipCfg.setIsValid(Constants.VALID_YES); ipCfg.setIsValid(Constants.VALID_YES);
bean.setIsValid(Constants.VALID_YES); bean.setIsValid(Constants.VALID_YES);
bean.setMaatTable(maatTable);
} }
int result=ipCfgService.auditIpCfg(bean,ipCfg); int result=ipCfgService.auditIpCfg(bean,ipCfg);
if(result!=0){ if(result!=0){

View File

@@ -199,6 +199,7 @@ public class NumCfgController extends BaseController{
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1 }else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1
cfg.setIsValid(Constants.VALID_YES); cfg.setIsValid(Constants.VALID_YES);
bean.setIsValid(Constants.VALID_YES); bean.setIsValid(Constants.VALID_YES);
bean.setMaatTable(serviceConfigInfo.getMaatTable());
} }
int result=numCfgService.auditNumCfg(bean,cfg); int result=numCfgService.auditNumCfg(bean,cfg);
if(result!=0){ if(result!=0){

View File

@@ -243,6 +243,7 @@ public class StringCfgController extends BaseController{
}else if(stringCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1 }else if(stringCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1
stringCfg.setIsValid(Constants.VALID_YES); stringCfg.setIsValid(Constants.VALID_YES);
bean.setIsValid(Constants.VALID_YES); bean.setIsValid(Constants.VALID_YES);
bean.setMaatTable(maatTable);
} }
int result=stringCfgService.auditStringCfg(bean,stringCfg); int result=stringCfgService.auditStringCfg(bean,stringCfg);
if(result!=0){ if(result!=0){

View File

@@ -207,7 +207,6 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
throw new RuntimeException("转换出错,配置为空"); throw new RuntimeException("转换出错,配置为空");
} }
Gson gson=new GsonBuilder().disableHtmlEscaping() Gson gson=new GsonBuilder().disableHtmlEscaping()
.setDateFormat("yyyy-MM-dd HH:mm:ss")
/*.setPrettyPrinting().serializeNulls()*/ /*.setPrettyPrinting().serializeNulls()*/
.excludeFieldsWithoutExposeAnnotation() .excludeFieldsWithoutExposeAnnotation()
.create(); .create();
@@ -224,6 +223,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
} }
bean.setCompileId(c.getCompileId()); bean.setCompileId(c.getCompileId());
bean.setMaatTable(c.getMaatTable()); bean.setMaatTable(c.getMaatTable());
toMaatUnAuditBean.getServiceCfg().add(bean);
} }
String json=gson.toJson(toMaatUnAuditBean); String json=gson.toJson(toMaatUnAuditBean);
logger.info("to maat json:"+json); logger.info("to maat json:"+json);
@@ -232,7 +232,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
}else{ }else{
int compileId=0; int compileId=0;
ToMaatBean toMaatBean=new ToMaatBean(); ToMaatBean toMaatBean=new ToMaatBean();
toMaatBean.setServiceCfg(new ArrayList<List<MaatCfg>>()); toMaatBean.setServiceCfg(new ArrayList<MaatCfg>());
MaatCfg maatCfg=new MaatCfg(); MaatCfg maatCfg=new MaatCfg();
for(BaseCfg c:cfg){ for(BaseCfg c:cfg){
if(c instanceof BaseIpCfg){ if(c instanceof BaseIpCfg){
@@ -279,10 +279,10 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
} }
if(areaCfg!=null){ if(areaCfg!=null){
toMaatBean.setAreaCfg(areaCfg); toMaatBean.setAreaCfg(areaCfg);
}else{
toMaatBean.setAreaCfg(new ArrayList<AreaIpCfg>());
} }
List<MaatCfg> serviceCfg=new ArrayList<>(); toMaatBean.getServiceCfg().add(maatCfg);
serviceCfg.add(maatCfg);
toMaatBean.getServiceCfg().add(serviceCfg);
BaseCfg baseCfg=(BaseCfg)cfg[0]; BaseCfg baseCfg=(BaseCfg)cfg[0];
if(compileId==0){ if(compileId==0){
throw new RuntimeException("转换出错,未获取到正确的compileId"); throw new RuntimeException("转换出错,未获取到正确的compileId");

View File

@@ -35,3 +35,19 @@ hasLastUpdate=true
#配置状态更新的字段 #配置状态更新的字段
updateFields=IS_VALID,OP_TIME updateFields=IS_VALID,OP_TIME
#maat configurations
#从后台服务获取compileid的url地址
get_compileId_url=http://10.0.6.30:8080/maatRest/service/cfg/v1/getCompileId
#从后台服务获取groupid的url地址
get_groupId_url=http://10.0.6.30:8080/maatRest/service/cfg/v1/getCompileId
#从后台服务获取regionid的url地址
get_regionId_url=http://10.0.6.30:8080/maatRest/service/cfg/v1/getCompileId
#http连接超时时间
httpConnectTimeout=5000
#http读超时时间
readTimeout=5000
#向后台提交配置的地址(post形式提交)
saveConfigUrl=http://10.0.6.30:8080/maatRest/service/cfg/v1/configSources
#将配置置为失效的接口地址
invalidConfigUrl=http://10.0.6.30:8080/maatRest/service/cfg/v1/configSources