查询项目管理机构管理的最高行政区划级别下的全部行政区划的树状列表逻辑完善
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package com.fastbee.project.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONException;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
@ -22,7 +21,6 @@ import com.fastbee.project.domain.Project;
|
||||
import com.fastbee.project.domain.vo.ProjectLoginBaseInfo;
|
||||
import com.fastbee.project.mapper.ProjectMapper;
|
||||
import com.fastbee.project.service.IProjectService;
|
||||
|
||||
import com.fastbee.system.domain.SysDistrict;
|
||||
import com.fastbee.system.mapper.SysDeptMapper;
|
||||
import com.fastbee.system.mapper.SysDistrictMapper;
|
||||
@ -167,7 +165,7 @@ public class ProjectServiceImpl implements IProjectService
|
||||
throw new ServiceException("创建默认机构失败!");
|
||||
}
|
||||
// 新增机构关联系统账号
|
||||
// 添加管理员角色,给所有权限
|
||||
// 添加管理员角色,给基本权限
|
||||
SysDept sysDept = deptService.selectDeptById(100L);
|
||||
List<SysMenu> sysMenuList = sysMenuService.selectMenuList(new SysMenu(), sysDept.getDeptUserId());
|
||||
Long[] menuIdList = sysMenuList.stream().map(SysMenu::getMenuId)
|
||||
@ -225,7 +223,7 @@ public class ProjectServiceImpl implements IProjectService
|
||||
throw new ServiceException("项目行政区域代码不能为空!");
|
||||
}
|
||||
//判断行政区域代码json格式
|
||||
if(isNotValidJsonArray(project.getAdministrativeAreaCode())){
|
||||
if(!JsonStrUtil.isJsonArray(project.getAdministrativeAreaCode())){
|
||||
throw new ServiceException("项目行政区域代码多选列表非json数组!");
|
||||
}
|
||||
//项目省代码列表
|
||||
@ -240,7 +238,7 @@ public class ProjectServiceImpl implements IProjectService
|
||||
List<String> villageCodeList =new ArrayList<>();
|
||||
JSONArray administrativeAreaList = JSONUtil.parseArray(project.getAdministrativeAreaCode());
|
||||
administrativeAreaList.forEach(item->{
|
||||
if(isNotValidJsonArray(item.toString())){
|
||||
if(!JsonStrUtil.isJsonArray(item.toString())){
|
||||
throw new ServiceException("项目行政区域代码多选列表的元素非json数组!");
|
||||
}
|
||||
//单个行政区划代码列表
|
||||
@ -275,17 +273,7 @@ public class ProjectServiceImpl implements IProjectService
|
||||
project.setVillageCode(JSONUtil.toJsonStr(villageCodeList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证json对象是否是数组
|
||||
*/
|
||||
public boolean isNotValidJsonArray(String jsonStr) {
|
||||
try {
|
||||
JSONUtil.parseArray(jsonStr);
|
||||
} catch (JSONException e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
@ -557,6 +545,31 @@ public class ProjectServiceImpl implements IProjectService
|
||||
//镇级查村级别行政区划
|
||||
queryInLevelList.add(DepartmentAdministrationLevelConstant.VILLAGE);
|
||||
|
||||
}
|
||||
//村级管理机构
|
||||
else if(Objects.equals(sysDept.getAdministrativeLevel(), DepartmentAdministrationLevelConstant.VILLAGE)){
|
||||
//添加省代码
|
||||
if(JsonStrUtil.nonEmptyArray(sysDept.getProvinceCode())){
|
||||
queryInAdcodeList.add(JSONUtil.parseArray(sysDept.getProvinceCode()).get(0));
|
||||
}
|
||||
//添加市代码
|
||||
if(JsonStrUtil.nonEmptyArray(sysDept.getCityCode()))
|
||||
queryInAdcodeList.add(JSONUtil.parseArray(sysDept.getCityCode()).get(0));
|
||||
//添加县代码
|
||||
if(JsonStrUtil.nonEmptyArray(sysDept.getCountyCode())){
|
||||
queryInAdcodeList.add(JSONUtil.parseArray(sysDept.getCountyCode()).get(0));
|
||||
}
|
||||
//添加镇代码
|
||||
if(JsonStrUtil.nonEmptyArray(sysDept.getTownCode())){
|
||||
queryInAdcodeList.add(JSONUtil.parseArray(sysDept.getTownCode()).get(0));
|
||||
}
|
||||
//添加村代码
|
||||
if(JsonStrUtil.nonEmptyArray(sysDept.getVillageCode())){
|
||||
queryInAdcodeList.add(JSONUtil.parseArray(sysDept.getVillageCode()).get(0));
|
||||
}
|
||||
//村级查户级别行政区划
|
||||
queryInLevelList.add(DepartmentAdministrationLevelConstant.VILLAGE);
|
||||
|
||||
}
|
||||
//先根据项目机构行政管理级别查上层的行政区划信息
|
||||
List<SysDistrict> aboveSysDistrictList =new ArrayList<>();
|
||||
|
Reference in New Issue
Block a user