app相关配置批量下发增加数据库状态更改
This commit is contained in:
@@ -80,6 +80,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
protected SpecificServiceCfgDao specificServiceCfgDao;
|
||||
@Autowired
|
||||
protected ConfigGroupInfoDao configGroupInfoDao;
|
||||
private boolean lastServiceTag = false;//标识是否是最后一个同步业务
|
||||
/**
|
||||
* 配置全量更新下发
|
||||
* @param request
|
||||
@@ -95,7 +96,13 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
if(cfg==null){
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceList();
|
||||
int lastService = 0;
|
||||
lastServiceTag = false;
|
||||
for(Map<String,Object> service:serviceList){
|
||||
lastService ++;
|
||||
if(lastService==serviceList.size()){
|
||||
lastServiceTag = true;
|
||||
}
|
||||
String tableName = service.get("tableName").toString();
|
||||
String serviceType = service.get("serviceType").toString();
|
||||
String className = service.get("className").toString();
|
||||
@@ -427,8 +434,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(hasData?null:"FINISHED"));
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
}
|
||||
return hasData;
|
||||
@@ -595,8 +602,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(hasData?null:"FINISHED"));
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
}
|
||||
return hasData;
|
||||
@@ -645,6 +652,11 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
for(AppPolicyCfg cfg:list){
|
||||
compileIds.add(cfg.getCompileId());
|
||||
}
|
||||
if(isUpdateCfg) {
|
||||
if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) {
|
||||
commonPolicyDao.auditCfgBatch( entity.getTableName(), entity,compileIds,null);
|
||||
}
|
||||
}
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
String tableName = m.get("tableName").toString();
|
||||
@@ -659,6 +671,11 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}else if("5".equals(m.get("cfgType"))){
|
||||
fileList.addAll(configSynchronizationDao.getFileDigestList(tableName, compileIds));
|
||||
}
|
||||
if(isUpdateCfg) {
|
||||
if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) {
|
||||
commonPolicyDao.auditCfgBatch( entity.getTableName(), entity,compileIds,null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号),compileIds.size()表示app策略本身有一个字符串域
|
||||
@@ -774,8 +791,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(hasData?null:"FINISHED"));
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
}
|
||||
return hasData;
|
||||
@@ -934,8 +951,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(hasData?null:"FINISHED"));
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
}
|
||||
return hasData;
|
||||
@@ -1143,8 +1160,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(hasData?null:"FINISHED"));
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1326,8 +1343,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(hasData?null:"FINISHED"));
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1444,8 +1461,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(hasData?null:"FINISHED"));
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1569,9 +1586,9 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
logger.info("配置批量下发响应信息:"+result.getMsg());
|
||||
}
|
||||
}else {
|
||||
FileUtils.writeToFile("/home/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
//调用服务接口同步回调类配置
|
||||
// JSONObject result = ConfigServiceUtil.configSync(json,2,entity.getServiceId(),entity.getTableName(),(hasData?null:"FINISHED"));
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,2,entity.getServiceId(),entity.getTableName(),(((!hasData)&&lastServiceTag)?"FINISHED":null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user