@@ -81,6 +81,7 @@ public class ConfigSynchronizationService extends BaseService{
@Autowired
@Autowired
protected ConfigGroupInfoDao configGroupInfoDao ;
protected ConfigGroupInfoDao configGroupInfoDao ;
private boolean lastServiceTag = false ; //标识是否是最后一个同步业务
private boolean lastServiceTag = false ; //标识是否是最后一个同步业务
private boolean isFinished = false ;
/**
/**
* 配置全量更新下发
* 配置全量更新下发
* @param request
* @param request
@@ -134,6 +135,15 @@ public class ConfigSynchronizationService extends BaseService{
Page < BaseCfg > page = new Page < BaseCfg > ( request , response , Constants . MAAT_JSON_SEND_SIZE , " a " ) ;
Page < BaseCfg > page = new Page < BaseCfg > ( request , response , Constants . MAAT_JSON_SEND_SIZE , " a " ) ;
handleCallbackData ( className , page , entity , request , response , false ) ;
handleCallbackData ( className , page , entity , request , response , false ) ;
}
}
if ( ! isFinished & & lastServiceTag ) { //如果业务没有配置数据,并且为最后一个业务,需要发送给服务接口一个结束标识
String json = " " ;
if ( " 1 " . equals ( serviceType ) ) {
json = " {} " ;
} else {
json = " [] " ;
}
JSONObject result = ConfigServiceUtil . configSync ( json , Integer . parseInt ( serviceType ) , entity . getServiceId ( ) , entity . getTableName ( ) , " FINISHED " ) ;
}
}
}
long end = System . currentTimeMillis ( ) ;
long end = System . currentTimeMillis ( ) ;
logger . info ( " 本次配置全量同步,开始时间: " + start
logger . info ( " 本次配置全量同步,开始时间: " + start
@@ -434,8 +444,9 @@ public class ConfigSynchronizationService extends BaseService{
}
}
} else {
} else {
//调用服务接口配置全量更新
//调用服务接口配置全量更新
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
JSONObject result = ConfigServiceUtil . configSync ( json , 1 , entity . getServiceId ( ) , null , isFinished ? " FINISHED " : null ) ;
}
}
}
}
return hasData ;
return hasData ;
@@ -482,6 +493,9 @@ public class ConfigSynchronizationService extends BaseService{
List < Integer > compileIds = new ArrayList ( ) ;
List < Integer > compileIds = new ArrayList ( ) ;
for ( FileDigestCfg cfg : list ) {
for ( FileDigestCfg cfg : list ) {
compileIds . add ( cfg . getCompileId ( ) ) ;
compileIds . add ( cfg . getCompileId ( ) ) ;
if ( ! StringUtil . isEmpty ( cfg . getCfdsLevel ( ) ) & & ( cfg . getCfdsLevel ( ) > 10 ) ) {
cfg . setCfdsLevel ( ( int ) ( cfg . getCfdsLevel ( ) / 10 ) ) ; //文件摘要置信度界面显示为70,80,90,100, 下发为7,8,9,10
}
fileList . add ( cfg ) ;
fileList . add ( cfg ) ;
}
}
@@ -602,8 +616,9 @@ public class ConfigSynchronizationService extends BaseService{
}
}
} else {
} else {
//调用服务接口配置全量更新
//调用服务接口配置全量更新
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
JSONObject result = ConfigServiceUtil . configSync ( json , 1 , entity . getServiceId ( ) , null , isFinished ? " FINISHED " : null ) ;
}
}
}
}
return hasData ;
return hasData ;
@@ -791,8 +806,9 @@ public class ConfigSynchronizationService extends BaseService{
}
}
} else {
} else {
//调用服务接口配置全量更新
//调用服务接口配置全量更新
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
JSONObject result = ConfigServiceUtil . configSync ( json , 1 , entity . getServiceId ( ) , null , isFinished ? " FINISHED " : null ) ;
}
}
}
}
return hasData ;
return hasData ;
@@ -951,8 +967,9 @@ public class ConfigSynchronizationService extends BaseService{
}
}
} else {
} else {
//调用服务接口配置全量更新
//调用服务接口配置全量更新
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
JSONObject result = ConfigServiceUtil . configSync ( json , 1 , entity . getServiceId ( ) , null , isFinished ? " FINISHED " : null ) ;
}
}
}
}
return hasData ;
return hasData ;
@@ -1160,8 +1177,9 @@ public class ConfigSynchronizationService extends BaseService{
}
}
} else {
} else {
//调用服务接口配置全量更新
//调用服务接口配置全量更新
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
JSONObject result = ConfigServiceUtil . configSync ( json , 1 , entity . getServiceId ( ) , null , isFinished ? " FINISHED " : null ) ;
}
}
}
}
@@ -1343,8 +1361,9 @@ public class ConfigSynchronizationService extends BaseService{
}
}
} else {
} else {
//调用服务接口配置全量更新
//调用服务接口配置全量更新
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
JSONObject result = ConfigServiceUtil . configSync ( json , 1 , entity . getServiceId ( ) , null , isFinished ? " FINISHED " : null ) ;
}
}
}
}
@@ -1461,8 +1480,9 @@ public class ConfigSynchronizationService extends BaseService{
}
}
} else {
} else {
//调用服务接口配置全量更新
//调用服务接口配置全量更新
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
JSONObject result = ConfigServiceUtil . configSync ( json , 1 , entity . getServiceId ( ) , null , isFinished ? " FINISHED " : null ) ;
}
}
}
}
@@ -1535,6 +1555,10 @@ public class ConfigSynchronizationService extends BaseService{
} else {
} else {
if ( className . equals ( " AvFileSampleCfg " ) ) {
if ( className . equals ( " AvFileSampleCfg " ) ) {
list = configSynchronizationDao . getAvFileCfgList ( entity ) ;
list = configSynchronizationDao . getAvFileCfgList ( entity ) ;
newList . addAll ( list ) ;
} else if ( className . equals ( " AvSignSampleCfg " ) ) {
list = configSynchronizationDao . getAvSignCfgList ( entity ) ;
newList . addAll ( list ) ;
} else if ( className . equals ( " PxyObjKeyring " ) ) {
} else if ( className . equals ( " PxyObjKeyring " ) ) {
list = configSynchronizationDao . getPxyObjKeyringCfgList ( entity ) ;
list = configSynchronizationDao . getPxyObjKeyringCfgList ( entity ) ;
for ( int i = 0 ; i < list . size ( ) ; i + + ) {
for ( int i = 0 ; i < list . size ( ) ; i + + ) {
@@ -1591,7 +1615,8 @@ 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 ) & & lastServiceTag ) ? " FINISHED " : null ) ) ;
isFinished = ( ( ! hasData ) & & lastServiceTag ) ? true : false ;
JSONObject result = ConfigServiceUtil . configSync ( json , 2 , entity . getServiceId ( ) , entity . getTableName ( ) , isFinished ? " FINISHED " : null ) ;
}
}
}
}