Ver código fonte

:sparkles: 内河低压分析月度报表按照新需求更改

lag 1 ano atrás
pai
commit
5b9aaede83

+ 11 - 1
src/main/java/com/shcd/enums/ShorePowerConnRecordInfoEnum.java

@@ -5,7 +5,17 @@ import lombok.Getter;
 
 @Getter
 public enum ShorePowerConnRecordInfoEnum {
-  PD("浦东新区", 4);
+  SGNH("市管内河",2),
+  CM("崇明区",3),
+  PD("浦东新区",4),
+  BS("宝山区",5),
+  JD("嘉定区",6),
+  FX("奉贤区",7),
+  MH("闵行区",8),
+  JS("金山区",9),
+  QP("青浦区",10),
+  SJ("松江区",11),
+  LG("临港新片区", 12);
 
 
   private String area;

+ 15 - 9
src/main/java/com/shcd/scheduling/ShorePowerReportGenerateScheduler.java

@@ -46,9 +46,9 @@ public class ShorePowerReportGenerateScheduler {
   public void generateSpInlandLowStatement() {
     try {
       // 生成各区上报数据   内河低压分析表
-      //generateReport1();
-      // 生成市级平台自动上传数据   内河低压分析表
-      //generateReport2();
+      generateReport1();
+//       生成市级平台自动上传数据   内河低压分析表
+      generateReport2();
       //生成报表三
       generateReport3();
     } catch (Exception e) {
@@ -154,6 +154,7 @@ public class ShorePowerReportGenerateScheduler {
       spStatementInlandLow.setType(x.getType());
       spStatementInlandLow.setReportDate(x.getReportDate());
     });
+    // 拿上个月的中间表的"合计"数据  用来计算使用岸电船舶(艘次)的环比
     SpStatementInlandLow lastMonthReportData = spStatementInlandLowService.getLastMonthReportData(
         getShorePowerLastMonthDate(), spStatementInlandLow.getType());
     if (Objects.isNull(lastMonthReportData) || Objects.isNull(
@@ -188,15 +189,18 @@ public class ShorePowerReportGenerateScheduler {
           AreaSortEnum.getByArea(spStatementInlandLow.getDistrict()).getSort());
       spStatementInlandLow.setType(2);
       spStatementInlandLow.setBoatUseNumberMonth(currentMonth.getTotal());
-      spStatementInlandLow.setPowerConnHoursMonth(
-          currentMonth.getDuration().divide(BigDecimal.valueOf(60), 2,
-              RoundingMode.HALF_UP));
+      // 使用岸电小时在查询数据库时已经转换为小时计算
+//      spStatementInlandLow.setPowerConnHoursMonth(
+//          currentMonth.getDuration().divide(BigDecimal.valueOf(60), 2,
+//              RoundingMode.HALF_UP));
+      spStatementInlandLow.setPowerConnHoursMonth(currentMonth.getDuration());
       spStatementInlandLow.setElectricityUsageMonth(currentMonth.getElect());
       if (CollectionUtils.isEmpty(lastMonthData)) {
         spStatementInlandLow.setBoatUseNumberChain(null);
       } else {
         for (ShorePowerConnRecordInfoVo lastMonth : lastMonthData) {
           if (currentMonth.getArea().equals(lastMonth.getArea())) {
+            // 计算使用岸电船舶(艘次)环比
             BigDecimal rate = getRate2(currentMonth, lastMonth);
             spStatementInlandLow.setBoatUseNumberChain(rate);
           } else {
@@ -205,15 +209,17 @@ public class ShorePowerReportGenerateScheduler {
         }
       }
       spStatementInlandLowList.add(spStatementInlandLow);
+      // 计算各区的当年累计
       for (SpStatementInlandLow statementInlandLow : spStatementInlandLowList) {
         for (ShorePowerConnRecordInfoVo yearData : currentYearDataList) {
           if (spStatementInlandLow.getDistrict().equals(
               ShorePowerConnRecordInfoEnum.getByArea(Integer.parseInt(yearData.getArea()))
                   .getArea())) {
             statementInlandLow.setBoatUseNumberYearTotal(yearData.getTotal());
-            statementInlandLow.setPowerConnHoursYearTotal(
-                yearData.getDuration().divide(BigDecimal.valueOf(60), 2,
-                    RoundingMode.HALF_UP));
+//            statementInlandLow.setPowerConnHoursYearTotal(
+//                yearData.getDuration().divide(BigDecimal.valueOf(60), 2,
+//                    RoundingMode.HALF_UP));
+            statementInlandLow.setPowerConnHoursYearTotal(yearData.getDuration());
             statementInlandLow.setElectricityUsageYearTotal(yearData.getElect());
           }
         }

+ 2 - 2
src/main/resources/mapper/SpStatementInlandLowMapper.xml

@@ -89,12 +89,12 @@
   <select id="selectDataFromShorePower" resultType="com.shcd.vo.ShorePowerConnRecordInfoVo">
     SELECT PORT.AREA area,
     SUM(T.ELECT) elect,
-    SUM(T.DURATION) duration,
+    SUM(ROUND((T.ENDTIME - T.STARTTIME) * 24, 2)) duration,
     COUNT(T.CONNRECORDSEQ) total
     FROM GHJG_PORT_MANAGE.SHORE_POWER_CONN_RECORD_INFO T
     LEFT JOIN GHJG_PORT_MANAGE.SHORE_POWER_PORT_INFO_NEW PORT
     ON PORT.PORTID = T.PORTID
-    WHERE T.CONNTYPE = '低压'
+    WHERE T.CONNTYPE = '低压(标准化)' AND PORT.AREA is not null and PORT.AREA != 1 AND PORT.PORTID != '1146'
     <if test="reportDateEnd != '' and reportDateEnd != null">
       AND T.MODIFYTIME &lt;=
       TO_DATE(#{reportDateEnd}, 'yyyy-MM-dd HH24:mi:ss')