fix: 修复组织机构及用户数据在同步时接口报错导致用户数据无法正常处理,直接将数据库中的数据全部删除的BUG

This commit is contained in:
zhangyanduan
2022-07-28 11:56:23 +08:00
parent 5075cd2daa
commit cbab7bbb89
@@ -47,6 +47,7 @@ public class DataSyncServiceImpl implements IDataSyncService {
try{ try{
SyncUserService syncUserService = new SyncUserService(); SyncUserService syncUserService = new SyncUserService();
List<String> res = syncUserService.syncFotonUser(); List<String> res = syncUserService.syncFotonUser();
if(res!=null && !res.isEmpty()){
//存放岗位信息 //存放岗位信息
Map<String, String> positionMap = new HashMap<>(); Map<String, String> positionMap = new HashMap<>();
TsPosition position = new TsPosition(); TsPosition position = new TsPosition();
@@ -131,6 +132,9 @@ public class DataSyncServiceImpl implements IDataSyncService {
logger.debug("本次更新的用户为:"+JSONObject.toJSONString(upUserList)); logger.debug("本次更新的用户为:"+JSONObject.toJSONString(upUserList));
tsUserService.updateBatchById(upUserList); tsUserService.updateBatchById(upUserList);
} }
}else{
logger.info("本次获取用户的数据为空,原因有2种:1、没有同步数据 2、请求接口报错");
}
}catch(Exception e){ }catch(Exception e){
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -145,6 +149,7 @@ public class DataSyncServiceImpl implements IDataSyncService {
try{ try{
SyncUserService syncUserService = new SyncUserService(); SyncUserService syncUserService = new SyncUserService();
List<String> res = syncUserService.syncFotonOrg(); List<String> res = syncUserService.syncFotonOrg();
if(res!=null && !res.isEmpty()){
//获取到所有用户数据 //获取到所有用户数据
List<String> strings=new ArrayList<>(); List<String> strings=new ArrayList<>();
//tsInstitutionService.clearData(); //tsInstitutionService.clearData();
@@ -208,6 +213,9 @@ public class DataSyncServiceImpl implements IDataSyncService {
} }
tsInstitutionService.removeByIds(delIdList); tsInstitutionService.removeByIds(delIdList);
} }
}else{
logger.info("本次获取组织机构的数据为空,原因有2种:1、没有同步数据 2、请求接口报错");
}
}catch(Exception e){ }catch(Exception e){
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();