Jelajahi Sumber

数据统计总览提交

nahida 1 tahun lalu
induk
melakukan
6c39b8e6f5

+ 151 - 17
zksy-admin/src/main/java/com/zksy/web/controller/basicData/CrmOverviewDataController.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.zksy.common.core.domain.AjaxResult;
 import com.zksy.system.basicData.domain.*;
 import com.zksy.system.basicData.domain.vo.CheckResultVo;
+import com.zksy.system.basicData.domain.vo.QuarterYoYVo;
 import com.zksy.system.basicData.mapper.*;
 import com.zksy.system.basicData.service.CrmOverviewDataService;
 import com.zksy.system.config.StrMapperMap;
@@ -38,8 +39,6 @@ public class CrmOverviewDataController {
     private StrMapperMap strMapperMap;
     @Autowired
     private CrmHighTechZoneEnterprisesMapper crmHighTechZoneEnterprisesMapper;
-    @Autowired
-    private CrmEnterpriseTaxPaymentInfoMapper crmEnterpriseTaxPaymentInfoMapper;
 
     @SneakyThrows
     @GetMapping("/checkByList")
@@ -71,28 +70,52 @@ public class CrmOverviewDataController {
                 processA(mapper, vos);
                 break;
             case "b1":
-                processCrmOutputValue(vos, q, CrmOutputValue::getFirstQuarterAmount, CheckResultVo::setB1);
+                processCrmOutputValue(vos, q, CrmOutputValue::getFirstQuarterAmount, CheckResultVo::setB1,LocalDate.now().getYear());
                 break;
             case "b2":
-                processCrmOutputValue(vos, q, CrmOutputValue::getSecondQuarterAmount, CheckResultVo::setB2);
+                processCrmOutputValue(vos, q, CrmOutputValue::getSecondQuarterAmount, CheckResultVo::setB2,LocalDate.now().getYear());
                 break;
             case "b3":
-                processCrmOutputValue(vos, q, CrmOutputValue::getThirdQuarterAmount, CheckResultVo::setB3);
+                processCrmOutputValue(vos, q, CrmOutputValue::getThirdQuarterAmount, CheckResultVo::setB3,LocalDate.now().getYear());
                 break;
             case "b4":
-                processCrmOutputValue(vos, q, CrmOutputValue::getFourthQuarterAmount, CheckResultVo::setB4);
+                processCrmOutputValue(vos, q, CrmOutputValue::getFourthQuarterAmount, CheckResultVo::setB4,LocalDate.now().getYear());
+                break;
+            case "b6":
+                processCrmOutputValue(vos, q, CrmOutputValue::getFirstQuarterAmount, CheckResultVo::setB6,LocalDate.now().getYear()-1);
+                break;
+            case "b7":
+                processCrmOutputValue(vos, q, CrmOutputValue::getSecondQuarterAmount, CheckResultVo::setB7,LocalDate.now().getYear()-1);
+                break;
+            case "b8":
+                processCrmOutputValue(vos, q, CrmOutputValue::getThirdQuarterAmount, CheckResultVo::setB8,LocalDate.now().getYear()-1);
+                break;
+            case "b9":
+                processCrmOutputValue(vos, q, CrmOutputValue::getFourthQuarterAmount, CheckResultVo::setB9,LocalDate.now().getYear()-1);
                 break;
             case "c1":
-                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getFirstQuarterAmount, CheckResultVo::setC1);
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getFirstQuarterAmount, CheckResultVo::setC1,LocalDate.now().getYear());
                 break;
             case "c2":
-                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getSecondQuarterAmount, CheckResultVo::setC2);
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getSecondQuarterAmount, CheckResultVo::setC2,LocalDate.now().getYear());
                 break;
             case "c3":
-                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getThirdQuarterAmount, CheckResultVo::setC3);
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getThirdQuarterAmount, CheckResultVo::setC3,LocalDate.now().getYear());
                 break;
             case "c4":
-                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getFourthQuarterAmount, CheckResultVo::setC4);
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getFourthQuarterAmount, CheckResultVo::setC4,LocalDate.now().getYear());
+                break;
+            case "c6":
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getFirstQuarterAmount, CheckResultVo::setC6,LocalDate.now().getYear()-1);
+                break;
+            case "c7":
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getSecondQuarterAmount, CheckResultVo::setC7,LocalDate.now().getYear()-1);
+                break;
+            case "c8":
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getThirdQuarterAmount, CheckResultVo::setC8,LocalDate.now().getYear()-1);
+                break;
+            case "c9":
+                processCrmEnterpriseTaxPaymentInfo(vos, q, CrmEnterpriseTaxPaymentInfo::getFourthQuarterAmount, CheckResultVo::setC9,LocalDate.now().getYear()-1);
                 break;
             case "dd":
                 processDd(mapper, vos);
@@ -136,6 +159,9 @@ public class CrmOverviewDataController {
             case "dr":
                 processDr(mapper, vos);
                 break;
+            case "dr1":
+                processDr1(mapper, vos);
+                break;
             case "ds":
                 processDs(mapper, vos);
                 break;
@@ -148,6 +174,54 @@ public class CrmOverviewDataController {
             case "dv":
                 processDv(mapper, vos);
                 break;
+            case "dw1":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getFirstQuarterUsage, CheckResultVo::setDw1,LocalDate.now().getYear());
+                break;
+            case "dw2":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getSecondQuarterUsage, CheckResultVo::setDw2,LocalDate.now().getYear());
+                break;
+            case "dw3":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getThirdQuarterUsage, CheckResultVo::setDw3,LocalDate.now().getYear());
+                break;
+            case "dw4":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getFourthQuarterUsage, CheckResultVo::setDw4,LocalDate.now().getYear());
+                break;
+            case "dw6":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getFirstQuarterUsage, CheckResultVo::setDw6,LocalDate.now().getYear()-1);
+                break;
+            case "dw7":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getSecondQuarterUsage, CheckResultVo::setDw7,LocalDate.now().getYear()-1);
+                break;
+            case "dw8":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getThirdQuarterUsage, CheckResultVo::setDw8,LocalDate.now().getYear()-1);
+                break;
+            case "dw9":
+                processWaterUsage(vos, q,CrmQuarterlyWaterUsage::getFourthQuarterUsage, CheckResultVo::setDw9,LocalDate.now().getYear()-1);
+                break;
+            case "dx1":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getFirstQuarterConsumption, CheckResultVo::setDx1,LocalDate.now().getYear());
+                break;
+            case "dx2":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getSecondQuarterConsumption, CheckResultVo::setDx2,LocalDate.now().getYear());
+                break;
+            case "dx3":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getThirdQuarterConsumption, CheckResultVo::setDx3,LocalDate.now().getYear());
+                break;
+            case "dx4":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getFourthQuarterConsumption, CheckResultVo::setDx4,LocalDate.now().getYear());
+                break;
+            case "dx6":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getFirstQuarterConsumption, CheckResultVo::setDx6,LocalDate.now().getYear()-1);
+                break;
+            case "dx7":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getSecondQuarterConsumption, CheckResultVo::setDx7,LocalDate.now().getYear()-1);
+                break;
+            case "dx8":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getThirdQuarterConsumption, CheckResultVo::setDx8,LocalDate.now().getYear()-1);
+                break;
+            case "dx9":
+                processElectricityBill(vos, q,CrmQuarterlyElectricityBill::getFourthQuarterConsumption, CheckResultVo::setDx9,LocalDate.now().getYear()-1);
+                break;
             default:
                 // 处理默认情况
                 break;
@@ -170,11 +244,12 @@ public class CrmOverviewDataController {
             List<CheckResultVo> vos,
             String q,
             Function<CrmOutputValue, String> amountFunction,
-            BiConsumer<CheckResultVo, String> setterFunction
+            BiConsumer<CheckResultVo, String> setterFunction,
+            Integer year
     ) {
         CrmOutputValueMapper o = (CrmOutputValueMapper) strMapperMap.contianer.get(q);
         LambdaQueryWrapper<CrmOutputValue> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(CrmOutputValue::getAnnualAmount, LocalDate.now().getYear());
+        wrapper.eq(CrmOutputValue::getAnnualAmount, year);
         List<CrmOutputValue> crmOutputValues = o.selectList(wrapper);
         Map<String, CrmOutputValue> crmOutputValueMap = crmOutputValues.stream()
                 .collect(Collectors.toMap(CrmOutputValue::getUnifiedSocialCreditCode, v -> v));
@@ -190,11 +265,12 @@ public class CrmOverviewDataController {
             List<CheckResultVo> vos,
             String q,
             Function<CrmEnterpriseTaxPaymentInfo, String> amountFunction,
-            BiConsumer<CheckResultVo, String> setterFunction
+            BiConsumer<CheckResultVo, String> setterFunction,
+            Integer year
     ) {
         CrmEnterpriseTaxPaymentInfoMapper o = (CrmEnterpriseTaxPaymentInfoMapper) strMapperMap.contianer.get(q);
         LambdaQueryWrapper<CrmEnterpriseTaxPaymentInfo> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(CrmEnterpriseTaxPaymentInfo::getAnnualAmount, LocalDate.now().getYear());
+        wrapper.eq(CrmEnterpriseTaxPaymentInfo::getAnnualAmount, year);
         List<CrmEnterpriseTaxPaymentInfo> list = o.selectList(wrapper);
         Map<String, CrmEnterpriseTaxPaymentInfo> map = list.stream()
                 .collect(Collectors.toMap(CrmEnterpriseTaxPaymentInfo::getUnifiedSocialCreditCode, v -> v));
@@ -298,9 +374,24 @@ public class CrmOverviewDataController {
                 .collect(Collectors.toMap(CrmEnterpriseSocialSecurityInfo::getUnifiedSocialCreditCode,
                         CrmEnterpriseSocialSecurityInfo::getAvgInsuredPersonsBand));
         vos.forEach(w1 -> Optional.ofNullable(map.get(w1.getUniCode()))
-                .ifPresent(q->{
-                    w1.setDr(Long.parseLong(q));
-                }));
+                .map(String::trim)
+                .filter(q->!q.isEmpty())
+                .map(Long::parseLong)
+                .ifPresent(w1::setDr));
+    }
+
+    private void processDr1(Object mapper, List<CheckResultVo> vos) {
+        CrmEnterpriseSocialSecurityInfoMapper crmEnterpriseSocialSecurityInfoMapper = (CrmEnterpriseSocialSecurityInfoMapper) mapper;
+        List<CrmEnterpriseSocialSecurityInfo> list = crmEnterpriseSocialSecurityInfoMapper.selectList(null);
+        Map<String, String> map = list.stream()
+                .filter(q->q.getRemarks().contains(String.valueOf(LocalDate.now().getYear())))
+                .collect(Collectors.toMap(CrmEnterpriseSocialSecurityInfo::getUnifiedSocialCreditCode,
+                        CrmEnterpriseSocialSecurityInfo::getAvgMonthlyPaymentBand));
+        vos.forEach(w1 -> Optional.ofNullable(map.get(w1.getUniCode()))
+                .map(String::trim)
+                .filter(q->!q.isEmpty())
+                .map(Long::parseLong)
+                .ifPresent(w1::setDr1));
     }
 
     private void processDs(Object mapper, List<CheckResultVo> vos) {
@@ -349,6 +440,49 @@ public class CrmOverviewDataController {
                 .ifPresent(w1::setDv));
     }
 
+    private void processWaterUsage(
+            List<CheckResultVo> vos,
+            String q,
+            Function<CrmQuarterlyWaterUsage, String> amountFunction,
+            BiConsumer<CheckResultVo, String> setterFunction,
+            Integer year
+    ) {
+        CrmQuarterlyWaterUsageMapper o = (CrmQuarterlyWaterUsageMapper) strMapperMap.contianer.get(q);
+        LambdaQueryWrapper<CrmQuarterlyWaterUsage> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(CrmQuarterlyWaterUsage::getAnnual, year);
+        List<CrmQuarterlyWaterUsage> value = o.selectList(wrapper);
+        Map<String, CrmQuarterlyWaterUsage> map = value.stream()
+                .collect(Collectors.toMap(CrmQuarterlyWaterUsage::getUnifiedSocialCreditCode, v -> v));
+        vos.forEach(w1 -> {
+            CrmQuarterlyWaterUsage v = map.get(w1.getUniCode());
+            if (v != null) {
+                setterFunction.accept(w1, amountFunction.apply(v));
+            }
+        });
+    }
+
+    private void processElectricityBill(
+            List<CheckResultVo> vos,
+            String q,
+            Function<CrmQuarterlyElectricityBill, String> amountFunction,
+            BiConsumer<CheckResultVo, String> setterFunction,
+            Integer year
+    ) {
+        CrmQuarterlyElectricityBillMapper o = (CrmQuarterlyElectricityBillMapper) strMapperMap.contianer.get(q);
+        LambdaQueryWrapper<CrmQuarterlyElectricityBill> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(CrmQuarterlyElectricityBill::getYear, year);
+        List<CrmQuarterlyElectricityBill> value = o.selectList(wrapper);
+        Map<String, CrmQuarterlyElectricityBill> map = value.stream()
+                .collect(Collectors.toMap(CrmQuarterlyElectricityBill::getUnifiedSocialCreditCode, v -> v));
+        vos.forEach(w1 -> {
+            CrmQuarterlyElectricityBill v = map.get(w1.getUniCode());
+            if (v != null) {
+                setterFunction.accept(w1, amountFunction.apply(v));
+            }
+        });
+    }
+
+
     private <T extends BaseMapper<R>, R> void processCommon(Object mapper, List<CheckResultVo> vos, Class<T> mapperClass,
                                                                Function<R, String> keyExtractor,
                                                                BiConsumer<CheckResultVo, Long> setter) {

+ 25 - 0
zksy-system/src/main/java/com/zksy/system/basicData/domain/vo/CheckResultVo.java

@@ -15,10 +15,18 @@ public class CheckResultVo {
     private String b2;
     private String b3;
     private String b4;
+    private String b6;
+    private String b7;
+    private String b8;
+    private String b9;
     private String c1;
     private String c2;
     private String c3;
     private String c4;
+    private String c6;
+    private String c7;
+    private String c8;
+    private String c9;
     private long dd;
     private long de;
     private long df;
@@ -33,8 +41,25 @@ public class CheckResultVo {
     private String dp;
     private String dq;
     private long dr;
+    private long dr1;
     private String ds = "无";
     private String dt = "无";
     private long du;
     private long dv;
+    private String dw1;
+    private String dw2;
+    private String dw3;
+    private String dw4;
+    private String dw6;
+    private String dw7;
+    private String dw8;
+    private String dw9;
+    private String dx1;
+    private String dx2;
+    private String dx3;
+    private String dx4;
+    private String dx6;
+    private String dx7;
+    private String dx8;
+    private String dx9;
 }

+ 30 - 4
zksy-system/src/main/java/com/zksy/system/config/StrMapperMap.java

@@ -1,10 +1,7 @@
 package com.zksy.system.config;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zksy.system.basicData.domain.CrmEnterpriseTaxClassificationInfo;
-import com.zksy.system.basicData.domain.CrmEnterpriseTaxPaymentInfo;
-import com.zksy.system.basicData.domain.CrmEnterpriseTechnologyRndSummary;
-import com.zksy.system.basicData.domain.CrmListedCompany;
+import com.zksy.system.basicData.domain.*;
 import com.zksy.system.basicData.mapper.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
@@ -29,10 +26,18 @@ public class StrMapperMap {
         map.put("b2",crmOutputValueMapper);
         map.put("b3",crmOutputValueMapper);
         map.put("b4",crmOutputValueMapper);
+        map.put("b6",crmOutputValueMapper);
+        map.put("b7",crmOutputValueMapper);
+        map.put("b8",crmOutputValueMapper);
+        map.put("b9",crmOutputValueMapper);
         map.put("c1",crmEnterpriseTaxPaymentInfoMapper);
         map.put("c2",crmEnterpriseTaxPaymentInfoMapper);
         map.put("c3",crmEnterpriseTaxPaymentInfoMapper);
         map.put("c4",crmEnterpriseTaxPaymentInfoMapper);
+        map.put("c6",crmEnterpriseTaxPaymentInfoMapper);
+        map.put("c7",crmEnterpriseTaxPaymentInfoMapper);
+        map.put("c8",crmEnterpriseTaxPaymentInfoMapper);
+        map.put("c9",crmEnterpriseTaxPaymentInfoMapper);
         map.put("dd",crmChangeRecordInformationMapper);
         map.put("de",crmAdministrativeLicenseMapper);
         map.put("df",crmAdministrativeConfirmationMapper);
@@ -47,10 +52,27 @@ public class StrMapperMap {
         map.put("dp",crmEnterpriseTaxClassificationInfoMapper);
         map.put("dq",crmAbnormalTaxInformationMapper);
         map.put("dr",crmEnterpriseSocialSecurityInfoMapper);
+        map.put("dr1",crmEnterpriseSocialSecurityInfoMapper);
         map.put("ds",crmEnvironmentalCreditEvaluationNotificationMapper);
         map.put("dt",crmNationalPublicCreditEvaluationInformationMapper);
         map.put("du",crmRatingAgencyInfoMapper);
         map.put("dv",crmEnterpriseCreditRatingMapper);
+        map.put("dw1",crmQuarterlyWaterUsageMapper);
+        map.put("dw2",crmQuarterlyWaterUsageMapper);
+        map.put("dw3",crmQuarterlyWaterUsageMapper);
+        map.put("dw4",crmQuarterlyWaterUsageMapper);
+        map.put("dw6",crmQuarterlyWaterUsageMapper);
+        map.put("dw7",crmQuarterlyWaterUsageMapper);
+        map.put("dw8",crmQuarterlyWaterUsageMapper);
+        map.put("dw9",crmQuarterlyWaterUsageMapper);
+        map.put("dx1",crmQuarterlyElectricityBillMapper);
+        map.put("dx2",crmQuarterlyElectricityBillMapper);
+        map.put("dx3",crmQuarterlyElectricityBillMapper);
+        map.put("dx4",crmQuarterlyElectricityBillMapper);
+        map.put("dx6",crmQuarterlyElectricityBillMapper);
+        map.put("dx7",crmQuarterlyElectricityBillMapper);
+        map.put("dx8",crmQuarterlyElectricityBillMapper);
+        map.put("dx9",crmQuarterlyElectricityBillMapper);
         return map;
     }
     @Autowired
@@ -95,4 +117,8 @@ public class StrMapperMap {
     private CrmRatingAgencyInfoMapper crmRatingAgencyInfoMapper;
     @Autowired
     private CrmEnterpriseCreditRatingMapper crmEnterpriseCreditRatingMapper;
+    @Autowired
+    private CrmQuarterlyWaterUsageMapper crmQuarterlyWaterUsageMapper;
+    @Autowired
+    private CrmQuarterlyElectricityBillMapper crmQuarterlyElectricityBillMapper;
 }