Ver código fonte

本地暂存

sbj 2 meses atrás
pai
commit
6df933a81e

+ 2 - 0
src/main/java/com/shcd/mapper/SpStatementShipUsageMonthMapper.java

@@ -30,6 +30,8 @@ public interface SpStatementShipUsageMonthMapper extends BaseMapper<SpStatementS
 
   SpStatementShipUsageMonthVo getUnderLineMonthData(@Param("toDate") Date toDate);
 
+  SpStatementShipUsageMonthVo selectUnderLineYear(@Param("lastDate") String lastDate);
+
   SpStatementShipUsageMonthVo getUnderLineYearData(@Param("yearCountBegin") Date yearCountBegin,
       @Param("yearCountEnd") Date yearCountEnd);
 

+ 65 - 48
src/main/java/com/shcd/service/impl/SpStatementInlandLowServiceImpl.java

@@ -11,6 +11,7 @@ import com.shcd.enums.AreaSortEnum;
 import com.shcd.enums.ShorePowerConnRecordInfoEnum;
 import com.shcd.service.SpStatementInlandLowService;
 import com.shcd.mapper.SpStatementInlandLowMapper;
+import com.shcd.utils.PrintLogUtils;
 import com.shcd.vo.ShorePowerConnRecordInfoVo;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -115,7 +116,7 @@ public class SpStatementInlandLowServiceImpl extends
 //      log.info("当年累计原始数据为:{}", JSONObject.toJSONString(currentYearOriginList));
       List<SpStatementInlandLow> spStatementInlandLowList = new ArrayList<>(originList.size());
       // 计算各区
-      executeEveryDistrict(originList, lastReportDataList, spStatementInlandLowList);
+      executeEveryDistrict(originList, lastReportDataList, spStatementInlandLowList, currentMonthDate);
       // 计算合计
       executeTotal(spStatementInlandLowList, lastMonthDate);
       log.info("最终存储的内河低压分析表1为:{}", JSONObject.toJSONString(spStatementInlandLowList));
@@ -198,56 +199,72 @@ public class SpStatementInlandLowServiceImpl extends
 
   private void executeEveryDistrict(List<ShorePowerDeviceUsage> originList,
       List<SpStatementInlandLow> lastReportDataList,
-      List<SpStatementInlandLow> spStatementInlandLowList) {
-    for (ShorePowerDeviceUsage thisMonthData : originList) {
-      // 计算各区  当月数据
-      SpStatementInlandLow spStatementInlandLow = new SpStatementInlandLow();
-      String id = String.valueOf(snowflakeMakeConf.snowflakeId());
-      spStatementInlandLow.setId(id);
-      spStatementInlandLow.setSort(Integer.valueOf(thisMonthData.getSort()));
-      spStatementInlandLow.setDistrict(thisMonthData.getDistrict());
-      spStatementInlandLow.setBoatUseNumberMonth(
-          thisMonthData.getShorePowerBoatUseNumber());
-      spStatementInlandLow.setPowerConnHoursMonth(thisMonthData.getPowerConnHours());
-      spStatementInlandLow.setElectricityUsageMonth(
-          thisMonthData.getElectricityConsumption());
-      spStatementInlandLow.setReportDate(thisMonthData.getReportDate());
-      spStatementInlandLow.setType(1);
-      // 计算当年累计 以及 环比
-      Calendar thisCalendar = Calendar.getInstance();
-      thisCalendar.setTime(thisMonthData.getReportDate());
-      // 判断是否为1月份
-      if (thisCalendar.get(Calendar.MONTH) == Calendar.JANUARY) {
-        spStatementInlandLow.setBoatUseNumberYearTotal(
-            spStatementInlandLow.getBoatUseNumberMonth());
-        spStatementInlandLow.setPowerConnHoursYearTotal(
-            spStatementInlandLow.getPowerConnHoursMonth());
-        spStatementInlandLow.setElectricityUsageYearTotal(
-            spStatementInlandLow.getElectricityUsageMonth());
-      } else {
-        // 2月才开始计算环比
-        for (SpStatementInlandLow lastReportData : lastReportDataList) {
-          if (lastReportData.getDistrict().equals(spStatementInlandLow.getDistrict())) {
-            spStatementInlandLow.setBoatUseNumberChain(
-                getRate(spStatementInlandLow.getBoatUseNumberMonth(),
-                    lastReportData.getBoatUseNumberMonth()));
-            spStatementInlandLow.setBoatUseNumberYearTotal(
-                spStatementInlandLow.getBoatUseNumberMonth()
-                    .add(lastReportData.getBoatUseNumberYearTotal())
-                    .setScale(2, RoundingMode.HALF_UP));
-            spStatementInlandLow.setPowerConnHoursYearTotal(
-                spStatementInlandLow.getPowerConnHoursMonth()
-                    .add(lastReportData.getPowerConnHoursYearTotal())
-                    .setScale(2, RoundingMode.HALF_UP));
-            spStatementInlandLow.setElectricityUsageYearTotal(
-                spStatementInlandLow.getElectricityUsageMonth()
-                    .add(lastReportData.getElectricityUsageYearTotal())
-                    .setScale(2, RoundingMode.HALF_UP));
-          }
+      List<SpStatementInlandLow> spStatementInlandLowList,String currentMonthDate) {
+    try {
+//    for (ShorePowerDeviceUsage thisMonthData : originList) {
+      for (AreaSortEnum thisMonthData : AreaSortEnum.values()) {
+        // 计算各区  当月数据
+        SpStatementInlandLow spStatementInlandLow = new SpStatementInlandLow();
+        String id = String.valueOf(snowflakeMakeConf.snowflakeId());
+        spStatementInlandLow.setId(id);
+        spStatementInlandLow.setSort(thisMonthData.getSort());
+        spStatementInlandLow.setDistrict(thisMonthData.getArea());
+        List<ShorePowerDeviceUsage> filterUsageList = originList.stream()
+                .filter(i->i.getDistrict().equals(thisMonthData.getArea()))
+                .collect(Collectors.toList());
+        if (filterUsageList.isEmpty()) {
+          spStatementInlandLow.setBoatUseNumberMonth(BigDecimal.ZERO);
+          spStatementInlandLow.setPowerConnHoursMonth(BigDecimal.ZERO);
+          spStatementInlandLow.setElectricityUsageMonth(BigDecimal.ZERO);
+          spStatementInlandLow.setReportDate(
+                  DateUtils.stringToDate(currentMonthDate, DateUtils.DATE_FORMAT_12));
+        } else {
+          spStatementInlandLow.setBoatUseNumberMonth(filterUsageList.get(0).getShorePowerBoatUseNumber());
+          spStatementInlandLow.setPowerConnHoursMonth(filterUsageList.get(0).getPowerConnHours());
+          spStatementInlandLow.setElectricityUsageMonth(filterUsageList.get(0).getElectricityConsumption());
+          spStatementInlandLow.setReportDate(
+                  DateUtils.stringToDate(currentMonthDate, DateUtils.DATE_FORMAT_12));
+        }
+
+        spStatementInlandLow.setType(1);
+        // 计算当年累计 以及 环比
+        Calendar thisCalendar = Calendar.getInstance();
+        thisCalendar.setTime(DateUtils.stringToDate(currentMonthDate, DateUtils.DATE_FORMAT_12));
+        // 判断是否为1月份
+        if (thisCalendar.get(Calendar.MONTH) == Calendar.JANUARY) {
+          spStatementInlandLow.setBoatUseNumberYearTotal(
+                  spStatementInlandLow.getBoatUseNumberMonth());
+          spStatementInlandLow.setPowerConnHoursYearTotal(
+                  spStatementInlandLow.getPowerConnHoursMonth());
+          spStatementInlandLow.setElectricityUsageYearTotal(
+                  spStatementInlandLow.getElectricityUsageMonth());
+        } else {
+          // 2月才开始计算环比
+          for (SpStatementInlandLow lastReportData : lastReportDataList) {
+            if (lastReportData.getDistrict().equals(spStatementInlandLow.getDistrict())) {
+              spStatementInlandLow.setBoatUseNumberChain(
+                      getRate(spStatementInlandLow.getBoatUseNumberMonth(),
+                              lastReportData.getBoatUseNumberMonth()));
+              spStatementInlandLow.setBoatUseNumberYearTotal(
+                      spStatementInlandLow.getBoatUseNumberMonth()
+                              .add(lastReportData.getBoatUseNumberYearTotal())
+                              .setScale(2, RoundingMode.HALF_UP));
+              spStatementInlandLow.setPowerConnHoursYearTotal(
+                      spStatementInlandLow.getPowerConnHoursMonth()
+                              .add(lastReportData.getPowerConnHoursYearTotal())
+                              .setScale(2, RoundingMode.HALF_UP));
+              spStatementInlandLow.setElectricityUsageYearTotal(
+                      spStatementInlandLow.getElectricityUsageMonth()
+                              .add(lastReportData.getElectricityUsageYearTotal())
+                              .setScale(2, RoundingMode.HALF_UP));
+            }
 
+          }
         }
+        spStatementInlandLowList.add(spStatementInlandLow);
       }
-      spStatementInlandLowList.add(spStatementInlandLow);
+    }catch (Exception e){
+      PrintLogUtils.printErrorLogInfo(e,"executeEveryDistrict异常");
     }
   }
 

+ 33 - 10
src/main/java/com/shcd/service/impl/SpStatementQuarterReportServiceImpl.java

@@ -121,12 +121,12 @@ public class SpStatementQuarterReportServiceImpl extends
       this.remove(Wrappers.<SpStatementQuarterReport>lambdaQuery()
           .eq(SpStatementQuarterReport::getQuarter, currentQuarter)
           .eq(SpStatementQuarterReport::getYear, currentYear));
-      //原始数据
+      //原始数据(连电平台数据)
       CompletableFuture<List<SpQuarterReportOriginVo>> future1 =
           CompletableFuture.supplyAsync(
               () -> spStatementShipUsageMonthMapper.selectQuarterOrigin(startDate, endDate,
                   newStartDate, newEndDate));
-      //线下手动上报数据
+      //线下手动上报数据(泊位本月使用情况)
       CompletableFuture<List<SpQuarterReportBlVo>> future2 = CompletableFuture.supplyAsync(
           () -> spStatementShipUsageMonthMapper.selectQuarterBlBerth(startDate, endDate));
       CompletableFuture.allOf(future1, future2).join();
@@ -134,90 +134,112 @@ public class SpStatementQuarterReportServiceImpl extends
       List<SpQuarterReportBlVo> spQuarterBlBerth = future2.get();
       //原始数据处理
       HashMap<Integer, List<SpQuarterReportOriginVo>> resultMapOrigin = new HashMap<>();
+      // 集装箱
       List<SpQuarterReportOriginVo> container = spQuarterOrigin.stream()
           .filter(i -> i.getBerthType().equals(1)).collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.CONTAINER_BERTH.getDataType(), container);
+      // 滚装
       List<SpQuarterReportOriginVo> roll = spQuarterOrigin.stream()
           .filter(i -> i.getBerthType().equals(7)).collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.ROLL_BERTH.getDataType(), roll);
+      // 干散货 2000吨及以上
       List<SpQuarterReportOriginVo> dryBulk2000 = spQuarterOrigin.stream().filter(
           i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3))
               && i.getCapacity() >= 2000).collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_2000.getDataType(),
           dryBulk2000);
+      // 干散货其他
       List<SpQuarterReportOriginVo> dryBulk = spQuarterOrigin.stream().filter(
               i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3)) && i.getCapacity() < 2000)
           .collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_OTHER.getDataType(),
           dryBulk);
+      // 多用途 2000吨及以上
       List<SpQuarterReportOriginVo> multiUse2000 = spQuarterOrigin.stream()
           .filter(i -> i.getBerthType().equals(11) && i.getCapacity() >= 2000)
           .collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_2000.getDataType(),
           multiUse2000);
+      // 多用途其他
       List<SpQuarterReportOriginVo> multiUse = spQuarterOrigin.stream()
           .filter(i -> i.getBerthType().equals(11) && i.getCapacity() < 2000)
           .collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_OTHER.getDataType(), multiUse);
+      // 通用 2000吨及以上
       List<SpQuarterReportOriginVo> common2000 = spQuarterOrigin.stream().filter(
           i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
               && i.getCapacity() >= 2000).collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.COMMON_BERTH_2000.getDataType(), common2000);
+      // 通用其他
       List<SpQuarterReportOriginVo> common = spQuarterOrigin.stream().filter(
           i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
               && i.getCapacity() < 2000).collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.COMMON_BERTH_OTHER.getDataType(), common);
+      // 邮轮
       List<SpQuarterReportOriginVo> cruise = spQuarterOrigin.stream()
           .filter(i -> i.getBerthType().equals(6)).collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.CRUISE_BERTH.getDataType(), cruise);
+      // 客运
       List<SpQuarterReportOriginVo> passenger = spQuarterOrigin.stream()
           .filter(i -> i.getBerthType().equals(4) || i.getBerthType().equals(5))
           .collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.PASSENGER_BERTH.getDataType(), passenger);
+      // 其他
       List<SpQuarterReportOriginVo> other = spQuarterOrigin.stream()
           .filter(i -> i.getBerthType().equals(255)).collect(Collectors.toList());
       resultMapOrigin.put(ShorePowerQuarterDataType.OTHER_BERTH.getDataType(), other);
       //手动数据处理
       HashMap<Integer, List<SpQuarterReportBlVo>> resultMapBl = new HashMap<>();
+      // 集装箱
       List<SpQuarterReportBlVo> containerBl = spQuarterBlBerth.stream()
           .filter(i -> i.getBerthType().equals(1)).collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.CONTAINER_BERTH.getDataType(), containerBl);
+      // 滚装
       List<SpQuarterReportBlVo> rollBl = spQuarterBlBerth.stream()
           .filter(i -> i.getBerthType().equals(7)).collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.ROLL_BERTH.getDataType(), rollBl);
+      // 干散货 2000吨及以上
       List<SpQuarterReportBlVo> dryBulk2000Bl = spQuarterBlBerth.stream().filter(
           i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3))
               && i.getCapacity() >= 2000).collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_2000.getDataType(),
           dryBulk2000Bl);
+      // 干散货其他
       List<SpQuarterReportBlVo> dryBulkBl = spQuarterBlBerth.stream().filter(
               i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3)) && i.getCapacity() < 2000)
           .collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_OTHER.getDataType(),
           dryBulkBl);
+      // 多用途 2000吨及以上
       List<SpQuarterReportBlVo> multiUse2000Bl = spQuarterBlBerth.stream()
           .filter(i -> i.getBerthType().equals(11) && i.getCapacity() >= 2000)
           .collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_2000.getDataType(), multiUse2000Bl);
+      // 多用途其他
       List<SpQuarterReportBlVo> multiUseBl = spQuarterBlBerth.stream()
           .filter(i -> i.getBerthType().equals(11) && i.getCapacity() < 2000)
           .collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_OTHER.getDataType(), multiUseBl);
+      // 通用 2000吨及以上
       List<SpQuarterReportBlVo> common2000Bl = spQuarterBlBerth.stream().filter(
           i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
               && i.getCapacity() >= 2000).collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.COMMON_BERTH_2000.getDataType(), common2000Bl);
+      // 通用其他
       List<SpQuarterReportBlVo> commonBl = spQuarterBlBerth.stream().filter(
           i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
               && i.getCapacity() < 2000).collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.COMMON_BERTH_OTHER.getDataType(), commonBl);
+      // 邮轮
       List<SpQuarterReportBlVo> cruiseBl = spQuarterBlBerth.stream()
           .filter(i -> i.getBerthType().equals(6)).collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.CRUISE_BERTH.getDataType(), cruiseBl);
+      // 客运
       List<SpQuarterReportBlVo> passengerBl = spQuarterBlBerth.stream()
           .filter(i -> i.getBerthType().equals(4) || i.getBerthType().equals(5))
           .collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.PASSENGER_BERTH.getDataType(), passengerBl);
+      // 其他
       List<SpQuarterReportBlVo> otherBl = spQuarterBlBerth.stream()
           .filter(i -> i.getBerthType().equals(255)).collect(Collectors.toList());
       resultMapBl.put(ShorePowerQuarterDataType.OTHER_BERTH.getDataType(), otherBl);
@@ -225,7 +247,7 @@ public class SpStatementQuarterReportServiceImpl extends
       ShorePowerQuarterDataType[] dataTypes = ShorePowerQuarterDataType.values();
       //计算季度,即使某个类型没有数据也能存进表里 spStatementQuarterReports必定会有12条数据
       for (ShorePowerQuarterDataType dataType : dataTypes) {
-        // 集装箱数据从指标报表中的集装箱数据中拿取
+        // 集装箱数据从指标报表中的集装箱数据中拿取(GHJG_PORT_MANAGE.SP_STATEMENT_CONTAINER)
         if (ShorePowerQuarterDataType.CONTAINER_BERTH.equals(dataType)) {
           SpQuarterReportOriginVo spQuarterReportOriginVo = containerMapper.selectCurrentQuarterData(
               quarterReportDateString);
@@ -276,9 +298,11 @@ public class SpStatementQuarterReportServiceImpl extends
         start = DateUtils.stringToDate(currentYear + "-" + "10" + dateEnd, "yyyy-MM");
         end = DateUtils.stringToDate(currentYear + "-" + "12" + dateEnd, "yyyy-MM");
       }
+      // 其他泊位
       SpStatementQuarterReport otherSumEntity = spStatementQuarterReports.stream()
           .filter(i -> i.getDataType().equals(ShorePowerQuarterDataType.OTHER_BERTH.getDataType()))
           .collect(Collectors.toList()).get(0);
+      // 查询季度内长江经济带报表数据
       SpShipUsageMonthQuarterVo spShipUsageMonthQuarterVo = spStatementShipUsageMonthMapper.selectThreeMonthsDataTotal(
           start, end);
       BigDecimal originChargeTimeSum = BigDecimal.ZERO;
@@ -287,19 +311,20 @@ public class SpStatementQuarterReportServiceImpl extends
       for (SpStatementQuarterReport report : spStatementQuarterReports.stream()
           .filter(i -> !i.getDataType().equals(ShorePowerQuarterDataType.OTHER_BERTH.getDataType()))
           .collect(Collectors.toList())) {
-        // 计算接电时间的合计值和其他泊位值
+        // 计算接电时间的合计值//和其他泊位值
         originChargeTimeSum = reportSum.getChargeTimeQuarter()
             .add(report.getChargeTimeQuarter()).setScale(2, RoundingMode.HALF_UP);
         reportSum.setChargeTimeQuarter(originChargeTimeSum);
-        // 计算使用岸电次数的合计值和其他泊位值
+        // 计算使用岸电次数的合计值//和其他泊位值
         originShipUsageSum = reportSum.getShipUsageQuarter()
             .add(report.getShipUsageQuarter()).setScale(2, RoundingMode.HALF_UP);
         reportSum.setShipUsageQuarter(originShipUsageSum);
-        // 计算用电量的合计值和其他泊位值
+        // 计算用电量的合计值//和其他泊位值
         originElectUseSum = reportSum.getElectUseQuarter()
             .add(report.getElectUseQuarter()).setScale(2, RoundingMode.HALF_UP);
         reportSum.setElectUseQuarter(originElectUseSum);
       }
+      // 其它泊位数值=长江经济带统计总数-除其他泊位之外的泊位综总和
       BigDecimal otherChargeTimeSum = spShipUsageMonthQuarterVo.getShorePowerTimeMonth()
           .subtract(originChargeTimeSum);
       otherSumEntity.setChargeTimeQuarter(otherChargeTimeSum.setScale(2, RoundingMode.HALF_UP));
@@ -324,8 +349,7 @@ public class SpStatementQuarterReportServiceImpl extends
       if (CollectionUtils.isEmpty(pastData)) {
         for (SpStatementQuarterReport spStatementQuarterReport : spStatementQuarterReports) {
           spStatementQuarterReport.setShipUsageYear(spStatementQuarterReport.getShipUsageQuarter());
-          spStatementQuarterReport.setChargeTimeYear(
-              spStatementQuarterReport.getChargeTimeQuarter());
+          spStatementQuarterReport.setChargeTimeYear(spStatementQuarterReport.getChargeTimeQuarter());
           spStatementQuarterReport.setElectUseYear(spStatementQuarterReport.getElectUseQuarter());
         }
       } else {
@@ -338,8 +362,7 @@ public class SpStatementQuarterReportServiceImpl extends
           spStatementQuarterReport.setShipUsageYear(spStatementQuarterReport.getShipUsageQuarter()
               .add(pastList.get(spStatementQuarterReport.getDataType()).get(0).getShipUsageYear()));
           spStatementQuarterReport.setChargeTimeYear(spStatementQuarterReport.getChargeTimeQuarter()
-              .add(
-                  pastList.get(spStatementQuarterReport.getDataType()).get(0).getChargeTimeYear()));
+              .add(pastList.get(spStatementQuarterReport.getDataType()).get(0).getChargeTimeYear()));
         }
       }
       BigDecimal shipUsageYear = reportSum.getShipUsageYear();

+ 9 - 4
src/main/java/com/shcd/service/impl/SpStatementShipUsageMonthServiceImpl.java

@@ -128,6 +128,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
           () -> spStatementShipUsageMonthMapper.selectOriginSelfDataMonth(thisDate, lastDate));
       CompletableFuture.allOf(future1, future2, future5).join();
       List<SpStatementShipUsageDetail> spStatementShipUsageDetails = future1.get();
+      log.info("查询到12月份连电平台记录数:"+spStatementShipUsageDetails.size());
 //      SpStatementShipUsageMonthVo originMonth = makeOriginMonthData(spStatementShipUsageDetails);
 
       SpStatementShipUsageMonthVo originMonth = new SpStatementShipUsageMonthVo();
@@ -135,10 +136,12 @@ public class SpStatementShipUsageMonthServiceImpl extends
       List<SpStatementShipUsageDetail> nhdybzhList = spStatementShipUsageDetails.stream()
           .filter(x -> "低压(标准化)".equals(x.getConnectType())).collect(
               Collectors.toList());
+      log.info("查询到12月份连电平台【低压标准化】记录数:"+nhdybzhList.size());
       // 过滤非内河低压标准化数据
       List<SpStatementShipUsageDetail> otherList = spStatementShipUsageDetails.stream()
           .filter(x -> !"低压(标准化)".equals(x.getConnectType())).collect(
               Collectors.toList());
+      log.info("查询到12月份连电平台【非低压标准化】记录数:"+otherList.size());
       // 求和 低压(标准化)
       SpStatementShipUsageMonthVo nhdybzhListMonth = makeOriginMonthDataV2d1(nhdybzhList);
       // 求和 非低压(标准化)(高压和低压大容量)
@@ -181,6 +184,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
 //        originSelfYear = new SpStatementShipUsageMonthVo();
 //      }
       ArrayList<SpStatementShipUsageMonth> spStatementShipUsageMonths = new ArrayList<>();
+      // 市级平台数据 origin
       SpStatementShipUsageMonth origin = new SpStatementShipUsageMonth();
       origin.setId(snowflakeGenerator.next().toString());
       origin.setShipUsageMonth(originMonth.getShipUsage().add(originSelfMonth.getShipUsage())
@@ -225,8 +229,9 @@ public class SpStatementShipUsageMonthServiceImpl extends
       SpStatementShipUsageMonthVo underLineMonth = spStatementShipUsageMonthMapper.getUnderLineMonthData(
           toDate);
       //之前线下年度
-      SpStatementShipUsageMonthVo underLineYear = spStatementShipUsageMonthMapper.getUnderLineYearData(
-          toDateBegin, toDate);
+//      SpStatementShipUsageMonthVo underLineYear = spStatementShipUsageMonthMapper.getUnderLineYearData(toDateBegin, toDate);
+      // 查询上个月报表中的当年累计值
+      SpStatementShipUsageMonthVo underLineYear = spStatementShipUsageMonthMapper.selectUnderLineYear(dateStrLast);
       SpStatementShipUsageMonth underLine = new SpStatementShipUsageMonth();
       if (underLineMonth != null || underLineYear != null) {
         if (underLineMonth == null) {
@@ -838,7 +843,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
           spStatementShipUsageMonthVo.getShorePowerCount()
               .add(spStatementShipUsageDetail.getShorePowerCount()));
       spStatementShipUsageMonthVo.setShorePowerTime(spStatementShipUsageDetail.getDuration()
-          .divide(BigDecimal.valueOf(60), RoundingMode.HALF_UP)
+          .divide(BigDecimal.valueOf(60),2, RoundingMode.HALF_UP)
           .add(spStatementShipUsageMonthVo.getShorePowerTime()));
     }
     BigDecimal decimal = spStatementShipUsageMonthVo.getShorePowerTime()
@@ -864,7 +869,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
           spStatementShipUsageMonthVo.getShorePowerCount()
               .add(spStatementShipUsageDetail.getShorePowerCount()));
       spStatementShipUsageMonthVo.setShorePowerTime(spStatementShipUsageDetail.getDuration()
-          .divide(BigDecimal.valueOf(60), RoundingMode.HALF_UP)
+          .divide(BigDecimal.valueOf(60),2 ,RoundingMode.HALF_UP)
           .add(spStatementShipUsageMonthVo.getShorePowerTime()));
     }
     BigDecimal decimal = spStatementShipUsageMonthVo.getShorePowerTime()

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
src/main/resources/application.properties


+ 9 - 2
src/main/resources/mapper/SpStatementShipUsageMonthMapper.xml

@@ -23,8 +23,6 @@
     select STARTTIME chargeStartDate, ENDTIME chargeEndDate, ELECT shorePowerCount, CONNTYPE connectType, DURATION duration
     from GHJG_PORT_MANAGE.SHORE_POWER_CONN_RECORD_INFO
     where (ENDTIME between #{lastDate} and #{thisDate})
-       OR (ENDTIME between #{lastCycleStart} and #{lastCycleEnd} AND
-           MODIFYTIME between #{lastDate} and #{thisDate})
   </select>
   <select id="selectGhDataMonth" resultType="com.shcd.vo.SpStatementShipUsageMonthVo">
     select decode(sum(SHORE_POWER_BOAT_USE_NUMBER), null, 0,
@@ -65,6 +63,15 @@
     where trunc(REPORT_DATE) = #{toDate}
       and NAME = '上海市黄浦江码头岸线建设管理有限公司'
   </select>
+
+    <select id="selectUnderLineYear" resultType="com.shcd.vo.SpStatementShipUsageMonthVo">
+        select SHIP_USAGE_YEAR        shipUsage,
+               SHORE_POWER_COUNT_YEAR shorePowerCount,
+               SHORE_POWER_TIME_YEAR  shorePowerTime
+        from GHJG_PORT_MANAGE.SP_STATEMENT_SHIP_USAGE_MONTH
+        where trunc(REPORT_DATE) = to_date(#{lastDate}, 'yyyy-mm-dd')
+          and DATA_SOURCE = 20
+    </select>
   <select id="getUnderLineYearData" resultType="com.shcd.vo.SpStatementShipUsageMonthVo">
     select SUM(ship_usage)     shipUsage,
            SUM(power_time_use) shorePowerTime,