|
@@ -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);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+//}
|