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> 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) {
|
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 jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
||||||
jsonArray.forEach(object -> {
|
if(jsonArray!=null){
|
||||||
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
jsonArray.forEach(object -> {
|
||||||
TsInstitution tsInstitution=new TsInstitution();
|
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
||||||
tsInstitution.setId(jsonObject.getString("orgNumber"));
|
TsInstitution tsInstitution=new TsInstitution();
|
||||||
tsInstitution.setName(jsonObject.getString("orgName"));
|
tsInstitution.setId(jsonObject.getString("orgNumber"));
|
||||||
tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0");
|
tsInstitution.setName(jsonObject.getString("orgName"));
|
||||||
tsInstitution.setParentId(jsonObject.getString("parentOrgNumber"));
|
tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0");
|
||||||
//部门为"null"的数据不保存
|
tsInstitution.setParentId(jsonObject.getString("parentOrgNumber"));
|
||||||
if (!"null".equals(jsonObject.getString("orgName"))){
|
//部门为"null"的数据不保存
|
||||||
TsInstitution institution = tsInstitutionService.getById(tsInstitution.getId());
|
if (!"null".equals(jsonObject.getString("orgName"))){
|
||||||
if(institution!=null){
|
TsInstitution institution = tsInstitutionService.getById(tsInstitution.getId());
|
||||||
updateTsInstitutionList.add(tsInstitution);
|
if(institution!=null){
|
||||||
}else{
|
updateTsInstitutionList.add(tsInstitution);
|
||||||
addTsInstitutionList.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(!addTsInstitutionList.isEmpty()){
|
||||||
}
|
tsInstitutionService.saveBatch(addTsInstitutionList);
|
||||||
//需要删除的数据
|
}
|
||||||
if(!delTsInstitutionList.isEmpty()){
|
//需要更新的数据
|
||||||
tsInstitutionService.updateBatchById(delTsInstitutionList);
|
if(!updateTsInstitutionList.isEmpty()){
|
||||||
}
|
tsInstitutionService.updateBatchById(updateTsInstitutionList);
|
||||||
|
}
|
||||||
|
//需要删除的数据
|
||||||
|
if(!delTsInstitutionList.isEmpty()){
|
||||||
|
tsInstitutionService.updateBatchById(delTsInstitutionList);
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error(e.getMessage(),e);
|
logger.error(e.getMessage(),e);
|
||||||
|
|||||||
+1
-1
@@ -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);
|
||||||
|
|||||||
+1
-1
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user