فهرست منبع

完成数据库建模(v1.0)

JensionDzero 1 سال پیش
والد
کامیت
5e1de3ff47
42فایلهای تغییر یافته به همراه1214 افزوده شده و 168 حذف شده
  1. 22 0
      benyun-core/Dockerfile
  2. 22 0
      benyun-core/pom.xml
  3. 1 0
      benyun-core/src/main/java/com/benyun/core/constant/ChannelMapContant.java
  4. 0 18
      benyun-core/src/main/java/com/benyun/core/controller/ChannelMapController.java
  5. 9 0
      benyun-core/src/main/java/com/benyun/core/dao/BuildWdDao.java
  6. 9 0
      benyun-core/src/main/java/com/benyun/core/dao/EnterpriseDao.java
  7. 9 0
      benyun-core/src/main/java/com/benyun/core/dao/EnterpriseWdDao.java
  8. 9 0
      benyun-core/src/main/java/com/benyun/core/dao/HouseWdDao.java
  9. 9 0
      benyun-core/src/main/java/com/benyun/core/dao/StoreWdDao.java
  10. 13 0
      benyun-core/src/main/java/com/benyun/core/dao/TopologicalBuildWdDao.java
  11. 13 0
      benyun-core/src/main/java/com/benyun/core/dao/TopologicalEnterpriseWdDao.java
  12. 12 0
      benyun-core/src/main/java/com/benyun/core/dao/TopologicalHouseWdDao.java
  13. 13 0
      benyun-core/src/main/java/com/benyun/core/dao/TopologicalStoreWdDao.java
  14. 1 2
      benyun-core/src/main/java/com/benyun/core/dao/WdTopologicalDao.java
  15. 23 0
      benyun-core/src/main/java/com/benyun/core/entity/BuildWd.java
  16. 82 0
      benyun-core/src/main/java/com/benyun/core/entity/Enterprise.java
  17. 14 0
      benyun-core/src/main/java/com/benyun/core/entity/EnterpriseWd.java
  18. 20 0
      benyun-core/src/main/java/com/benyun/core/entity/HouseWd.java
  19. 36 0
      benyun-core/src/main/java/com/benyun/core/entity/StoreWd.java
  20. 22 0
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalBuildWdStatisticsCategory.java
  21. 39 0
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalBuildingWd.java
  22. 41 0
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalEnterpriseWd.java
  23. 49 0
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalHouseWd.java
  24. 33 0
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalHouseWdStatisticsData.java
  25. 40 0
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalStoreWd.java
  26. 30 0
      benyun-core/src/main/java/com/benyun/core/entity/TopologicalStoreWdStatisticsCategory.java
  27. 16 0
      benyun-core/src/main/java/com/benyun/core/entity/TrafficWd.java
  28. 18 18
      benyun-core/src/main/java/com/benyun/core/entity/WdTopological.java
  29. 37 0
      benyun-core/src/main/java/com/benyun/core/entity/WdTopologicalInfo.java
  30. 22 3
      benyun-core/src/main/java/com/benyun/core/entity/vo/ChannelMapAceeptVo.java
  31. 5 0
      benyun-core/src/main/java/com/benyun/core/service/AnalyseWdService.java
  32. 299 0
      benyun-core/src/main/java/com/benyun/core/service/impl/AnalyseWdServiceImpl.java
  33. 35 0
      benyun-core/src/main/java/com/benyun/core/utils/DistanceUtil.java
  34. 141 0
      benyun-core/src/main/resources/application-dev.yaml
  35. 13 119
      benyun-core/src/main/resources/application.yaml
  36. 12 0
      benyun-core/src/main/resources/mapper/TopologicalBuildWdDao.xml
  37. 11 0
      benyun-core/src/main/resources/mapper/TopologicalEnterpriseWdDao.xml
  38. 11 0
      benyun-core/src/main/resources/mapper/TopologicalHouseWdDao.xml
  39. 11 0
      benyun-core/src/main/resources/mapper/TopologicalStoreWdDao.xml
  40. 12 0
      benyun-core/src/main/resources/mapper/WdTopologicalDao.xml
  41. 0 2
      benyun-core/src/test/java/com/benyun/core/service/WdTopologicalServiceImplTest.java
  42. 0 6
      pom.xml

+ 22 - 0
benyun-core/Dockerfile

@@ -0,0 +1,22 @@
+FROM anapsix/alpine-java:8_server-jre_unlimited
+
+MAINTAINER dzk
+
+RUN mkdir -p /saas/modules/integral/logs  \
+    /saas/modules/integral/temp  \
+    /saas/skywalking/agent
+
+WORKDIR /saas/modules/integral
+
+#ENV SERVER_PORT=9210
+#
+EXPOSE 8000
+
+ADD ./target/benyun-core-4.8.0.jar ./app.jar
+
+ENTRYPOINT ["java", \
+            "-Djava.security.egd=file:/dev/./urandom", \
+#            "-Dserver.port=${SERVER_PORT}", \
+#            "-Dskywalking.agent.service_name=saas-auth", \
+#            "-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar", \
+            "-jar", "app.jar"]

+ 22 - 0
benyun-core/pom.xml

@@ -121,8 +121,30 @@
             <version>4.0.0-RC1</version>
         </dependency>
 
+        <!--  计算两经纬度之间的距离  -->
+        <dependency>
+            <groupId>org.gavaghan</groupId>
+            <artifactId>geodesy</artifactId>
+            <version>1.1.3</version>
+        </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.7.13</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 
 
 </project>

+ 1 - 0
benyun-core/src/main/java/com/benyun/core/constant/ChannelMapContant.java

@@ -2,4 +2,5 @@ package com.benyun.core.constant;
 
 public class ChannelMapContant {
     public static String[] FULL_PROVINCE = new String[]{"110000000000", "120000000000", "130000000000", "140000000000", "150000000000", "210000000000", "220000000000", "230000000000", "310000000000", "320000000000", "330000000000", "340000000000", "350000000000", "360000000000", "370000000000", "410000000000", "420000000000", "430000000000", "440000000000", "450000000000", "460000000000", "500000000000", "510000000000", "520000000000", "530000000000", "540000000000", "610000000000", "620000000000", "630000000000", "640000000000", "650000000000"};
+    public static String[] FULL_CHANNEL = new String[]{"0","1","2","3","4","5"};
 }

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

@@ -35,16 +35,6 @@ public class ChannelMapController {
 
     @RequestMapping("/getArea")
     public R area(@Validated(value={ChannelAreaGroup.class}) ChannelMapAceeptVo channel) {
-
-        //如果没需要查的省码,则查全国的省份
-        if ((channel.getAddrCode() == null || channel.getAddrCode().length == 0)) {
-            if ("province".equals(channel.getRankType())) {
-                String[] strings = ChannelMapContant.FULL_PROVINCE;
-                channel.setAddrCode(strings);
-            } else
-                return R.fail("请求参数错误");
-        }
-
         String md5 = channel.getHash();
 
         //2.查看redis中是否存在有缓存
@@ -67,14 +57,6 @@ public class ChannelMapController {
     //TODO 这里还需要思考返回来的是什么数据
     @RequestMapping("/list")
     public R list(@Validated(value={ChannelListGroup.class}) ChannelMapAceeptVo channel){
-        //如果没需要查的省码,则查全国的省份
-        if ((channel.getAddrCode() == null || channel.getAddrCode().length == 0)) {
-            if ("province".equals(channel.getRankType())) {
-                String[] strings =  ChannelMapContant.FULL_PROVINCE;
-                channel.setAddrCode(strings);
-            } else
-                return R.fail("传值不对");
-        }
 
         String md5 = channel.getHash();
         PageInfo<WdInfo> pageInfo = (PageInfo<WdInfo>) redisTemplate.boundHashOps(RedisContant.CHANNEL_MAP_LIST).get(md5);

+ 9 - 0
benyun-core/src/main/java/com/benyun/core/dao/BuildWdDao.java

@@ -0,0 +1,9 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.BuildWd;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface BuildWdDao extends BaseMapper<BuildWd> {
+}

+ 9 - 0
benyun-core/src/main/java/com/benyun/core/dao/EnterpriseDao.java

@@ -0,0 +1,9 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.Enterprise;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface EnterpriseDao extends BaseMapper<Enterprise> {
+}

+ 9 - 0
benyun-core/src/main/java/com/benyun/core/dao/EnterpriseWdDao.java

@@ -0,0 +1,9 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.EnterpriseWd;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface EnterpriseWdDao extends BaseMapper<EnterpriseWd> {
+}

+ 9 - 0
benyun-core/src/main/java/com/benyun/core/dao/HouseWdDao.java

@@ -0,0 +1,9 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.HouseWd;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface HouseWdDao extends BaseMapper<HouseWd> {
+}

+ 9 - 0
benyun-core/src/main/java/com/benyun/core/dao/StoreWdDao.java

@@ -0,0 +1,9 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.StoreWd;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface StoreWdDao extends BaseMapper<StoreWd> {
+}

+ 13 - 0
benyun-core/src/main/java/com/benyun/core/dao/TopologicalBuildWdDao.java

@@ -0,0 +1,13 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.TopologicalBuildingWd;
+import com.benyun.core.entity.WdTopological;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface TopologicalBuildWdDao extends BaseMapper<TopologicalBuildingWd> {
+    public void insertList(List<TopologicalBuildingWd> topologicalBuildingWds);
+}

+ 13 - 0
benyun-core/src/main/java/com/benyun/core/dao/TopologicalEnterpriseWdDao.java

@@ -0,0 +1,13 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.TopologicalBuildingWd;
+import com.benyun.core.entity.TopologicalEnterpriseWd;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface TopologicalEnterpriseWdDao extends BaseMapper<TopologicalEnterpriseWd> {
+    public void insertList(List<TopologicalEnterpriseWd> topologicalEnterpriseWds);
+}

+ 12 - 0
benyun-core/src/main/java/com/benyun/core/dao/TopologicalHouseWdDao.java

@@ -0,0 +1,12 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.TopologicalHouseWd;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface TopologicalHouseWdDao extends BaseMapper<TopologicalHouseWd> {
+    public void insertList(List<TopologicalHouseWd> topologicalHouseWds);
+}

+ 13 - 0
benyun-core/src/main/java/com/benyun/core/dao/TopologicalStoreWdDao.java

@@ -0,0 +1,13 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.TopologicalBuildingWd;
+import com.benyun.core.entity.TopologicalStoreWd;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface TopologicalStoreWdDao extends BaseMapper<TopologicalStoreWd> {
+    public void insertList(List<TopologicalStoreWd> topologicalStoreWds);
+}

+ 1 - 2
benyun-core/src/main/java/com/benyun/core/dao/WdTopologicalDao.java

@@ -12,8 +12,7 @@ import java.util.List;
 @Mapper
 public interface WdTopologicalDao extends BaseMapper<WdTopological> {
 
-    @Insert("insert into bl_wd_topological values(#{centerWdId},#{centerWdName},#{radius},#{aroundWdId},#{aroundWdName},#{aroundWdTypeCode},#{aroundTypeCodeTx},#{aroundTypeCodeGd},#{aroundTypeCodeBy},#{distance},#{addrCode},#{addrCodeInfo},#{addrInfo},#{lat},#{lng},#{geoHash})")
-    public void insertWdTopological(WdTopological wdTopological);
+    public void insertList(List<WdTopological> wdTopological);
 
     @Select("select * from bl_wd_topological where center_wd_id = #{centerWdId}")
     public List<WdTopological> selectWdTopologicalListById(String centerWdId);

+ 23 - 0
benyun-core/src/main/java/com/benyun/core/entity/BuildWd.java

@@ -0,0 +1,23 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("ddt_build_wd")
+public class BuildWd {
+    @TableField("wd_id")
+    private String wdId;
+    @TableField("property_type")
+    private String propertyType;
+
+    @TableField("build_type")
+    private String buildType;
+
+    @TableField("households")
+    private int households;
+
+    @TableField("people_count")
+    private int peopleCount;
+}

+ 82 - 0
benyun-core/src/main/java/com/benyun/core/entity/Enterprise.java

@@ -0,0 +1,82 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+@Data
+@TableName("ddt_enterprise")
+public class Enterprise {
+    @TableId("enterprise_usci")
+    private String enterpriseUsci;
+    @TableField("enterprise_img")
+    private String enterpriseImg;
+    @TableField("enterprise_name")
+    private String enterpriseName;
+    @TableField("enterprise_name_short")
+    private String enterpriseNameShort;
+    @TableField("addr_info")
+    private String addrInfo;
+    @TableField("addr_code")
+    private String addrCode;
+    @TableField("enterprise_info")
+    private String enterpriseInfo;
+    @TableField("manage_range_info")
+    private String manageRangeInfo;
+    @TableField("enterprise_scale")
+    private String enterpriseScale;
+    @TableField("registered_capital")
+    private BigDecimal registeredCapital;
+    @TableField("linkmen_id")
+    private String linkmenId;
+    @TableField("linkmen_name")
+    private String linkmenName;
+    @TableField("create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonSerialize(using = LocalDateTimeSerializer.class)
+    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
+    private LocalDate createTime;
+    @TableField("enterprise_itin")
+    private String enterpriseItin;
+    @TableField("business_status")
+    private String businessStatus;
+    @TableField("industry_code")
+    private String industryCode;
+    @TableField("enterprise_type")
+    private String enterpriseType;
+    @TableField("credit_score")
+    private int creditScore;
+    @TableField("audit")
+    private int audit;
+    @TableField("collect_user_id")
+    private String collectUserId;
+    @TableField("collect_person")
+    private String collectPerson;
+    @TableField("collect_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonSerialize(using = LocalDateTimeSerializer.class)
+    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
+    private LocalDateTime collectTime;
+    @TableField("enter_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonSerialize(using = LocalDateTimeSerializer.class)
+    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
+    private LocalDateTime enterTime;
+    @TableField("update_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonSerialize(using = LocalDateTimeSerializer.class)
+    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
+    private LocalDateTime updateTime;
+    @TableField("hash")
+    private String hash;
+}

+ 14 - 0
benyun-core/src/main/java/com/benyun/core/entity/EnterpriseWd.java

@@ -0,0 +1,14 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("ddt_enterprise_wd")
+public class EnterpriseWd {
+    @TableField("wd_id")
+    private String wdId;
+    @TableField("enterprise_usci")
+    private String enterpriseUsci;
+}

+ 20 - 0
benyun-core/src/main/java/com/benyun/core/entity/HouseWd.java

@@ -0,0 +1,20 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("ddt_house_wd")
+public class HouseWd {
+    @TableField("wd_id")
+    private String wdId;
+    @TableField("property_type")
+    private String propertyType;
+
+    @TableField("households")
+    private int households;
+
+    @TableField("people_count")
+    private int peopleCount;
+}

+ 36 - 0
benyun-core/src/main/java/com/benyun/core/entity/StoreWd.java

@@ -0,0 +1,36 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("ddt_store_wd")
+public class StoreWd {
+    @TableField("wd_id")
+    private String wdId;
+    @TableField("brand_id")
+    private String brandId;
+    @TableField("per_capita_consumption")
+    private String perCapitaConsumption;
+    @TableField("manage_type_code")
+    private String manageTypeCode;
+    @TableField("industry_code")
+    private String industryCode;
+    @TableField("organization_code")
+    private String organizationCode;
+    @TableField("comment_count")
+    private int commentCount;
+    @TableField("score")
+    private Double score;
+    @TableField("buy_info")
+    private String buyInfo;
+    @TableField("index_score")
+    private double indexScore;
+    @TableField("business_status")
+    private String businessStatus;
+    @TableField("business_time")
+    private String businessTime;
+    @TableField("telephone")
+    private String telephone;
+}

+ 22 - 0
benyun-core/src/main/java/com/benyun/core/entity/TopologicalBuildWdStatisticsCategory.java

@@ -0,0 +1,22 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@TableName("bl_topological_build_wd_statistics_category")
+public class TopologicalBuildWdStatisticsCategory {
+
+    @TableField("center_wd_id")
+    private String centerWdId;
+    @TableField("radius")
+    private String radius;
+    @TableField("property_type_statistics")
+    private String propertyTypeStatistics;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 39 - 0
benyun-core/src/main/java/com/benyun/core/entity/TopologicalBuildingWd.java

@@ -0,0 +1,39 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@TableName("bl_topological_building_wd_list")
+public class TopologicalBuildingWd {
+    @TableField("center_wd_id")
+    private String centerWdId;
+    @TableField("radius")
+    private int radius;
+    @TableField("around_wd_id")
+    private String aroundWdId;
+    @TableField("around_wd_name")
+    private String aroundWdName;
+    @TableField("around_wd_type_code")
+    private String aroundWdTypeCode;
+    @TableField("distance")
+    private double distance;
+    @TableField("addr_code")
+    private String addrCode;
+    @TableField("addr_code_info")
+    private String addrCodeInfo;
+    @TableField("addr_info")
+    private String addrInfo;
+    @TableField("rent")
+    private double rent;
+    @TableField("build_type")
+    private String buildType;
+    @TableField("property_type")
+    private String propertyTpe;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 41 - 0
benyun-core/src/main/java/com/benyun/core/entity/TopologicalEnterpriseWd.java

@@ -0,0 +1,41 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+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")
+    private String aroundWdName;
+    @TableField("around_wd_type_code")
+    private String aroundWdTypeCode;
+    @TableField("distance")
+    private double distance;
+    @TableField("addr_code")
+    private String addrCode;
+    @TableField("addr_code_info")
+    private String addrCodeInfo;
+    @TableField("addr_info")
+    private String addrInfo;
+
+    @TableField("industry_code")
+    private String industrycode;
+    @TableField("registered_capital")
+    private BigDecimal registeredCapital;
+    @TableField("enterprise_scale")
+    private String enterpriseScale;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 49 - 0
benyun-core/src/main/java/com/benyun/core/entity/TopologicalHouseWd.java

@@ -0,0 +1,49 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@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")
+    public String aroundWdName;
+    @TableField("around_wd_type_code")
+    public String aroundWdTypeCode;
+    @TableField("distance")
+    public double distance;
+
+    @TableField("addr_code")
+    public String addrCode;
+
+    @TableField("addr_code_info")
+    public String addrCodeInfo;
+
+    @TableField("addr_info")
+    public String addrInfo;
+
+    @TableField("rent")
+    public double rent;
+
+    @TableField("property_type")
+    public String property_type;
+
+    @TableField("households")
+    public int households;
+
+    @TableField("people_count")
+    public int peopleCount;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 33 - 0
benyun-core/src/main/java/com/benyun/core/entity/TopologicalHouseWdStatisticsData.java

@@ -0,0 +1,33 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@TableName("bl_topological_house_wd_statistics_data")
+public class TopologicalHouseWdStatisticsData {
+
+    @TableField("center_wd_id")
+    private String centerWdId;
+
+    @TableField("radius")
+    private double radius;
+
+    @TableField("house_wd_count")
+    private int houseWdCount;
+
+    @TableField("total_households")
+    private int totalHouseholds;
+
+    @TableField("total_people_count")
+    private int totalPeopleCount;
+
+    @TableField("average_rent")
+    private double averageRent;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 40 - 0
benyun-core/src/main/java/com/benyun/core/entity/TopologicalStoreWd.java

@@ -0,0 +1,40 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+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")
+    public String aroundWdName;
+    @TableField("around_wd_type_code")
+    public String aroundWdTypeCode;
+    @TableField("distance")
+    public double distance;
+
+    @TableField("addr_code")
+    public String addrCode;
+
+    @TableField("addr_code_info")
+    public String addrCodeInfo;
+
+    @TableField("addr_info")
+    public String addrInfo;
+
+    @TableField("industry_code")
+    public String industryCode;
+
+    @TableField("manage_type_code")
+    public String manageTypeCode;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 30 - 0
benyun-core/src/main/java/com/benyun/core/entity/TopologicalStoreWdStatisticsCategory.java

@@ -0,0 +1,30 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@TableName("bl_topological_store_wd_statistics_category")
+public class TopologicalStoreWdStatisticsCategory {
+
+    @TableField("center_wd_id")
+    private String centerWdId;
+
+    @TableField("radius")
+    private String radius;
+
+    @TableField("big_manage_type_code")
+    private String bigManageTypeCode;
+
+    @TableField("mid_manage_type_code")
+    private String midManageTypeCode;
+
+    @TableField("sub_category_code_statistics")
+    private String subCategoryCodeStatistics;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 16 - 0
benyun-core/src/main/java/com/benyun/core/entity/TrafficWd.java

@@ -0,0 +1,16 @@
+package com.benyun.core.entity;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("ddt_traffic_wd")
+public class TrafficWd {
+    @TableField(value = "wd_id")
+    private String wdId;
+
+    @TableField("cars")
+    String cars;
+}

+ 18 - 18
benyun-core/src/main/java/com/benyun/core/entity/WdTopological.java

@@ -5,40 +5,40 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 
 @Data
 @TableName("bl_wd_topological")
 public class WdTopological {
     @TableField("center_wd_id")
-    public String centerWdId;
+    private String centerWdId;
     @TableField("center_wd_name")
-    public String centerWdName;
+    private String centerWdName;
     @TableField("radius")
-    public int radius;
+    private int radius;
     @TableField("around_wd_id")
-    public String aroundWdId;
+    private String aroundWdId;
     @TableField("around_wd_name")
-    public String aroundWdName;
+    private String aroundWdName;
     @TableField("around_wd_type_code")
-    public String aroundWdTypeCode;
-    @TableField("around_type_code_tx")
-    public String aroundTypeCodeTx;
-    @TableField("around_type_code_gd")
-    public String aroundTypeCodeGd;
+    private String aroundWdTypeCode;
     @TableField("around_type_code_by")
-    public String aroundTypeCodeBy;
+    private String aroundTypeCodeBy;
     @TableField("distance")
-    public int distance;
+    private double distance;
     @TableField("addr_code")
-    public String addrCode;
+    private String addrCode;
     @TableField("addr_code_info")
-    public String addrCodeInfo;
+    private String addrCodeInfo;
     @TableField("addr_info")
-    public String addrInfo;
+    private String addrInfo;
     @TableField("lat")
-    public BigDecimal lat;
+    private BigDecimal lat;
     @TableField("lng")
-    public BigDecimal lng;
+    private BigDecimal lng;
     @TableField("geo_hash")
-    public String geoHash;
+    private String geoHash;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
 }

+ 37 - 0
benyun-core/src/main/java/com/benyun/core/entity/WdTopologicalInfo.java

@@ -0,0 +1,37 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@TableName("bl_wd_topological_info")
+public class WdTopologicalInfo {
+    @TableField("center_wd_id")
+    private String center_wd_id;
+    @TableField("center_wd_name")
+    private String center_wd_name;
+    @TableField("center_wd_type_code")
+    private String center_wd_type_code;
+    @TableField("radius")
+    private String radius;
+    @TableField("addr_code")
+    private String addr_code;
+    @TableField("addr_code_info")
+    private String addr_code_info;
+    @TableField("addr_info")
+    private String addr_info;
+    @TableField("lat")
+    private String lat;
+    @TableField("lng")
+    private String lng;
+    @TableField("geo_hash")
+    private String geo_hash;
+    @TableField("tag")
+    private String tag;
+
+    @TableField("analyse_time")
+    private LocalDateTime analyseTime;
+}

+ 22 - 3
benyun-core/src/main/java/com/benyun/core/entity/vo/ChannelMapAceeptVo.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.ChannelAreaGroup;
 import com.benyun.core.valida.ChannelListGroup;
@@ -11,7 +12,7 @@ import javax.validation.constraints.NotEmpty;
 
 @Data
 public class ChannelMapAceeptVo {
-    @NotEmpty(groups = {ChannelPointGroup.class, ChannelAreaGroup.class, ChannelListGroup.class})
+
     String[] channel;  //网点类型,渠道(0:基础设施网点、1:门店网点、2:小区网点、3:楼宇网点、4:交通设施网点、5:公司网点)
     @NotBlank(groups = { ChannelAreaGroup.class, ChannelListGroup.class},message = "rankType不能为空")
     String rankType; //搜索等级(province:搜索省、city:搜素市、zone:搜素区)
@@ -34,11 +35,26 @@ public class ChannelMapAceeptVo {
     int pageNum = 1;
     int pageSize = 10;
 
+
+    public String[] getChannel() {
+        if(this.channel == null || this.channel.length == 0){
+            return channel = ChannelMapContant.FULL_CHANNEL;
+        }
+        return channel;
+    }
+
+    public String[] getAddrCode() {
+        if(this.addrCode == null || this.addrCode.length == 0){
+            this.addrCode = ChannelMapContant.FULL_PROVINCE;
+        }
+        return addrCode;
+    }
+
     public String getHash(){
         StringBuilder stringBuilder = new StringBuilder();
 
         //搜索渠道
-        for (String s : this.channel) {
+        for (String s : getChannel()) {
             stringBuilder.append(s);
         }
 
@@ -49,10 +65,13 @@ public class ChannelMapAceeptVo {
         stringBuilder.append(this.searchText);
 
         //搜索地区
-        for (String s : this.addrCode) {
+        for (String s : getAddrCode()) {
             stringBuilder.append(s);
         }
 
+        stringBuilder.append(pageNum);
+        stringBuilder.append(pageSize);
+
         //生成Hash
         String s = stringBuilder.toString();
         String md5 = HashUtil.hash(s, "MD5");

+ 5 - 0
benyun-core/src/main/java/com/benyun/core/service/AnalyseWdService.java

@@ -0,0 +1,5 @@
+package com.benyun.core.service;
+
+public interface AnalyseWdService {
+    public void analyse();
+}

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

@@ -0,0 +1,299 @@
+package com.benyun.core.service.impl;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+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.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;
+
+
+
+    @Override
+    public void analyse() {
+        for (WdInfo wdInfo : wdInfoDao.selectList(null)) {
+            //1.找到该点半径 r = 4.89km 内的所有点
+            QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
+            queryWrapper.likeRight("geo_hash",wdInfo.getGeoHash().substring(0,5));
+            List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
+
+            //经营分类统计
+            HashMap<String,HashMap<String,Integer>>[] storeCategory = new HashMap[anly.size()];
+
+            //小区分析统计
+            HashMap<String,Double>[] houseData = new HashMap[anly.size()];
+
+
+            //楼宇网点分析统计
+            HashMap<String,Integer>[] buildCategory = new HashMap[anly.size()];
+
+            //初始化
+            for(int i=0;i<anly.size();i++){
+                storeCategory[i] = new HashMap<>();
+                houseData[i] = new HashMap<>();
+                houseData[i].put("totalHouseholds",0.0);   //总户数
+                houseData[i].put("totalPeopleCount",0.0);  //总人口数
+                houseData[i].put("totalRent",0.0); //房价
+                buildCategory[i] = new HashMap<>();
+            }
+
+            //各网点列表统计
+            List<WdTopological> wdTopologicalList = new ArrayList<>();
+            List<TopologicalEnterpriseWd> topologicalEnterpriseWds = new ArrayList<>();
+            List<TopologicalStoreWd> topologicalStoreWds = new ArrayList<>();
+            List<TopologicalHouseWd> topologicalHouseWds = new ArrayList<>();
+            List<TopologicalBuildingWd> topologicalBuildingWds = new ArrayList<>();
+            for (WdInfo info : wdInfos) {
+                //计算距离
+                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);
+                        p = i;
+                        break;
+                    }
+                }
+                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);
+                //规定时区
+                ZoneId zone = ZoneId.of("Asia/Shanghai");
+                wdTopological.setAnalyseTime(LocalDateTime.now(zone));
+                wdTopologicalList.add(wdTopological);
+
+                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);
+
+                        //分析经营分类
+                        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());
+
+
+                    //小区分析
+                    HouseWd houseWd = houseWdDao.selectById(info.getWdId());
+                    if(houseWd != null){
+                        topologicalHouseWd.setHouseholds(houseWd.getHouseholds());
+                        topologicalHouseWd.setRent(info.getRent());
+                        topologicalHouseWd.setPeopleCount(houseWd.getPeopleCount());
+                        topologicalHouseWd.setProperty_type(houseWd.getPropertyType());
+
+                        //小区关键信息统计
+                        HashMap<String, Double> houseDatum = houseData[p];
+                        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.setPropertyTpe(buildWd.getPropertyType());
+
+                        //分析楼宇分类
+                        HashMap<String, Integer> buildCategoryMap = buildCategory[p];
+                        Integer integer = buildCategoryMap.get(topologicalBuildingWd.getPropertyTpe());
+                        if(integer == null){
+                            buildCategoryMap.put(topologicalBuildingWd.getPropertyTpe(),1);
+                        }else
+                            buildCategoryMap.put(topologicalBuildingWd.getPropertyTpe(),buildCategoryMap.get(topologicalBuildingWd.getPropertyTpe())+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);
+                }
+
+
+            }
+
+            //保存网点拓扑
+            wdTopologicalDao.insertList(wdTopologicalList);
+
+            //保存拓扑门店信息
+            topologicalStoreWdDao.insertList(topologicalStoreWds);
+            topologicalHouseWdDao.insertList(topologicalHouseWds);
+            topologicalBuildWdDao.insertList(topologicalBuildingWds);
+            topologicalEnterpriseWdDao.insertList(topologicalEnterpriseWds);
+
+            //TODO 门店分类
+//            for(int i=0;i<anly.size();i++){
+//                TopologicalStoreWdStatisticsCategory storeWdStatisticsCategory = new TopologicalStoreWdStatisticsCategory();
+//                storeWdStatisticsCategory.setRadius(String.valueOf(anly.get(i)));
+//                storeWdStatisticsCategory.setBigManageTypeCode();
+//                storeCategory[i]
+//            }
+
+
+        }
+    }
+}

+ 35 - 0
benyun-core/src/main/java/com/benyun/core/utils/DistanceUtil.java

@@ -0,0 +1,35 @@
+package com.benyun.core.utils;
+
+
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GeodeticCalculator;
+import org.gavaghan.geodesy.GeodeticCurve;
+import org.gavaghan.geodesy.GlobalCoordinates;
+
+/***
+ * 坐标经纬度距离公式
+ */
+public class DistanceUtil {
+
+    public static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid) {
+        //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离
+        GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo);
+        return geoCurve.getEllipsoidalDistance();
+    }
+
+    public static void main(String[] args) {
+        GlobalCoordinates source = new GlobalCoordinates(24.331757, 109.444606);
+        GlobalCoordinates target = new GlobalCoordinates(24.331757, 109.444706);
+        double meter1 = getDistanceMeter(source, target, Ellipsoid.Sphere);
+        double meter2 = getDistanceMeter(source, target, Ellipsoid.WGS84);
+        System.out.println("Sphere坐标系计算结果:" + meter1 + "米");
+        System.out.println("WGS84 坐标系计算结果:" + meter2 + "米");
+
+    }
+}
+
+
+
+
+
+

+ 141 - 0
benyun-core/src/main/resources/application-dev.yaml

@@ -0,0 +1,141 @@
+spring:
+  main:
+    allow-bean-definition-overriding: true
+  datasource:
+    type: com.zaxxer.hikari.HikariDataSource
+    # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
+    dynamic:
+      # 性能分析插件(有性能损耗 不建议生产环境使用)
+      p6spy: false
+      # 设置默认的数据源或者数据源组,默认值即为 master
+      primary: master
+      # 严格模式 匹配不到数据源则报错
+      strict: true
+      datasource:
+        # 主库数据源
+        master:
+          type: ${spring.datasource.type}
+          driverClassName: com.mysql.cj.jdbc.Driver
+          # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
+          # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
+          url: jdbc:mysql://127.0.0.1:3306/bailian-ai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
+          username: root
+          password: Aa@1230
+        # 从库数据源
+        slave:
+          lazy: true
+          type: ${spring.datasource.type}
+          driverClassName: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://127.0.0.1:3306/bailian-ai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
+          username: root
+          password: Aa@1230
+      #        oracle:
+      #          type: ${spring.datasource.type}
+      #          driverClassName: oracle.jdbc.OracleDriver
+      #          url: jdbc:oracle:thin:@//localhost:1521/XE
+      #          username: ROOT
+      #          password: root
+      #          hikari:
+      #            connectionTestQuery: SELECT 1 FROM DUAL
+      #        postgres:
+      #          type: ${spring.datasource.type}
+      #          driverClassName: org.postgresql.Driver
+      #          url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
+      #          username: root
+      #          password: root
+      #        sqlserver:
+      #          type: ${spring.datasource.type}
+      #          driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
+      #          url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
+      #          username: SA
+      #          password: root
+      hikari:
+        # 最大连接池数量
+        maxPoolSize: 20
+        # 最小空闲线程数量
+        minIdle: 10
+        # 配置获取连接等待超时的时间
+        connectionTimeout: 30000
+        # 校验超时时间
+        validationTimeout: 5000
+        # 空闲连接存活最大时间,默认10分钟
+        idleTimeout: 600000
+        # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
+        maxLifetime: 1800000
+        # 连接测试query(配置检测连接是否有效)
+        connectionTestQuery: SELECT 1
+        # 多久检查一次连接的活性
+        keepaliveTime: 30000
+  shardingsphere:
+    datasource:
+      names: ds1
+      ds1:
+        type: com.zaxxer.hikari.HikariDataSource
+        driver-class-name: com.mysql.cj.jdbc.Driver
+        jdbcUrl: jdbc:mysql://127.0.0.1:3306/bailian-ai?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
+        username: root
+        password: Aa@1230
+    sharding:
+      tables:
+        bl_wd_topological:
+          actual-data-nodes: ds1.bl_wd_topological_$->{1..10}
+          key-generator:
+            column: center_wd_id
+            type: SNOWFLAKE
+          table-strategy:
+            standard:
+              sharding-column: center_wd_id
+              precise-algorithm-class-name: com.benyun.core.utils.sharding.ConsistenceHashAlgorithm
+        bl_topological_store_wd_list:
+          actual-data-nodes: ds1.bl_topological_store_wd_list_$->{1..5}
+          key-generator:
+            column: center_wd_id
+            type: SNOWFLAKE
+          table-strategy:
+            standard:
+              sharding-column: center_wd_id
+              precise-algorithm-class-name: com.benyun.core.utils.sharding.ConsistenceHashAlgorithm
+        bl_topological_house_wd_list:
+          actual-data-nodes: ds1.bl_topological_house_wd_list_$->{1..5}
+          key-generator:
+            column: center_wd_id
+            type: SNOWFLAKE
+          table-strategy:
+            standard:
+              sharding-column: center_wd_id
+              precise-algorithm-class-name: com.benyun.core.utils.sharding.ConsistenceHashAlgorithm
+        bl_topological_building_wd_list:
+          actual-data-nodes: ds1.bl_topological_building_wd_list_$->{1..5}
+          key-generator:
+            column: center_wd_id
+            type: SNOWFLAKE
+          table-strategy:
+            standard:
+              sharding-column: center_wd_id
+              precise-algorithm-class-name: com.benyun.core.utils.sharding.ConsistenceHashAlgorithm
+  redis: #redis配置
+    host: 127.0.0.1  #redis服务地址
+    database: 11
+    port: 6379       #redis连接端口
+    timeout: 5000ms  #连接超时时间
+    #password: "123456"
+    pool:
+      minIdle: 1   #连接池中的最小空闲连接
+      maxIdle: 10  #连接池中的最大空闲连接
+      maxWait: 3   #连接池最大阻塞等待时间(使用负值表示没有限制)
+      maxActive: 8 #连接池最大连接数(使用赋值表示没有限制)
+
+#mybatis-plus配置
+mybatis-plus:
+  mapper-locations: classpath:/mapper/**/*.xml  #告诉mybatis数据库映射文件mapper.xml的位置
+  #  configuration:
+  #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl  #显示sql日志
+  global-config:
+    db-config:
+      id-type: auto
+
+pagehelper:
+  helper-dialect: mysql
+  reasonable: true
+  support-methods-arguments: true
+  params: count=countSql

+ 13 - 119
benyun-core/src/main/resources/application.yaml

@@ -2,127 +2,19 @@ server:
   port: 8000
   servlet:
     context-path: /bailianAi
---- # 数据源配置
-#spring:
-#  shardingsphere:
-#    datasource:
-#      names: ds1
-#      ds1:
-#        type: com.alibaba.druid.pool.DruidDataSource
-#        driver-class-name: com.mysql.cj.jdbc.Driver
-#        url: jdbc:mysql://localhost:3306/ddt?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
-#        username: root
-#        password: Aa@1230
-#    sharding:
-#      tables:
-#        bl_wd_topological:
-#          actual-data-nodes: ds1.bl_wd_topological_$->{1..2}
-#          key-generator:
-#            column: center_wd_id
-#            type: SNOWFLAKE
-#          table-strategy:
-#            standard:
-#              sharding-column: center_wd_id
-#              precise-algorithm-class-name: com.benyun.core.utils.sharding.ConsistenceHashAlgorithm
+    encoding:
+      enabled: true
+      force: true
+      charset: utf-8
+
+# 数据源配置
 spring:
-  main:
-    allow-bean-definition-overriding: true
+  profiles:
+    active: dev
+  application:
+    name: bailian-ai #当前服务的名称
+
 
-  datasource:
-    type: com.zaxxer.hikari.HikariDataSource
-    # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
-    dynamic:
-      # 性能分析插件(有性能损耗 不建议生产环境使用)
-      p6spy: false
-      # 设置默认的数据源或者数据源组,默认值即为 master
-      primary: master
-      # 严格模式 匹配不到数据源则报错
-      strict: true
-      datasource:
-        # 主库数据源
-        master:
-          type: ${spring.datasource.type}
-          driverClassName: com.mysql.cj.jdbc.Driver
-          # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
-          # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          url: jdbc:mysql://localhost:3306/bailian-ai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
-          username: root
-          password: Aa@1230
-        # 从库数据源
-        slave:
-          lazy: true
-          type: ${spring.datasource.type}
-          driverClassName: com.mysql.cj.jdbc.Driver
-          url: jdbc:mysql://localhost:3306/bailian-ai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
-          username: root
-          password: Aa@1230
-      #        oracle:
-      #          type: ${spring.datasource.type}
-      #          driverClassName: oracle.jdbc.OracleDriver
-      #          url: jdbc:oracle:thin:@//localhost:1521/XE
-      #          username: ROOT
-      #          password: root
-      #          hikari:
-      #            connectionTestQuery: SELECT 1 FROM DUAL
-      #        postgres:
-      #          type: ${spring.datasource.type}
-      #          driverClassName: org.postgresql.Driver
-      #          url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
-      #          username: root
-      #          password: root
-      #        sqlserver:
-      #          type: ${spring.datasource.type}
-      #          driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
-      #          url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
-      #          username: SA
-      #          password: root
-      hikari:
-        # 最大连接池数量
-        maxPoolSize: 20
-        # 最小空闲线程数量
-        minIdle: 10
-        # 配置获取连接等待超时的时间
-        connectionTimeout: 30000
-        # 校验超时时间
-        validationTimeout: 5000
-        # 空闲连接存活最大时间,默认10分钟
-        idleTimeout: 600000
-        # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
-        maxLifetime: 1800000
-        # 连接测试query(配置检测连接是否有效)
-        connectionTestQuery: SELECT 1
-        # 多久检查一次连接的活性
-        keepaliveTime: 30000
-  shardingsphere:
-    datasource:
-      names: ds1
-      ds1:
-        type: com.zaxxer.hikari.HikariDataSource
-        driver-class-name: com.mysql.cj.jdbc.Driver
-        jdbcUrl: jdbc:mysql://localhost:3306/bailian-ai?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
-        username: root
-        password: Aa@1230
-    sharding:
-      tables:
-        bl_wd_topological:
-          actual-data-nodes: ds1.bl_wd_topological_$->{1..2}
-          key-generator:
-            column: center_wd_id
-            type: SNOWFLAKE
-          table-strategy:
-            standard:
-              sharding-column: center_wd_id
-              precise-algorithm-class-name: com.benyun.core.utils.sharding.ConsistenceHashAlgorithm
-  redis: #redis配置
-    host: 127.0.0.1  #redis服务地址
-    port: 6379       #redis连接端口
-    timeout: 5000ms  #连接超时时间
-    # password:  密码
-    pool:
-      minIdle: 1   #连接池中的最小空闲连接
-      maxIdle: 10  #连接池中的最大空闲连接
-      maxWait: 3   #连接池最大阻塞等待时间(使用负值表示没有限制)
-      maxActive: 8 #连接池最大连接数(使用赋值表示没有限制)
 
 #mybatis-plus配置
 mybatis-plus:
@@ -133,6 +25,8 @@ mybatis-plus:
     db-config:
       id-type: auto
 
+
+#分页配置
 pagehelper:
   helper-dialect: mysql
   reasonable: true

+ 12 - 0
benyun-core/src/main/resources/mapper/TopologicalBuildWdDao.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.benyun.core.dao.TopologicalBuildWdDao">
+    <insert id="insertList">
+        insert into bl_topological_building_wd_list values
+        <foreach collection="topologicalBuildingWds"  separator="," item="item">
+            (#{item.centerWdId}},#{item.radius},#{item.aroundWdId},#{item.aroundWdName},#{item.aroundWdTypeCode},#{item.distance},#{item.addrCode},#{item.addrCodeInfo},#{item.addrInfo},#{item.rent},#{item.buildType},#{item.propertyType},#{item.analyseTime})
+        </foreach>
+    </insert>
+</mapper>
+

+ 11 - 0
benyun-core/src/main/resources/mapper/TopologicalEnterpriseWdDao.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.benyun.core.dao.TopologicalEnterpriseWdDao">
+    <insert id="insertList">
+        insert into bl_topological_enterprise_wd_list values
+        <foreach collection="topologicalEnterpriseWds"  separator="," item="item">
+            (#{item.centerWdId}},#{item.radius},#{item.aroundWdId},#{item.aroundWdName},#{item.aroundWdTypeCode},#{item.distance},#{item.addrCode},#{item.addrCodeInfo},#{item.addrInfo},#{item.industryCode},#{item.registeredCapital},#{item.enterpriseScale},#{item.analyseTime})
+        </foreach>
+    </insert>
+</mapper>

+ 11 - 0
benyun-core/src/main/resources/mapper/TopologicalHouseWdDao.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.benyun.core.dao.TopologicalHouseWdDao">
+    <insert id="insertList">
+        insert into bl_topological_house_wd_list values
+        <foreach collection="topologicalHouseWds"  separator="," item="item">
+            (#{item.centerWdId}},#{item.radius},#{item.aroundWdId},#{item.aroundWdName},#{item.aroundWdTypeCode},#{item.distance},#{item.addrCode},#{item.addrCodeInfo},#{item.addrInfo},#{item.rent},#{item.propertyType},#{item.households},#{item.peopleCount},#{item.analyseTime})
+        </foreach>
+    </insert>
+</mapper>

+ 11 - 0
benyun-core/src/main/resources/mapper/TopologicalStoreWdDao.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.benyun.core.dao.TopologicalStoreWdDao">
+    <insert id="insertList">
+        insert into bl_topological_store_wd_list values
+        <foreach collection="topologicalStoreWds"  separator="," item="item">
+            (#{item.centerWdId}},#{item.radius},#{item.aroundWdId},#{item.aroundWdName},#{item.aroundWdTypeCode},#{item.distance},#{item.addrCode},#{item.addrCodeInfo},#{item.addrInfo},#{item.industryCode},#{item.manageTypeCode},#{item.analyseTime})
+        </foreach>
+    </insert>
+</mapper>

+ 12 - 0
benyun-core/src/main/resources/mapper/WdTopologicalDao.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+    <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.benyun.core.dao.WdTopologicalDao">
+    <insert id="insertList">
+        insert into bl_wd_topological values
+        <foreach collection="wdTopological"  separator="," item="item">
+            (#{item.centerWdId},#{item.centerWdName},#{item.radius},#{item.aroundWdId},#{item.aroundWdName},#{item.aroundWdTypeCode},#{item.aroundTypeCodeBy},#{item.distance},#{item.addrCode},#{item.addrCodeInfo},#{item.addrInfo},#{item.lat},#{item.lng},#{item.geoHash},#{item.analyseTime})
+        </foreach>
+    </insert>
+</mapper>
+

+ 0 - 2
benyun-core/src/test/java/com/benyun/core/service/WdTopologicalServiceImplTest.java

@@ -39,8 +39,6 @@ public class WdTopologicalServiceImplTest {
             wdTopological.setLat(BigDecimal.valueOf(2));
             wdTopological.setGeoHash("123");
             wdTopological.setAroundTypeCodeBy("123");
-            wdTopological.setAroundTypeCodeGd("123");
-            wdTopological.setAroundTypeCodeTx("123");
             wdTopological.setAroundWdTypeCode("123");
             wdTopological.setAroundWdName("123");
             wdTopological.setAroundWdId("123");

+ 0 - 6
pom.xml

@@ -338,12 +338,6 @@
                 <version>0.0.1-SNAPSHOT</version>
             </dependency>
 
-            <dependency>
-                <groupId>com.benyun.core</groupId>
-                <artifactId>benyun-core</artifactId>
-                <version>0.0.1-SNAPSHOT</version>
-            </dependency>
-
 
         </dependencies>
     </dependencyManagement>