|
@@ -1,6 +1,5 @@
|
|
|
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.*;
|
|
@@ -12,16 +11,18 @@ 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);
|
|
|
+ List<Integer> anly = Arrays.asList(2000, 1000, 500);
|
|
|
|
|
|
@Autowired
|
|
|
WdInfoDao wdInfoDao;
|
|
@@ -41,6 +42,7 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
@Autowired
|
|
|
EnterpriseDao enterpriseDao;
|
|
|
|
|
|
+ /*分析信息*/
|
|
|
@Autowired
|
|
|
WdTopologicalDao wdTopologicalDao;
|
|
|
|
|
@@ -57,67 +59,103 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
@Autowired
|
|
|
TopologicalEnterpriseWdDao topologicalEnterpriseWdDao;
|
|
|
|
|
|
+ /*统计信息*/
|
|
|
+ @Autowired
|
|
|
+ TopologicalHouseWdStatisticsDataDao houseWdStatisticsDataDao;
|
|
|
+ @Autowired
|
|
|
+ TopologicalBuildWdStatisticsCategoryDao buildWdStatisticsCategoryDao;
|
|
|
+ @Autowired
|
|
|
+ TopologicalStoreWdStatisticsCategoryDao storeWdStatisticsCategoryDao;
|
|
|
+ @Autowired
|
|
|
+ WdTopologicalInfoDao wdTopologicalInfoDao;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public void analyse() {
|
|
|
- for (WdInfo wdInfo : wdInfoDao.selectList(null)) {
|
|
|
+ ZoneId zone = ZoneId.of("Asia/Shanghai");
|
|
|
+ LocalDateTime now = LocalDateTime.now(zone); //分析时间
|
|
|
+
|
|
|
+ //测试需要
|
|
|
+ QueryWrapper<WdInfo> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("wd_type_code", "1");
|
|
|
+
|
|
|
+ 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));
|
|
|
+ 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()];
|
|
|
-
|
|
|
+ //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:数量
|
|
|
|
|
|
- //楼宇网点分析统计
|
|
|
- HashMap<String,Integer>[] buildCategory = new HashMap[anly.size()];
|
|
|
|
|
|
- //初始化
|
|
|
- for(int i=0;i<anly.size();i++){
|
|
|
+ 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); //房价
|
|
|
+ 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<WdTopological> wdTopologicalList = 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++);
|
|
|
+ //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))
|
|
|
+ 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)){
|
|
|
+ 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());
|
|
@@ -128,14 +166,22 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
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);
|
|
|
+ wdTopological.setAnalyseTime(now);
|
|
|
+
|
|
|
+ wdTopologicals.add(wdTopological);
|
|
|
|
|
|
- if(wdTopological.getAroundWdTypeCode().equals("1")){
|
|
|
+ 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());
|
|
@@ -153,29 +199,33 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
|
|
|
//门店分析
|
|
|
StoreWd storeWd = storeWdDao.selectById(info.getWdId());
|
|
|
- if(storeWd != null){
|
|
|
+ if (storeWd != null) {
|
|
|
topologicalStoreWd.setIndustryCode(storeWd.getIndustryCode());
|
|
|
String manageTypeCode = storeWd.getManageTypeCode();
|
|
|
topologicalStoreWd.setManageTypeCode(manageTypeCode);
|
|
|
+ topologicalStoreWd.setBrandId(storeWd.getBrandId());
|
|
|
|
|
|
//分析经营分类
|
|
|
- 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);
|
|
|
+ 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")){
|
|
|
+ } else if (wdTopological.getAroundWdTypeCode().equals("2")) {
|
|
|
//小区网点
|
|
|
TopologicalHouseWd topologicalHouseWd = new TopologicalHouseWd();
|
|
|
topologicalHouseWd.setCenterWdId(wdTopological.getCenterWdId());
|
|
@@ -191,25 +241,26 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
|
|
|
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){
|
|
|
+ if (houseWd != null) {
|
|
|
topologicalHouseWd.setHouseholds(houseWd.getHouseholds());
|
|
|
topologicalHouseWd.setRent(info.getRent());
|
|
|
topologicalHouseWd.setPeopleCount(houseWd.getPeopleCount());
|
|
|
- topologicalHouseWd.setProperty_type(houseWd.getPropertyType());
|
|
|
+ topologicalHouseWd.setPropertyType(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());
|
|
|
+ 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 (wdTopological.getAroundWdTypeCode().equals("3")) {
|
|
|
//楼宇网点
|
|
|
TopologicalBuildingWd topologicalBuildingWd = new TopologicalBuildingWd();
|
|
|
topologicalBuildingWd.setCenterWdId(wdTopological.getCenterWdId());
|
|
@@ -227,23 +278,26 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
|
|
|
//楼宇分析
|
|
|
BuildWd buildWd = buildWdDao.selectById(info.getWdId());
|
|
|
- if(buildWd != null){
|
|
|
+ if (buildWd != null) {
|
|
|
topologicalBuildingWd.setRent(info.getRent());
|
|
|
topologicalBuildingWd.setBuildType(buildWd.getBuildType());
|
|
|
- topologicalBuildingWd.setPropertyTpe(buildWd.getPropertyType());
|
|
|
+ topologicalBuildingWd.setPropertyType(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);
|
|
|
+ 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")){
|
|
|
+ } else if (wdTopological.getAroundWdTypeCode().equals("5")) {
|
|
|
//公司网点
|
|
|
TopologicalEnterpriseWd topologicalEnterpriseWd = new TopologicalEnterpriseWd();
|
|
|
topologicalEnterpriseWd.setCenterWdId(wdTopological.getCenterWdId());
|
|
@@ -261,10 +315,10 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
|
|
|
//公司分析
|
|
|
EnterpriseWd enterpriseWd = enterpriseWdDao.selectById(info.getWdId());
|
|
|
- if(enterpriseWd != null){
|
|
|
+ if (enterpriseWd != null) {
|
|
|
Enterprise enterprise = enterpriseDao.selectById(enterpriseWd.getEnterpriseUsci());
|
|
|
- if (enterprise != null){
|
|
|
- topologicalEnterpriseWd.setIndustrycode(enterprise.getIndustryCode());
|
|
|
+ if (enterprise != null) {
|
|
|
+ topologicalEnterpriseWd.setIndustryCode(enterprise.getIndustryCode());
|
|
|
topologicalEnterpriseWd.setRegisteredCapital(enterprise.getRegisteredCapital());
|
|
|
topologicalEnterpriseWd.setEnterpriseScale(enterprise.getEnterpriseScale());
|
|
|
}
|
|
@@ -273,26 +327,123 @@ public class AnalyseWdServiceImpl implements AnalyseWdService {
|
|
|
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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //保存网点拓扑
|
|
|
- wdTopologicalDao.insertList(wdTopologicalList);
|
|
|
+ //TODO 楼宇分类
|
|
|
+ for (int i = 0; i < anly.size(); i++) {
|
|
|
+ TopologicalBuildWdStatisticsCategory buildWdStatisticsCategory = new TopologicalBuildWdStatisticsCategory();
|
|
|
+ buildWdStatisticsCategory.setCenterWdId(wdInfo.getWdId());
|
|
|
+ buildWdStatisticsCategory.setRadius(anly.get(i));
|
|
|
|
|
|
- //保存拓扑门店信息
|
|
|
- topologicalStoreWdDao.insertList(topologicalStoreWds);
|
|
|
- topologicalHouseWdDao.insertList(topologicalHouseWds);
|
|
|
- topologicalBuildWdDao.insertList(topologicalBuildingWds);
|
|
|
- topologicalEnterpriseWdDao.insertList(topologicalEnterpriseWds);
|
|
|
+ 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++){
|
|
|
-// TopologicalStoreWdStatisticsCategory storeWdStatisticsCategory = new TopologicalStoreWdStatisticsCategory();
|
|
|
-// storeWdStatisticsCategory.setRadius(String.valueOf(anly.get(i)));
|
|
|
-// storeWdStatisticsCategory.setBigManageTypeCode();
|
|
|
-// storeCategory[i]
|
|
|
-// }
|
|
|
+ //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);
|
|
|
|
|
|
}
|
|
|
}
|