修改全量同步finished标识逻辑,最后一个业务的最后一批数据才标识finished
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();
|
||||||
@@ -428,7 +435,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
//调用服务接口配置全量更新
|
//调用服务接口配置全量更新
|
||||||
FileUtils.writeToFile("/home/ceiec/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;
|
||||||
@@ -596,7 +603,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
//调用服务接口配置全量更新
|
//调用服务接口配置全量更新
|
||||||
FileUtils.writeToFile("/home/ceiec/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;
|
||||||
@@ -775,7 +782,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
//调用服务接口配置全量更新
|
//调用服务接口配置全量更新
|
||||||
FileUtils.writeToFile("/home/ceiec/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;
|
||||||
@@ -935,7 +942,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
//调用服务接口配置全量更新
|
//调用服务接口配置全量更新
|
||||||
FileUtils.writeToFile("/home/ceiec/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;
|
||||||
@@ -1144,7 +1151,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
//调用服务接口配置全量更新
|
//调用服务接口配置全量更新
|
||||||
FileUtils.writeToFile("/home/ceiec/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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1327,7 +1334,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
//调用服务接口配置全量更新
|
//调用服务接口配置全量更新
|
||||||
FileUtils.writeToFile("/home/ceiec/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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1445,7 +1452,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
//调用服务接口配置全量更新
|
//调用服务接口配置全量更新
|
||||||
FileUtils.writeToFile("/home/ceiec/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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1571,7 +1578,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
}else {
|
}else {
|
||||||
FileUtils.writeToFile("/home/ceiec/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