|
@@ -7,6 +7,7 @@ import com.zoniot.ccrc.commom.model.BuildingData;
|
|
|
import com.zoniot.ccrc.commom.model.Pagination;
|
|
|
import com.zoniot.ccrc.commom.utils.TreeUtil;
|
|
|
import com.zoniot.ccrc.commom.utils.UserUtil;
|
|
|
+import com.zoniot.ccrc.commom.utils.Util;
|
|
|
import com.zoniot.ccrc.dao.AreaMapper;
|
|
|
import com.zoniot.ccrc.dao.BuildingMapper;
|
|
|
import com.zoniot.ccrc.dao.CommunityMapper;
|
|
@@ -101,7 +102,70 @@ public class BuildingServiceImpl implements BuildingService {
|
|
|
|
|
|
@Override
|
|
|
public List<BuildingSelectDto> area(Integer sysId) {
|
|
|
- return null;
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ List<Integer> ids = newArrayList();
|
|
|
+ List<Integer> communityIds = newArrayList();
|
|
|
+ List<BuildingSelectDto> buildingSelectDtoArrayList = newArrayList();
|
|
|
+ List<Building> buildingList = buildingMapper.findBySiteId(loginUser.getSiteId());
|
|
|
+
|
|
|
+ if (buildingList != null && buildingList.size() > 0) {
|
|
|
+ buildingList.forEach(building -> {
|
|
|
+ ids.add(building.getProvince());
|
|
|
+ ids.add(building.getCity());
|
|
|
+ ids.add(building.getRegion());
|
|
|
+ communityIds.add(building.getCommunityId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询所有的小区
|
|
|
+ if (communityIds.size() > 0) {
|
|
|
+ List<Community> communityList = communityMapper.findByIds(communityIds.stream().distinct().collect(Collectors.toList()));
|
|
|
+ if (communityList != null && communityList.size() > 0) {
|
|
|
+ for (Community community : communityList) {
|
|
|
+ BuildingSelectDto buildingSelectDto = new BuildingSelectDto();
|
|
|
+ buildingSelectDto.setCode(community.getId());
|
|
|
+ buildingSelectDto.setName(community.getName());
|
|
|
+ buildingSelectDto.setStatus(0);
|
|
|
+ buildingSelectDto.setNum(0);
|
|
|
+ buildingSelectDto.setDimensionCode("COMMUNITY");
|
|
|
+ if (community.getRegion() != null) {
|
|
|
+ //区关联建筑,把区id设置成建筑的父类id
|
|
|
+ buildingSelectDto.setPid(community.getRegion());
|
|
|
+ } else {
|
|
|
+ if (community.getCity() != null) {
|
|
|
+ //市关联建筑,把市id设置成建筑的父类id
|
|
|
+ buildingSelectDto.setPid(community.getCity());
|
|
|
+ } else {
|
|
|
+ if (community.getProvince() != null) {
|
|
|
+ //省关联建筑,把省id设置成建筑的父类id
|
|
|
+ buildingSelectDto.setPid(community.getProvince());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buildingSelectDtoArrayList.add(buildingSelectDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询所有建筑的区域
|
|
|
+ List<Area> areaList = newArrayList();
|
|
|
+ if (ids.size() > 0) {
|
|
|
+ areaList = areaMapper.findByIds(Util.removeDuplicate(ids));
|
|
|
+ }
|
|
|
+ if (areaList != null && areaList.size() > 0) {
|
|
|
+ areaList.forEach(area -> {
|
|
|
+ BuildingSelectDto buildingSelectDto = new BuildingSelectDto();
|
|
|
+ buildingSelectDto.setCode(area.getId());
|
|
|
+ buildingSelectDto.setPid(area.getParentId());
|
|
|
+ buildingSelectDto.setName(area.getName());
|
|
|
+ buildingSelectDto.setStatus(0);
|
|
|
+ if (area.getLevelType() == 1) buildingSelectDto.setDimensionCode("PROVINCE");
|
|
|
+ if (area.getLevelType() == 2) buildingSelectDto.setDimensionCode("CITY");
|
|
|
+ if (area.getLevelType() == 3) buildingSelectDto.setDimensionCode("REGION");
|
|
|
+
|
|
|
+ buildingSelectDtoArrayList.add(buildingSelectDto);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return TreeUtil.getBuildingSelect(buildingSelectDtoArrayList, 100000, "", 1);
|
|
|
}
|
|
|
|
|
|
|