Browse Source

2025年长江经济带和指标表统计内容调整

sbj 2 months ago
parent
commit
aee69b939a

+ 8 - 1
src/main/java/com/shcd/entity/SpStatementShipUsageMonth.java

@@ -54,7 +54,14 @@ public class SpStatementShipUsageMonth implements Serializable {
     private BigDecimal shorePowerCountYear;
 
     /**
-     * 0 市级平台原始数据,1内河平台数据,2为外港平台数据,10港航部门报送数据即内河非标数据, 20线下报送数据(外港非标数据) 99报送交通委数据,100及以后为其他类型数据
+     * 0 市级平台原始数据,1内河平台数据,2为外港平台数据,
+     * 3市级平台手动填报数据,     // 2025年1月开始新增该统计项
+     * 10港航部门报送数据即内河非标数据, 20线下报送数据(外港非标数据)  //这两项从2025年1月开始不统计
+     * 99报送交通委数据,
+     * 100 外高桥发电码头船舶(外一电、外二电、外三电)
+     * 101 用于上海市岸电使用指标完成情况统计表
+     * 102 外港平台数据
+     * 103 靠泊邮轮港码头船舶(大容量)
      */
     @TableField(value = "DATA_SOURCE")
     private Integer dataSource;

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

@@ -54,6 +54,8 @@ public interface SpStatementShipUsageMonthMapper extends BaseMapper<SpStatementS
 
   SpStatementShipUsageMonthVo selectWgqYear(@Param("toDate") String dateStrLast);
 
+  SpStatementShipUsageMonthVo selectylgdrlYear(@Param("toDate") String dateStrLast);
+
   SpStatementShipUsageMonthVo getInRiverDataBeforeThisMonth(@Param("toDate") String dateStrLast);
 
   List<SpStatementShipUsageDetail> getInRiverDataThisMonth(
@@ -85,6 +87,10 @@ public interface SpStatementShipUsageMonthMapper extends BaseMapper<SpStatementS
   List<SpStatementShipUsageDetailV2> getInRiverDataThisMonthV2(@Param("thisDate") Date thisDate,@Param("lastDate") Date lastDate);
 
   SpStatementShipUsageMonthVo getUnderLineMonthDataSgNew(@Param("lastDate") Date lastDate,@Param("thisDate") Date thisDate);
+
+  SpStatementShipUsageMonthVo selectHandDataWithDate(@Param("date") String date);
+
+  SpStatementShipUsageMonthVo selectHandDataYear(@Param("start") String start, @Param("end") String end);
 }
 
 

+ 94 - 26
src/main/java/com/shcd/service/impl/SpStatementShipUsageMonthServiceImpl.java

@@ -128,7 +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());
+      log.info("查询到连电平台记录数:"+spStatementShipUsageDetails.size());
 //      SpStatementShipUsageMonthVo originMonth = makeOriginMonthData(spStatementShipUsageDetails);
 
       SpStatementShipUsageMonthVo originMonth = new SpStatementShipUsageMonthVo();
@@ -136,12 +136,12 @@ public class SpStatementShipUsageMonthServiceImpl extends
       List<SpStatementShipUsageDetail> nhdybzhList = spStatementShipUsageDetails.stream()
           .filter(x -> "低压(标准化)".equals(x.getConnectType())).collect(
               Collectors.toList());
-      log.info("查询到12月份连电平台【低压标准化】记录数:"+nhdybzhList.size());
+      log.info("查询到连电平台【低压标准化】记录数:"+nhdybzhList.size());
       // 过滤非内河低压标准化数据
       List<SpStatementShipUsageDetail> otherList = spStatementShipUsageDetails.stream()
           .filter(x -> !"低压(标准化)".equals(x.getConnectType())).collect(
               Collectors.toList());
-      log.info("查询到12月份连电平台【非低压标准化】记录数:"+otherList.size());
+      log.info("查询到连电平台【非低压标准化】记录数:"+otherList.size());
       // 求和 低压(标准化)
       SpStatementShipUsageMonthVo nhdybzhListMonth = makeOriginMonthDataV2d1(nhdybzhList);
       // 求和 非低压(标准化)(高压和低压大容量)
@@ -153,7 +153,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
       originMonth.setShorePowerCount(
           nhdybzhListMonth.getShorePowerCount().add(otherListMonth.getShorePowerCount()));
 
-      SpStatementShipUsageMonthVo ghMonth = future2.get();
+//      SpStatementShipUsageMonthVo ghMonth = future2.get();
       SpStatementShipUsageMonthVo originSelfMonth = future5.get();
       // 查询市级平台 除本月之前当年累计
       CompletableFuture<SpStatementShipUsageMonthVo> future3 = CompletableFuture.supplyAsync(
@@ -166,9 +166,9 @@ public class SpStatementShipUsageMonthServiceImpl extends
 //          () -> spStatementShipUsageMonthMapper.selectOriginSelfDataYear(yearCountBegin, thisDate));
       CompletableFuture.allOf(future3, future4).join();
       SpStatementShipUsageMonthVo originYear = future3.get();
-      SpStatementShipUsageMonthVo ghYear = future4.get();
+//      SpStatementShipUsageMonthVo ghYear = future4.get();
       //SpStatementShipUsageMonthVo originSelfYear = future6.get();
-      if (ghMonth == null) {
+/*      if (ghMonth == null) {
         ghMonth = new SpStatementShipUsageMonthVo();
       }
       if (originYear == null) {
@@ -176,10 +176,13 @@ public class SpStatementShipUsageMonthServiceImpl extends
       }
       if (ghYear == null) {
         ghYear = new SpStatementShipUsageMonthVo();
-      }
+      }*/
       if (originSelfMonth == null) {
         originSelfMonth = new SpStatementShipUsageMonthVo();
       }
+      if (originYear == null) {
+        originYear = new SpStatementShipUsageMonthVo();
+      }
 //      if (originSelfYear == null) {
 //        originSelfYear = new SpStatementShipUsageMonthVo();
 //      }
@@ -209,7 +212,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
       origin.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
       origin.setDataSource(0);
       spStatementShipUsageMonths.add(origin);
-      SpStatementShipUsageMonth gh = new SpStatementShipUsageMonth();
+      /*SpStatementShipUsageMonth gh = new SpStatementShipUsageMonth();
       Thread.sleep(1);
       gh.setId(snowflakeGenerator.next().toString());
       gh.setShipUsageMonth(ghMonth.getShipUsage().setScale(2, RoundingMode.HALF_UP));
@@ -226,8 +229,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
       spStatementShipUsageMonths.add(gh);
       //新增线下数据
       //月度的
-      SpStatementShipUsageMonthVo underLineMonth = spStatementShipUsageMonthMapper.getUnderLineMonthData(
-          toDate);
+      SpStatementShipUsageMonthVo underLineMonth = spStatementShipUsageMonthMapper.getUnderLineMonthData(toDate);
       //之前线下年度
 //      SpStatementShipUsageMonthVo underLineYear = spStatementShipUsageMonthMapper.getUnderLineYearData(toDateBegin, toDate);
       // 查询上个月报表中的当年累计值
@@ -262,33 +264,66 @@ public class SpStatementShipUsageMonthServiceImpl extends
         underLine.setShorePowerCountYear(BigDecimal.ZERO);
         underLine.setShorePowerTimeMonth(BigDecimal.ZERO);
         underLine.setShorePowerTimeYear(BigDecimal.ZERO);
+      }*/
+
+      // 新增 市级平台手动填报数据,从连电平台推送的 SHORE_POWER_BLBERTHMONTHUSE表中查询数据
+      // 当月数据
+      SpStatementShipUsageMonthVo handDataThisMonth = spStatementShipUsageMonthMapper.selectHandDataWithDate(thisYear + "-" + thisMonth);
+      // 当年累计数据
+      SpStatementShipUsageMonthVo handDataThisYear = spStatementShipUsageMonthMapper.selectHandDataYear(thisYear+"-01", thisYear + "-" + thisMonth);
+      SpStatementShipUsageMonth handData = new SpStatementShipUsageMonth();
+      if (handDataThisMonth != null || handDataThisYear != null) {
+        if (handDataThisMonth == null) {
+          handDataThisMonth = new SpStatementShipUsageMonthVo();
+        }
+        if (handDataThisYear == null) {
+          handDataThisYear = new SpStatementShipUsageMonthVo();
+        }
+        handData.setId(snowflakeGenerator.next().toString());
+        handData.setReportDate(toDate);
+        handData.setDataSource(3);
+        handData.setShipUsageYear(handDataThisYear.getShipUsage().setScale(2, RoundingMode.HALF_UP));
+        handData.setShipUsageMonth(handDataThisMonth.getShipUsage().setScale(2, RoundingMode.HALF_UP));
+        handData.setShorePowerCountMonth(handDataThisMonth.getShorePowerCount().setScale(2, RoundingMode.HALF_UP));
+        handData.setShorePowerCountYear(handDataThisYear.getShorePowerCount().setScale(2, RoundingMode.HALF_UP));
+        handData.setShorePowerTimeMonth(handDataThisMonth.getShorePowerTime().setScale(2, RoundingMode.HALF_UP));
+        handData.setShorePowerTimeYear(handDataThisYear.getShorePowerTime().setScale(2, RoundingMode.HALF_UP));
+        spStatementShipUsageMonths.add(handData);
+      } else {
+        handData.setShipUsageYear(BigDecimal.ZERO);
+        handData.setShipUsageMonth(BigDecimal.ZERO);
+        handData.setShorePowerCountMonth(BigDecimal.ZERO);
+        handData.setShorePowerCountYear(BigDecimal.ZERO);
+        handData.setShorePowerTimeMonth(BigDecimal.ZERO);
+        handData.setShorePowerTimeYear(BigDecimal.ZERO);
       }
+
+      // 2024年是内河非标数据+
       SpStatementShipUsageMonth sum = new SpStatementShipUsageMonth();
       Thread.sleep(1);
       sum.setId(snowflakeGenerator.next().toString());
       sum.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
       sum.setDataSource(99);
-      sum.setShipUsageMonth(
-          origin.getShipUsageMonth().add(gh.getShipUsageMonth()).add(underLine.getShipUsageMonth())
+      sum.setShipUsageMonth(origin.getShipUsageMonth().add(handData.getShipUsageMonth())
               .setScale(2, RoundingMode.HALF_UP));
-      sum.setShipUsageYear(
-          origin.getShipUsageYear().add(gh.getShipUsageYear()).add(underLine.getShipUsageYear())
+      sum.setShipUsageYear(origin.getShipUsageYear().add(handData.getShipUsageYear())
               .setScale(2, RoundingMode.HALF_UP));
-      sum.setShorePowerCountMonth(origin.getShorePowerCountMonth().add(gh.getShorePowerCountMonth())
-          .add(underLine.getShorePowerCountMonth()).setScale(2, RoundingMode.HALF_UP));
-      sum.setShorePowerCountYear(origin.getShorePowerCountYear().add(gh.getShorePowerCountYear())
-          .add(underLine.getShorePowerCountYear()).setScale(2, RoundingMode.HALF_UP));
-      sum.setShorePowerTimeMonth(origin.getShorePowerTimeMonth().add(gh.getShorePowerTimeMonth())
-          .add(underLine.getShorePowerTimeMonth()).setScale(2, RoundingMode.HALF_UP));
-      sum.setShorePowerTimeYear(origin.getShorePowerTimeYear().add(gh.getShorePowerTimeYear())
-          .add(underLine.getShorePowerTimeYear()).setScale(2, RoundingMode.HALF_UP));
+      sum.setShorePowerCountMonth(origin.getShorePowerCountMonth().add(handData.getShorePowerCountMonth())
+          .setScale(2, RoundingMode.HALF_UP));
+      sum.setShorePowerCountYear(origin.getShorePowerCountYear().add(handData.getShorePowerCountYear())
+          .setScale(2, RoundingMode.HALF_UP));
+      sum.setShorePowerTimeMonth(origin.getShorePowerTimeMonth().add(handData.getShorePowerTimeMonth())
+          .setScale(2, RoundingMode.HALF_UP));
+      sum.setShorePowerTimeYear(origin.getShorePowerTimeYear().add(handData.getShorePowerTimeYear())
+          .setScale(2, RoundingMode.HALF_UP));
       spStatementShipUsageMonths.add(sum);
-      //zoro备注:要多算一部分数据,外电1,2,3
+
+      // 2025年1月开始不做 外高桥发电码头船舶(外一电、外二电、外三电) 数据统计,改为统计靠泊邮轮港码头船舶(大容量)
+/*      //zoro备注:要多算一部分数据,外电1,2,3
       List<SpStatementShipUsageDetail> sbWgq = spStatementShipUsageMonthMapper.selectWgqMonth(
           thisDate, lastDate, lastCycleStart, lastCycleEnd);
       SpStatementShipUsageMonthVo wgqMonth = makeOriginMonthData(sbWgq);
-      SpStatementShipUsageMonthVo wgqYear = spStatementShipUsageMonthMapper.selectWgqYear(
-          dateStrLast);
+      SpStatementShipUsageMonthVo wgqYear = spStatementShipUsageMonthMapper.selectWgqYear(dateStrLast);
       if (wgqYear == null) {
         wgqYear = new SpStatementShipUsageMonthVo();
       }
@@ -305,7 +340,40 @@ public class SpStatementShipUsageMonthServiceImpl extends
           .setScale(2, RoundingMode.HALF_UP));
       wgq.setShorePowerCountYear(wgqYear.getShorePowerCount().add(wgqMonth.getShorePowerCount())
           .setScale(2, RoundingMode.HALF_UP));
-      spStatementShipUsageMonths.add(wgq);
+      spStatementShipUsageMonths.add(wgq);*/
+
+      // 靠泊邮轮港码头船舶(大容量)
+      // 主要统计“上海港国际客运中心开发有限公司”和“上海吴淞口国际邮轮港发展有限公司”两家公司的“高压”和“低压大容量”两类连船记录数据。
+      List<SpStatementShipUsageDetail> ylgdrlList = spStatementShipUsageDetails.stream()
+          .filter(x -> "上海吴淞口国际邮轮港发展有限公司".equals(x.getEnterprisesName())
+              || "上海港国际客运中心开发有限公司".equals(x.getEnterprisesName()))
+          .filter(x -> !"低压(标准化)".equals(x.getConnectType()))
+          .collect(Collectors.toList());
+      log.info("查询到连电平台【靠泊邮轮港码头船舶(大容量)】记录数:"+ylgdrlList.size());
+
+      SpStatementShipUsageMonthVo ylgdrlMonth = makeOriginMonthDataV2d1(ylgdrlList);
+      SpStatementShipUsageMonthVo ylgdrlYear = spStatementShipUsageMonthMapper.selectylgdrlYear(dateStrLast);
+      if (ylgdrlMonth == null) {
+        ylgdrlMonth = new SpStatementShipUsageMonthVo();
+      }
+      if (ylgdrlYear == null) {
+        ylgdrlYear = new SpStatementShipUsageMonthVo();
+      }
+      SpStatementShipUsageMonth ylgdrl = new SpStatementShipUsageMonth();
+      ylgdrl.setId(snowflakeGenerator.next().toString());
+      ylgdrl.setDataSource(103);
+      ylgdrl.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
+      ylgdrl.setShorePowerCountMonth(ylgdrlMonth.getShorePowerCount());
+      ylgdrl.setShipUsageMonth(ylgdrlMonth.getShipUsage());
+      ylgdrl.setShorePowerTimeMonth(ylgdrlMonth.getShorePowerTime());
+      ylgdrl.setShipUsageYear(ylgdrlYear.getShipUsage().add(ylgdrlMonth.getShipUsage())
+          .setScale(2, RoundingMode.HALF_UP));
+      ylgdrl.setShorePowerTimeYear(ylgdrlYear.getShorePowerTime().add(ylgdrlMonth.getShorePowerTime())
+          .setScale(2, RoundingMode.HALF_UP));
+      ylgdrl.setShorePowerCountYear(ylgdrlYear.getShorePowerCount().add(ylgdrlMonth.getShorePowerCount())
+          .setScale(2, RoundingMode.HALF_UP));
+      spStatementShipUsageMonths.add(ylgdrl);
+
       //有一个合计的用于上海市岸电使用指标完成情况统计表,对应的dataSource为101
       //获取对应月的数据
 //      List<SpStatementShipUsageDetail> nwSum = spStatementShipUsageMonthMapper.selectNhAndWgMonth(thisDate,lastDate,lastCycleStart,lastCycleEnd);

+ 1 - 0
src/main/java/com/shcd/vo/SpStatementShipUsageDetail.java

@@ -7,6 +7,7 @@ import java.util.Date;
 
 @Data
 public class SpStatementShipUsageDetail {
+    private String enterprisesName;
     private BigDecimal shorePowerCount;
     private Date chargeStartDate;
     private Date chargeEndDate;

+ 28 - 1
src/main/resources/mapper/SpStatementShipUsageMonthMapper.xml

@@ -20,7 +20,7 @@
     where trunc(REPORT_DATE) = to_date(#{toDate}, 'yyyy-mm-dd')
   </delete>
   <select id="selectOriginDataMonth" resultType="com.shcd.vo.SpStatementShipUsageDetail">
-    select STARTTIME chargeStartDate, ENDTIME chargeEndDate, ELECT shorePowerCount, CONNTYPE connectType, DURATION duration
+    select ENTERPRISESNAME enterprisesName,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})
   </select>
@@ -135,6 +135,14 @@
     where trunc(REPORT_DATE) = to_date(#{toDate}, 'yyyy-mm-dd')
       and DATA_SOURCE = 100
   </select>
+    <select id="selectylgdrlYear" 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(#{toDate}, 'yyyy-mm-dd')
+          and DATA_SOURCE = 103
+    </select>
   <select id="getInRiverDataThisMonth" resultType="com.shcd.vo.SpStatementShipUsageDetail">
     select STARTTIME chargeStartDate, ENDTIME chargeEndDate, ELECT shorePowerCount
     from GHJG_PORT_MANAGE.SHORE_POWER_CONN_RECORD_INFO i
@@ -233,4 +241,23 @@
           TO_DATE(#{currentCycleStart}, 'yyyy-MM-dd HH24:mi:ss')))
     GROUP BY PORT.AREA
   </select>
+
+    <select id="selectHandDataWithDate" resultType="com.shcd.vo.SpStatementShipUsageMonthVo">
+        select
+            sum(t.use_count) shipUsage,
+            sum(t.ele_time) shorePowerTime,
+            sum(t.use_electricity) shorePowerCount
+        from ghjg_port_manage.shore_power_blberthmonthuse t
+        where to_date(t.month,'yyyy-mm') = to_date(#{date},'yyyy-mm')
+    </select>
+
+    <select id="selectHandDataYear" resultType="com.shcd.vo.SpStatementShipUsageMonthVo">
+        select
+            sum(t.use_count) shipUsage,
+            sum(t.ele_time) shorePowerTime,
+            sum(t.use_electricity) shorePowerCount
+        from ghjg_port_manage.shore_power_blberthmonthuse t
+        where to_date(t.month,'yyyy-mm') >= to_date(#{start},'yyyy-mm')
+          and to_date(t.month,'yyyy-mm') &lt;= to_date(#{end},'yyyy-mm')
+    </select>
 </mapper>