Quellcode durchsuchen

进入plus(v1.0)

JensionDzero vor 1 Jahr
Ursprung
Commit
3af5066eff
24 geänderte Dateien mit 1163 neuen und 724 gelöschten Zeilen
  1. 14 11
      benyun-core/src/main/java/com/benyun/core/constant/RedisContant.java
  2. 7 7
      benyun-core/src/main/java/com/benyun/core/controller/ChannelMapController.java
  3. 6 6
      benyun-core/src/main/java/com/benyun/core/controller/TopologicalBuildWdController.java
  4. 25 0
      benyun-core/src/main/java/com/benyun/core/controller/TopologicalCommonController.java
  5. 3 2
      benyun-core/src/main/java/com/benyun/core/controller/TopologicalEnterpriseWdController.java
  6. 3 2
      benyun-core/src/main/java/com/benyun/core/controller/TopologicalHouseWdController.java
  7. 2 2
      benyun-core/src/main/java/com/benyun/core/controller/TopologicalStoreWdController.java
  8. 12 4
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalBuildingWd.java
  9. 11 4
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalEnterpriseWd.java
  10. 12 4
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalHouseWd.java
  11. 11 4
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalStoreWd.java
  12. 29 4
      benyun-core/src/main/java/com/benyun/core/entity/vo/TopologicalWdAceeptVo.java
  13. 1 1
      benyun-core/src/main/java/com/benyun/core/service/TopologicalBuildWdSerevice.java
  14. 3 0
      benyun-core/src/main/java/com/benyun/core/service/TopologicalCommonService.java
  15. 3 1
      benyun-core/src/main/java/com/benyun/core/service/TopologicalEnterpriseWdService.java
  16. 1 1
      benyun-core/src/main/java/com/benyun/core/service/TopologicalHouseWdService.java
  17. 1 1
      benyun-core/src/main/java/com/benyun/core/service/TopologicalStoreWdService.java
  18. 600 600
      benyun-core/src/main/java/com/benyun/core/service/impl/AnalyseWdServiceImpl.java
  19. 119 27
      benyun-core/src/main/java/com/benyun/core/service/impl/ChannelMapServiceImpl.java
  20. 122 28
      benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalBuildWdSereviceImpl.java
  21. 32 0
      benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalCommonServiceImpl.java
  22. 48 5
      benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalEnterpriseWdServiceImpl.java
  23. 51 5
      benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalHouseServiceWdImpl.java
  24. 47 5
      benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalStoreWdServiceImpl.java

+ 14 - 11
benyun-core/src/main/java/com/benyun/core/constant/RedisContant.java

@@ -2,35 +2,38 @@ package com.benyun.core.constant;
 
 public class RedisContant {
     public static String CHANNEL_MAP_AREA = "channel_area";  //保存渠道地图area数据的Hash名
-    public static int CHANNEL_MAP_AREA_TIME = 30;  //渠道地图area数据的超时时间
+    public static int CHANNEL_MAP_AREA_TIME = 60*8;  //渠道地图area数据的超时时间
     public static String CHANNEL_MAP_LIST = "channel_list";  //保存渠道地图list数据的Hash名
 
-    public static int CHANNEL_MAP_LIST_TIME = 30;  //渠道地图list数据的超时时间
+    public static int CHANNEL_MAP_LIST_TIME = 60*8;  //渠道地图list数据的超时时间
     public static String CHANNEL_MAP_POINT = "channel_point"; //保存渠道地图point数据的Hash名
 
-    public static int CHANNEL_MAP_POINT_TIME = 30;  //渠道地图point数据的超时时间
+    public static int CHANNEL_MAP_POINT_TIME = 60*8;  //渠道地图point数据的超时时间
 
 
     public static String TOPOLOGICAL_STORE_WD_LIST = "topological_store_wd_list";
 
-    public static int TOPOLOGICAL_STORE_WD_LIST_TIME = 30;
+    public static int TOPOLOGICAL_STORE_WD_LIST_TIME = 60*8;
 
     public static String TOPOLOGICAL_STORE_WD_CATEGORY = "topological_store_wd_category";
 
-    public static int TOPOLOGICAL_STORE_WD_CATEGORY_TIME = 30;
+    public static int TOPOLOGICAL_STORE_WD_CATEGORY_TIME = 60*8;
 
     public static String TOPOLOGICAL_BUILD_WD_LIST = "topological_build_wd_list";
-    public static int TOPOLOGICAL_BUILD_WD_LIST_TIME = 30;
+    public static int TOPOLOGICAL_BUILD_WD_LIST_TIME = 60*8;
     public static String TOPOLOGICAL_BUILD_WD_CATEGORY= "topological_build_wd_category";
-    public static int TOPOLOGICAL_BUILD_WD_CATEGORY_TIME = 30;
+    public static int TOPOLOGICAL_BUILD_WD_CATEGORY_TIME = 60*8;
 
     public static String TOPOLOGICAL_ENTERPRISE_WD_LIST = "topological_enterprise_wd_list";
-    public static int TOPOLOGICAL_ENTERPRISE_WD_LIST_TIME = 30;
+    public static int TOPOLOGICAL_ENTERPRISE_WD_LIST_TIME = 60*8;
     public static String TOPOLOGICAL_HOUSE_WD_LIST = "topological_house_wd_list";
-    public static int TOPOLOGICAL_HOUSE_WD_LIST_TIME = 30;
+    public static int TOPOLOGICAL_HOUSE_WD_LIST_TIME = 60*8;
     public static String TOPOLOGICAL_HOUSE_WD_INFO = "topological_house_wd_info";
-    public static int TOPOLOGICAL_HOUSE_WD_INFO_TIME = 30;
+    public static int TOPOLOGICAL_HOUSE_WD_INFO_TIME = 60*8;
 
     public static String CHANNEL_ANALYSE_CITYTIER = "channel_analyse_cityiter";
-    public static int CHANNEL_ANALYSE_CITYTIER_TIME = 30;
+    public static int CHANNEL_ANALYSE_CITYTIER_TIME = 60*8;
+
+    public static String TOPOLOGICAL_COMMON_MAP = "topological_common_map";
+    public static int TOPOLOGICAL_COMMON_MAP_TIME = 60*8;
 }

+ 7 - 7
benyun-core/src/main/java/com/benyun/core/controller/ChannelMapController.java

@@ -65,13 +65,13 @@ public class ChannelMapController {
     public R list(@Validated(value={ChannelListGroup.class}) ChannelMapAceeptVo channel){
 
         String md5 = channel.getHash();
-        HashMap pageInfo = (HashMap) redisTemplate.boundHashOps(RedisContant.CHANNEL_MAP_LIST).get(md5);
-        if(pageInfo != null){
-            List<WdTopologicalInfoBo> data = (List<WdTopologicalInfoBo>) pageInfo.get("data");
-            attention(data);
-            pageInfo.put("data",data);
-            return R.ok(pageInfo);
-        }
+//        HashMap pageInfo = (HashMap) redisTemplate.boundHashOps(RedisContant.CHANNEL_MAP_LIST).get(md5);
+//        if(pageInfo != null){
+//            List<WdTopologicalInfoBo> data = (List<WdTopologicalInfoBo>) pageInfo.get("data");
+//            attention(data);
+//            pageInfo.put("data",data);
+//            return R.ok(pageInfo);
+//        }
 
         HashMap hashMap = channelMapService.list(channel.getChannel(), channel.getRankType(), channel.getSearchText(), channel.getOrderby(), channel.getAddrCode(), channel.getPageNum(), channel.getPageSize());
         if(hashMap == null)

+ 6 - 6
benyun-core/src/main/java/com/benyun/core/controller/TopologicalBuildWdController.java

@@ -32,10 +32,10 @@ public class TopologicalBuildWdController {
     public R buildingLevel(@Validated(value = {TopologicalWdGroup.class}) TopologicalWdAceeptVo topologicalWdAceeptVo){
         String md5 = topologicalWdAceeptVo.getHash();
         //2.查看redis中是否存在有缓存
-        List<BuildWdCategoryCount> wdCount = (List<BuildWdCategoryCount>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_BUILD_WD_CATEGORY).get(md5);
-        if (wdCount != null) {
-            return R.ok(wdCount);
-        }
+//        List<BuildWdCategoryCount> wdCount = (List<BuildWdCategoryCount>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_BUILD_WD_CATEGORY).get(md5);
+//        if (wdCount != null) {
+//            return R.ok(wdCount);
+//        }
 
         List<BuildWdCategoryCount> list = topologicalBuildWdSerevice.buildingLevel(topologicalWdAceeptVo);
 
@@ -49,12 +49,12 @@ public class TopologicalBuildWdController {
     public R list(@Validated(value = {TopologicalWdListGroup.class}) TopologicalWdAceeptVo topologicalWdAceeptVo){
         String md5 = topologicalWdAceeptVo.getHash();
         //2.查看redis中是否存在有缓存
-        PageInfo<TopologicalBuildingWd> wdCount = (PageInfo<TopologicalBuildingWd> )redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_BUILD_WD_LIST).get(md5);
+        List<TopologicalBuildingWd> wdCount = (List<TopologicalBuildingWd>)redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_BUILD_WD_LIST).get(md5);
         if (wdCount != null) {
             return R.ok(wdCount);
         }
 
-        PageInfo<TopologicalBuildingWd> list = topologicalBuildWdSerevice.list(topologicalWdAceeptVo);
+        List<TopologicalBuildingWd> list = topologicalBuildWdSerevice.list(topologicalWdAceeptVo);
 
         redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_BUILD_WD_LIST).put(md5,list);
         redisTemplate.expire(RedisContant.TOPOLOGICAL_BUILD_WD_LIST,RedisContant.TOPOLOGICAL_BUILD_WD_LIST_TIME, TimeUnit.MINUTES); //30分钟

+ 25 - 0
benyun-core/src/main/java/com/benyun/core/controller/TopologicalCommonController.java

@@ -1,20 +1,29 @@
 package com.benyun.core.controller;
 
+import com.benyun.core.constant.RedisContant;
+import com.benyun.core.entity.TopologicalStoreWd;
 import com.benyun.core.entity.WdInfo;
+import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 import com.benyun.core.service.TopologicalCommonService;
 import com.ruoyi.common.core.domain.R;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 @RestController
 @RequestMapping("/poi/common")
 public class TopologicalCommonController {
     @Autowired
     TopologicalCommonService topologicalCommonService;
+
+    @Autowired
+    RedisTemplate redisTemplate;
+
     @RequestMapping("/prefixSearch")
     public R prefixSearch(String searchText){
         List<WdInfo> wdInfos = topologicalCommonService.prefixSearch(searchText);
@@ -28,4 +37,20 @@ public class TopologicalCommonController {
         hashMap.put("2km",2000);
         return R.ok(hashMap);
     }
+
+    @RequestMapping("/map")
+    public R map(TopologicalWdAceeptVo topologicalWdAceeptVo){
+        String md5 = topologicalWdAceeptVo.getHash();
+        //2.查看redis中是否存在有缓存
+        List<WdInfo> wdCount = (List<WdInfo>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_COMMON_MAP).get(md5);
+        if (wdCount != null) {
+            return R.ok(wdCount);
+        }
+
+        List<WdInfo> map = topologicalCommonService.map(topologicalWdAceeptVo);
+        redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_COMMON_MAP).put(md5,map);
+        redisTemplate.expire(RedisContant.TOPOLOGICAL_COMMON_MAP,RedisContant.TOPOLOGICAL_COMMON_MAP_TIME, TimeUnit.MINUTES); //30分钟
+
+        return R.ok(map);
+    }
 }

+ 3 - 2
benyun-core/src/main/java/com/benyun/core/controller/TopologicalEnterpriseWdController.java

@@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 @RestController
@@ -29,12 +30,12 @@ public class TopologicalEnterpriseWdController {
     public R list(@Validated(value = {TopologicalWdListGroup.class}) TopologicalWdAceeptVo topologicalWdAceeptVo){
         String md5 = topologicalWdAceeptVo.getHash();
         //2.查看redis中是否存在有缓存
-        PageInfo<TopologicalEnterpriseWd>  wdCount = (PageInfo<TopologicalEnterpriseWd> ) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_ENTERPRISE_WD_LIST).get(md5);
+        List<TopologicalEnterpriseWd> wdCount = (List<TopologicalEnterpriseWd>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_ENTERPRISE_WD_LIST).get(md5);
         if (wdCount != null) {
             return R.ok(wdCount);
         }
 
-        PageInfo<TopologicalEnterpriseWd> list = topologicalEnterpriseWdService.list(topologicalWdAceeptVo);
+        List<TopologicalEnterpriseWd> list = topologicalEnterpriseWdService.list(topologicalWdAceeptVo);
 
         redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_ENTERPRISE_WD_LIST).put(md5,list);
         redisTemplate.expire(RedisContant.TOPOLOGICAL_ENTERPRISE_WD_LIST,RedisContant.TOPOLOGICAL_ENTERPRISE_WD_LIST_TIME, TimeUnit.MINUTES); //30分钟

+ 3 - 2
benyun-core/src/main/java/com/benyun/core/controller/TopologicalHouseWdController.java

@@ -16,6 +16,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 @RestController
@@ -50,12 +51,12 @@ public class TopologicalHouseWdController {
     public R list(@Validated(value = {TopologicalWdListGroup.class}) TopologicalWdAceeptVo topologicalWdAceeptVo){
         String md5 = topologicalWdAceeptVo.getHash();
         //2.查看redis中是否存在有缓存
-        PageInfo<TopologicalHouseWd> wdCount = (PageInfo<TopologicalHouseWd>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_HOUSE_WD_LIST).get(md5);
+        List<TopologicalHouseWd> wdCount = (List<TopologicalHouseWd>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_HOUSE_WD_LIST).get(md5);
         if (wdCount != null) {
             return R.ok(wdCount);
         }
 
-        PageInfo<TopologicalHouseWd> list = topologicalHouseWdService.list(topologicalWdAceeptVo);
+        List<TopologicalHouseWd> list = topologicalHouseWdService.list(topologicalWdAceeptVo);
 
         redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_HOUSE_WD_LIST).put(md5,list);
         redisTemplate.expire(RedisContant.TOPOLOGICAL_HOUSE_WD_LIST,RedisContant.TOPOLOGICAL_HOUSE_WD_LIST_TIME, TimeUnit.MINUTES); //30分钟

+ 2 - 2
benyun-core/src/main/java/com/benyun/core/controller/TopologicalStoreWdController.java

@@ -50,13 +50,13 @@ public class TopologicalStoreWdController {
     public R list(@Validated(value = {TopologicalWdListGroup.class}) TopologicalWdAceeptVo topologicalWdAceeptVo){
         String md5 = topologicalWdAceeptVo.getHash();
         //2.查看redis中是否存在有缓存
-        PageInfo<TopologicalStoreWd> wdCount = (PageInfo<TopologicalStoreWd>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_STORE_WD_LIST).get(md5);
+        List<TopologicalStoreWd> wdCount = (List<TopologicalStoreWd>) redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_STORE_WD_LIST).get(md5);
         if (wdCount != null) {
             return R.ok(wdCount);
         }
 
 
-        PageInfo<TopologicalStoreWd> list = topologicalStoreWdService.list(topologicalWdAceeptVo);
+        List<TopologicalStoreWd> list = topologicalStoreWdService.list(topologicalWdAceeptVo);
 
         redisTemplate.boundHashOps(RedisContant.TOPOLOGICAL_STORE_WD_LIST).put(md5,list);
         redisTemplate.expire(RedisContant.TOPOLOGICAL_STORE_WD_LIST,RedisContant.TOPOLOGICAL_STORE_WD_LIST_TIME, TimeUnit.MINUTES); //30分钟

+ 12 - 4
benyun-core/src/main/java/com/benyun/core/entity/TopologicalBuildingWd.java

@@ -10,10 +10,7 @@ import java.time.LocalDateTime;
 @Data
 @TableName("bl_topological_building_wd_list")
 public class TopologicalBuildingWd {
-    @TableId("center_wd_id")
-    private String centerWdId;
-    @TableField("radius")
-    private int radius;
+
     @TableField("around_wd_id")
     private String aroundWdId;
     @TableField("around_wd_name")
@@ -36,4 +33,15 @@ public class TopologicalBuildingWd {
     private String propertyType;
     @TableField("analyse_time")
     private LocalDateTime analyseTime;
+
+    public TopologicalBuildingWd(WdInfo wdInfo) {
+        this.aroundWdId = wdInfo.getWdId();
+        this.aroundWdName = wdInfo.getWdName();
+        this.aroundWdTypeCode = wdInfo.getWdTypeCode();
+        this.addrCode = wdInfo.getAddrCode();
+        this.addrInfo = wdInfo.getAddrInfo();
+    }
+
+    public TopologicalBuildingWd() {
+    }
 }

+ 11 - 4
benyun-core/src/main/java/com/benyun/core/entity/TopologicalEnterpriseWd.java

@@ -10,10 +10,6 @@ import java.time.LocalDateTime;
 @Data
 @TableName("bl_topological_enterprise_wd_list")
 public class TopologicalEnterpriseWd {
-    @TableField("center_wd_id")
-    private String centerWdId;
-    @TableField("radius")
-    private int radius;
     @TableField("around_wd_id")
     private String aroundWdId;
     @TableField("around_wd_name")
@@ -38,4 +34,15 @@ public class TopologicalEnterpriseWd {
 
     @TableField("analyse_time")
     private LocalDateTime analyseTime;
+
+    public TopologicalEnterpriseWd(WdInfo wdInfo) {
+        this.aroundWdId = wdInfo.getWdId();
+        this.aroundWdName = wdInfo.getWdName();
+        this.aroundWdTypeCode = wdInfo.getWdTypeCode();
+        this.addrCode = wdInfo.getAddrCode();
+        this.addrInfo = wdInfo.getAddrInfo();
+    }
+
+    public TopologicalEnterpriseWd() {
+    }
 }

+ 12 - 4
benyun-core/src/main/java/com/benyun/core/entity/TopologicalHouseWd.java

@@ -11,10 +11,6 @@ import java.time.LocalDateTime;
 @TableName("bl_topological_house_wd_list")
 public class TopologicalHouseWd {
 
-    @TableField("center_wd_id")
-    public String centerWdId;
-    @TableField("radius")
-    public int radius;
     @TableField("around_wd_id")
     public String aroundWdId;
     @TableField("around_wd_name")
@@ -47,4 +43,16 @@ public class TopologicalHouseWd {
 
     @TableField("analyse_time")
     private LocalDateTime analyseTime;
+
+    public TopologicalHouseWd(WdInfo wdInfo) {
+        this.aroundWdId = wdInfo.getWdId();
+        this.aroundWdName = wdInfo.getWdName();
+        this.aroundWdTypeCode = wdInfo.getWdTypeCode();
+        this.addrCode = wdInfo.getAddrCode();
+        this.addrInfo = wdInfo.getAddrInfo();
+    }
+
+    public TopologicalHouseWd() {
+
+    }
 }

+ 11 - 4
benyun-core/src/main/java/com/benyun/core/entity/TopologicalStoreWd.java

@@ -7,10 +7,6 @@ import java.time.LocalDateTime;
 
 @Data
 public class TopologicalStoreWd {
-    @TableField("center_wd_id")
-    public String centerWdId;
-    @TableField("radius")
-    public int radius;
     @TableField("around_wd_id")
     public String aroundWdId;
     @TableField("around_wd_name")
@@ -40,4 +36,15 @@ public class TopologicalStoreWd {
 
     @TableField("brand_id")
     private String brandId;
+
+    public TopologicalStoreWd(WdInfo wdInfo) {
+        this.aroundWdId = wdInfo.getWdId();
+        this.aroundWdName = wdInfo.getWdName();
+        this.aroundWdTypeCode = wdInfo.getWdTypeCode();
+        this.addrCode = wdInfo.getAddrCode();
+        this.addrInfo = wdInfo.getAddrInfo();
+    }
+
+    public TopologicalStoreWd() {
+    }
 }

+ 29 - 4
benyun-core/src/main/java/com/benyun/core/entity/vo/TopologicalWdAceeptVo.java

@@ -1,5 +1,6 @@
 package com.benyun.core.entity.vo;
 
+import com.benyun.core.constant.ChannelMapContant;
 import com.benyun.core.utils.HashUtil;
 import com.benyun.core.valida.TopologicalWdGroup;
 import com.benyun.core.valida.TopologicalWdListGroup;
@@ -15,18 +16,42 @@ public class TopologicalWdAceeptVo {
     String centerWdId;
     @NotNull(groups = {TopologicalWdGroup.class,TopologicalWdListGroup.class},message = "半径范围未正确选择")
     int radius;
-    int pageNum = 1;
-    int pageSize = 10;
+    int size = 10;
+
+    @NotBlank(groups = {TopologicalWdListGroup.class},message = "geoHash不能为空")
+    String geoHash;
+
+    @NotNull(groups = {TopologicalWdListGroup.class},message = "lat不能为空")
+    double lat;
+    @NotNull(groups = {TopologicalWdListGroup.class},message = "lng不能为空")
+    double lng;
+
+    String[] channel;
+
 
     public String getHash(){
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.append(centerWdId);
         stringBuilder.append(radius);
-        stringBuilder.append(pageNum);
-        stringBuilder.append(pageSize);
+        stringBuilder.append(size);
+        stringBuilder.append(geoHash);
+        stringBuilder.append(lat);
+        stringBuilder.append(lng);
+        for (String s : getChannel()) {
+            stringBuilder.append(s);
+        }
+
 
         String s = stringBuilder.toString();
         String md5 = HashUtil.hash(s, "MD5");
         return md5;
     }
+
+    public String[] getChannel() {
+        if(this.channel == null || this.channel.length == 0){
+            return channel = ChannelMapContant.FULL_CHANNEL;
+        }
+        return channel;
+    }
+
 }

+ 1 - 1
benyun-core/src/main/java/com/benyun/core/service/TopologicalBuildWdSerevice.java

@@ -9,5 +9,5 @@ import java.util.List;
 
 public interface TopologicalBuildWdSerevice {
     public List<BuildWdCategoryCount> buildingLevel(TopologicalWdAceeptVo topologicalWdAceeptVo);
-    public PageInfo<TopologicalBuildingWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
+    public List<TopologicalBuildingWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
 }

+ 3 - 0
benyun-core/src/main/java/com/benyun/core/service/TopologicalCommonService.java

@@ -1,10 +1,13 @@
 package com.benyun.core.service;
 
 import com.benyun.core.entity.WdInfo;
+import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 
 import java.util.List;
 
 public interface TopologicalCommonService {
     public List<WdInfo> prefixSearch(String searchText);
     void search(String searchText,int radius);
+
+    List<WdInfo> map(TopologicalWdAceeptVo topologicalWdAceeptVo);
 }

+ 3 - 1
benyun-core/src/main/java/com/benyun/core/service/TopologicalEnterpriseWdService.java

@@ -4,6 +4,8 @@ import com.benyun.core.entity.TopologicalEnterpriseWd;
 import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 import com.github.pagehelper.PageInfo;
 
+import java.util.List;
+
 public interface TopologicalEnterpriseWdService {
-    public PageInfo<TopologicalEnterpriseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
+    public List<TopologicalEnterpriseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
 }

+ 1 - 1
benyun-core/src/main/java/com/benyun/core/service/TopologicalHouseWdService.java

@@ -10,7 +10,7 @@ import com.github.pagehelper.PageInfo;
 import java.util.List;
 
 public interface TopologicalHouseWdService {
-    public PageInfo<TopologicalHouseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
+    public List<TopologicalHouseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
 
     public TopologicalHouseWdStatisticsData info(TopologicalWdAceeptVo topologicalWdAceeptVo);
 }

+ 1 - 1
benyun-core/src/main/java/com/benyun/core/service/TopologicalStoreWdService.java

@@ -9,7 +9,7 @@ import com.github.pagehelper.PageInfo;
 import java.util.List;
 
 public interface TopologicalStoreWdService {
-    public PageInfo<TopologicalStoreWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
+    public List<TopologicalStoreWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo);
 
     List<StoreWdCategoryCountBody> category(TopologicalWdAceeptVo topologicalWdAceeptVo);
 }

+ 600 - 600
benyun-core/src/main/java/com/benyun/core/service/impl/AnalyseWdServiceImpl.java

@@ -1,76 +1,454 @@
-package com.benyun.core.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.benyun.core.dao.*;
-import com.benyun.core.entity.*;
-import com.benyun.core.service.AnalyseWdService;
-import com.benyun.core.utils.DistanceUtil;
-import org.gavaghan.geodesy.Ellipsoid;
-import org.gavaghan.geodesy.GlobalCoordinates;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.*;
-
-
-@Service
-@Transactional
-public class AnalyseWdServiceImpl implements AnalyseWdService {
-
-    //分析范围集
-    List<Integer> anly = Arrays.asList(2000, 1000, 500);
-
-    @Autowired
-    WdInfoDao wdInfoDao;
-
-    @Autowired
-    StoreWdDao storeWdDao;
-
-    @Autowired
-    HouseWdDao houseWdDao;
-
-    @Autowired
-    BuildWdDao buildWdDao;
-
-    @Autowired
-    EnterpriseWdDao enterpriseWdDao;
-
-    @Autowired
-    EnterpriseDao enterpriseDao;
-
-    /*分析信息*/
-    @Autowired
-    WdTopologicalDao wdTopologicalDao;
-
-    @Autowired
-    TopologicalBuildWdDao topologicalBuildWdDao;
-
-
-    @Autowired
-    TopologicalStoreWdDao topologicalStoreWdDao;
-
-    @Autowired
-    TopologicalHouseWdDao topologicalHouseWdDao;
-
-    @Autowired
-    TopologicalEnterpriseWdDao topologicalEnterpriseWdDao;
-
-    /*统计信息*/
-    @Autowired
-    TopologicalHouseWdStatisticsDataDao houseWdStatisticsDataDao;
-    @Autowired
-    TopologicalBuildWdStatisticsCategoryDao buildWdStatisticsCategoryDao;
-    @Autowired
-    TopologicalStoreWdStatisticsCategoryDao storeWdStatisticsCategoryDao;
-    @Autowired
-    WdTopologicalInfoDao wdTopologicalInfoDao;
-
-
+//package com.benyun.core.service.impl;
+//
+//import com.alibaba.fastjson.JSON;
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+//import com.benyun.core.dao.*;
+//import com.benyun.core.entity.*;
+//import com.benyun.core.service.AnalyseWdService;
+//import com.benyun.core.utils.DistanceUtil;
+//import org.gavaghan.geodesy.Ellipsoid;
+//import org.gavaghan.geodesy.GlobalCoordinates;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Service;
+//import org.springframework.transaction.annotation.Transactional;
+//
+//import java.math.BigDecimal;
+//import java.time.LocalDateTime;
+//import java.time.ZoneId;
+//import java.util.*;
+//
+//
+//@Service
+//@Transactional
+//public class AnalyseWdServiceImpl implements AnalyseWdService {
+//
+//    //分析范围集
+//    List<Integer> anly = Arrays.asList(2000, 1000, 500);
+//
+//    @Autowired
+//    WdInfoDao wdInfoDao;
+//
+//    @Autowired
+//    StoreWdDao storeWdDao;
+//
+//    @Autowired
+//    HouseWdDao houseWdDao;
+//
+//    @Autowired
+//    BuildWdDao buildWdDao;
+//
+//    @Autowired
+//    EnterpriseWdDao enterpriseWdDao;
+//
+//    @Autowired
+//    EnterpriseDao enterpriseDao;
+//
+//    /*分析信息*/
+//    @Autowired
+//    WdTopologicalDao wdTopologicalDao;
+//
+//    @Autowired
+//    TopologicalBuildWdDao topologicalBuildWdDao;
+//
+//
+//    @Autowired
+//    TopologicalStoreWdDao topologicalStoreWdDao;
+//
+//    @Autowired
+//    TopologicalHouseWdDao topologicalHouseWdDao;
+//
+//    @Autowired
+//    TopologicalEnterpriseWdDao topologicalEnterpriseWdDao;
+//
+//    /*统计信息*/
+//    @Autowired
+//    TopologicalHouseWdStatisticsDataDao houseWdStatisticsDataDao;
+//    @Autowired
+//    TopologicalBuildWdStatisticsCategoryDao buildWdStatisticsCategoryDao;
+//    @Autowired
+//    TopologicalStoreWdStatisticsCategoryDao storeWdStatisticsCategoryDao;
+//    @Autowired
+//    WdTopologicalInfoDao wdTopologicalInfoDao;
+//
+//
+////    @Override
+////    public void analyse() {
+////        ZoneId zone = ZoneId.of("Asia/Shanghai");
+////        LocalDateTime now = LocalDateTime.now(zone);  //分析时间
+////
+////        //测试需要
+////        QueryWrapper<WdInfo> queryWrapper1 = new QueryWrapper<>();
+////        queryWrapper1.eq("wd_type_code", "5");
+////
+////        List<WdInfo> wdInfos1 = wdInfoDao.selectList(queryWrapper1);
+////        int index = 1;
+////        //1.遍历所有网点
+////        for (WdInfo wdInfo : wdInfos1) {
+////            //1.找到该点半径 r = 4.89km 内的所有点
+////            QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+////            queryWrapper.likeRight("geo_hash", wdInfo.getGeoHash().substring(0, 5));
+////            List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
+////
+////            //2.初始化
+////            //关键信息统计
+////            HashMap<String, HashMap<String, Integer>>[] storeCategory = new HashMap[anly.size()];  //经营分类统计:<中类,<小类,数量>>
+////            HashMap<String, Double>[] houseData = new HashMap[anly.size()];  //小区分析统计:key:totalHouseholds、totalPeopleCount、totalRent
+////            HashMap<String, Integer>[] buildCategory = new HashMap[anly.size()];   //楼宇网点分析统计,key:甲类、乙类...
+////            HashMap<String, Integer>[] wdTopologicalInfoHash = new HashMap[anly.size()];  //分类tag:key:byCode value:数量
+////
+////
+////            for (int i = 0; i < anly.size(); i++) {
+////                storeCategory[i] = new HashMap<>();
+////                houseData[i] = new HashMap<>();
+////                houseData[i].put("houseWdCount", 0.0);
+////                houseData[i].put("totalHouseholds", 0.0);   //总户数
+////                houseData[i].put("totalPeopleCount", 0.0);  //总人口数
+////                houseData[i].put("totalRent", 0.0); //房价
+////                buildCategory[i] = new HashMap<>();
+////                wdTopologicalInfoHash[i] = new HashMap<>();
+////            }
+////
+////            //关键信息集合
+////            List<TopologicalStoreWdStatisticsCategory> storeWdStatisticsCategoryList = new ArrayList<>();
+////            List<TopologicalBuildWdStatisticsCategory> buildWdStatisticsCategoryList = new ArrayList<>();
+////            List<TopologicalHouseWdStatisticsData> houseWdStatisticsDataList = new ArrayList<>();
+////            List<WdTopologicalInfo> wdTopologicalInfoList = new ArrayList<>();
+////
+////            //各拓扑网点集合
+////            List<WdTopological> wdTopologicals = new ArrayList<>();
+////            List<TopologicalEnterpriseWd> topologicalEnterpriseWds = new ArrayList<>();
+////            List<TopologicalStoreWd> topologicalStoreWds = new ArrayList<>();
+////            List<TopologicalHouseWd> topologicalHouseWds = new ArrayList<>();
+////            List<TopologicalBuildingWd> topologicalBuildingWds = new ArrayList<>();
+////
+////            System.out.println("初始化完成------总进度:" + wdInfos1.size() + "/" + index++);
+////            //3.开始分析
+////            for (WdInfo info : wdInfos) {
+////
+////                //网点等于自己不要
+////                if (info.getWdId().equals(wdInfo.getWdId()))
+////                    continue;
+////
+////                //计算距离
+////                GlobalCoordinates source = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
+////                GlobalCoordinates target = new GlobalCoordinates(info.getLat().doubleValue(), info.getLng().doubleValue());
+////                double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
+////
+////                //大于4.89Km不要
+////                if (meter2 > anly.get(0))
+////                    continue;
+////
+////                Integer r = anly.get(anly.size() - 1);
+////                int p = anly.size() - 1; //记录r位置
+////                for (int i = 1; i < anly.size(); i++) {
+////                    if (meter2 > anly.get(i)) {
+////                        r = anly.get(i - 1);
+////                        p = i - 1;
+////                        break;
+////                    } else if (meter2 == anly.get(i)) {
+////                        r = anly.get(i);
+////                        p = i;
+////                        break;
+////                    }
+////                }
+////
+////                //3.1 WdTopological
+////                WdTopological wdTopological = new WdTopological();
+////                wdTopological.setCenterWdId(wdInfo.getWdId());
+////                wdTopological.setCenterWdName(wdInfo.getWdName());
+////                wdTopological.setRadius(r);
+////                wdTopological.setAroundWdId(info.getWdId());
+////                wdTopological.setAroundWdName(info.getWdName());
+////                wdTopological.setAroundWdTypeCode(info.getWdTypeCode());
+////                wdTopological.setAddrCode(info.getAddrCode());
+////                wdTopological.setAddrCodeInfo(info.getAddrInfo());
+////                wdTopological.setAddrInfo(info.getAddrInfo());
+////                wdTopological.setLat(info.getLat());
+////                wdTopological.setLng(info.getLng());
+////                wdTopological.setGeoHash(info.getGeoHash());
+////                wdTopological.setAroundTypeCodeBy(info.getTypeCodeBy());
+////                wdTopological.setDistance(meter2);
+////                wdTopological.setAnalyseTime(now);
+////
+////                wdTopologicals.add(wdTopological);
+////
+////                if (info.getTypeCodeBy() != null && !info.getTypeCodeBy().equals("")) {
+////                    HashMap<String, Integer> wdTopologicalInfoHash1 = wdTopologicalInfoHash[p];
+////                    Integer put = wdTopologicalInfoHash1.get(info.getTypeCodeBy());
+////                    if (put == null) {
+////                        wdTopologicalInfoHash1.put(info.getTypeCodeBy(), 1);
+////                    } else {
+////                        wdTopologicalInfoHash1.put(info.getTypeCodeBy(), wdTopologicalInfoHash1.get(info.getTypeCodeBy()) + 1);
+////                    }
+////                }
+////
+////                if (wdTopological.getAroundWdTypeCode().equals("1")) {
+////                    //门店网点
+////                    TopologicalStoreWd topologicalStoreWd = new TopologicalStoreWd();
+////                    topologicalStoreWd.setCenterWdId(wdTopological.getCenterWdId());
+////                    topologicalStoreWd.setRadius(wdTopological.getRadius());
+////
+////                    topologicalStoreWd.setAroundWdId(wdTopological.getAroundWdId());
+////                    topologicalStoreWd.setAroundWdName(wdTopological.getAroundWdName());
+////                    topologicalStoreWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+////
+////                    topologicalStoreWd.setAddrCode(wdTopological.getAddrCode());
+////                    topologicalStoreWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
+////                    topologicalStoreWd.setAddrInfo(wdTopological.getAddrInfo());
+////
+////                    topologicalStoreWd.setDistance(wdTopological.getDistance());
+////
+////                    //门店分析
+////                    StoreWd storeWd = storeWdDao.selectById(info.getWdId());
+////                    if (storeWd != null) {
+////                        topologicalStoreWd.setIndustryCode(storeWd.getIndustryCode());
+////                        String manageTypeCode = storeWd.getManageTypeCode();
+////                        topologicalStoreWd.setManageTypeCode(manageTypeCode);
+////                        topologicalStoreWd.setBrandId(storeWd.getBrandId());
+////
+////                        //分析经营分类
+////                        if (manageTypeCode != null && !manageTypeCode.equals("")) {
+////                            HashMap<String, HashMap<String, Integer>> stringHashMapHashMap = storeCategory[p];
+////                            HashMap<String, Integer> hashMap = stringHashMapHashMap.get(manageTypeCode.substring(0, 4));
+////                            if (hashMap == null) {
+////                                HashMap<String, Integer> map = new HashMap<>();
+////                                map.put(manageTypeCode, 1);
+////                            } else {
+////                                Integer integer = hashMap.get(manageTypeCode);
+////                                if (integer == null)
+////                                    hashMap.put(manageTypeCode, 1);
+////                                else
+////                                    hashMap.put(manageTypeCode, hashMap.get(manageTypeCode) + 1);
+////                            }
+////                        }
+////
+////                    }
+////
+////                    topologicalStoreWd.setAnalyseTime(wdTopological.getAnalyseTime());
+////                    topologicalStoreWds.add(topologicalStoreWd);
+////                } else if (wdTopological.getAroundWdTypeCode().equals("2")) {
+////                    //小区网点
+////                    TopologicalHouseWd topologicalHouseWd = new TopologicalHouseWd();
+////                    topologicalHouseWd.setCenterWdId(wdTopological.getCenterWdId());
+////                    topologicalHouseWd.setRadius(wdTopological.getRadius());
+////
+////                    topologicalHouseWd.setAroundWdId(wdTopological.getAroundWdId());
+////                    topologicalHouseWd.setAroundWdName(wdTopological.getAroundWdName());
+////                    topologicalHouseWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+////
+////                    topologicalHouseWd.setAddrCode(wdTopological.getAddrCode());
+////                    topologicalHouseWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
+////                    topologicalHouseWd.setAddrInfo(wdTopological.getAddrInfo());
+////
+////                    topologicalHouseWd.setDistance(wdTopological.getDistance());
+////
+////                    HashMap<String, Double> houseDatum = houseData[p];
+////                    houseDatum.put("houseWdCount", houseDatum.get("houseWdCount") + 1.0);
+////
+////                    //小区分析
+////                    HouseWd houseWd = houseWdDao.selectById(info.getWdId());
+////                    if (houseWd != null) {
+////                        topologicalHouseWd.setHouseholds(houseWd.getHouseholds());
+////                        topologicalHouseWd.setRent(info.getRent());
+////                        topologicalHouseWd.setPeopleCount(houseWd.getPeopleCount());
+////                        topologicalHouseWd.setPropertyType(houseWd.getPropertyType());
+////
+////                        //小区关键信息统计
+////                        houseDatum.put("totalRent", houseDatum.get("totalRent") + topologicalHouseWd.getRent());
+////                        houseDatum.put("totalHouseholds", houseDatum.get("totalHouseholds") + topologicalHouseWd.getHouseholds());
+////                        houseDatum.put("totalPeopleCount", houseDatum.get("totalPeopleCount") + topologicalHouseWd.getPeopleCount());
+////                    }
+////
+////                    topologicalHouseWd.setAnalyseTime(wdTopological.getAnalyseTime());
+////                    topologicalHouseWds.add(topologicalHouseWd);
+////                } else if (wdTopological.getAroundWdTypeCode().equals("3")) {
+////                    //楼宇网点
+////                    TopologicalBuildingWd topologicalBuildingWd = new TopologicalBuildingWd();
+////                    topologicalBuildingWd.setCenterWdId(wdTopological.getCenterWdId());
+////                    topologicalBuildingWd.setRadius(wdTopological.getRadius());
+////
+////                    topologicalBuildingWd.setAroundWdId(wdTopological.getAroundWdId());
+////                    topologicalBuildingWd.setAroundWdName(wdTopological.getAroundWdName());
+////                    topologicalBuildingWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+////
+////                    topologicalBuildingWd.setAddrCode(wdTopological.getAddrCode());
+////                    topologicalBuildingWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
+////                    topologicalBuildingWd.setAddrInfo(wdTopological.getAddrInfo());
+////
+////                    topologicalBuildingWd.setDistance(wdTopological.getDistance());
+////
+////                    //楼宇分析
+////                    BuildWd buildWd = buildWdDao.selectById(info.getWdId());
+////                    if (buildWd != null) {
+////                        topologicalBuildingWd.setRent(info.getRent());
+////                        topologicalBuildingWd.setBuildType(buildWd.getBuildType());
+////                        topologicalBuildingWd.setPropertyType(buildWd.getPropertyType());
+////
+////                        //分析楼宇分类
+////                        if (topologicalBuildingWd.getPropertyType() != null && !topologicalBuildingWd.getPropertyType().equals("")) {
+////                            HashMap<String, Integer> buildCategoryMap = buildCategory[p];
+////                            Integer integer = buildCategoryMap.get(topologicalBuildingWd.getPropertyType());
+////                            if (integer == null) {
+////                                buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), 1);
+////                            } else
+////                                buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), buildCategoryMap.get(topologicalBuildingWd.getPropertyType()) + 1);
+////
+////                        }
+////                    }
+////
+////                    topologicalBuildingWd.setAnalyseTime(wdTopological.getAnalyseTime());
+////                    topologicalBuildingWds.add(topologicalBuildingWd);
+////                } else if (wdTopological.getAroundWdTypeCode().equals("5")) {
+////                    //公司网点
+////                    TopologicalEnterpriseWd topologicalEnterpriseWd = new TopologicalEnterpriseWd();
+////                    topologicalEnterpriseWd.setCenterWdId(wdTopological.getCenterWdId());
+////                    topologicalEnterpriseWd.setRadius(wdTopological.getRadius());
+////
+////                    topologicalEnterpriseWd.setAroundWdId(wdTopological.getAroundWdId());
+////                    topologicalEnterpriseWd.setAroundWdName(wdTopological.getAroundWdName());
+////                    topologicalEnterpriseWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+////
+////                    topologicalEnterpriseWd.setAddrCode(wdTopological.getAddrCode());
+////                    topologicalEnterpriseWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
+////                    topologicalEnterpriseWd.setAddrInfo(wdTopological.getAddrInfo());
+////
+////                    topologicalEnterpriseWd.setDistance(wdTopological.getDistance());
+////
+////                    //公司分析
+////                    EnterpriseWd enterpriseWd = enterpriseWdDao.selectById(info.getWdId());
+////                    if (enterpriseWd != null) {
+////                        Enterprise enterprise = enterpriseDao.selectById(enterpriseWd.getEnterpriseUsci());
+////                        if (enterprise != null) {
+////                            topologicalEnterpriseWd.setIndustryCode(enterprise.getIndustryCode());
+////                            topologicalEnterpriseWd.setRegisteredCapital(enterprise.getRegisteredCapital());
+////                            topologicalEnterpriseWd.setEnterpriseScale(enterprise.getEnterpriseScale());
+////                        }
+////                    }
+////                    topologicalEnterpriseWd.setAnalyseTime(wdTopological.getAnalyseTime());
+////                    topologicalEnterpriseWds.add(topologicalEnterpriseWd);
+////                }
+////
+////            }
+////
+////            //TODO 门店分类
+////            for (int i = 0; i < anly.size(); i++) {
+////                TopologicalStoreWdStatisticsCategory storeWdStatisticsCategory = new TopologicalStoreWdStatisticsCategory();
+////                storeWdStatisticsCategory.setCenterWdId(wdInfo.getWdId());
+////                storeWdStatisticsCategory.setRadius(anly.get(i));
+////                HashMap<String, HashMap<String, Integer>> stringHashMapHashMap = storeCategory[i];
+////                for (String s : stringHashMapHashMap.keySet()) {
+////                    storeWdStatisticsCategory.setBigManageTypeCode(s.substring(0, 2) + "0000");
+////                    storeWdStatisticsCategory.setMidManageTypeCode(s);
+////
+////                    HashMap<String, Integer> hashMap = stringHashMapHashMap.get(s);
+////                    StringBuilder stringBuilder = new StringBuilder();
+////                    for (String s1 : hashMap.keySet()) {
+////                        stringBuilder.append(s1);
+////                        stringBuilder.append(":");
+////                        stringBuilder.append(hashMap.get(s1));
+////                        stringBuilder.append(";");
+////                    }
+////                    storeWdStatisticsCategory.setSubCategoryCodeStatistics(stringBuilder.toString());
+////                    storeWdStatisticsCategory.setAnalyseTime(now);
+////                    storeWdStatisticsCategoryList.add(storeWdStatisticsCategory);
+////                }
+////            }
+////
+////            //TODO 楼宇分类
+////            for (int i = 0; i < anly.size(); i++) {
+////                TopologicalBuildWdStatisticsCategory buildWdStatisticsCategory = new TopologicalBuildWdStatisticsCategory();
+////                buildWdStatisticsCategory.setCenterWdId(wdInfo.getWdId());
+////                buildWdStatisticsCategory.setRadius(anly.get(i));
+////
+////                HashMap<String, Integer> hashMap = buildCategory[i];
+////                StringBuilder stringBuilder = new StringBuilder();
+////                for (String s : hashMap.keySet()) {
+////                    stringBuilder.append(s + ":" + hashMap.get(s) + ";");
+////                }
+////                buildWdStatisticsCategory.setPropertyTypeStatistics(stringBuilder.toString());
+////                buildWdStatisticsCategory.setAnalyseTime(now);
+////                buildWdStatisticsCategoryList.add(buildWdStatisticsCategory);
+////            }
+////
+////            //TODO 社区关键数据
+////            for (int i = 0; i < anly.size(); i++) {
+////                TopologicalHouseWdStatisticsData houseWdStatisticsData = new TopologicalHouseWdStatisticsData();
+////                houseWdStatisticsData.setCenterWdId(wdInfo.getWdId());
+////                houseWdStatisticsData.setRadius(anly.get(i));
+////                HashMap<String, Double> houseDatum = houseData[i];
+////                double houseWdCount = houseDatum.get("houseWdCount");
+////                double totalHouseholds = houseDatum.get("totalHouseholds");
+////                double totalPeopleCount = houseDatum.get("totalPeopleCount");
+////                double totalRent = houseDatum.get("totalRent");
+////                houseWdStatisticsData.setHouseWdCount((int) houseWdCount);
+////                houseWdStatisticsData.setTotalHouseholds((int) totalHouseholds);
+////                houseWdStatisticsData.setTotalPeopleCount((int) totalPeopleCount);
+////                if(houseWdCount != 0.0)
+////                    houseWdStatisticsData.setAverageRent(totalRent / houseWdCount);
+////                else
+////                    houseWdStatisticsData.setAverageRent(0.0);
+////
+////                houseWdStatisticsData.setAnalyseTime(now);
+////                houseWdStatisticsDataList.add(houseWdStatisticsData);
+////            }
+////
+////            //TODO 网点拓扑信息
+////            for (int i = 0; i < anly.size(); i++) {
+////                WdTopologicalInfo wdTopologicalInfo = new WdTopologicalInfo();
+////                wdTopologicalInfo.setCenterWdId(wdInfo.getWdId());
+////                wdTopologicalInfo.setCenterWdName(wdInfo.getWdName());
+////                wdTopologicalInfo.setCenterWdTypeCode(wdInfo.getWdTypeCode());
+////                wdTopologicalInfo.setTypeCodeBy(wdInfo.getTypeCodeBy());
+////                wdTopologicalInfo.setLat(wdInfo.getLat());
+////                wdTopologicalInfo.setLng(wdInfo.getLng());
+////                wdTopologicalInfo.setRadius(anly.get(i));
+////                wdTopologicalInfo.setAddrCode(wdInfo.getAddrCode());
+////                wdTopologicalInfo.setAddrInfo(wdInfo.getAddrInfo());
+////                wdTopologicalInfo.setGeoHash(wdInfo.getGeoHash());
+////                wdTopologicalInfo.setAnalyseTime(now);
+////
+////                HashMap<String, Integer> wdTopologicalInfoHash1 = wdTopologicalInfoHash[i];
+////                StringBuilder stringBuilder = new StringBuilder();
+////                for (String s : wdTopologicalInfoHash1.keySet()) {
+////                    stringBuilder.append(s + ":" + wdTopologicalInfoHash1.get(s) + ";");
+////                }
+////                wdTopologicalInfo.setTag(stringBuilder.toString());
+////                wdTopologicalInfoList.add(wdTopologicalInfo);
+////            }
+////
+////            System.out.println("完成------");
+////
+////
+////            //4.导入数据库
+////            if (topologicalStoreWds.isEmpty())
+////                continue;
+////
+////            wdTopologicalDao.insertList(wdTopologicals);//保存网点拓扑
+////
+////            //4.1 保存拓扑信息
+////            if (!topologicalStoreWds.isEmpty())
+////                topologicalStoreWdDao.insertList(topologicalStoreWds);
+////            if (!topologicalHouseWds.isEmpty())
+////                topologicalHouseWdDao.insertList(topologicalHouseWds);
+////            if (!topologicalBuildingWds.isEmpty())
+////                topologicalBuildWdDao.insertList(topologicalBuildingWds);
+////            if (!topologicalEnterpriseWds.isEmpty()){
+////                topologicalEnterpriseWdDao.insertList(topologicalEnterpriseWds);
+////            }
+////
+////            //4.2 保存其他相关统计信息
+////            if (!houseWdStatisticsDataList.isEmpty())
+////                houseWdStatisticsDataDao.insertList(houseWdStatisticsDataList);
+////            if (!storeWdStatisticsCategoryList.isEmpty())
+////                storeWdStatisticsCategoryDao.insertList(storeWdStatisticsCategoryList);
+////            if (!buildWdStatisticsCategoryList.isEmpty())
+////                buildWdStatisticsCategoryDao.insertList(buildWdStatisticsCategoryList);
+////            if (!wdTopologicalInfoList.isEmpty())
+////                wdTopologicalInfoDao.insertList(wdTopologicalInfoList);
+////
+////        }
+////    }
+//
 //    @Override
 //    public void analyse() {
 //        ZoneId zone = ZoneId.of("Asia/Shanghai");
@@ -95,7 +473,7 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //            HashMap<String, Double>[] houseData = new HashMap[anly.size()];  //小区分析统计:key:totalHouseholds、totalPeopleCount、totalRent
 //            HashMap<String, Integer>[] buildCategory = new HashMap[anly.size()];   //楼宇网点分析统计,key:甲类、乙类...
 //            HashMap<String, Integer>[] wdTopologicalInfoHash = new HashMap[anly.size()];  //分类tag:key:byCode value:数量
-//
+//            List<WdToologicalItem>[] wdToologicalItemList = new ArrayList[anly.size()];
 //
 //            for (int i = 0; i < anly.size(); i++) {
 //                storeCategory[i] = new HashMap<>();
@@ -106,6 +484,7 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //                houseData[i].put("totalRent", 0.0); //房价
 //                buildCategory[i] = new HashMap<>();
 //                wdTopologicalInfoHash[i] = new HashMap<>();
+//                wdToologicalItemList[i] = new ArrayList<>();
 //            }
 //
 //            //关键信息集合
@@ -122,6 +501,13 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //            List<TopologicalBuildingWd> topologicalBuildingWds = new ArrayList<>();
 //
 //            System.out.println("初始化完成------总进度:" + wdInfos1.size() + "/" + index++);
+//
+//            //WdTopological
+//            WdTopological wdTopological = new WdTopological();
+//            wdTopological.setCenterWdId(wdInfo.getWdId());
+//            wdTopological.setCenterWdName(wdInfo.getWdName());
+//            wdTopological.setAnalyseTime(now);
+//
 //            //3.开始分析
 //            for (WdInfo info : wdInfos) {
 //
@@ -152,51 +538,50 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //                    }
 //                }
 //
-//                //3.1 WdTopological
-//                WdTopological wdTopological = new WdTopological();
-//                wdTopological.setCenterWdId(wdInfo.getWdId());
-//                wdTopological.setCenterWdName(wdInfo.getWdName());
-//                wdTopological.setRadius(r);
-//                wdTopological.setAroundWdId(info.getWdId());
-//                wdTopological.setAroundWdName(info.getWdName());
-//                wdTopological.setAroundWdTypeCode(info.getWdTypeCode());
-//                wdTopological.setAddrCode(info.getAddrCode());
-//                wdTopological.setAddrCodeInfo(info.getAddrInfo());
-//                wdTopological.setAddrInfo(info.getAddrInfo());
-//                wdTopological.setLat(info.getLat());
-//                wdTopological.setLng(info.getLng());
-//                wdTopological.setGeoHash(info.getGeoHash());
-//                wdTopological.setAroundTypeCodeBy(info.getTypeCodeBy());
-//                wdTopological.setDistance(meter2);
-//                wdTopological.setAnalyseTime(now);
-//
-//                wdTopologicals.add(wdTopological);
-//
+//                //3.2 组装WdTologicalItem
+//                WdToologicalItem wdToologicalItem = new WdToologicalItem();
+//                wdToologicalItem.setAroundWdId(info.getWdId());
+//                wdToologicalItem.setAroundWdName(info.getWdName());
+//                wdToologicalItem.setAddrCodeInfo(info.getAddrInfo());
+//                wdToologicalItem.setAddrCode(info.getAddrCode());
+//                wdToologicalItem.setAddrInfo(info.getAddrInfo());
+//                wdToologicalItem.setLat(info.getLat());
+//                wdToologicalItem.setLng(info.getLng());
+//                wdToologicalItem.setAroundWdTypeCode(info.getWdTypeCode());
+//                wdToologicalItem.setAroundTypeCodeBy(info.getTypeCodeBy());
+//                wdToologicalItem.setDistance(meter2);
+//
+//                //3.3 将WdTologicalItem放入满足半径的区域
+//                wdToologicalItemList[p].add(wdToologicalItem);
+//
+//                //3.4 犇云标签统计
 //                if (info.getTypeCodeBy() != null && !info.getTypeCodeBy().equals("")) {
-//                    HashMap<String, Integer> wdTopologicalInfoHash1 = wdTopologicalInfoHash[p];
-//                    Integer put = wdTopologicalInfoHash1.get(info.getTypeCodeBy());
-//                    if (put == null) {
-//                        wdTopologicalInfoHash1.put(info.getTypeCodeBy(), 1);
-//                    } else {
-//                        wdTopologicalInfoHash1.put(info.getTypeCodeBy(), wdTopologicalInfoHash1.get(info.getTypeCodeBy()) + 1);
+//                    for(int i=p;i>=0;i--){
+//                        HashMap<String, Integer> wdTopologicalInfoHash1 = wdTopologicalInfoHash[i];
+//                        Integer put = wdTopologicalInfoHash1.get(info.getTypeCodeBy());
+//                        if (put == null) {
+//                            wdTopologicalInfoHash1.put(info.getTypeCodeBy(), 1);
+//                        } else {
+//                            wdTopologicalInfoHash1.put(info.getTypeCodeBy(), wdTopologicalInfoHash1.get(info.getTypeCodeBy()) + 1);
+//                        }
 //                    }
 //                }
 //
-//                if (wdTopological.getAroundWdTypeCode().equals("1")) {
+//                if (wdToologicalItem.getAroundWdTypeCode().equals("1")) {
 //                    //门店网点
 //                    TopologicalStoreWd topologicalStoreWd = new TopologicalStoreWd();
 //                    topologicalStoreWd.setCenterWdId(wdTopological.getCenterWdId());
-//                    topologicalStoreWd.setRadius(wdTopological.getRadius());
+//                    topologicalStoreWd.setRadius(r);
 //
-//                    topologicalStoreWd.setAroundWdId(wdTopological.getAroundWdId());
-//                    topologicalStoreWd.setAroundWdName(wdTopological.getAroundWdName());
-//                    topologicalStoreWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+//                    topologicalStoreWd.setAroundWdId(wdToologicalItem.getAroundWdId());
+//                    topologicalStoreWd.setAroundWdName(wdToologicalItem.getAroundWdName());
+//                    topologicalStoreWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
 //
-//                    topologicalStoreWd.setAddrCode(wdTopological.getAddrCode());
-//                    topologicalStoreWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
-//                    topologicalStoreWd.setAddrInfo(wdTopological.getAddrInfo());
+//                    topologicalStoreWd.setAddrCode(wdToologicalItem.getAddrCode());
+//                    topologicalStoreWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
+//                    topologicalStoreWd.setAddrInfo(wdToologicalItem.getAddrInfo());
 //
-//                    topologicalStoreWd.setDistance(wdTopological.getDistance());
+//                    topologicalStoreWd.setDistance(wdToologicalItem.getDistance());
 //
 //                    //门店分析
 //                    StoreWd storeWd = storeWdDao.selectById(info.getWdId());
@@ -206,19 +591,21 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //                        topologicalStoreWd.setManageTypeCode(manageTypeCode);
 //                        topologicalStoreWd.setBrandId(storeWd.getBrandId());
 //
-//                        //分析经营分类
+//                        //TODO 分析经营分类
 //                        if (manageTypeCode != null && !manageTypeCode.equals("")) {
-//                            HashMap<String, HashMap<String, Integer>> stringHashMapHashMap = storeCategory[p];
-//                            HashMap<String, Integer> hashMap = stringHashMapHashMap.get(manageTypeCode.substring(0, 4));
-//                            if (hashMap == null) {
-//                                HashMap<String, Integer> map = new HashMap<>();
-//                                map.put(manageTypeCode, 1);
-//                            } else {
-//                                Integer integer = hashMap.get(manageTypeCode);
-//                                if (integer == null)
-//                                    hashMap.put(manageTypeCode, 1);
-//                                else
-//                                    hashMap.put(manageTypeCode, hashMap.get(manageTypeCode) + 1);
+//                            for(int i=p;i>=0;i--){
+//                                HashMap<String, HashMap<String, Integer>> stringHashMapHashMap = storeCategory[i];
+//                                HashMap<String, Integer> hashMap = stringHashMapHashMap.get(manageTypeCode.substring(0, 4));
+//                                if (hashMap == null) {
+//                                    HashMap<String, Integer> map = new HashMap<>();
+//                                    map.put(manageTypeCode, 1);
+//                                } else {
+//                                    Integer integer = hashMap.get(manageTypeCode);
+//                                    if (integer == null)
+//                                        hashMap.put(manageTypeCode, 1);
+//                                    else
+//                                        hashMap.put(manageTypeCode, hashMap.get(manageTypeCode) + 1);
+//                                }
 //                            }
 //                        }
 //
@@ -226,24 +613,21 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //
 //                    topologicalStoreWd.setAnalyseTime(wdTopological.getAnalyseTime());
 //                    topologicalStoreWds.add(topologicalStoreWd);
-//                } else if (wdTopological.getAroundWdTypeCode().equals("2")) {
+//                } else if (wdToologicalItem.getAroundWdTypeCode().equals("2")) {
 //                    //小区网点
 //                    TopologicalHouseWd topologicalHouseWd = new TopologicalHouseWd();
 //                    topologicalHouseWd.setCenterWdId(wdTopological.getCenterWdId());
-//                    topologicalHouseWd.setRadius(wdTopological.getRadius());
-//
-//                    topologicalHouseWd.setAroundWdId(wdTopological.getAroundWdId());
-//                    topologicalHouseWd.setAroundWdName(wdTopological.getAroundWdName());
-//                    topologicalHouseWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+//                    topologicalHouseWd.setRadius(r);
 //
-//                    topologicalHouseWd.setAddrCode(wdTopological.getAddrCode());
-//                    topologicalHouseWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
-//                    topologicalHouseWd.setAddrInfo(wdTopological.getAddrInfo());
+//                    topologicalHouseWd.setAroundWdId(wdToologicalItem.getAroundWdId());
+//                    topologicalHouseWd.setAroundWdName(wdToologicalItem.getAroundWdName());
+//                    topologicalHouseWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
 //
-//                    topologicalHouseWd.setDistance(wdTopological.getDistance());
+//                    topologicalHouseWd.setAddrCode(wdToologicalItem.getAddrCode());
+//                    topologicalHouseWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
+//                    topologicalHouseWd.setAddrInfo(wdToologicalItem.getAddrInfo());
 //
-//                    HashMap<String, Double> houseDatum = houseData[p];
-//                    houseDatum.put("houseWdCount", houseDatum.get("houseWdCount") + 1.0);
+//                    topologicalHouseWd.setDistance(wdToologicalItem.getDistance());
 //
 //                    //小区分析
 //                    HouseWd houseWd = houseWdDao.selectById(info.getWdId());
@@ -252,30 +636,38 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //                        topologicalHouseWd.setRent(info.getRent());
 //                        topologicalHouseWd.setPeopleCount(houseWd.getPeopleCount());
 //                        topologicalHouseWd.setPropertyType(houseWd.getPropertyType());
+//                    }
+//
+//                    //小区关键信息
+//                    for(int i=p;i>=0;i--){
+//                        HashMap<String, Double> houseDatum = houseData[i];
+//                        houseDatum.put("houseWdCount", houseDatum.get("houseWdCount") + 1.0);
 //
 //                        //小区关键信息统计
-//                        houseDatum.put("totalRent", houseDatum.get("totalRent") + topologicalHouseWd.getRent());
-//                        houseDatum.put("totalHouseholds", houseDatum.get("totalHouseholds") + topologicalHouseWd.getHouseholds());
-//                        houseDatum.put("totalPeopleCount", houseDatum.get("totalPeopleCount") + topologicalHouseWd.getPeopleCount());
+//                        if (houseWd != null) {
+//                            houseDatum.put("totalRent", houseDatum.get("totalRent") + topologicalHouseWd.getRent());
+//                            houseDatum.put("totalHouseholds", houseDatum.get("totalHouseholds") + topologicalHouseWd.getHouseholds());
+//                            houseDatum.put("totalPeopleCount", houseDatum.get("totalPeopleCount") + topologicalHouseWd.getPeopleCount());
+//                        }
 //                    }
 //
 //                    topologicalHouseWd.setAnalyseTime(wdTopological.getAnalyseTime());
 //                    topologicalHouseWds.add(topologicalHouseWd);
-//                } else if (wdTopological.getAroundWdTypeCode().equals("3")) {
+//                } else if (wdToologicalItem.getAroundWdTypeCode().equals("3")) {
 //                    //楼宇网点
 //                    TopologicalBuildingWd topologicalBuildingWd = new TopologicalBuildingWd();
 //                    topologicalBuildingWd.setCenterWdId(wdTopological.getCenterWdId());
-//                    topologicalBuildingWd.setRadius(wdTopological.getRadius());
+//                    topologicalBuildingWd.setRadius(r);
 //
-//                    topologicalBuildingWd.setAroundWdId(wdTopological.getAroundWdId());
-//                    topologicalBuildingWd.setAroundWdName(wdTopological.getAroundWdName());
-//                    topologicalBuildingWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+//                    topologicalBuildingWd.setAroundWdId(wdToologicalItem.getAroundWdId());
+//                    topologicalBuildingWd.setAroundWdName(wdToologicalItem.getAroundWdName());
+//                    topologicalBuildingWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
 //
-//                    topologicalBuildingWd.setAddrCode(wdTopological.getAddrCode());
-//                    topologicalBuildingWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
-//                    topologicalBuildingWd.setAddrInfo(wdTopological.getAddrInfo());
+//                    topologicalBuildingWd.setAddrCode(wdToologicalItem.getAddrCode());
+//                    topologicalBuildingWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
+//                    topologicalBuildingWd.setAddrInfo(wdToologicalItem.getAddrInfo());
 //
-//                    topologicalBuildingWd.setDistance(wdTopological.getDistance());
+//                    topologicalBuildingWd.setDistance(wdToologicalItem.getDistance());
 //
 //                    //楼宇分析
 //                    BuildWd buildWd = buildWdDao.selectById(info.getWdId());
@@ -286,33 +678,34 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //
 //                        //分析楼宇分类
 //                        if (topologicalBuildingWd.getPropertyType() != null && !topologicalBuildingWd.getPropertyType().equals("")) {
-//                            HashMap<String, Integer> buildCategoryMap = buildCategory[p];
-//                            Integer integer = buildCategoryMap.get(topologicalBuildingWd.getPropertyType());
-//                            if (integer == null) {
-//                                buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), 1);
-//                            } else
-//                                buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), buildCategoryMap.get(topologicalBuildingWd.getPropertyType()) + 1);
-//
+//                            for(int i=p;i>=0;i--){
+//                                HashMap<String, Integer> buildCategoryMap = buildCategory[i];
+//                                Integer integer = buildCategoryMap.get(topologicalBuildingWd.getPropertyType());
+//                                if (integer == null) {
+//                                    buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), 1);
+//                                } else
+//                                    buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), buildCategoryMap.get(topologicalBuildingWd.getPropertyType()) + 1);
+//                            }
 //                        }
 //                    }
 //
 //                    topologicalBuildingWd.setAnalyseTime(wdTopological.getAnalyseTime());
 //                    topologicalBuildingWds.add(topologicalBuildingWd);
-//                } else if (wdTopological.getAroundWdTypeCode().equals("5")) {
+//                } else if (wdToologicalItem.getAroundWdTypeCode().equals("5")) {
 //                    //公司网点
 //                    TopologicalEnterpriseWd topologicalEnterpriseWd = new TopologicalEnterpriseWd();
 //                    topologicalEnterpriseWd.setCenterWdId(wdTopological.getCenterWdId());
-//                    topologicalEnterpriseWd.setRadius(wdTopological.getRadius());
+//                    topologicalEnterpriseWd.setRadius(r);
 //
-//                    topologicalEnterpriseWd.setAroundWdId(wdTopological.getAroundWdId());
-//                    topologicalEnterpriseWd.setAroundWdName(wdTopological.getAroundWdName());
-//                    topologicalEnterpriseWd.setAroundWdTypeCode(wdTopological.getAroundWdTypeCode());
+//                    topologicalEnterpriseWd.setAroundWdId(wdToologicalItem.getAroundWdId());
+//                    topologicalEnterpriseWd.setAroundWdName(wdToologicalItem.getAroundWdName());
+//                    topologicalEnterpriseWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
 //
-//                    topologicalEnterpriseWd.setAddrCode(wdTopological.getAddrCode());
-//                    topologicalEnterpriseWd.setAddrCodeInfo(wdTopological.getAddrCodeInfo());
-//                    topologicalEnterpriseWd.setAddrInfo(wdTopological.getAddrInfo());
+//                    topologicalEnterpriseWd.setAddrCode(wdToologicalItem.getAddrCode());
+//                    topologicalEnterpriseWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
+//                    topologicalEnterpriseWd.setAddrInfo(wdToologicalItem.getAddrInfo());
 //
-//                    topologicalEnterpriseWd.setDistance(wdTopological.getDistance());
+//                    topologicalEnterpriseWd.setDistance(wdToologicalItem.getDistance());
 //
 //                    //公司分析
 //                    EnterpriseWd enterpriseWd = enterpriseWdDao.selectById(info.getWdId());
@@ -338,16 +731,22 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //                HashMap<String, HashMap<String, Integer>> stringHashMapHashMap = storeCategory[i];
 //                for (String s : stringHashMapHashMap.keySet()) {
 //                    storeWdStatisticsCategory.setBigManageTypeCode(s.substring(0, 2) + "0000");
-//                    storeWdStatisticsCategory.setMidManageTypeCode(s);
 //
 //                    HashMap<String, Integer> hashMap = stringHashMapHashMap.get(s);
 //                    StringBuilder stringBuilder = new StringBuilder();
+//                    int total = 0;
 //                    for (String s1 : hashMap.keySet()) {
-//                        stringBuilder.append(s1);
-//                        stringBuilder.append(":");
-//                        stringBuilder.append(hashMap.get(s1));
-//                        stringBuilder.append(";");
+//                        total+=hashMap.get(s1);
+//
+//                        if(!s.equals(s1)){
+//                            stringBuilder.append(s1);
+//                            stringBuilder.append(":");
+//                            stringBuilder.append(hashMap.get(s1));
+//                            stringBuilder.append(";");
+//                        }else
+//                            break;
 //                    }
+//                    storeWdStatisticsCategory.setMidManageTypeCode(s+":"+total);
 //                    storeWdStatisticsCategory.setSubCategoryCodeStatistics(stringBuilder.toString());
 //                    storeWdStatisticsCategory.setAnalyseTime(now);
 //                    storeWdStatisticsCategoryList.add(storeWdStatisticsCategory);
@@ -416,445 +815,46 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
 //                wdTopologicalInfoList.add(wdTopologicalInfo);
 //            }
 //
+//            //TODO 网点拓扑
+//            for (int i = 0; i < anly.size(); i++) {
+//                WdTopological wdTopological1 = new WdTopological();
+//                wdTopological1.setCenterWdId(wdTopological.getCenterWdId());
+//                wdTopological1.setCenterWdName(wdTopological.getCenterWdName());
+//                wdTopological1.setAnalyseTime(wdTopological.getAnalyseTime());
+//                wdTopological1.setRadius(anly.get(i));
+//                String o = JSON.toJSON(wdToologicalItemList[i]).toString();
+//                wdTopological1.setAroundWdInfo(o);
+//                wdTopologicals.add(wdTopological1);
+//            }
+//
 //            System.out.println("完成------");
 //
 //
 //            //4.导入数据库
-//            if (topologicalStoreWds.isEmpty())
-//                continue;
-//
-//            wdTopologicalDao.insertList(wdTopologicals);//保存网点拓扑
-//
-//            //4.1 保存拓扑信息
-//            if (!topologicalStoreWds.isEmpty())
-//                topologicalStoreWdDao.insertList(topologicalStoreWds);
-//            if (!topologicalHouseWds.isEmpty())
-//                topologicalHouseWdDao.insertList(topologicalHouseWds);
-//            if (!topologicalBuildingWds.isEmpty())
-//                topologicalBuildWdDao.insertList(topologicalBuildingWds);
-//            if (!topologicalEnterpriseWds.isEmpty()){
-//                topologicalEnterpriseWdDao.insertList(topologicalEnterpriseWds);
-//            }
 //
-//            //4.2 保存其他相关统计信息
-//            if (!houseWdStatisticsDataList.isEmpty())
-//                houseWdStatisticsDataDao.insertList(houseWdStatisticsDataList);
-//            if (!storeWdStatisticsCategoryList.isEmpty())
-//                storeWdStatisticsCategoryDao.insertList(storeWdStatisticsCategoryList);
-//            if (!buildWdStatisticsCategoryList.isEmpty())
-//                buildWdStatisticsCategoryDao.insertList(buildWdStatisticsCategoryList);
-//            if (!wdTopologicalInfoList.isEmpty())
-//                wdTopologicalInfoDao.insertList(wdTopologicalInfoList);
+////            wdTopologicalDao.insertList(wdTopologicals);//保存网点拓扑
+////
+////            //4.1 保存拓扑信息
+////            if (!topologicalStoreWds.isEmpty())
+////                topologicalStoreWdDao.insertList(topologicalStoreWds);
+////            if (!topologicalHouseWds.isEmpty())
+////                topologicalHouseWdDao.insertList(topologicalHouseWds);
+////            if (!topologicalBuildingWds.isEmpty())
+////                topologicalBuildWdDao.insertList(topologicalBuildingWds);
+////            if (!topologicalEnterpriseWds.isEmpty()){
+////                topologicalEnterpriseWdDao.insertList(topologicalEnterpriseWds);
+////            }
+////
+////            //4.2 保存其他相关统计信息
+////            if (!houseWdStatisticsDataList.isEmpty())
+////                houseWdStatisticsDataDao.insertList(houseWdStatisticsDataList);
+////            if (!storeWdStatisticsCategoryList.isEmpty())
+////                storeWdStatisticsCategoryDao.insertList(storeWdStatisticsCategoryList);
+////            if (!buildWdStatisticsCategoryList.isEmpty())
+////                buildWdStatisticsCategoryDao.insertList(buildWdStatisticsCategoryList);
+////            if (!wdTopologicalInfoList.isEmpty())
+////                wdTopologicalInfoDao.insertList(wdTopologicalInfoList);
 //
 //        }
 //    }
-
-    @Override
-    public void analyse() {
-        ZoneId zone = ZoneId.of("Asia/Shanghai");
-        LocalDateTime now = LocalDateTime.now(zone);  //分析时间
-
-        //测试需要
-        QueryWrapper<WdInfo> queryWrapper1 = new QueryWrapper<>();
-        queryWrapper1.eq("wd_type_code", "5");
-
-        List<WdInfo> wdInfos1 = wdInfoDao.selectList(queryWrapper1);
-        int index = 1;
-        //1.遍历所有网点
-        for (WdInfo wdInfo : wdInfos1) {
-            //1.找到该点半径 r = 4.89km 内的所有点
-            QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
-            queryWrapper.likeRight("geo_hash", wdInfo.getGeoHash().substring(0, 5));
-            List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
-
-            //2.初始化
-            //关键信息统计
-            HashMap<String, HashMap<String, Integer>>[] storeCategory = new HashMap[anly.size()];  //经营分类统计:<中类,<小类,数量>>
-            HashMap<String, Double>[] houseData = new HashMap[anly.size()];  //小区分析统计:key:totalHouseholds、totalPeopleCount、totalRent
-            HashMap<String, Integer>[] buildCategory = new HashMap[anly.size()];   //楼宇网点分析统计,key:甲类、乙类...
-            HashMap<String, Integer>[] wdTopologicalInfoHash = new HashMap[anly.size()];  //分类tag:key:byCode value:数量
-            List<WdToologicalItem>[] wdToologicalItemList = new ArrayList[anly.size()];
-
-            for (int i = 0; i < anly.size(); i++) {
-                storeCategory[i] = new HashMap<>();
-                houseData[i] = new HashMap<>();
-                houseData[i].put("houseWdCount", 0.0);
-                houseData[i].put("totalHouseholds", 0.0);   //总户数
-                houseData[i].put("totalPeopleCount", 0.0);  //总人口数
-                houseData[i].put("totalRent", 0.0); //房价
-                buildCategory[i] = new HashMap<>();
-                wdTopologicalInfoHash[i] = new HashMap<>();
-                wdToologicalItemList[i] = new ArrayList<>();
-            }
-
-            //关键信息集合
-            List<TopologicalStoreWdStatisticsCategory> storeWdStatisticsCategoryList = new ArrayList<>();
-            List<TopologicalBuildWdStatisticsCategory> buildWdStatisticsCategoryList = new ArrayList<>();
-            List<TopologicalHouseWdStatisticsData> houseWdStatisticsDataList = new ArrayList<>();
-            List<WdTopologicalInfo> wdTopologicalInfoList = new ArrayList<>();
-
-            //各拓扑网点集合
-            List<WdTopological> wdTopologicals = new ArrayList<>();
-            List<TopologicalEnterpriseWd> topologicalEnterpriseWds = new ArrayList<>();
-            List<TopologicalStoreWd> topologicalStoreWds = new ArrayList<>();
-            List<TopologicalHouseWd> topologicalHouseWds = new ArrayList<>();
-            List<TopologicalBuildingWd> topologicalBuildingWds = new ArrayList<>();
-
-            System.out.println("初始化完成------总进度:" + wdInfos1.size() + "/" + index++);
-
-            //WdTopological
-            WdTopological wdTopological = new WdTopological();
-            wdTopological.setCenterWdId(wdInfo.getWdId());
-            wdTopological.setCenterWdName(wdInfo.getWdName());
-            wdTopological.setAnalyseTime(now);
-
-            //3.开始分析
-            for (WdInfo info : wdInfos) {
-
-                //网点等于自己不要
-                if (info.getWdId().equals(wdInfo.getWdId()))
-                    continue;
-
-                //计算距离
-                GlobalCoordinates source = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
-                GlobalCoordinates target = new GlobalCoordinates(info.getLat().doubleValue(), info.getLng().doubleValue());
-                double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
-
-                //大于4.89Km不要
-                if (meter2 > anly.get(0))
-                    continue;
-
-                Integer r = anly.get(anly.size() - 1);
-                int p = anly.size() - 1; //记录r位置
-                for (int i = 1; i < anly.size(); i++) {
-                    if (meter2 > anly.get(i)) {
-                        r = anly.get(i - 1);
-                        p = i - 1;
-                        break;
-                    } else if (meter2 == anly.get(i)) {
-                        r = anly.get(i);
-                        p = i;
-                        break;
-                    }
-                }
-
-                //3.2 组装WdTologicalItem
-                WdToologicalItem wdToologicalItem = new WdToologicalItem();
-                wdToologicalItem.setAroundWdId(info.getWdId());
-                wdToologicalItem.setAroundWdName(info.getWdName());
-                wdToologicalItem.setAddrCodeInfo(info.getAddrInfo());
-                wdToologicalItem.setAddrCode(info.getAddrCode());
-                wdToologicalItem.setAddrInfo(info.getAddrInfo());
-                wdToologicalItem.setLat(info.getLat());
-                wdToologicalItem.setLng(info.getLng());
-                wdToologicalItem.setAroundWdTypeCode(info.getWdTypeCode());
-                wdToologicalItem.setAroundTypeCodeBy(info.getTypeCodeBy());
-                wdToologicalItem.setDistance(meter2);
-
-                //3.3 将WdTologicalItem放入满足半径的区域
-                wdToologicalItemList[p].add(wdToologicalItem);
-
-                //3.4 犇云标签统计
-                if (info.getTypeCodeBy() != null && !info.getTypeCodeBy().equals("")) {
-                    for(int i=p;i>=0;i--){
-                        HashMap<String, Integer> wdTopologicalInfoHash1 = wdTopologicalInfoHash[i];
-                        Integer put = wdTopologicalInfoHash1.get(info.getTypeCodeBy());
-                        if (put == null) {
-                            wdTopologicalInfoHash1.put(info.getTypeCodeBy(), 1);
-                        } else {
-                            wdTopologicalInfoHash1.put(info.getTypeCodeBy(), wdTopologicalInfoHash1.get(info.getTypeCodeBy()) + 1);
-                        }
-                    }
-                }
-
-                if (wdToologicalItem.getAroundWdTypeCode().equals("1")) {
-                    //门店网点
-                    TopologicalStoreWd topologicalStoreWd = new TopologicalStoreWd();
-                    topologicalStoreWd.setCenterWdId(wdTopological.getCenterWdId());
-                    topologicalStoreWd.setRadius(r);
-
-                    topologicalStoreWd.setAroundWdId(wdToologicalItem.getAroundWdId());
-                    topologicalStoreWd.setAroundWdName(wdToologicalItem.getAroundWdName());
-                    topologicalStoreWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
-
-                    topologicalStoreWd.setAddrCode(wdToologicalItem.getAddrCode());
-                    topologicalStoreWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
-                    topologicalStoreWd.setAddrInfo(wdToologicalItem.getAddrInfo());
-
-                    topologicalStoreWd.setDistance(wdToologicalItem.getDistance());
-
-                    //门店分析
-                    StoreWd storeWd = storeWdDao.selectById(info.getWdId());
-                    if (storeWd != null) {
-                        topologicalStoreWd.setIndustryCode(storeWd.getIndustryCode());
-                        String manageTypeCode = storeWd.getManageTypeCode();
-                        topologicalStoreWd.setManageTypeCode(manageTypeCode);
-                        topologicalStoreWd.setBrandId(storeWd.getBrandId());
-
-                        //TODO 分析经营分类
-                        if (manageTypeCode != null && !manageTypeCode.equals("")) {
-                            for(int i=p;i>=0;i--){
-                                HashMap<String, HashMap<String, Integer>> stringHashMapHashMap = storeCategory[i];
-                                HashMap<String, Integer> hashMap = stringHashMapHashMap.get(manageTypeCode.substring(0, 4));
-                                if (hashMap == null) {
-                                    HashMap<String, Integer> map = new HashMap<>();
-                                    map.put(manageTypeCode, 1);
-                                } else {
-                                    Integer integer = hashMap.get(manageTypeCode);
-                                    if (integer == null)
-                                        hashMap.put(manageTypeCode, 1);
-                                    else
-                                        hashMap.put(manageTypeCode, hashMap.get(manageTypeCode) + 1);
-                                }
-                            }
-                        }
-
-                    }
-
-                    topologicalStoreWd.setAnalyseTime(wdTopological.getAnalyseTime());
-                    topologicalStoreWds.add(topologicalStoreWd);
-                } else if (wdToologicalItem.getAroundWdTypeCode().equals("2")) {
-                    //小区网点
-                    TopologicalHouseWd topologicalHouseWd = new TopologicalHouseWd();
-                    topologicalHouseWd.setCenterWdId(wdTopological.getCenterWdId());
-                    topologicalHouseWd.setRadius(r);
-
-                    topologicalHouseWd.setAroundWdId(wdToologicalItem.getAroundWdId());
-                    topologicalHouseWd.setAroundWdName(wdToologicalItem.getAroundWdName());
-                    topologicalHouseWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
-
-                    topologicalHouseWd.setAddrCode(wdToologicalItem.getAddrCode());
-                    topologicalHouseWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
-                    topologicalHouseWd.setAddrInfo(wdToologicalItem.getAddrInfo());
-
-                    topologicalHouseWd.setDistance(wdToologicalItem.getDistance());
-
-                    //小区分析
-                    HouseWd houseWd = houseWdDao.selectById(info.getWdId());
-                    if (houseWd != null) {
-                        topologicalHouseWd.setHouseholds(houseWd.getHouseholds());
-                        topologicalHouseWd.setRent(info.getRent());
-                        topologicalHouseWd.setPeopleCount(houseWd.getPeopleCount());
-                        topologicalHouseWd.setPropertyType(houseWd.getPropertyType());
-                    }
-
-                    //小区关键信息
-                    for(int i=p;i>=0;i--){
-                        HashMap<String, Double> houseDatum = houseData[i];
-                        houseDatum.put("houseWdCount", houseDatum.get("houseWdCount") + 1.0);
-
-                        //小区关键信息统计
-                        if (houseWd != null) {
-                            houseDatum.put("totalRent", houseDatum.get("totalRent") + topologicalHouseWd.getRent());
-                            houseDatum.put("totalHouseholds", houseDatum.get("totalHouseholds") + topologicalHouseWd.getHouseholds());
-                            houseDatum.put("totalPeopleCount", houseDatum.get("totalPeopleCount") + topologicalHouseWd.getPeopleCount());
-                        }
-                    }
-
-                    topologicalHouseWd.setAnalyseTime(wdTopological.getAnalyseTime());
-                    topologicalHouseWds.add(topologicalHouseWd);
-                } else if (wdToologicalItem.getAroundWdTypeCode().equals("3")) {
-                    //楼宇网点
-                    TopologicalBuildingWd topologicalBuildingWd = new TopologicalBuildingWd();
-                    topologicalBuildingWd.setCenterWdId(wdTopological.getCenterWdId());
-                    topologicalBuildingWd.setRadius(r);
-
-                    topologicalBuildingWd.setAroundWdId(wdToologicalItem.getAroundWdId());
-                    topologicalBuildingWd.setAroundWdName(wdToologicalItem.getAroundWdName());
-                    topologicalBuildingWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
-
-                    topologicalBuildingWd.setAddrCode(wdToologicalItem.getAddrCode());
-                    topologicalBuildingWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
-                    topologicalBuildingWd.setAddrInfo(wdToologicalItem.getAddrInfo());
-
-                    topologicalBuildingWd.setDistance(wdToologicalItem.getDistance());
-
-                    //楼宇分析
-                    BuildWd buildWd = buildWdDao.selectById(info.getWdId());
-                    if (buildWd != null) {
-                        topologicalBuildingWd.setRent(info.getRent());
-                        topologicalBuildingWd.setBuildType(buildWd.getBuildType());
-                        topologicalBuildingWd.setPropertyType(buildWd.getPropertyType());
-
-                        //分析楼宇分类
-                        if (topologicalBuildingWd.getPropertyType() != null && !topologicalBuildingWd.getPropertyType().equals("")) {
-                            for(int i=p;i>=0;i--){
-                                HashMap<String, Integer> buildCategoryMap = buildCategory[i];
-                                Integer integer = buildCategoryMap.get(topologicalBuildingWd.getPropertyType());
-                                if (integer == null) {
-                                    buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), 1);
-                                } else
-                                    buildCategoryMap.put(topologicalBuildingWd.getPropertyType(), buildCategoryMap.get(topologicalBuildingWd.getPropertyType()) + 1);
-                            }
-                        }
-                    }
-
-                    topologicalBuildingWd.setAnalyseTime(wdTopological.getAnalyseTime());
-                    topologicalBuildingWds.add(topologicalBuildingWd);
-                } else if (wdToologicalItem.getAroundWdTypeCode().equals("5")) {
-                    //公司网点
-                    TopologicalEnterpriseWd topologicalEnterpriseWd = new TopologicalEnterpriseWd();
-                    topologicalEnterpriseWd.setCenterWdId(wdTopological.getCenterWdId());
-                    topologicalEnterpriseWd.setRadius(r);
-
-                    topologicalEnterpriseWd.setAroundWdId(wdToologicalItem.getAroundWdId());
-                    topologicalEnterpriseWd.setAroundWdName(wdToologicalItem.getAroundWdName());
-                    topologicalEnterpriseWd.setAroundWdTypeCode(wdToologicalItem.getAroundWdTypeCode());
-
-                    topologicalEnterpriseWd.setAddrCode(wdToologicalItem.getAddrCode());
-                    topologicalEnterpriseWd.setAddrCodeInfo(wdToologicalItem.getAddrCodeInfo());
-                    topologicalEnterpriseWd.setAddrInfo(wdToologicalItem.getAddrInfo());
-
-                    topologicalEnterpriseWd.setDistance(wdToologicalItem.getDistance());
-
-                    //公司分析
-                    EnterpriseWd enterpriseWd = enterpriseWdDao.selectById(info.getWdId());
-                    if (enterpriseWd != null) {
-                        Enterprise enterprise = enterpriseDao.selectById(enterpriseWd.getEnterpriseUsci());
-                        if (enterprise != null) {
-                            topologicalEnterpriseWd.setIndustryCode(enterprise.getIndustryCode());
-                            topologicalEnterpriseWd.setRegisteredCapital(enterprise.getRegisteredCapital());
-                            topologicalEnterpriseWd.setEnterpriseScale(enterprise.getEnterpriseScale());
-                        }
-                    }
-                    topologicalEnterpriseWd.setAnalyseTime(wdTopological.getAnalyseTime());
-                    topologicalEnterpriseWds.add(topologicalEnterpriseWd);
-                }
-
-            }
-
-            //TODO 门店分类
-            for (int i = 0; i < anly.size(); i++) {
-                TopologicalStoreWdStatisticsCategory storeWdStatisticsCategory = new TopologicalStoreWdStatisticsCategory();
-                storeWdStatisticsCategory.setCenterWdId(wdInfo.getWdId());
-                storeWdStatisticsCategory.setRadius(anly.get(i));
-                HashMap<String, HashMap<String, Integer>> stringHashMapHashMap = storeCategory[i];
-                for (String s : stringHashMapHashMap.keySet()) {
-                    storeWdStatisticsCategory.setBigManageTypeCode(s.substring(0, 2) + "0000");
-
-                    HashMap<String, Integer> hashMap = stringHashMapHashMap.get(s);
-                    StringBuilder stringBuilder = new StringBuilder();
-                    int total = 0;
-                    for (String s1 : hashMap.keySet()) {
-                        total+=hashMap.get(s1);
-
-                        if(!s.equals(s1)){
-                            stringBuilder.append(s1);
-                            stringBuilder.append(":");
-                            stringBuilder.append(hashMap.get(s1));
-                            stringBuilder.append(";");
-                        }else
-                            break;
-                    }
-                    storeWdStatisticsCategory.setMidManageTypeCode(s+":"+total);
-                    storeWdStatisticsCategory.setSubCategoryCodeStatistics(stringBuilder.toString());
-                    storeWdStatisticsCategory.setAnalyseTime(now);
-                    storeWdStatisticsCategoryList.add(storeWdStatisticsCategory);
-                }
-            }
-
-            //TODO 楼宇分类
-            for (int i = 0; i < anly.size(); i++) {
-                TopologicalBuildWdStatisticsCategory buildWdStatisticsCategory = new TopologicalBuildWdStatisticsCategory();
-                buildWdStatisticsCategory.setCenterWdId(wdInfo.getWdId());
-                buildWdStatisticsCategory.setRadius(anly.get(i));
-
-                HashMap<String, Integer> hashMap = buildCategory[i];
-                StringBuilder stringBuilder = new StringBuilder();
-                for (String s : hashMap.keySet()) {
-                    stringBuilder.append(s + ":" + hashMap.get(s) + ";");
-                }
-                buildWdStatisticsCategory.setPropertyTypeStatistics(stringBuilder.toString());
-                buildWdStatisticsCategory.setAnalyseTime(now);
-                buildWdStatisticsCategoryList.add(buildWdStatisticsCategory);
-            }
-
-            //TODO 社区关键数据
-            for (int i = 0; i < anly.size(); i++) {
-                TopologicalHouseWdStatisticsData houseWdStatisticsData = new TopologicalHouseWdStatisticsData();
-                houseWdStatisticsData.setCenterWdId(wdInfo.getWdId());
-                houseWdStatisticsData.setRadius(anly.get(i));
-                HashMap<String, Double> houseDatum = houseData[i];
-                double houseWdCount = houseDatum.get("houseWdCount");
-                double totalHouseholds = houseDatum.get("totalHouseholds");
-                double totalPeopleCount = houseDatum.get("totalPeopleCount");
-                double totalRent = houseDatum.get("totalRent");
-                houseWdStatisticsData.setHouseWdCount((int) houseWdCount);
-                houseWdStatisticsData.setTotalHouseholds((int) totalHouseholds);
-                houseWdStatisticsData.setTotalPeopleCount((int) totalPeopleCount);
-                if(houseWdCount != 0.0)
-                    houseWdStatisticsData.setAverageRent(totalRent / houseWdCount);
-                else
-                    houseWdStatisticsData.setAverageRent(0.0);
-
-                houseWdStatisticsData.setAnalyseTime(now);
-                houseWdStatisticsDataList.add(houseWdStatisticsData);
-            }
-
-            //TODO 网点拓扑信息
-            for (int i = 0; i < anly.size(); i++) {
-                WdTopologicalInfo wdTopologicalInfo = new WdTopologicalInfo();
-                wdTopologicalInfo.setCenterWdId(wdInfo.getWdId());
-                wdTopologicalInfo.setCenterWdName(wdInfo.getWdName());
-                wdTopologicalInfo.setCenterWdTypeCode(wdInfo.getWdTypeCode());
-                wdTopologicalInfo.setTypeCodeBy(wdInfo.getTypeCodeBy());
-                wdTopologicalInfo.setLat(wdInfo.getLat());
-                wdTopologicalInfo.setLng(wdInfo.getLng());
-                wdTopologicalInfo.setRadius(anly.get(i));
-                wdTopologicalInfo.setAddrCode(wdInfo.getAddrCode());
-                wdTopologicalInfo.setAddrInfo(wdInfo.getAddrInfo());
-                wdTopologicalInfo.setGeoHash(wdInfo.getGeoHash());
-                wdTopologicalInfo.setAnalyseTime(now);
-
-                HashMap<String, Integer> wdTopologicalInfoHash1 = wdTopologicalInfoHash[i];
-                StringBuilder stringBuilder = new StringBuilder();
-                for (String s : wdTopologicalInfoHash1.keySet()) {
-                    stringBuilder.append(s + ":" + wdTopologicalInfoHash1.get(s) + ";");
-                }
-                wdTopologicalInfo.setTag(stringBuilder.toString());
-                wdTopologicalInfoList.add(wdTopologicalInfo);
-            }
-
-            //TODO 网点拓扑
-            for (int i = 0; i < anly.size(); i++) {
-                WdTopological wdTopological1 = new WdTopological();
-                wdTopological1.setCenterWdId(wdTopological.getCenterWdId());
-                wdTopological1.setCenterWdName(wdTopological.getCenterWdName());
-                wdTopological1.setAnalyseTime(wdTopological.getAnalyseTime());
-                wdTopological1.setRadius(anly.get(i));
-                String o = JSON.toJSON(wdToologicalItemList[i]).toString();
-                wdTopological1.setAroundWdInfo(o);
-                wdTopologicals.add(wdTopological1);
-            }
-
-            System.out.println("完成------");
-
-
-            //4.导入数据库
-
-//            wdTopologicalDao.insertList(wdTopologicals);//保存网点拓扑
-//
-//            //4.1 保存拓扑信息
-//            if (!topologicalStoreWds.isEmpty())
-//                topologicalStoreWdDao.insertList(topologicalStoreWds);
-//            if (!topologicalHouseWds.isEmpty())
-//                topologicalHouseWdDao.insertList(topologicalHouseWds);
-//            if (!topologicalBuildingWds.isEmpty())
-//                topologicalBuildWdDao.insertList(topologicalBuildingWds);
-//            if (!topologicalEnterpriseWds.isEmpty()){
-//                topologicalEnterpriseWdDao.insertList(topologicalEnterpriseWds);
-//            }
-//
-//            //4.2 保存其他相关统计信息
-//            if (!houseWdStatisticsDataList.isEmpty())
-//                houseWdStatisticsDataDao.insertList(houseWdStatisticsDataList);
-//            if (!storeWdStatisticsCategoryList.isEmpty())
-//                storeWdStatisticsCategoryDao.insertList(storeWdStatisticsCategoryList);
-//            if (!buildWdStatisticsCategoryList.isEmpty())
-//                buildWdStatisticsCategoryDao.insertList(buildWdStatisticsCategoryList);
-//            if (!wdTopologicalInfoList.isEmpty())
-//                wdTopologicalInfoDao.insertList(wdTopologicalInfoList);
-
-        }
-    }
-}
+//}

+ 119 - 27
benyun-core/src/main/java/com/benyun/core/service/impl/ChannelMapServiceImpl.java

@@ -49,6 +49,9 @@ public class ChannelMapServiceImpl implements ChannelMapService {
     @Autowired
     AttentionPoolDao attentionPoolDao;
 
+    @Autowired
+    WdInfoDao wdInfoDao;
+
     @Override
     public WdCount area(List<String> channel, String rankType, String searchText, String[] addrCode) {
         long start = System.currentTimeMillis();
@@ -160,6 +163,98 @@ public class ChannelMapServiceImpl implements ChannelMapService {
     }
 
     //TODO 需要优化
+//    @Override
+//    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)) {
+//            //省码
+//            for (String s : addrCode) {
+//                String substring = s.substring(0, 2);
+//                addrCodeList.add(substring);
+//            }
+//        } else if ("city".equals(rankType)) {
+//            //省的所有市
+//            for (String s : addrCode) {
+//                String substring = s.substring(0, 4);
+//                addrCodeList.add(substring);
+//            }
+//        } else if ("zone".equals(rankType)) {
+//            //区
+//            for (String s : addrCode) {
+//                String substring = s.substring(0, 6);
+//                addrCodeList.add(substring);
+//            }
+//        } else {
+//            return null;
+//        }
+//
+//
+//        //2.根据地区前缀找到所有的网点
+//        QueryWrapper<WdTopologicalInfo> queryWrapper = new QueryWrapper<>();
+//        queryWrapper.in("center_wd_type_code", channel).and(originWdInfoQueryWrapper -> {
+//            for (String s : addrCodeList) {
+//                originWdInfoQueryWrapper.likeRight("addr_code", s).or();
+//            }
+//        });
+//
+//        if (searchText != null && !searchText.trim().equals("")) {
+//            queryWrapper.and(originWdInfoQueryWrapper -> {
+//                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<WdTopologicalInfo> originWdInfos = wdTopologicalInfoDao.selectList(queryWrapper);
+//        PageInfo<WdTopologicalInfo> PageInfo = new PageInfo<>(originWdInfos);
+//
+//
+//        //组装
+//        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) {
+//                    if(typeByMap.get(split[0]) == null)
+//                        continue;
+//                    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
     public HashMap list(String[] channel, String rankType, String searchText, String orderby, String[] addrCode, int pageNum, int pageSize) {
         //1.根据不同级别得到地区码
@@ -188,8 +283,8 @@ public class ChannelMapServiceImpl implements ChannelMapService {
 
 
         //2.根据地区前缀找到所有的网点
-        QueryWrapper<WdTopologicalInfo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.in("center_wd_type_code", channel).and(originWdInfoQueryWrapper -> {
+        QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("wd_type_code", channel).and(originWdInfoQueryWrapper -> {
             for (String s : addrCodeList) {
                 originWdInfoQueryWrapper.likeRight("addr_code", s).or();
             }
@@ -197,48 +292,44 @@ public class ChannelMapServiceImpl implements ChannelMapService {
 
         if (searchText != null && !searchText.trim().equals("")) {
             queryWrapper.and(originWdInfoQueryWrapper -> {
-                originWdInfoQueryWrapper.like("center_wd_name", searchText);
+                originWdInfoQueryWrapper.like("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<WdTopologicalInfo> originWdInfos = wdTopologicalInfoDao.selectList(queryWrapper);
-        PageInfo<WdTopologicalInfo> PageInfo = new PageInfo<>(originWdInfos);
+        List<WdInfo> originWdInfos = wdInfoDao.selectList(queryWrapper);
+        PageInfo<WdInfo> PageInfo = new PageInfo<>(originWdInfos);
 
 
         //组装
-        List<WdTopologicalInfoBo> collect = PageInfo.getList().stream().map(wdTopologicalInfo -> {
-            wdTopologicalInfo.setAddrCodeInfo(addrCodeMap.get(wdTopologicalInfo.getAddrCode()));
+        List<WdTopologicalInfoBo> collect = PageInfo.getList().stream().map(wdInfo -> {
 
             List<String> list = new ArrayList<>();
-            String tag = wdTopologicalInfo.getTag();
-            for (String s : tag.split(";")) {
-                String[] split = s.split(":");
-                if (split != null && split.length == 2) {
-                    if(typeByMap.get(split[0]) == null)
-                        continue;
-                    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);
+            String tag = wdInfo.getTypeNameBy();
+            if(tag != null){
+                String[] split = tag.split(":");
+                for (String s : split) {
+                    list.add(s);
                 }
             }
 
-            WdTopologicalInfoBo wdTopologicalInfoBo = new WdTopologicalInfoBo(wdTopologicalInfo);
+
+            WdTopologicalInfoBo wdTopologicalInfoBo = new WdTopologicalInfoBo();
+            wdTopologicalInfoBo.setCenterWdId(wdInfo.getWdId());
+            wdTopologicalInfoBo.setCenterWdName(wdInfo.getWdName());
+            wdTopologicalInfoBo.setCenterWdTypeCode(wdInfo.getWdTypeCode());
+            wdTopologicalInfoBo.setAddrCode(wdInfo.getAddrCode());
+            wdTopologicalInfoBo.setAddrCodeInfo(addrCodeMap.get(wdInfo.getAddrCode()));
+            wdTopologicalInfoBo.setAddrInfo(wdInfo.getAddrInfo());
+            wdTopologicalInfoBo.setGeoHash(wdInfo.getGeoHash());
+            wdTopologicalInfoBo.setLat(wdInfo.getLat());
+            wdTopologicalInfoBo.setLng(wdInfo.getLng());
+
             wdTopologicalInfoBo.setTag(list);
             return wdTopologicalInfoBo;
         }).collect(Collectors.toList());
@@ -252,6 +343,7 @@ public class ChannelMapServiceImpl implements ChannelMapService {
         return result;
     }
 
+
     @Override
     public PageInfo<WdInfo> point(String[] channel, String searchText, String[] addrCode, int pageNum, int pageSize) {
         QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();

+ 122 - 28
benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalBuildWdSereviceImpl.java

@@ -3,22 +3,26 @@ package com.benyun.core.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.benyun.core.dao.TopologicalBuildWdDao;
 import com.benyun.core.dao.TopologicalBuildWdStatisticsCategoryDao;
-import com.benyun.core.entity.TopologicalBuildWdStatisticsCategory;
-import com.benyun.core.entity.TopologicalBuildingWd;
-import com.benyun.core.entity.TopologicalStoreWd;
-import com.benyun.core.entity.TopologicalStoreWdStatisticsCategory;
+import com.benyun.core.dao.WdInfoDao;
+import com.benyun.core.entity.*;
 import com.benyun.core.entity.bo.BuildWdCategoryCount;
 import com.benyun.core.entity.bo.StoreWdCategoryCount;
 import com.benyun.core.entity.bo.StoreWdCategoryCountBody;
 import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 import com.benyun.core.service.TopologicalBuildWdSerevice;
+import com.benyun.core.utils.DistanceUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 
 @Service
@@ -31,40 +35,130 @@ public class TopologicalBuildWdSereviceImpl implements TopologicalBuildWdSerevic
     @Autowired
     TopologicalBuildWdStatisticsCategoryDao topologicalBuildWdStatisticsCategoryDao;
 
+    @Autowired
+    WdInfoDao wdInfoDao;
+
+    @Autowired
+    @Qualifier("addrCodeMap")
+    HashMap<String,String> addrCodeMap;
+
+//    @Override
+//    public List<BuildWdCategoryCount> buildingLevel(TopologicalWdAceeptVo topologicalWdAceeptVo) {
+//        QueryWrapper<TopologicalBuildWdStatisticsCategory> queryWrapper = new QueryWrapper<>();
+//        queryWrapper.eq("center_wd_id",topologicalWdAceeptVo.getCenterWdId());
+//        queryWrapper.and(wrapper -> {
+//            wrapper.eq("radius",topologicalWdAceeptVo.getRadius());
+//        });
+//
+//        List<BuildWdCategoryCount> list = new ArrayList<>();
+//        TopologicalBuildWdStatisticsCategory topologicalBuildWdStatisticsCategory = topologicalBuildWdStatisticsCategoryDao.selectOne(queryWrapper);
+//        String propertyTypeStatistics = topologicalBuildWdStatisticsCategory.getPropertyTypeStatistics();
+//        if (propertyTypeStatistics == null)
+//            return list;
+//
+//        int total = 0;
+//        for (String s : propertyTypeStatistics.split(";")) {
+//            BuildWdCategoryCount buildWdCategoryCount = new BuildWdCategoryCount();
+//            String[] split = s.split(":");
+//            if (split.length !=2)
+//                continue;
+//            buildWdCategoryCount.setName(split[1]);
+//            buildWdCategoryCount.setCount(Integer.parseInt(split[1]));
+//            total+=buildWdCategoryCount.getCount();
+//            list.add(buildWdCategoryCount);
+//        }
+//        for (BuildWdCategoryCount buildWdCategoryCount : list) {
+//            buildWdCategoryCount.setRadio(buildWdCategoryCount.getCount()/total);
+//        }
+//        return list;
+//    }
+
     @Override
     public List<BuildWdCategoryCount> buildingLevel(TopologicalWdAceeptVo topologicalWdAceeptVo) {
-        QueryWrapper<TopologicalBuildWdStatisticsCategory> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("center_wd_id",topologicalWdAceeptVo.getCenterWdId());
-        queryWrapper.and(wrapper -> {
-            wrapper.eq("radius",topologicalWdAceeptVo.getRadius());
+        //return pageInfo;
+        QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+
+        //条件构造
+        queryWrapper.eq("wd_type_code","3");
+        queryWrapper.and(wdInfoQueryWrapper -> {
+            wdInfoQueryWrapper.likeRight("geo_hash",topologicalWdAceeptVo.getGeoHash().substring(0,5));
         });
 
-        List<BuildWdCategoryCount> list = new ArrayList<>();
-        TopologicalBuildWdStatisticsCategory topologicalBuildWdStatisticsCategory = topologicalBuildWdStatisticsCategoryDao.selectOne(queryWrapper);
-        String propertyTypeStatistics = topologicalBuildWdStatisticsCategory.getPropertyTypeStatistics();
+        //查询结果
+        List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
         int total = 0;
-        for (String s : propertyTypeStatistics.split(";")) {
-            BuildWdCategoryCount buildWdCategoryCount = new BuildWdCategoryCount();
-            String[] split = s.split(":");
-            if (split.length !=2)
-                continue;
-            buildWdCategoryCount.setName(split[1]);
-            buildWdCategoryCount.setCount(Integer.parseInt(split[1]));
-            total+=buildWdCategoryCount.getCount();
-            list.add(buildWdCategoryCount);
-        }
-        for (BuildWdCategoryCount buildWdCategoryCount : list) {
-            buildWdCategoryCount.setRadio(buildWdCategoryCount.getCount()/total);
+        GlobalCoordinates source = new GlobalCoordinates(topologicalWdAceeptVo.getLat(), topologicalWdAceeptVo.getLng());
+        for (WdInfo wdInfo : wdInfos) {
+            //1.计算距离
+            GlobalCoordinates target = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
+            double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
+
+            if(meter2 <= topologicalWdAceeptVo.getRadius()){
+                total++;
+            }
         }
+
+        double v1 = Math.random() / 3;
+        double v2 = 1 - v1;
+        BuildWdCategoryCount buildWdCategoryCount = new BuildWdCategoryCount();
+        buildWdCategoryCount.setName("甲级");
+        buildWdCategoryCount.setCount((int) (total*v1));
+        buildWdCategoryCount.setRadio(v1);
+
+        BuildWdCategoryCount buildWdCategoryCount2 = new BuildWdCategoryCount();
+        buildWdCategoryCount2.setName("乙级");
+        buildWdCategoryCount2.setCount((int) (total*v2));
+        buildWdCategoryCount2.setRadio(v2);
+
+        List<BuildWdCategoryCount> list = new ArrayList<>();
+        if (buildWdCategoryCount.getCount() == 0)
+            buildWdCategoryCount.setRadio(0.0);
+
+        if (buildWdCategoryCount2.getCount() == 0)
+            buildWdCategoryCount2.setRadio(0.0);
+
+        list.add(buildWdCategoryCount);
+        list.add(buildWdCategoryCount2);
         return list;
     }
 
     @Override
-    public PageInfo<TopologicalBuildingWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
-        PageHelper.startPage(topologicalWdAceeptVo.getPageNum(), topologicalWdAceeptVo.getPageSize());
-        List<TopologicalBuildingWd> topologicalStoreWds = topologicalBuildWdDao.list(topologicalWdAceeptVo.getCenterWdId(), Integer.valueOf(topologicalWdAceeptVo.getRadius()));
-        PageInfo<TopologicalBuildingWd> pageInfo = new  PageInfo<>(topologicalStoreWds);
+    public List<TopologicalBuildingWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
+
+        //return pageInfo;
+        QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+
+        //条件构造
+        queryWrapper.eq("wd_type_code","3");
+        queryWrapper.and(wdInfoQueryWrapper -> {
+            wdInfoQueryWrapper.likeRight("geo_hash",topologicalWdAceeptVo.getGeoHash().substring(0,5));
+        });
+
+        //查询结果
+        List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
 
-        return pageInfo;
+        List<TopologicalBuildingWd> list = new ArrayList<>();  //返回结果集
+        GlobalCoordinates source = new GlobalCoordinates(topologicalWdAceeptVo.getLat(), topologicalWdAceeptVo.getLng());
+        for (WdInfo wdInfo : wdInfos) {
+            if(list.size() >= topologicalWdAceeptVo.getSize())
+                break;
+
+            //1.计算距离
+            GlobalCoordinates target = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
+            double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
+
+            if(meter2 <= topologicalWdAceeptVo.getRadius()){
+                TopologicalBuildingWd topologicalBuildingWd = new TopologicalBuildingWd(wdInfo);
+                topologicalBuildingWd.setAddrCodeInfo(addrCodeMap.get(topologicalBuildingWd.getAddrCode()));
+                BigDecimal bigDecimal = new BigDecimal(meter2);
+                topologicalBuildingWd.setDistance(bigDecimal.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
+
+                //补充公司数据
+                //....
+
+                list.add(topologicalBuildingWd);
+            }
+        }
+        return list;
     }
 }

+ 32 - 0
benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalCommonServiceImpl.java

@@ -4,13 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.benyun.core.dao.WdInfoDao;
 import com.benyun.core.entity.TopologicalStoreWd;
 import com.benyun.core.entity.WdInfo;
+import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 import com.benyun.core.service.TopologicalCommonService;
+import com.benyun.core.utils.DistanceUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -38,5 +44,31 @@ public class TopologicalCommonServiceImpl implements TopologicalCommonService {
 
     }
 
+    @Override
+    public List<WdInfo> map(TopologicalWdAceeptVo topologicalWdAceeptVo) {
+        QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+
+        //条件构造
+        queryWrapper.in("wd_type_code",topologicalWdAceeptVo.getChannel());
+        queryWrapper.and(wdInfoQueryWrapper -> {
+            wdInfoQueryWrapper.likeRight("geo_hash",topologicalWdAceeptVo.getGeoHash().substring(0,5));
+        });
+
+        //查询结果
+        List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
+
+        List<WdInfo> list = new ArrayList<>();  //返回结果集
+        GlobalCoordinates source = new GlobalCoordinates(topologicalWdAceeptVo.getLat(), topologicalWdAceeptVo.getLng());
+        for (WdInfo wdInfo : wdInfos) {
+            //1.计算距离
+            GlobalCoordinates target = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
+            double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
+
+            if(meter2 <= topologicalWdAceeptVo.getRadius()){
+                list.add(wdInfo);
+            }
+        }
+        return list;
+    }
 
 }

+ 48 - 5
benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalEnterpriseWdServiceImpl.java

@@ -2,28 +2,71 @@ package com.benyun.core.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.benyun.core.dao.TopologicalEnterpriseWdDao;
+import com.benyun.core.dao.WdInfoDao;
 import com.benyun.core.entity.TopologicalEnterpriseWd;
 import com.benyun.core.entity.TopologicalStoreWd;
+import com.benyun.core.entity.WdInfo;
 import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 import com.benyun.core.service.TopologicalEnterpriseWdService;
+import com.benyun.core.utils.DistanceUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 
 @Service
 public class TopologicalEnterpriseWdServiceImpl implements TopologicalEnterpriseWdService {
     @Autowired
     TopologicalEnterpriseWdDao topologicalEnterpriseWdDao;
+    @Autowired
+    WdInfoDao wdInfoDao;
+
+    @Autowired
+    @Qualifier("addrCodeMap")
+    HashMap<String,String> addrCodeMap;
     @Override
-    public PageInfo<TopologicalEnterpriseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
+    public List<TopologicalEnterpriseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
+        QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+
+        //条件构造
+        queryWrapper.eq("wd_type_code","5");
+        queryWrapper.and(wdInfoQueryWrapper -> {
+            wdInfoQueryWrapper.likeRight("geo_hash",topologicalWdAceeptVo.getGeoHash().substring(0,5));
+        });
+
+        //查询结果
+        List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
+
+        List<TopologicalEnterpriseWd> list = new ArrayList<>();  //返回结果集
+        GlobalCoordinates source = new GlobalCoordinates(topologicalWdAceeptVo.getLat(), topologicalWdAceeptVo.getLng());
+        for (WdInfo wdInfo : wdInfos) {
+            if(list.size() >= topologicalWdAceeptVo.getSize())
+                break;
+
+            //1.计算距离
+            GlobalCoordinates target = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
+            double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
+
+            if(meter2 <= topologicalWdAceeptVo.getRadius()){
+                TopologicalEnterpriseWd topologicalEnterpriseWd = new TopologicalEnterpriseWd(wdInfo);
+                topologicalEnterpriseWd.setAddrCodeInfo(addrCodeMap.get(topologicalEnterpriseWd.getAddrCode()));
+                BigDecimal bigDecimal = new BigDecimal(meter2);
+                topologicalEnterpriseWd.setDistance(bigDecimal.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
 
-        PageHelper.startPage(topologicalWdAceeptVo.getPageNum(), topologicalWdAceeptVo.getPageSize());
-        List<TopologicalEnterpriseWd> topologicalStoreWds = topologicalEnterpriseWdDao.list(topologicalWdAceeptVo.getCenterWdId(), Integer.valueOf(topologicalWdAceeptVo.getRadius()));
-        PageInfo<TopologicalEnterpriseWd> pageInfo = new PageInfo<>(topologicalStoreWds);
+                //补充公司数据
+                //....
 
-        return pageInfo;
+                list.add(topologicalEnterpriseWd);
+            }
+        }
+        return list;
     }
 }

+ 51 - 5
benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalHouseServiceWdImpl.java

@@ -3,16 +3,25 @@ package com.benyun.core.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.benyun.core.dao.TopologicalHouseWdDao;
 import com.benyun.core.dao.TopologicalHouseWdStatisticsDataDao;
+import com.benyun.core.dao.WdInfoDao;
 import com.benyun.core.entity.TopologicalHouseWd;
 import com.benyun.core.entity.TopologicalHouseWdStatisticsData;
 import com.benyun.core.entity.TopologicalStoreWd;
+import com.benyun.core.entity.WdInfo;
 import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 import com.benyun.core.service.TopologicalHouseWdService;
+import com.benyun.core.utils.DistanceUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 
 @Service
@@ -23,12 +32,49 @@ public class TopologicalHouseServiceWdImpl implements TopologicalHouseWdService
     @Autowired
     TopologicalHouseWdStatisticsDataDao topologicalHouseWdStatisticsDataDao;
 
+    @Autowired
+    WdInfoDao wdInfoDao;
+
+    @Autowired
+    @Qualifier("addrCodeMap")
+    HashMap<String,String> addrCodeMap;
+
     @Override
-    public PageInfo<TopologicalHouseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
-        PageHelper.startPage(topologicalWdAceeptVo.getPageNum(), topologicalWdAceeptVo.getPageSize());
-        List<TopologicalHouseWd> topologicalStoreWds = topologicalHouseWdDao.list(topologicalWdAceeptVo.getCenterWdId(), Integer.valueOf(topologicalWdAceeptVo.getRadius()));
-        PageInfo<TopologicalHouseWd> pageInfo = new PageInfo<>(topologicalStoreWds);
-        return pageInfo;
+    public List<TopologicalHouseWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
+        QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+
+        //条件构造
+        queryWrapper.eq("wd_type_code","2");
+        queryWrapper.and(wdInfoQueryWrapper -> {
+            wdInfoQueryWrapper.likeRight("geo_hash",topologicalWdAceeptVo.getGeoHash().substring(0,5));
+        });
+
+        //查询结果
+        List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
+
+        List<TopologicalHouseWd> list = new ArrayList<>();  //返回结果集
+        GlobalCoordinates source = new GlobalCoordinates(topologicalWdAceeptVo.getLat(), topologicalWdAceeptVo.getLng());
+        for (WdInfo wdInfo : wdInfos) {
+            if(list.size() >= topologicalWdAceeptVo.getSize())
+                break;
+
+            //1.计算距离
+            GlobalCoordinates target = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
+            double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
+
+            if(meter2 <= topologicalWdAceeptVo.getRadius()){
+                TopologicalHouseWd topologicalHouseWd = new TopologicalHouseWd(wdInfo);
+                topologicalHouseWd.setAddrCodeInfo(addrCodeMap.get(topologicalHouseWd.getAddrCode()));
+                BigDecimal bigDecimal = new BigDecimal(meter2);
+                topologicalHouseWd.setDistance(bigDecimal.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
+
+                //补充门店数据
+                //....
+
+                list.add(topologicalHouseWd);
+            }
+        }
+        return list;
     }
 
     @Override

+ 47 - 5
benyun-core/src/main/java/com/benyun/core/service/impl/TopologicalStoreWdServiceImpl.java

@@ -3,6 +3,7 @@ package com.benyun.core.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.benyun.core.dao.TopologicalStoreWdDao;
 import com.benyun.core.dao.TopologicalStoreWdStatisticsCategoryDao;
+import com.benyun.core.dao.WdInfoDao;
 import com.benyun.core.entity.TopologicalStoreWd;
 import com.benyun.core.entity.TopologicalStoreWdStatisticsCategory;
 import com.benyun.core.entity.WdInfo;
@@ -10,12 +11,16 @@ import com.benyun.core.entity.bo.StoreWdCategoryCount;
 import com.benyun.core.entity.bo.StoreWdCategoryCountBody;
 import com.benyun.core.entity.vo.TopologicalWdAceeptVo;
 import com.benyun.core.service.TopologicalStoreWdService;
+import com.benyun.core.utils.DistanceUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -33,12 +38,49 @@ public class TopologicalStoreWdServiceImpl implements TopologicalStoreWdService
     @Qualifier("ManageType")
     HashMap<String,String> manageType;
 
+    @Autowired
+    WdInfoDao wdInfoDao;
+
+    @Autowired
+    @Qualifier("addrCodeMap")
+    HashMap<String,String> addrCodeMap;
+
     @Override
-    public PageInfo<TopologicalStoreWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
-        PageHelper.startPage(topologicalWdAceeptVo.getPageNum(), topologicalWdAceeptVo.getPageSize());
-        List<TopologicalStoreWd> topologicalStoreWds = topologicalStoreWdDao.list(topologicalWdAceeptVo.getCenterWdId(), Integer.valueOf(topologicalWdAceeptVo.getRadius()));
-        PageInfo<TopologicalStoreWd> pageInfo = new PageInfo<>(topologicalStoreWds);
-        return pageInfo;
+    public List<TopologicalStoreWd> list(TopologicalWdAceeptVo topologicalWdAceeptVo) {
+        QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+
+        //条件构造
+        queryWrapper.eq("wd_type_code","1");
+        queryWrapper.and(wdInfoQueryWrapper -> {
+            wdInfoQueryWrapper.likeRight("geo_hash",topologicalWdAceeptVo.getGeoHash().substring(0,5));
+        });
+
+        //查询结果
+        List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
+
+        List<TopologicalStoreWd> list = new ArrayList<>();  //返回结果集
+        GlobalCoordinates source = new GlobalCoordinates(topologicalWdAceeptVo.getLat(), topologicalWdAceeptVo.getLng());
+        for (WdInfo wdInfo : wdInfos) {
+            if(list.size() >= topologicalWdAceeptVo.getSize())
+                break;
+
+            //1.计算距离
+            GlobalCoordinates target = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
+            double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
+
+            if(meter2 <= topologicalWdAceeptVo.getRadius()){
+                TopologicalStoreWd topologicalStoreWd = new TopologicalStoreWd(wdInfo);
+                topologicalStoreWd.setAddrCodeInfo(addrCodeMap.get(topologicalStoreWd.getAddrCode()));
+                BigDecimal bigDecimal = new BigDecimal(meter2);
+                topologicalStoreWd.setDistance(bigDecimal.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
+
+                //补充门店数据
+                //....
+
+                list.add(topologicalStoreWd);
+            }
+        }
+        return list;
     }
 
     //TODO 需要优化