|
|
@@ -48,6 +48,62 @@ public class DataCountService {
|
|
|
MultiValueMap<String, IndustrialPark> buildMap = new LinkedMultiValueMap<>();
|
|
|
List<IndustrialPark> allPark = new ArrayList<>();
|
|
|
|
|
|
+ private Map<String,String> nationalIndustryToMerged = new HashMap<>();
|
|
|
+ private Map<String,String> nationalIndustryMap = new HashMap<>();
|
|
|
+ private Map<String,String> regTypeMap = new HashMap<>();
|
|
|
+
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+ initNationalIndustryToMerged();
|
|
|
+ initRegType();
|
|
|
+ initNationalIndustry();
|
|
|
+ }
|
|
|
+ private void initNationalIndustryToMerged () {
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("F", "批发和零售业");
|
|
|
+ map.put("I", "信息传输、软件和信息技术服务业");
|
|
|
+ map.put("L", "租赁和商务服务业");
|
|
|
+ map.put("M", "科学研究和技术服务业");
|
|
|
+ map.put("C", "制造业");
|
|
|
+ map.put("R", "文化、体育和娱乐业");
|
|
|
+ nationalIndustryToMerged = map;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initRegType(){
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("1", "注册实体型");
|
|
|
+ map.put("2", "注册非实体型");
|
|
|
+ map.put("3", "实体非注册型");
|
|
|
+ map.put("4", "临时流动");
|
|
|
+ regTypeMap = map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void initNationalIndustry() {
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("A", "农、林、牧、渔业");
|
|
|
+ map.put("B", "采矿业");
|
|
|
+ map.put("C", "制造业");
|
|
|
+ map.put("D", "电力、热力、燃气及水生产和供应业");
|
|
|
+ map.put("E", "建筑业");
|
|
|
+ map.put("F", "批发和零售业");
|
|
|
+ map.put("G", "交通运输、仓储和邮政业");
|
|
|
+ map.put("H", "住宿和餐饮业");
|
|
|
+ map.put("I", "信息传输、软件和信息技术服务业");
|
|
|
+ map.put("J", "金融业");
|
|
|
+ map.put("K", "房地产业");
|
|
|
+ map.put("L", "租赁和商务服务业");
|
|
|
+ map.put("M", "科学研究和技术服务业");
|
|
|
+ map.put("N", "水利、环境和公共设施管理业");
|
|
|
+ map.put("O", "居民服务、修理和其他服务业");
|
|
|
+ map.put("P", "教育");
|
|
|
+ map.put("Q", "卫生和社会工作");
|
|
|
+ map.put("R", "文化、体育和娱乐业");
|
|
|
+ map.put("S", "公共管理、社会保障和社会组织");
|
|
|
+ map.put("T", "国际组织");
|
|
|
+ nationalIndustryMap = map;
|
|
|
+ }
|
|
|
+
|
|
|
//简单限制统计频率
|
|
|
@Value("${app.count-cache-length}")
|
|
|
private long INTERVAL_MILLIS ;
|
|
|
@@ -118,7 +174,7 @@ public class DataCountService {
|
|
|
|
|
|
//数据量大不了所以不做流式
|
|
|
List<IndustrialPark> allIndustrialPark = dmsService.query(authService.getTokenOfServiceAccount(), DMSQuery.INDUSTRIAL_PARK, IndustrialPark.class, now);
|
|
|
- List<Enterprise> allEnterprise = dmsService.query(authService.getTokenOfServiceAccount(), DMSQuery.ENTERPRISE, Enterprise.class, now);
|
|
|
+ List<Enterprise> allEnterprise = dmsService.queryEnterpriseByComplex(authService.getTokenOfServiceAccount());
|
|
|
List<EnterpriseEconomic> inDateEnterpriseEconomic = dmsService.query(authService.getTokenOfServiceAccount(), DMSQuery.ECONOMIC_ALL_INDEED, EnterpriseEconomic.class, now);
|
|
|
List<Order> allOrder = dmsService.query(authService.getTokenOfServiceAccount(), DMSQuery.ORDER, Order.class, now);
|
|
|
List<LeaseDetail> lastLeaseDetail = dmsService.query(authService.getTokenOfServiceAccount(), DMSQuery.LAST_LEASE_DETAIL, LeaseDetail.class, now);
|
|
|
@@ -252,7 +308,6 @@ public class DataCountService {
|
|
|
|
|
|
int enterPriceCount = 0;
|
|
|
int enterPriceGsCount = 0;
|
|
|
- Map<String, Integer> industryCount = new HashMap<>();
|
|
|
Set<String> inParkEnterpriseCode = new HashSet<>();
|
|
|
List<String> aliveEnterprise = new ArrayList<>();
|
|
|
int usedRoomCount = 0;
|
|
|
@@ -267,8 +322,6 @@ public class DataCountService {
|
|
|
|
|
|
Set<String> buildEnterpriseCode = new HashSet<>();
|
|
|
JSONObject buildData = new JSONObject();
|
|
|
- int buildEnterpriseCount = 0;
|
|
|
- int buildGsEnterpriseCount = 0;
|
|
|
int buildRoomCount = 0;
|
|
|
int buildUsedRoomCount = 0;
|
|
|
|
|
|
@@ -312,14 +365,20 @@ public class DataCountService {
|
|
|
floorData.put("floorName", floor.getCResourceName());
|
|
|
floors.add(floorData);
|
|
|
}
|
|
|
+ int buildEnterpriseCount = 0;
|
|
|
+ int buildGsEnterpriseCount = 0;
|
|
|
for (String enterpriseCode : buildEnterpriseCode) {
|
|
|
+ boolean isGsqy = false;
|
|
|
if (aliveEnterpriseMap.containsKey(enterpriseCode)) {
|
|
|
Enterprise enterprise = aliveEnterpriseMap.get(enterpriseCode);
|
|
|
- buildEnterpriseCount++;
|
|
|
if ("2".equals(enterprise.getIsGsqy())) {
|
|
|
- buildGsEnterpriseCount++;
|
|
|
+ isGsqy = true;
|
|
|
}
|
|
|
}
|
|
|
+ buildEnterpriseCount++;
|
|
|
+ if (isGsqy) {
|
|
|
+ buildGsEnterpriseCount++;
|
|
|
+ }
|
|
|
}
|
|
|
buildData.put("enterpriseCount", buildEnterpriseCount);
|
|
|
buildData.put("gsEnterpriseCount", buildGsEnterpriseCount);
|
|
|
@@ -335,10 +394,16 @@ public class DataCountService {
|
|
|
for (EnterpriseLevel value : EnterpriseLevel.values()) {
|
|
|
enterPriceLevelCountByPark.get(value).put(industrialPark.getCResourceName(), 0);
|
|
|
}
|
|
|
+ Map<String, Integer> enterPriceIndustryCount = new HashMap<>();
|
|
|
for (String enterpriseCode : inParkEnterpriseCode) {
|
|
|
+ boolean isGsqy = false;
|
|
|
+ String nationalIndustry = null;
|
|
|
if (aliveEnterpriseMap.containsKey(enterpriseCode)) {
|
|
|
Enterprise enterprise = aliveEnterpriseMap.get(enterpriseCode);
|
|
|
|
|
|
+ isGsqy = "2".equals(enterprise.getIsGsqy());
|
|
|
+ nationalIndustry = enterprise.getCNationalIndustry();
|
|
|
+
|
|
|
EnterpriseLevel.ofJsonValue(enterprise.getCompanyLevel()).ifPresent(level -> {
|
|
|
Map<String, Integer> map = enterPriceLevelCountByPark.get(level);
|
|
|
map.put(industrialPark.getCResourceName(), map.get(industrialPark.getCResourceName()) + 1);
|
|
|
@@ -349,24 +414,31 @@ public class DataCountService {
|
|
|
allTaxByYtdThisYear = allTaxByYtdThisYear.add(ytdThisYear.tax);
|
|
|
allTaxByYtdLastYear = allTaxByYtdLastYear.add(ytdLastYear.tax);
|
|
|
|
|
|
- if ("2".equals(enterprise.getIsGsqy())) {
|
|
|
+ if (isGsqy) {
|
|
|
allGsProductByYtdThisYear = allGsProductByYtdThisYear.add(ytdThisYear.product);
|
|
|
allGsProductByYtdLastYear = allGsProductByYtdLastYear.add(ytdLastYear.product);
|
|
|
- enterPriceGsCount++;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- enterPriceCount++;
|
|
|
aliveEnterprise.add(enterpriseCode);
|
|
|
+ enterPriceCount++;
|
|
|
+ if (isGsqy) {
|
|
|
+ enterPriceGsCount++;
|
|
|
+ }
|
|
|
|
|
|
- String industry = enterprise.getIndustry();
|
|
|
- if (industry != null) {
|
|
|
- if (industryCount.containsKey(industry)) {
|
|
|
- industryCount.put(industry, industryCount.get(industry) + 1);
|
|
|
- } else {
|
|
|
- industryCount.put(industry, 1);
|
|
|
- }
|
|
|
+ }
|
|
|
+ enterPriceCount++;
|
|
|
+ if (isGsqy) {
|
|
|
+ enterPriceGsCount++;
|
|
|
+ }
|
|
|
+ if (nationalIndustry != null) {
|
|
|
+ if (enterPriceIndustryCount.containsKey(nationalIndustry)) {
|
|
|
+ enterPriceIndustryCount.put(nationalIndustry, enterPriceIndustryCount.get(nationalIndustry) + 1);
|
|
|
+ } else {
|
|
|
+ enterPriceIndustryCount.put(nationalIndustry, 1);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
List<String> sortedEnterprise = aliveEnterprise.stream().sorted((a, b) -> {
|
|
|
BigDecimal ar = economicCountBy12Month.get(a).revenue;
|
|
|
@@ -385,7 +457,7 @@ public class DataCountService {
|
|
|
parkDataCount.put("enterpriseCount", enterPriceCount);
|
|
|
parkDataCount.put("enterpriseGsCount", enterPriceGsCount);
|
|
|
parkDataCount.put("parkVacantArea", industrialPark.getCVacantArea());
|
|
|
- parkDataCount.put("enterPriseIndustry", industryCount);
|
|
|
+ parkDataCount.put("enterPriseIndustry", enterPriceIndustryCount);
|
|
|
|
|
|
JSONArray topRevenue = new JSONArray();
|
|
|
for (String enterPriseCode : sortedEnterprise) {
|
|
|
@@ -423,9 +495,6 @@ public class DataCountService {
|
|
|
|
|
|
private void simpleCountPark(List<IndustrialPark> allIndustrialPark) {
|
|
|
int parkCount = 0;
|
|
|
- BigDecimal totalFloorArea = BigDecimal.ZERO;
|
|
|
- BigDecimal totalBuildArea = BigDecimal.ZERO;
|
|
|
- BigDecimal totalVacantArea = BigDecimal.ZERO;
|
|
|
|
|
|
Map<String, Integer> parkTypeCount = new HashMap<>();
|
|
|
for (IndustrialPark industrialPark : allIndustrialPark) {
|
|
|
@@ -455,18 +524,6 @@ public class DataCountService {
|
|
|
} else {
|
|
|
parkTypeCount.put(industrialPark.getCLandUse(), 1);
|
|
|
}
|
|
|
- try {
|
|
|
- totalFloorArea = totalFloorArea.add(industrialPark.getCFloorArea());
|
|
|
- } catch (NumberFormatException ignore) {
|
|
|
- }
|
|
|
- try {
|
|
|
- totalBuildArea = totalBuildArea.add(industrialPark.getCBuildingArea());
|
|
|
- } catch (NumberFormatException ignore) {
|
|
|
- }
|
|
|
- try {
|
|
|
- totalVacantArea = totalVacantArea.add(industrialPark.getCVacantArea());
|
|
|
- } catch (NumberFormatException ignore) {
|
|
|
- }
|
|
|
}
|
|
|
default: {
|
|
|
//do nothing
|
|
|
@@ -477,6 +534,10 @@ public class DataCountService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ BigDecimal totalFloorArea = allPark.stream().map(IndustrialPark::getCFloorArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+ BigDecimal totalBuildArea = allPark.stream().map(IndustrialPark::getCBuildingArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+ BigDecimal totalVacantArea = allPark.stream().map(IndustrialPark::getCVacantArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+
|
|
|
tempCacheTownData.put("parkCount", parkCount);
|
|
|
tempCacheTownData.put("parkType", parkTypeCount);
|
|
|
tempCacheTownData.put("areaBuild", totalBuildArea);
|
|
|
@@ -490,6 +551,8 @@ public class DataCountService {
|
|
|
int gsqyCount = 0;
|
|
|
int aliveCount = 0;
|
|
|
Map<String, Integer> industryCount = new HashMap<>();
|
|
|
+ Map<String, Integer> nationalIndustryCount = new HashMap<>();
|
|
|
+ Map<String, Integer> regTypeCount = new HashMap<>();
|
|
|
|
|
|
for (Enterprise enterPrise : allEnterprise) {
|
|
|
boolean isInTown =Arrays.asList("1","3","4").contains(Optional.ofNullable(enterPrise.getRegType()).orElse("1"));
|
|
|
@@ -505,13 +568,34 @@ public class DataCountService {
|
|
|
gsqyCount++;
|
|
|
}
|
|
|
|
|
|
- String industry = enterPrise.getIndustry();
|
|
|
- if (industry != null) {
|
|
|
+ String nationalIndustryCode = enterPrise.getCNationalIndustryCode();
|
|
|
+ String mergedNationalIndustry = null;
|
|
|
+ if (nationalIndustryCode!=null&& !nationalIndustryCode.isEmpty()) {
|
|
|
+ String prefix = nationalIndustryCode.substring(0, 1);
|
|
|
+ String industry = nationalIndustryMap.get(prefix);
|
|
|
if (industryCount.containsKey(industry)) {
|
|
|
industryCount.put(industry, industryCount.get(industry) + 1);
|
|
|
} else {
|
|
|
industryCount.put(industry, 1);
|
|
|
}
|
|
|
+ mergedNationalIndustry = nationalIndustryToMerged.get(prefix);
|
|
|
+ }
|
|
|
+ if (mergedNationalIndustry==null)mergedNationalIndustry = "其他";
|
|
|
+ if (nationalIndustryCount.containsKey(mergedNationalIndustry)) {
|
|
|
+ nationalIndustryCount.put(mergedNationalIndustry, nationalIndustryCount.get(mergedNationalIndustry) + 1);
|
|
|
+ } else {
|
|
|
+ nationalIndustryCount.put(mergedNationalIndustry, 1);
|
|
|
+ }
|
|
|
+ String regType = enterPrise.getRegType();
|
|
|
+ String regTypeChinese = null;
|
|
|
+ if (regType!=null&& !regType.isEmpty()){
|
|
|
+ regTypeChinese = regTypeMap.get(regType);
|
|
|
+ }
|
|
|
+ if (regTypeChinese == null) regTypeChinese = "其他";
|
|
|
+ if (regTypeCount.containsKey(regTypeChinese)) {
|
|
|
+ regTypeCount.put(regTypeChinese, regTypeCount.get(regTypeChinese) + 1);
|
|
|
+ } else {
|
|
|
+ regTypeCount.put(regTypeChinese, 1);
|
|
|
}
|
|
|
|
|
|
String enterPriceCode = enterPrise.getCUnifiedSocialCreditCode();
|
|
|
@@ -551,6 +635,8 @@ public class DataCountService {
|
|
|
tempCacheTownData.put("enterPriseGsCount", gsqyCount);
|
|
|
|
|
|
tempCacheTownData.put("enterPriseIndustry", industryCount);
|
|
|
+ tempCacheTownData.put("mergedEnterPriseIndustry", nationalIndustryCount);
|
|
|
+ tempCacheTownData.put("enterPriseRegType", regTypeCount);
|
|
|
}
|
|
|
|
|
|
private void countOrder(List<Order> allOrder) {
|