新增根据行政区划代码查询项目列表接口。

This commit is contained in:
mi9688
2024-12-11 16:59:20 +08:00
parent 679b651706
commit 73042e17af
6 changed files with 77 additions and 9 deletions

View File

@ -78,4 +78,10 @@ public interface IProjectService
List<SysDistrict> getProjectAreaTreeAll(Long deptId, Integer startLevel);
/**
* 根据行政区划代码获取项目列表
* @param areaCode
* @return
*/
List<Project> getProjectListByArea(Long areaCode);
}

View File

@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
/**
@ -178,7 +179,6 @@ public class ProjectServiceImpl implements IProjectService
.toArray(Long[]::new);
//根据项目类型过滤菜单
if (Objects.equals(project.getType(),ProjectTypeConstant.WATER)) {
List<Long> menuList=Arrays.asList(menuIdList);
menuIdList = menuList.stream().filter(this::waterMenuFilter).toArray(Long[]::new);
@ -257,8 +257,6 @@ public class ProjectServiceImpl implements IProjectService
}
/**
* 解析项目行政区划信息
* @param project 项目
@ -309,9 +307,7 @@ public class ProjectServiceImpl implements IProjectService
//保存项目村代码列表
villageCodeList.add(administrativeArea.get(4).toString());
}
});
//设置项目省、市、县、镇、村行政区划代码列表
project.setProvinceCode(JSONUtil.toJsonStr(provincialCodeList));
project.setCityCode(JSONUtil.toJsonStr(cityCodeList));
@ -640,6 +636,35 @@ public class ProjectServiceImpl implements IProjectService
return Collections.singletonList(sysDistricts.get(0));
}
@Override
public List<Project> getProjectListByArea(Long areaCode) {
//查询全部项目列表
List<Project> projectAllList = new LambdaQueryChainWrapper<>(projectMapper)
.select(Project::getId, Project::getProjectName, Project::getAdministrativeAreaCode)
.list();
//根据行政区划过滤
System.err.println("项目行政区划代码列表:"+projectAllList.size());
//过滤后项目列表
List<Project> projectFilterList =new ArrayList<>();
for (Project project : projectAllList) {
String administrativeAreaCode = project.getAdministrativeAreaCode();
if(StringUtils.isNotBlank(administrativeAreaCode)){
JSONArray areaCodeArrays = JSONUtil.parseArray(administrativeAreaCode);
if(!areaCodeArrays.isEmpty()){
JSONArray areaCodeArray = JSONUtil.parseArray(areaCodeArrays.get(0));
for (Object o : areaCodeArray) {
if(o.equals(areaCode)){
projectFilterList.add(project);
}
}
}
}
}
return projectFilterList;
}
/**