Browse Source

长江经济带市级平台自动上报数据减掉手动上报数据;指标表统计靠泊邮轮码头用电时间问题

sbj 2 months ago
parent
commit
e5b03741c8

+ 23 - 22
src/main/java/com/shcd/service/impl/SpStatementShipUsageMonthServiceImpl.java

@@ -124,9 +124,9 @@ public class SpStatementShipUsageMonthServiceImpl extends
       CompletableFuture<SpStatementShipUsageMonthVo> future2 = CompletableFuture.supplyAsync(
           () -> spStatementShipUsageMonthMapper.selectGhDataMonth(toDate));
       // 泊位本月使用情况
-      CompletableFuture<SpStatementShipUsageMonthVo> future5 = CompletableFuture.supplyAsync(
-          () -> spStatementShipUsageMonthMapper.selectOriginSelfDataMonth(thisDate, lastDate));
-      CompletableFuture.allOf(future1, future2, future5).join();
+//      CompletableFuture<SpStatementShipUsageMonthVo> future5 = CompletableFuture.supplyAsync(
+//          () -> spStatementShipUsageMonthMapper.selectOriginSelfDataMonth(thisDate, lastDate));
+      CompletableFuture.allOf(future1, future2).join();
       List<SpStatementShipUsageDetail> spStatementShipUsageDetails = future1.get();
       log.info("查询到连电平台记录数:"+spStatementShipUsageDetails.size());
 //      SpStatementShipUsageMonthVo originMonth = makeOriginMonthData(spStatementShipUsageDetails);
@@ -154,7 +154,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
           nhdybzhListMonth.getShorePowerCount().add(otherListMonth.getShorePowerCount()));
 
 //      SpStatementShipUsageMonthVo ghMonth = future2.get();
-      SpStatementShipUsageMonthVo originSelfMonth = future5.get();
+//      SpStatementShipUsageMonthVo originSelfMonth = future5.get();
       // 查询市级平台 除本月之前当年累计
       CompletableFuture<SpStatementShipUsageMonthVo> future3 = CompletableFuture.supplyAsync(
           () -> spStatementShipUsageMonthMapper.selectOriginDataYear(dateStrLast));
@@ -177,9 +177,9 @@ public class SpStatementShipUsageMonthServiceImpl extends
       if (ghYear == null) {
         ghYear = new SpStatementShipUsageMonthVo();
       }*/
-      if (originSelfMonth == null) {
-        originSelfMonth = new SpStatementShipUsageMonthVo();
-      }
+//      if (originSelfMonth == null) {
+//        originSelfMonth = new SpStatementShipUsageMonthVo();
+//      }
       if (originYear == null) {
         originYear = new SpStatementShipUsageMonthVo();
       }
@@ -190,24 +190,21 @@ public class SpStatementShipUsageMonthServiceImpl extends
       // 市级平台数据 origin
       SpStatementShipUsageMonth origin = new SpStatementShipUsageMonth();
       origin.setId(snowflakeGenerator.next().toString());
-      origin.setShipUsageMonth(originMonth.getShipUsage().add(originSelfMonth.getShipUsage())
+      origin.setShipUsageMonth(originMonth.getShipUsage()
           .setScale(2, RoundingMode.HALF_UP));
       origin.setShipUsageYear(originYear.getShipUsage().add(originMonth.getShipUsage())
-          .add(originSelfMonth.getShipUsage())
           .setScale(2, RoundingMode.HALF_UP));
       origin.setShorePowerTimeMonth(
-          originMonth.getShorePowerTime().add(originSelfMonth.getShorePowerTime())
+          originMonth.getShorePowerTime()
               .setScale(2, RoundingMode.HALF_UP));
       origin.setShorePowerTimeYear(
           originYear.getShorePowerTime().add(originMonth.getShorePowerTime())
-              .add(originSelfMonth.getShorePowerTime())
               .setScale(2, RoundingMode.HALF_UP));
       origin.setShorePowerCountMonth(
-          originMonth.getShorePowerCount().add(originSelfMonth.getShorePowerCount())
+          originMonth.getShorePowerCount()
               .setScale(2, RoundingMode.HALF_UP));
       origin.setShorePowerCountYear(
           originYear.getShorePowerCount().add(originMonth.getShorePowerCount())
-              .add(originSelfMonth.getShorePowerCount())
               .setScale(2, RoundingMode.HALF_UP));
       origin.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
       origin.setDataSource(0);
@@ -351,7 +348,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
           .collect(Collectors.toList());
       log.info("查询到连电平台【靠泊邮轮港码头船舶(大容量)】记录数:"+ylgdrlList.size());
 
-      SpStatementShipUsageMonthVo ylgdrlMonth = makeOriginMonthDataV2d1(ylgdrlList);
+      SpStatementShipUsageMonthVo ylgdrlMonth = makeOriginMonthData(ylgdrlList);
       SpStatementShipUsageMonthVo ylgdrlYear = spStatementShipUsageMonthMapper.selectylgdrlYear(dateStrLast);
       if (ylgdrlMonth == null) {
         ylgdrlMonth = new SpStatementShipUsageMonthVo();
@@ -419,27 +416,28 @@ public class SpStatementShipUsageMonthServiceImpl extends
           () -> spStatementShipUsageMonthMapper.getInRiverDataBeforeThisMonth(dateStrLast));
       CompletableFuture.allOf(futureInRiver, futureInRiverSelf, futureInRiverLast).join();
       List<SpStatementShipUsageDetailV2> inRiverDetail = futureInRiver.get();
-      SpStatementShipUsageMonthVo inRiverSelfMonth = futureInRiverSelf.get();
+//      SpStatementShipUsageMonthVo inRiverSelfMonth = futureInRiverSelf.get();
       SpStatementShipUsageMonthVo inRiverLast = futureInRiverLast.get();
 //      SpStatementShipUsageMonthVo inRiver = makeOriginMonthData(inRiverDetail);
       SpStatementShipUsageMonthVo inRiver = makeOriginMonthDataV2(inRiverDetail);
       if (inRiverLast == null) {
         inRiverLast = new SpStatementShipUsageMonthVo();
       }
-      if (inRiverSelfMonth == null) {
-        inRiverSelfMonth = new SpStatementShipUsageMonthVo();
-      }
+//      if (inRiverSelfMonth == null) {
+//        inRiverSelfMonth = new SpStatementShipUsageMonthVo();
+//      }
       SpStatementShipUsageMonth inRiverShipUsage = new SpStatementShipUsageMonth();
       inRiverShipUsage.setId(snowflakeGenerator.next().toString());
       inRiverShipUsage.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
       inRiverShipUsage.setDataSource(1);
-      inRiverShipUsage.setShipUsageMonth(inRiver.getShipUsage().add(inRiverSelfMonth.getShipUsage())
+      inRiverShipUsage.setShipUsageMonth(
+          inRiver.getShipUsage()//.add(inRiverSelfMonth.getShipUsage())
           .setScale(2, RoundingMode.HALF_UP));
       inRiverShipUsage.setShorePowerTimeMonth(
-          inRiver.getShorePowerTime().add(inRiverSelfMonth.getShorePowerTime())
+          inRiver.getShorePowerTime()//.add(inRiverSelfMonth.getShorePowerTime())
               .setScale(2, RoundingMode.HALF_UP));
       inRiverShipUsage.setShorePowerCountMonth(
-          inRiver.getShorePowerCount().add(inRiverSelfMonth.getShorePowerCount())
+          inRiver.getShorePowerCount()//.add(inRiverSelfMonth.getShorePowerCount())
               .setScale(2, RoundingMode.HALF_UP));
       inRiverShipUsage.setShipUsageYear(
           inRiverShipUsage.getShipUsageMonth().add(inRiverLast.getShipUsage())
@@ -524,9 +522,12 @@ public class SpStatementShipUsageMonthServiceImpl extends
           JSONObject.toJSONString(portIdEq1146Data));
       spStatementShipUsageMonths.add(portIdEq1146Data);
       this.saveBatch(spStatementShipUsageMonths);
+
+
+      log.info("================ 开始生成年度对比表===============");
       //岸电年比
       ArrayList<SpStatementYearAnalysis> save = new ArrayList<>();
-      //删除合计
+      //删除当年合计和本月合计数据
       spStatementYearAnalysisService.remove(Wrappers.<SpStatementYearAnalysis>lambdaQuery()
           .eq(SpStatementYearAnalysis::getYear, thisYear)
           .eq(SpStatementYearAnalysis::getMonth, 13));