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