|
|
@ -21,11 +21,11 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.constant.AreaCodeConstant; |
|
|
|
import com.epmet.dao.AreaCodeChildDao; |
|
|
|
import com.epmet.dao.AreaCodeDao; |
|
|
@ -43,7 +43,6 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -342,6 +341,8 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
AreaCodeDictResultDTO dto = new AreaCodeDictResultDTO(); |
|
|
|
dto.setCode(three.getCountyCode()); |
|
|
|
dto.setName(three.getCountyName()); |
|
|
|
//区县的上一级取city_code
|
|
|
|
dto.setParentCode(three.getCityCode()); |
|
|
|
threeResult.add(dto); |
|
|
|
}); |
|
|
|
List<AreaCodeDictResultDTO> threeSort = threeResult.stream().sorted(Comparator.comparing(AreaCodeDictResultDTO::getCode)).collect(Collectors.toList()); |
|
|
@ -360,6 +361,8 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
}); |
|
|
|
List<AreaCodeDictResultDTO> citySort = cityOnceResult.stream().sorted(Comparator.comparing(AreaCodeDictResultDTO::getCode)).collect(Collectors.toList()); |
|
|
|
dto.setChildren(citySort); |
|
|
|
//一级行政地区parent_code设置为0
|
|
|
|
dto.setParentCode("0"); |
|
|
|
result.add(dto); |
|
|
|
}); |
|
|
|
List<AreaCodeDictResultDTO> collect = result.stream().sorted(Comparator.comparing(AreaCodeDictResultDTO::getCode)).collect(Collectors.toList()); |
|
|
@ -378,8 +381,10 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
List<AreaCodeDictResultDTO> fourResult = new ArrayList<>(); |
|
|
|
// 街道-社区
|
|
|
|
Map<Integer, List<AreaCodeChildDTO>> groupByLevel = areaCodeChildDTOS.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getLevel)); |
|
|
|
//社区
|
|
|
|
List<AreaCodeChildDTO> levelFive = groupByLevel.get(NumConstant.FIVE); |
|
|
|
Map<String, List<AreaCodeChildDTO>> groupByPCode = levelFive.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); |
|
|
|
//街道
|
|
|
|
List<AreaCodeChildDTO> levelFour = groupByLevel.get(NumConstant.FOUR); |
|
|
|
levelFour.forEach(four -> { |
|
|
|
AreaCodeDictResultDTO dto = new AreaCodeDictResultDTO(); |
|
|
@ -393,6 +398,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
AreaCodeDictResultDTO fiveDto = new AreaCodeDictResultDTO(); |
|
|
|
fiveDto.setCode(five.getCode()); |
|
|
|
fiveDto.setName(five.getName()); |
|
|
|
fiveDto.setParentCode(pCode); |
|
|
|
fiveResult.add(fiveDto); |
|
|
|
}); |
|
|
|
List<AreaCodeDictResultDTO> fiveSort = fiveResult.stream().sorted(Comparator.comparing(AreaCodeDictResultDTO::getCode)).collect(Collectors.toList()); |
|
|
|