Browse Source

:sparkles: 岸电报表上港计算改动

lag 3 months ago
parent
commit
abab322f3f

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

@@ -81,6 +81,8 @@ public interface SpStatementShipUsageMonthMapper extends BaseMapper<SpStatementS
   List<SpStatementShipUsageDetailV2> selectNhAndWgMonthV2(@Param("thisDate") Date thisDate,@Param("lastDate") Date lastDate);
 
   List<SpStatementShipUsageDetailV2> getInRiverDataThisMonthV2(@Param("thisDate") Date thisDate,@Param("lastDate") Date lastDate);
+
+  SpStatementShipUsageMonthVo getUnderLineMonthDataSgNew(@Param("lastDate") Date lastDate,@Param("thisDate") Date thisDate);
 }
 
 

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

@@ -629,7 +629,7 @@ public class SpStatementShipUsageMonthServiceImpl extends
               thisYear + "-" + (thisMonth < 10 ? "0" + thisMonth : thisMonth)));
       log.info("开始计算靠泊上港集团码头的集装箱船舶部分报表 ===========");
       try {
-        executeSg(toDate, thisYear, thisMonth, snowflakeGenerator, lastMonth);
+        executeSg(toDate, thisYear, thisMonth, snowflakeGenerator, lastMonth,lastDate, thisDate);
       } catch (Exception e) {
         PrintLogUtils.printErrorLogInfo(e);
         log.info("计算靠泊上港集团码头的集装箱船舶部分报表出错  ==========  原因:{}",
@@ -674,9 +674,10 @@ public class SpStatementShipUsageMonthServiceImpl extends
   }
 
   private void executeSg(Date toDate, int thisYear, int thisMonth,
-      SnowflakeGenerator snowflakeGenerator, int lastMonth) {
-    SpStatementShipUsageMonthVo underLineSg = spStatementShipUsageMonthMapper.getUnderLineMonthDataSg(
-        toDate);
+      SnowflakeGenerator snowflakeGenerator, int lastMonth,Date lastDate,Date thisDate) {
+//    SpStatementShipUsageMonthVo underLineSg = spStatementShipUsageMonthMapper.getUnderLineMonthDataSg(
+//        toDate);
+    SpStatementShipUsageMonthVo underLineSg = spStatementShipUsageMonthMapper.getUnderLineMonthDataSgNew(lastDate,thisDate);
     if (underLineSg == null) {
       underLineSg = new SpStatementShipUsageMonthVo();
     }

+ 13 - 0
src/main/resources/mapper/SpStatementShipUsageMonthMapper.xml

@@ -154,6 +154,19 @@
     where trunc(REPORT_DATE) = #{toDate}
       and NAME = '上海国际港务(集团)股份有限公司'
   </select>
+  <select id="getUnderLineMonthDataSgNew" resultType="com.shcd.vo.SpStatementShipUsageMonthVo">
+    select SUM(T.ELECT)                                  shorePowerCount,
+    SUM(ROUND((T.ENDTIME - T.STARTTIME) * 24, 2)) shorePowerTime,
+    COUNT(T.CONNRECORDSEQ)                        shipUsage
+    from ghjg_port_manage.shore_power_conn_record_info t
+    where t.OPERATORID in
+    ('sgldjzx','shgdjzxmt','shgjgwsd','shgjgwzd','shhdjzxmt','shmdjzxmt','shpdgjjzxmt','shsdjzxmt')
+    AND t.conntype != '低压(标准化)'
+    AND ((T.ENDTIME &lt;=
+    TO_DATE(#{thisDate}, 'yyyy-MM-dd HH24:mi:ss')
+    AND T.ENDTIME >=
+    TO_DATE(#{lastDate}, 'yyyy-MM-dd HH24:mi:ss')))
+  </select>
   <select id="selectThreeMonthsDataTotal" resultType="com.shcd.vo.SpShipUsageMonthQuarterVo">
     SELECT SUM(T.SHIP_USAGE_MONTH)        shipUsageMonth,
            MAX(T.SHIP_USAGE_YEAR)         shipUsageYear,