fix: 修复BUG
This commit is contained in:
+39
-38
@@ -167,49 +167,50 @@ public class DataSyncServiceImpl implements IDataSyncService {
|
||||
});
|
||||
}
|
||||
List<TsInstitution> allTsInstitutionList = tsInstitutionService.list();
|
||||
List<TsInstitution> addTsInstitutionList = new ArrayList<>();
|
||||
List<TsInstitution> updateTsInstitutionList = new ArrayList<>();
|
||||
List<TsInstitution> delTsInstitutionList = new ArrayList<>();
|
||||
Set<String> syncAllIdList = new HashSet<>();
|
||||
for (String s : res) {
|
||||
List<TsInstitution> addTsInstitutionList = new ArrayList<>();
|
||||
List<TsInstitution> updateTsInstitutionList = new ArrayList<>();
|
||||
List<TsInstitution> delTsInstitutionList = new ArrayList<>();
|
||||
Set<String> syncAllIdList = new HashSet<>();
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
||||
jsonArray.forEach(object -> {
|
||||
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
||||
TsInstitution tsInstitution=new TsInstitution();
|
||||
tsInstitution.setId(jsonObject.getString("orgNumber"));
|
||||
tsInstitution.setName(jsonObject.getString("orgName"));
|
||||
tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0");
|
||||
tsInstitution.setParentId(jsonObject.getString("parentOrgNumber"));
|
||||
//部门为"null"的数据不保存
|
||||
if (!"null".equals(jsonObject.getString("orgName"))){
|
||||
TsInstitution institution = tsInstitutionService.getById(tsInstitution.getId());
|
||||
if(institution!=null){
|
||||
updateTsInstitutionList.add(tsInstitution);
|
||||
}else{
|
||||
addTsInstitutionList.add(tsInstitution);
|
||||
if(jsonArray!=null){
|
||||
jsonArray.forEach(object -> {
|
||||
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
||||
TsInstitution tsInstitution=new TsInstitution();
|
||||
tsInstitution.setId(jsonObject.getString("orgNumber"));
|
||||
tsInstitution.setName(jsonObject.getString("orgName"));
|
||||
tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0");
|
||||
tsInstitution.setParentId(jsonObject.getString("parentOrgNumber"));
|
||||
//部门为"null"的数据不保存
|
||||
if (!"null".equals(jsonObject.getString("orgName"))){
|
||||
TsInstitution institution = tsInstitutionService.getById(tsInstitution.getId());
|
||||
if(institution!=null){
|
||||
updateTsInstitutionList.add(tsInstitution);
|
||||
}else{
|
||||
addTsInstitutionList.add(tsInstitution);
|
||||
}
|
||||
syncAllIdList.add(tsInstitution.getId());
|
||||
}
|
||||
syncAllIdList.add(tsInstitution.getId());
|
||||
}
|
||||
});
|
||||
//遍历出来需要删除的数据
|
||||
for(TsInstitution data :allTsInstitutionList){
|
||||
if(!syncAllIdList.contains(data.getId())){
|
||||
delTsInstitutionList.add(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
//需要新增的数据
|
||||
if(!addTsInstitutionList.isEmpty()){
|
||||
tsInstitutionService.saveBatch(addTsInstitutionList);
|
||||
}
|
||||
//遍历出来需要删除的数据
|
||||
for(TsInstitution data :allTsInstitutionList){
|
||||
if(!syncAllIdList.contains(data.getId())){
|
||||
delTsInstitutionList.add(data);
|
||||
}
|
||||
//需要更新的数据
|
||||
if(!updateTsInstitutionList.isEmpty()){
|
||||
tsInstitutionService.updateBatchById(updateTsInstitutionList);
|
||||
}
|
||||
//需要删除的数据
|
||||
if(!delTsInstitutionList.isEmpty()){
|
||||
tsInstitutionService.updateBatchById(delTsInstitutionList);
|
||||
}
|
||||
|
||||
}
|
||||
//需要新增的数据
|
||||
if(!addTsInstitutionList.isEmpty()){
|
||||
tsInstitutionService.saveBatch(addTsInstitutionList);
|
||||
}
|
||||
//需要更新的数据
|
||||
if(!updateTsInstitutionList.isEmpty()){
|
||||
tsInstitutionService.updateBatchById(updateTsInstitutionList);
|
||||
}
|
||||
//需要删除的数据
|
||||
if(!delTsInstitutionList.isEmpty()){
|
||||
tsInstitutionService.updateBatchById(delTsInstitutionList);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error(e.getMessage(),e);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
if(sarMenuStandardNew.getDicId()!=null){
|
||||
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.orderByAsc("DISPLAY_SEQ");
|
||||
TsResources=dao.selectList(queryWrapper);
|
||||
|
||||
+1
-1
@@ -268,7 +268,7 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
|
||||
}
|
||||
queryWrapper.isNull("PARENT_ID");
|
||||
queryWrapper.eq("VALID_FLAG","0");
|
||||
queryWrapper.in(null!=access,"ID",access);
|
||||
queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
|
||||
queryWrapper.orderByAsc("DISPLAY_SEQ");
|
||||
TsResources=dao.selectList(queryWrapper);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user