|
@@ -3,19 +3,26 @@ package com.benyun.core.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.benyun.core.dao.AddrCategoryDao;
|
|
|
import com.benyun.core.dao.WdInfoDao;
|
|
|
+import com.benyun.core.dao.WdTopologicalInfoDao;
|
|
|
import com.benyun.core.entity.AddrCategory;
|
|
|
+import com.benyun.core.entity.WdTopologicalInfo;
|
|
|
import com.benyun.core.entity.bo.WdCount;
|
|
|
import com.benyun.core.entity.bo.WdCountBody;
|
|
|
import com.benyun.core.entity.WdInfo;
|
|
|
+import com.benyun.core.entity.bo.WdTopologicalInfoBo;
|
|
|
import com.benyun.core.service.ChannelMapService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.ruoyi.common.core.domain.R;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class ChannelMapServiceImpl implements ChannelMapService {
|
|
@@ -26,6 +33,17 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
@Autowired
|
|
|
private WdInfoDao originWdInfoDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WdTopologicalInfoDao wdTopologicalInfoDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("addrCodeMap")
|
|
|
+ private HashMap<String,String> addrCodeMap;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("typeByMap")
|
|
|
+ private HashMap<String,String> typeByMap;
|
|
|
+
|
|
|
@Override
|
|
|
public WdCount area(List<String> channel, String rankType, String searchText, String[] addrCode) {
|
|
|
long start = System.currentTimeMillis();
|
|
@@ -138,7 +156,7 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
//TODO 需要优化
|
|
|
@Override
|
|
|
- public PageInfo<WdInfo> list(String[] channel, String rankType, String searchText, String orderby, String[] addrCode, int pageNum, int pageSize) {
|
|
|
+ public HashMap list(String[] channel, String rankType, String searchText, String orderby, String[] addrCode, int pageNum, int pageSize) {
|
|
|
//1.根据不同级别得到地区码
|
|
|
List<String> addrCodeList = new ArrayList<>();
|
|
|
if ("province".equals(rankType)) {
|
|
@@ -165,8 +183,8 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
|
|
|
//2.根据地区前缀找到所有的网点
|
|
|
- QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("wd_type_code", channel).and(originWdInfoQueryWrapper -> {
|
|
|
+ QueryWrapper<WdTopologicalInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.in("center_wd_type_code", channel).and(originWdInfoQueryWrapper -> {
|
|
|
for (String s : addrCodeList) {
|
|
|
originWdInfoQueryWrapper.likeRight("addr_code", s).or();
|
|
|
}
|
|
@@ -174,17 +192,57 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
if (searchText != null && !searchText.trim().equals("")) {
|
|
|
queryWrapper.and(originWdInfoQueryWrapper -> {
|
|
|
- originWdInfoQueryWrapper.like("wd_name", searchText);
|
|
|
+ originWdInfoQueryWrapper.like("center_wd_name", searchText);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ queryWrapper.and(wdTopologicalInfoQueryWrapper -> {
|
|
|
+ wdTopologicalInfoQueryWrapper.eq("radius",1000); //1km内算附近
|
|
|
+ });
|
|
|
+
|
|
|
if (orderby != null && !orderby.trim().equals("")) {
|
|
|
queryWrapper.orderByDesc(orderby);
|
|
|
}
|
|
|
|
|
|
+ //获取数据
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- List<WdInfo> originWdInfos = originWdInfoDao.selectList(queryWrapper);
|
|
|
- PageInfo<WdInfo> PageInfo = new PageInfo<>(originWdInfos);
|
|
|
- return PageInfo;
|
|
|
+ List<WdTopologicalInfo> originWdInfos = wdTopologicalInfoDao.selectList(queryWrapper);
|
|
|
+ PageInfo<WdTopologicalInfo> PageInfo = new PageInfo<>(originWdInfos);
|
|
|
+
|
|
|
+ List<String> id = new ArrayList<>();
|
|
|
+
|
|
|
+ //组装
|
|
|
+ List<WdTopologicalInfoBo> collect = PageInfo.getList().stream().map(wdTopologicalInfo -> {
|
|
|
+ wdTopologicalInfo.setAddrCodeInfo(addrCodeMap.get(wdTopologicalInfo.getAddrCode()));
|
|
|
+
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ String tag = wdTopologicalInfo.getTag();
|
|
|
+ for (String s : tag.split(";")) {
|
|
|
+ String[] split = s.split(":");
|
|
|
+ if (split != null && split.length == 2) {
|
|
|
+ String[] split1 = typeByMap.get(split[0]).split(":");
|
|
|
+ String t = "";
|
|
|
+ if (split1.length == 3)
|
|
|
+ t = split1[2];
|
|
|
+ else if (split1.length == 2)
|
|
|
+ t = split1[1];
|
|
|
+ else if (split1.length == 1)
|
|
|
+ t = split1[0];
|
|
|
+ list.add(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ WdTopologicalInfoBo wdTopologicalInfoBo = new WdTopologicalInfoBo(wdTopologicalInfo);
|
|
|
+ wdTopologicalInfoBo.setTag(list);
|
|
|
+ return wdTopologicalInfoBo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ PageInfo.setList(null);
|
|
|
+ HashMap result = new HashMap();
|
|
|
+ result.put("data",collect);
|
|
|
+ result.put("page",PageInfo);
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|