zhaoyun 5 ماه پیش
والد
کامیت
c2defd62da

+ 14 - 6
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/domain/vo/PdmLineComplete.java

@@ -2,12 +2,14 @@ package com.ruoyi.powerdistribution.domain.vo;
 
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.powerdistribution.domain.PdmLine;
+import lombok.Data;
 
 import java.math.BigDecimal;
 
 /**
  * 线路完成情况统计
  */
+@Data
 public class PdmLineComplete extends PdmLine {
 
     /** 计划检修后无故障持续时间 */
@@ -15,12 +17,18 @@ public class PdmLineComplete extends PdmLine {
 
     /** 奖励金额 */
     private BigDecimal rewardAmount;
+    /**
+     * 停电次数
+     */
+    private String poweroffNum;
+    /**
+     * 是否检修超期(1-是,0-否)
+     */
+    private  String isMaintOverdue;
+    /**
+     * 是否重复停电(1-是,0-否)
+     */
+    private String isRepeatPoweroff;
 
-    public String getFaultFreeDuration() {
-        return faultFreeDuration;
-    }
 
-    public BigDecimal getRewardAmount() {
-        return rewardAmount;
-    }
 }

+ 16 - 9
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmLineMapper.xml

@@ -185,20 +185,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <select id="selectCompleteList" parameterType="com.ruoyi.powerdistribution.domain.vo.PdmLineComplete" resultType="com.ruoyi.powerdistribution.domain.vo.PdmLineComplete">
-        select *,TIMESTAMPDIFF(DAY,poweroff_term_tm,NOW()) fault_free_duration from(
-            SELECT
-            t1.id, t1.rec_id, t1.line_nm, t1.line_run_no, t1.volt_lvl_cd, t1.volt_lvl_dsc,
-            t1.subs_id, t1.subs_nm, t1.feeder_id, t1.feeder_nm, t1.op_maint_org_id, t1.op_maint_org_nm,
-            t1.maint_team_id, t1.maint_team_nm, t1.org_no, t1.org_nm, t1.std_creator_no, t1.std_creator_nm,
-            t1.std_updator_no, t1.std_updator_nm, t1.std_org_no, t1.std_org_nm, t1.std_city_org_no,
-            t1.std_city_org_nm, t1.std_county_org_no, t1.std_county_org_nm, t1.data_dt, t1.etl_tm,
-            (select max(poweroff_term_tm) poweroff_term_tm from pdm_stop_records where line_id = t1.rec_id  ) poweroff_term_tm
+        SELECT
+        t1.id, t1.rec_id, t1.line_nm, t1.line_run_no, t1.volt_lvl_cd, t1.volt_lvl_dsc,
+        t1.subs_id, t1.subs_nm, t1.feeder_id, t1.feeder_nm, t1.op_maint_org_id, t1.op_maint_org_nm,
+        t1.maint_team_id, t1.maint_team_nm, t1.org_no, t1.org_nm, t1.std_creator_no, t1.std_creator_nm,
+        t1.std_updator_no, t1.std_updator_nm, t1.std_org_no, t1.std_org_nm, t1.std_city_org_no,
+        SUBSTRING_INDEX(t1.std_city_org_nm, '国网湖南省电力有限公司', -1)std_city_org_nm, t1.std_county_org_no, SUBSTRING_INDEX(t1.std_county_org_nm, '国网湖南省电力有限公司', -1) std_county_org_nm, t1.data_dt, t1.etl_tm,t1.bouns as reward_amount,t1.fault_free_duration,
+        (SELECT count(1) from pdm_stop_records where line_id=t1.rec_id)poweroff_num
         from pdm_line t1
         <where>
             <if test="recId != null  and recId != ''"> and t1.rec_id = #{recId}</if>
             <if test="lineNm != null  and lineNm != ''"> and t1.line_nm like concat('%', #{lineNm}, '%')</if>
+            <if test="isMaintOverdue!=null and 'true'.toString() == isMaintOverdue.toString()">
+                and (EXISTS(SELECT 1 from pdm_stop_records r where r.line_id=t1.rec_id and TIMESTAMPDIFF(YEAR,r.create_tm, SYSDATE())>3)
+                or (TIMESTAMPDIFF(YEAR,t1.ship_dt, SYSDATE())>3 and  not EXISTS(SELECT 1 from pdm_stop_records r where r.line_id=t1.rec_id)))
+           </if>
+            <if test="isRepeatPoweroff!=null and 'true'.toString() == isRepeatPoweroff.toString()">
+                and EXISTS(SELECT 1 from pdm_stop_records r where r.line_id=t1.rec_id and TIMESTAMPDIFF(MONTH,r.create_tm, SYSDATE())=2)
+                and (SELECT count(1) from pdm_stop_records r where r.line_id=t1.rec_id )>=3
+            </if>
         </where>
-        ) a
+
     </select>
     <update id="calculateBounsProc" statementType="CALLABLE" parameterType="java.util.Map">
         {call calculateBounsProc(#{calcuDate, mode=IN})}