Browse Source

[feat]提交:修改部门区域解析逻辑③

pull/7/head
杨威 2 weeks ago
parent
commit
e965a29259
  1. 42
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java

42
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java

@ -257,37 +257,26 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
SysDepartBoundary businessDepartBoundary = new SysDepartBoundary();
businessDepartBoundary.setBoundary(item);
//判断是否存在表中,在表中更新部门区域中的部门id信息
if (ObjectUtil.isNotEmpty(namePathMap.get(divisionName))){
Map<String, Object> objectMap = namePathMap.get(divisionName).get(0);
businessDepartBoundary.setDeptName(objectMap.get("deptName") + "");
businessDepartBoundary.setDeptId(Long.valueOf(objectMap.get("deptId") + ""));
businessDepartBoundary.setNamePath(objectMap.get("namePath") + "");
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
}else {
//如果不存在在部门表中则添加
SysDeptBo sysDeptBo = new SysDeptBo();
sysDeptBo.setParentId(parentId);
sysDeptBo.setDeptName(param.getAdminDivisionName());
SysDept sysDept = deptService.addBoundaryDept(sysDeptBo);
createBoundary(businessDepartBoundary,namePathMap,divisionName,areaType,parentId);
List<Map<String,Object>> deptNamePath = deptService.getNamePathList(sysDept.getDeptId());
businessDepartBoundary.setDeptName(sysDept.getDeptName());
businessDepartBoundary.setDeptId(sysDept.getDeptId());
businessDepartBoundary.setNamePath(deptNamePath.getFirst().get("namePath").toString());
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
}
});
}else {
SysDepartBoundary businessDepartBoundary = new SysDepartBoundary();
businessDepartBoundary.setBoundary(param.getLandCategories());
createBoundary(businessDepartBoundary,namePathMap,divisionName,areaType,parentId);
resultList.add(businessDepartBoundary);
}
});
return resultList;
}
private void createBoundary(SysDepartBoundary businessDepartBoundary, Map<String, List<Map<String, Object>>> namePathMap, String divisionName, Integer areaType, Long parentId) {
//判断是否存在表中,在表中更新部门区域中的部门id信息
if (ObjectUtil.isNotEmpty(namePathMap.get(divisionName))){
Map<String, Object> objectMap = namePathMap.get(divisionName).get(0);
@ -295,12 +284,11 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
businessDepartBoundary.setDeptId(Long.valueOf(objectMap.get("deptId") + ""));
businessDepartBoundary.setNamePath(objectMap.get("namePath") + "");
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
}else {
//如果不存在在部门表中则添加
SysDeptBo sysDeptBo = new SysDeptBo();
sysDeptBo.setParentId(parentId);
sysDeptBo.setDeptName(param.getAdminDivisionName());
sysDeptBo.setDeptName(divisionName);
SysDept sysDept = deptService.addBoundaryDept(sysDeptBo);
@ -310,13 +298,9 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
businessDepartBoundary.setDeptId(sysDept.getDeptId());
businessDepartBoundary.setNamePath(deptNamePath.getFirst().get("namePath").toString());
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
}
}
});
return resultList;
}
public static List<String> convertStringToList(String str) {
// 去除首尾的 "[" 和 "]"

Loading…
Cancel
Save