|
|
@ -1,5 +1,6 @@ |
|
|
|
package org.dromara.demo.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import org.dromara.common.core.utils.MapstructUtils; |
|
|
|
import org.dromara.common.core.utils.StringUtils; |
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
@ -145,16 +146,20 @@ public class AreaInfoServiceImpl implements IAreaInfoService { |
|
|
|
// 从数据库中获取的所有区域信息
|
|
|
|
List<AreaInfoVo> areaInfoVos = this.queryList(bo); |
|
|
|
|
|
|
|
// 按 district(区域)分组
|
|
|
|
Map<String, List<AreaInfoVo>> groupedByDistrict = areaInfoVos.stream() |
|
|
|
.collect(Collectors.groupingBy(AreaInfoVo::getDistrict)); |
|
|
|
if (CollectionUtil.isNotEmpty(areaInfoVos)){ |
|
|
|
// 按 district(区域)分组
|
|
|
|
Map<String, List<AreaInfoVo>> groupedByDistrict = areaInfoVos.stream() |
|
|
|
.collect(Collectors.groupingBy(AreaInfoVo::getDistrict)); |
|
|
|
|
|
|
|
// 转换为 List<AreaInfoFinalVo>
|
|
|
|
List<AreaInfoFinalVo> result = new ArrayList<>(); |
|
|
|
for (Map.Entry<String, List<AreaInfoVo>> entry : groupedByDistrict.entrySet()) { |
|
|
|
result.add(new AreaInfoFinalVo(entry.getValue(), des)); // description 先为 null
|
|
|
|
} |
|
|
|
// 转换为 List<AreaInfoFinalVo>
|
|
|
|
// TODO 各区AI描述待提供
|
|
|
|
List<AreaInfoFinalVo> result = new ArrayList<>(); |
|
|
|
for (Map.Entry<String, List<AreaInfoVo>> entry : groupedByDistrict.entrySet()) { |
|
|
|
result.add(new AreaInfoFinalVo(entry.getValue(), des)); // description 先为默认
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|