fix: 修复BUG

This commit is contained in:
zhangyanduan
2022-06-02 14:53:11 +08:00
parent 692907904d
commit d7da01a447
3 changed files with 41 additions and 40 deletions
@@ -167,12 +167,13 @@ public class DataSyncServiceImpl implements IDataSyncService {
}); });
} }
List<TsInstitution> allTsInstitutionList = tsInstitutionService.list(); List<TsInstitution> allTsInstitutionList = tsInstitutionService.list();
for (String s : res) {
List<TsInstitution> addTsInstitutionList = new ArrayList<>(); List<TsInstitution> addTsInstitutionList = new ArrayList<>();
List<TsInstitution> updateTsInstitutionList = new ArrayList<>(); List<TsInstitution> updateTsInstitutionList = new ArrayList<>();
List<TsInstitution> delTsInstitutionList = new ArrayList<>(); List<TsInstitution> delTsInstitutionList = new ArrayList<>();
Set<String> syncAllIdList = new HashSet<>(); Set<String> syncAllIdList = new HashSet<>();
for (String s : res) {
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results")); JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
if(jsonArray!=null){
jsonArray.forEach(object -> { jsonArray.forEach(object -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString()); JSONObject jsonObject = JSONObject.parseObject(object.toString());
TsInstitution tsInstitution=new TsInstitution(); TsInstitution tsInstitution=new TsInstitution();
@@ -191,6 +192,8 @@ public class DataSyncServiceImpl implements IDataSyncService {
syncAllIdList.add(tsInstitution.getId()); syncAllIdList.add(tsInstitution.getId());
} }
}); });
}
}
//遍历出来需要删除的数据 //遍历出来需要删除的数据
for(TsInstitution data :allTsInstitutionList){ for(TsInstitution data :allTsInstitutionList){
if(!syncAllIdList.contains(data.getId())){ if(!syncAllIdList.contains(data.getId())){
@@ -209,8 +212,6 @@ public class DataSyncServiceImpl implements IDataSyncService {
if(!delTsInstitutionList.isEmpty()){ if(!delTsInstitutionList.isEmpty()){
tsInstitutionService.updateBatchById(delTsInstitutionList); tsInstitutionService.updateBatchById(delTsInstitutionList);
} }
}
}catch(Exception e){ }catch(Exception e){
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -47,7 +47,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
if(sarMenuStandardNew.getDicId()!=null){ if(sarMenuStandardNew.getDicId()!=null){
queryWrapper.eq("DIC_ID", sarMenuStandardNew.getDicId()); queryWrapper.eq("DIC_ID", sarMenuStandardNew.getDicId());
} }
queryWrapper.in(null!=access,"ID",access); queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
queryWrapper.isNull("PARENT_ID"); queryWrapper.isNull("PARENT_ID");
queryWrapper.orderByAsc("DISPLAY_SEQ"); queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources=dao.selectList(queryWrapper); TsResources=dao.selectList(queryWrapper);
@@ -268,7 +268,7 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
} }
queryWrapper.isNull("PARENT_ID"); queryWrapper.isNull("PARENT_ID");
queryWrapper.eq("VALID_FLAG","0"); queryWrapper.eq("VALID_FLAG","0");
queryWrapper.in(null!=access,"ID",access); queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
queryWrapper.orderByAsc("DISPLAY_SEQ"); queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources=dao.selectList(queryWrapper); TsResources=dao.selectList(queryWrapper);