|
@@ -2,12 +2,11 @@ package com.skyversation.xjcy.service;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.skyversation.xjcy.bean.Enterprise;
|
|
|
|
|
-import com.skyversation.xjcy.bean.EnterpriseEconomic;
|
|
|
|
|
-import com.skyversation.xjcy.bean.IndustrialPark;
|
|
|
|
|
-import com.skyversation.xjcy.bean.Order;
|
|
|
|
|
|
|
+import com.skyversation.xjcy.bean.*;
|
|
|
|
|
+import com.skyversation.xjcy.enums.EnterpriseLevel;
|
|
|
import com.skyversation.xjcy.query.DMSQuery;
|
|
import com.skyversation.xjcy.query.DMSQuery;
|
|
|
import com.skyversation.xjcy.util.SpecialisationStringCollector;
|
|
import com.skyversation.xjcy.util.SpecialisationStringCollector;
|
|
|
|
|
+import com.skyversation.xjcy.util.TimeUtil;
|
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NoArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
@@ -16,17 +15,18 @@ import org.springframework.util.MultiValueMap;
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class DataCountService {
|
|
public class DataCountService {
|
|
|
@Resource
|
|
@Resource
|
|
|
DMSService dmsService;
|
|
DMSService dmsService;
|
|
|
|
|
|
|
|
- private boolean counted = false;
|
|
|
|
|
private JSONObject cacheTownData;
|
|
private JSONObject cacheTownData;
|
|
|
private Map<String, JSONObject> cacheParkData;
|
|
private Map<String, JSONObject> cacheParkData;
|
|
|
private Map<String, JSONObject> cacheBuildData;
|
|
private Map<String, JSONObject> cacheBuildData;
|
|
@@ -35,9 +35,9 @@ public class DataCountService {
|
|
|
private Map<String, JSONObject> tempCacheParkData;
|
|
private Map<String, JSONObject> tempCacheParkData;
|
|
|
private Map<String, JSONObject> tempCacheBuildData;
|
|
private Map<String, JSONObject> tempCacheBuildData;
|
|
|
|
|
|
|
|
- Map<String,EnterpriseEconomicCount> economicCountBy12Month = new HashMap<>();
|
|
|
|
|
- Map<String,EnterpriseEconomicCount> economicCountByYtdThisYear = new HashMap<>();
|
|
|
|
|
- Map<String,EnterpriseEconomicCount> economicCountByYtdLastYear = new HashMap<>();
|
|
|
|
|
|
|
+ Map<String, EnterpriseEconomicCount> economicCountBy12Month = new HashMap<>();
|
|
|
|
|
+ Map<String, EnterpriseEconomicCount> economicCountByYtdThisYear = new HashMap<>();
|
|
|
|
|
+ Map<String, EnterpriseEconomicCount> economicCountByYtdLastYear = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, Enterprise> aliveEnterpriseMap = new HashMap<>();
|
|
Map<String, Enterprise> aliveEnterpriseMap = new HashMap<>();
|
|
|
|
|
|
|
@@ -77,11 +77,13 @@ public class DataCountService {
|
|
|
running.set(false);
|
|
running.set(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@NoArgsConstructor
|
|
@NoArgsConstructor
|
|
|
- private static class EnterpriseEconomicCount{
|
|
|
|
|
|
|
+ private static class EnterpriseEconomicCount {
|
|
|
BigDecimal tax = BigDecimal.ZERO;
|
|
BigDecimal tax = BigDecimal.ZERO;
|
|
|
BigDecimal product = BigDecimal.ZERO;
|
|
BigDecimal product = BigDecimal.ZERO;
|
|
|
BigDecimal revenue = BigDecimal.ZERO;
|
|
BigDecimal revenue = BigDecimal.ZERO;
|
|
|
|
|
+
|
|
|
public EnterpriseEconomicCount(List<EnterpriseEconomic> enterpriseEconomicList) {
|
|
public EnterpriseEconomicCount(List<EnterpriseEconomic> enterpriseEconomicList) {
|
|
|
for (EnterpriseEconomic enterpriseEconomic : enterpriseEconomicList) {
|
|
for (EnterpriseEconomic enterpriseEconomic : enterpriseEconomicList) {
|
|
|
tax = tax.add(Optional.ofNullable(enterpriseEconomic.getCApprovedOutputValue()).orElse(BigDecimal.ZERO));
|
|
tax = tax.add(Optional.ofNullable(enterpriseEconomic.getCApprovedOutputValue()).orElse(BigDecimal.ZERO));
|
|
@@ -102,12 +104,13 @@ public class DataCountService {
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
}
|
|
|
- counted = true;
|
|
|
|
|
//统一查询所有需要的数据避免处理时间太长token过期,数据量大不了所以不做流式
|
|
//统一查询所有需要的数据避免处理时间太长token过期,数据量大不了所以不做流式
|
|
|
List<IndustrialPark> allIndustrialPark = dmsService.query(token, DMSQuery.INDUSTRIAL_PARK, IndustrialPark.class);
|
|
List<IndustrialPark> allIndustrialPark = dmsService.query(token, DMSQuery.INDUSTRIAL_PARK, IndustrialPark.class);
|
|
|
List<Enterprise> allEnterprise = dmsService.query(token, DMSQuery.ENTERPRISE, Enterprise.class);
|
|
List<Enterprise> allEnterprise = dmsService.query(token, DMSQuery.ENTERPRISE, Enterprise.class);
|
|
|
List<EnterpriseEconomic> inDateEnterpriseEconomic = dmsService.query(token, DMSQuery.ECONOMIC_ALL_INDEED, EnterpriseEconomic.class);
|
|
List<EnterpriseEconomic> inDateEnterpriseEconomic = dmsService.query(token, DMSQuery.ECONOMIC_ALL_INDEED, EnterpriseEconomic.class);
|
|
|
List<Order> allOrder = dmsService.query(token, DMSQuery.ORDER, Order.class);
|
|
List<Order> allOrder = dmsService.query(token, DMSQuery.ORDER, Order.class);
|
|
|
|
|
+ List<LeaseDetail> lastLeaseDetail = dmsService.query(token, DMSQuery.LAST_LEASE_DETAIL, LeaseDetail.class);
|
|
|
|
|
+ List<LeaseDetail> lastYearLease = dmsService.query(token, DMSQuery.LAST_YEAR_LEASE_DETAIL, LeaseDetail.class);
|
|
|
|
|
|
|
|
//处理一下拿到的数据,建一建索引
|
|
//处理一下拿到的数据,建一建索引
|
|
|
Map<String, List<EnterpriseEconomic>> enterpriseEconomicMap = new HashMap<>();
|
|
Map<String, List<EnterpriseEconomic>> enterpriseEconomicMap = new HashMap<>();
|
|
@@ -133,17 +136,85 @@ public class DataCountService {
|
|
|
//企呼我应
|
|
//企呼我应
|
|
|
countOrder(allOrder);
|
|
countOrder(allOrder);
|
|
|
|
|
|
|
|
|
|
+ //租赁信息相关统计
|
|
|
|
|
+ countLease(lastLeaseDetail);
|
|
|
|
|
+
|
|
|
|
|
+ //历史企业总数统计
|
|
|
|
|
+ //历史数据,所以不论企业现状如何
|
|
|
|
|
+ Map<String, List<Enterprise>> enterpriseMap = TimeUtil.split(allEnterprise);
|
|
|
|
|
+ Map<String, Integer> enterpriseByMonth = enterpriseMap.entrySet()
|
|
|
|
|
+ .stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size()));
|
|
|
|
|
+
|
|
|
|
|
+ //历史异地企业统计
|
|
|
|
|
+ //同上
|
|
|
|
|
+ Map<String, List<Enterprise>> enterpriseInTownMap = TimeUtil.split(allEnterprise
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .filter(e -> Objects.equals(e.getCSsxqCode(), "#YIDIQIYE"))
|
|
|
|
|
+ .collect(Collectors.toList()));
|
|
|
|
|
+ Map<String, Integer> enterpriseInTownByMonth = enterpriseInTownMap.entrySet()
|
|
|
|
|
+ .stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size()));
|
|
|
|
|
+
|
|
|
|
|
+ //历史房间总数统计
|
|
|
|
|
+ Map<String, List<IndustrialPark>> industrialParkMap = TimeUtil.split(allIndustrialPark
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .filter(e->Objects.equals(e.getCResourceType(),"1"))
|
|
|
|
|
+ .collect(Collectors.toList())
|
|
|
|
|
+ );
|
|
|
|
|
+ Map<String,Integer> roomByMonth = industrialParkMap.entrySet().stream().collect(
|
|
|
|
|
+ Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size())
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ //历史已使用房间总数统计
|
|
|
|
|
+ Map<String, List<LeaseDetail>> leaseMap = TimeUtil.split(lastYearLease);
|
|
|
|
|
+ Map<String, Long> leaseByMonth = leaseMap.entrySet()
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .collect(
|
|
|
|
|
+ Collectors.toMap(
|
|
|
|
|
+ Map.Entry::getKey,
|
|
|
|
|
+ e -> {
|
|
|
|
|
+ Set<String> parkCodes = industrialParkMap.getOrDefault(e.getKey(), new ArrayList<>())
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .map(IndustrialPark::getCParkCode)
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
|
+ return e.getValue()
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .map(LeaseDetail::getCRoomCode)
|
|
|
|
|
+ .filter(parkCodes::contains)
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .count();
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ tempCacheTownData.put("enterpriseByMonth", enterpriseByMonth);
|
|
|
|
|
+ tempCacheTownData.put("enterpriseInTownByMonth", enterpriseInTownByMonth);
|
|
|
|
|
+ tempCacheTownData.put("leaseByMonth", leaseByMonth);
|
|
|
|
|
+ tempCacheTownData.put("roomByMonth", roomByMonth);
|
|
|
|
|
+
|
|
|
cacheTownData = tempCacheTownData;
|
|
cacheTownData = tempCacheTownData;
|
|
|
cacheParkData = tempCacheParkData;
|
|
cacheParkData = tempCacheParkData;
|
|
|
cacheBuildData = tempCacheBuildData;
|
|
cacheBuildData = tempCacheBuildData;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
private void countIndustrialPark(List<IndustrialPark> allIndustrialPark) {
|
|
private void countIndustrialPark(List<IndustrialPark> allIndustrialPark) {
|
|
|
//简单统计并按父级编码建映射
|
|
//简单统计并按父级编码建映射
|
|
|
simpleCountPark(allIndustrialPark);
|
|
simpleCountPark(allIndustrialPark);
|
|
|
|
|
+ Map<EnterpriseLevel, Map<String, Integer>> enterPriceLevelCountByPark = new HashMap<>();
|
|
|
|
|
+ for (EnterpriseLevel value : EnterpriseLevel.values()) {
|
|
|
|
|
+ enterPriceLevelCountByPark.put(value, new HashMap<>());
|
|
|
|
|
+ }
|
|
|
//按楼宇父子关系统计
|
|
//按楼宇父子关系统计
|
|
|
for (IndustrialPark industrialPark : allPark) {
|
|
for (IndustrialPark industrialPark : allPark) {
|
|
|
String parkCode = industrialPark.getCParkCode();
|
|
String parkCode = industrialPark.getCParkCode();
|
|
|
|
|
+
|
|
|
|
|
+ for (EnterpriseLevel value : EnterpriseLevel.values()) {
|
|
|
|
|
+ enterPriceLevelCountByPark.get(value).put(industrialPark.getCResourceName(), 0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
List<IndustrialPark> allBuild;
|
|
List<IndustrialPark> allBuild;
|
|
|
List<IndustrialPark> allRoom = new ArrayList<>();
|
|
List<IndustrialPark> allRoom = new ArrayList<>();
|
|
|
|
|
|
|
@@ -237,17 +308,26 @@ public class DataCountService {
|
|
|
for (String enterpriseCode : inParkEnterpriseCode) {
|
|
for (String enterpriseCode : inParkEnterpriseCode) {
|
|
|
if (aliveEnterpriseMap.containsKey(enterpriseCode)) {
|
|
if (aliveEnterpriseMap.containsKey(enterpriseCode)) {
|
|
|
Enterprise enterprise = aliveEnterpriseMap.get(enterpriseCode);
|
|
Enterprise enterprise = aliveEnterpriseMap.get(enterpriseCode);
|
|
|
|
|
+
|
|
|
|
|
+ EnterpriseLevel.ofJsonValue(enterprise.getCompanyLevel()).ifPresent(level -> {
|
|
|
|
|
+ Map<String, Integer> map = enterPriceLevelCountByPark.get(level);
|
|
|
|
|
+ map.put(enterpriseCode, map.get(enterprise.getCEnterpriseName()) + 1);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
EnterpriseEconomicCount ytdThisYear = economicCountByYtdThisYear.get(enterpriseCode);
|
|
EnterpriseEconomicCount ytdThisYear = economicCountByYtdThisYear.get(enterpriseCode);
|
|
|
EnterpriseEconomicCount ytdLastYear = economicCountByYtdLastYear.get(enterpriseCode);
|
|
EnterpriseEconomicCount ytdLastYear = economicCountByYtdLastYear.get(enterpriseCode);
|
|
|
allTaxByYtdThisYear = allTaxByYtdThisYear.add(ytdThisYear.tax);
|
|
allTaxByYtdThisYear = allTaxByYtdThisYear.add(ytdThisYear.tax);
|
|
|
allTaxByYtdLastYear = allTaxByYtdLastYear.add(ytdLastYear.tax);
|
|
allTaxByYtdLastYear = allTaxByYtdLastYear.add(ytdLastYear.tax);
|
|
|
|
|
+
|
|
|
if ("2".equals(enterprise.getIsGsqy())) {
|
|
if ("2".equals(enterprise.getIsGsqy())) {
|
|
|
allGsProductByYtdThisYear = allGsProductByYtdThisYear.add(ytdThisYear.product);
|
|
allGsProductByYtdThisYear = allGsProductByYtdThisYear.add(ytdThisYear.product);
|
|
|
allGsProductByYtdLastYear = allGsProductByYtdLastYear.add(ytdLastYear.product);
|
|
allGsProductByYtdLastYear = allGsProductByYtdLastYear.add(ytdLastYear.product);
|
|
|
enterPriceGsCount++;
|
|
enterPriceGsCount++;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
enterPriceCount++;
|
|
enterPriceCount++;
|
|
|
aliveEnterprise.add(enterpriseCode);
|
|
aliveEnterprise.add(enterpriseCode);
|
|
|
|
|
+
|
|
|
String industry = enterprise.getIndustry();
|
|
String industry = enterprise.getIndustry();
|
|
|
if (industry != null) {
|
|
if (industry != null) {
|
|
|
if (industryCount.containsKey(industry)) {
|
|
if (industryCount.containsKey(industry)) {
|
|
@@ -290,6 +370,22 @@ public class DataCountService {
|
|
|
parkDataCount.put("topRevenue", topRevenue);
|
|
parkDataCount.put("topRevenue", topRevenue);
|
|
|
|
|
|
|
|
tempCacheParkData.put(parkCode, parkDataCount);
|
|
tempCacheParkData.put(parkCode, parkDataCount);
|
|
|
|
|
+
|
|
|
|
|
+ for (EnterpriseLevel level : EnterpriseLevel.values()) {
|
|
|
|
|
+ Map<String, Integer> map = enterPriceLevelCountByPark.get(level);
|
|
|
|
|
+ Map<String, Integer> sortedDesc = map.entrySet()
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .sorted(Map.Entry.<String, Integer>comparingByValue().reversed())
|
|
|
|
|
+ .limit(10)
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ Map.Entry::getKey,
|
|
|
|
|
+ Map.Entry::getValue,
|
|
|
|
|
+ (e1, e2) -> e1,
|
|
|
|
|
+ LinkedHashMap::new
|
|
|
|
|
+ ));
|
|
|
|
|
+ enterPriceLevelCountByPark.put(level, sortedDesc);
|
|
|
|
|
+ }
|
|
|
|
|
+ tempCacheTownData.put("enterpriseLevelCountByPark", tempCacheParkData);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -300,6 +396,8 @@ public class DataCountService {
|
|
|
BigDecimal totalFloorArea = BigDecimal.ZERO;
|
|
BigDecimal totalFloorArea = BigDecimal.ZERO;
|
|
|
BigDecimal totalBuildArea = BigDecimal.ZERO;
|
|
BigDecimal totalBuildArea = BigDecimal.ZERO;
|
|
|
BigDecimal totalVacantArea = BigDecimal.ZERO;
|
|
BigDecimal totalVacantArea = BigDecimal.ZERO;
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Integer> parkTypeCount = new HashMap<>();
|
|
|
for (IndustrialPark industrialPark : allIndustrialPark) {
|
|
for (IndustrialPark industrialPark : allIndustrialPark) {
|
|
|
try {
|
|
try {
|
|
|
int type = Integer.parseInt(industrialPark.getCResourceType());
|
|
int type = Integer.parseInt(industrialPark.getCResourceType());
|
|
@@ -322,6 +420,11 @@ public class DataCountService {
|
|
|
case 4: {
|
|
case 4: {
|
|
|
parkCount++;
|
|
parkCount++;
|
|
|
allPark.add(industrialPark);
|
|
allPark.add(industrialPark);
|
|
|
|
|
+ if (parkTypeCount.containsKey(industrialPark.getCLandUse())) {
|
|
|
|
|
+ parkTypeCount.put(industrialPark.getCLandUse(), parkCount + 1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ parkTypeCount.put(industrialPark.getCLandUse(), 1);
|
|
|
|
|
+ }
|
|
|
try {
|
|
try {
|
|
|
totalFloorArea = totalFloorArea.add(industrialPark.getCFloorArea());
|
|
totalFloorArea = totalFloorArea.add(industrialPark.getCFloorArea());
|
|
|
} catch (NumberFormatException ignore) {
|
|
} catch (NumberFormatException ignore) {
|
|
@@ -345,6 +448,7 @@ public class DataCountService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
tempCacheTownData.put("parkCount", parkCount);
|
|
tempCacheTownData.put("parkCount", parkCount);
|
|
|
|
|
+ tempCacheTownData.put("parkType", parkTypeCount);
|
|
|
tempCacheTownData.put("areaBuild", totalBuildArea);
|
|
tempCacheTownData.put("areaBuild", totalBuildArea);
|
|
|
tempCacheTownData.put("areaFloor", totalFloorArea);
|
|
tempCacheTownData.put("areaFloor", totalFloorArea);
|
|
|
tempCacheTownData.put("areaVacant", totalVacantArea);
|
|
tempCacheTownData.put("areaVacant", totalVacantArea);
|
|
@@ -404,7 +508,7 @@ public class DataCountService {
|
|
|
economicByYtdLastYear.add(e);
|
|
economicByYtdLastYear.add(e);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- economicCountBy12Month.put(enterPriceCode,new EnterpriseEconomicCount(economicBy12Month));
|
|
|
|
|
|
|
+ economicCountBy12Month.put(enterPriceCode, new EnterpriseEconomicCount(economicBy12Month));
|
|
|
economicCountByYtdThisYear.put(enterPriceCode, new EnterpriseEconomicCount(economicByYtdThisYear));
|
|
economicCountByYtdThisYear.put(enterPriceCode, new EnterpriseEconomicCount(economicByYtdThisYear));
|
|
|
economicCountByYtdLastYear.put(enterPriceCode, new EnterpriseEconomicCount(economicByYtdLastYear));
|
|
economicCountByYtdLastYear.put(enterPriceCode, new EnterpriseEconomicCount(economicByYtdLastYear));
|
|
|
}
|
|
}
|
|
@@ -419,7 +523,7 @@ public class DataCountService {
|
|
|
tempCacheTownData.put("enterPriseIndustry", industryCount);
|
|
tempCacheTownData.put("enterPriseIndustry", industryCount);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void countOrder(List<Order> allOrder) {
|
|
|
|
|
|
|
+ private void countOrder(List<Order> allOrder) {
|
|
|
int orderComplete = 0;
|
|
int orderComplete = 0;
|
|
|
int orderCount = 0;
|
|
int orderCount = 0;
|
|
|
for (Order order : allOrder) {
|
|
for (Order order : allOrder) {
|
|
@@ -443,7 +547,95 @@ public class DataCountService {
|
|
|
tempCacheTownData.put("orderCount", orderCount);
|
|
tempCacheTownData.put("orderCount", orderCount);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void countLease(List<LeaseDetail> allLease) {
|
|
|
|
|
+ List<LeaseDetail> timeoutIn1Month = new ArrayList<>();
|
|
|
|
|
+ List<LeaseDetail> timeoutIn3Month = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, LeaseDetail> leaseMap = new HashMap<>();
|
|
|
|
|
+ for (LeaseDetail lease : allLease) {
|
|
|
|
|
+ if (lease.getCEndDate() != null) {
|
|
|
|
|
+ if (lease.getCEndDate().isAfter(now)) {
|
|
|
|
|
+ if (lease.getCEndDate().isBefore(now.plusMonths(1))) {
|
|
|
|
|
+ timeoutIn1Month.add(lease);
|
|
|
|
|
+ } else if (lease.getCEndDate().isBefore(now.plusMonths(3))) {
|
|
|
|
|
+ timeoutIn3Month.add(lease);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ leaseMap.put(lease.getCRoomCode(), lease);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int vacantRoomCount = 0;
|
|
|
|
|
+ BigDecimal vacantAreaCount = BigDecimal.ZERO;
|
|
|
|
|
+ int expiringSoonRoomCount = 0;
|
|
|
|
|
+ BigDecimal expiringSoonAreaCount = BigDecimal.ZERO;
|
|
|
|
|
+ int utilizedRoomCount = 0;
|
|
|
|
|
+ BigDecimal utilizedAreaCount = BigDecimal.ZERO;
|
|
|
|
|
+ int reservedRoomCount = 0;
|
|
|
|
|
+ BigDecimal reservedAreaCount = BigDecimal.ZERO;
|
|
|
|
|
+ int terminatedRoomCount = 0;
|
|
|
|
|
+ BigDecimal terminatedAreaCount = BigDecimal.ZERO;
|
|
|
|
|
+ for (List<IndustrialPark> roomList : roomMap.values()) {
|
|
|
|
|
+ for (IndustrialPark room : roomList) {
|
|
|
|
|
+ LeaseDetail lease = leaseMap.get(room.getCParkCode());
|
|
|
|
|
+ if (lease == null) {
|
|
|
|
|
+ vacantRoomCount++;
|
|
|
|
|
+ vacantAreaCount = vacantAreaCount.add(Optional.ofNullable(room.getCBuildingArea()).orElse(BigDecimal.ZERO));
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lease.getCEndDate().isAfter(now) && lease.getCStartDate().isBefore(now)) {
|
|
|
|
|
+ utilizedRoomCount++;
|
|
|
|
|
+ utilizedAreaCount = utilizedAreaCount.add(Optional.ofNullable(room.getCBuildingArea()).orElse(BigDecimal.ZERO));
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lease.getCStartDate().isAfter(now) && lease.getCEndDate().isAfter(now)) {
|
|
|
|
|
+ reservedRoomCount++;
|
|
|
|
|
+ reservedAreaCount = reservedAreaCount.add(Optional.ofNullable(room.getCBuildingArea()).orElse(BigDecimal.ZERO));
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lease.getCEndDate().isBefore(now) && lease.getCEndDate().plusMonths(1).isAfter(now)) {
|
|
|
|
|
+ terminatedRoomCount++;
|
|
|
|
|
+ terminatedAreaCount = terminatedAreaCount.add(Optional.ofNullable(room.getCBuildingArea()).orElse(BigDecimal.ZERO));
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lease.getCEndDate().isAfter(now) && lease.getCEndDate().isBefore(now.plusMonths(3))) {
|
|
|
|
|
+ expiringSoonRoomCount++;
|
|
|
|
|
+ expiringSoonAreaCount = expiringSoonAreaCount.add(Optional.ofNullable(room.getCBuildingArea()).orElse(BigDecimal.ZERO));
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ vacantRoomCount++;
|
|
|
|
|
+ vacantAreaCount = vacantAreaCount.add(Optional.ofNullable(room.getCBuildingArea()).orElse(BigDecimal.ZERO));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ timeoutIn1Month.sort(Comparator.comparing(LeaseDetail::getCEndDate));
|
|
|
|
|
+ timeoutIn3Month.sort(Comparator.comparing(LeaseDetail::getCEndDate));
|
|
|
|
|
+
|
|
|
|
|
+ List<LeaseDetail> sortedLeaseTimeout = Stream.concat(timeoutIn1Month.stream(), timeoutIn3Month.stream())
|
|
|
|
|
+ .sorted(Comparator.comparing(LeaseDetail::getCEndDate))
|
|
|
|
|
+ .limit(25)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
+ tempCacheTownData.put("leaseTimeoutIn1Month", timeoutIn1Month.size());
|
|
|
|
|
+ tempCacheTownData.put("leaseTimeoutIn3Month", timeoutIn3Month.size());
|
|
|
|
|
+ tempCacheTownData.put("leaseTimeout", sortedLeaseTimeout);
|
|
|
|
|
+ tempCacheTownData.put("leaseVacantRoomCount", vacantRoomCount);
|
|
|
|
|
+ tempCacheTownData.put("leaseVacantAreaCount", vacantAreaCount);
|
|
|
|
|
+
|
|
|
|
|
+ tempCacheTownData.put("leaseExpiringSoonRoomCount", expiringSoonRoomCount);
|
|
|
|
|
+ tempCacheTownData.put("leaseExpiringSoonAreaCount", expiringSoonAreaCount);
|
|
|
|
|
+
|
|
|
|
|
+ tempCacheTownData.put("leaseUtilizedRoomCount", utilizedRoomCount);
|
|
|
|
|
+ tempCacheTownData.put("leaseUtilizedAreaCount", utilizedAreaCount);
|
|
|
|
|
+
|
|
|
|
|
+ tempCacheTownData.put("leaseReservedRoomCount", reservedRoomCount);
|
|
|
|
|
+ tempCacheTownData.put("leaseReservedAreaCount", reservedAreaCount);
|
|
|
|
|
+
|
|
|
|
|
+ tempCacheTownData.put("leaseTerminatedRoomCount", terminatedRoomCount);
|
|
|
|
|
+ tempCacheTownData.put("leaseTerminatedAreaCount", terminatedAreaCount);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public JSONObject getTownData() {
|
|
public JSONObject getTownData() {
|
|
|
tryCount();
|
|
tryCount();
|