From efd53d4980b5a0ae537fb7ec6f5a993eae507dac Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期二, 06 八月 2024 10:48:59 +0800 Subject: [PATCH] 2024-08-06 朱宝民 获取指定时间段内开阀次数超过指定值的农户 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml | 415 +++++++++++++++------------ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeValueQO.java | 4 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java | 67 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java | 15 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java | 53 +++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/OpenCountQO.java | 22 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/CommonQO.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java | 51 ++- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java | 6 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java | 48 +++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml | 186 ++++++------ pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/CloseCountQO.java | 22 + 13 files changed, 584 insertions(+), 309 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java index ee5171e..ef1ae3d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory; import com.dy.pipIrrGlobal.voRm.VoOpenCloseValve; +import com.dy.pipIrrGlobal.voSt.VoClient; import com.dy.pipIrrGlobal.voSt.VoIntake; import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; import org.apache.ibatis.annotations.Mapper; @@ -121,4 +122,18 @@ * @return */ List<VoIntakeOpenCount> getOpenValveLtIntakes(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺 + * @param params + * @return + */ + Long getLargeOpenCountClientsCount(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param params + * @return + */ + List<VoClient> getLargeOpenCountClients(Map<String, Object> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java new file mode 100644 index 0000000..3c3e426 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java @@ -0,0 +1,48 @@ +package com.dy.pipIrrGlobal.voSt; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-08-06 9:45 + * @LastEditTime 2024-08-06 9:45 + * @Description 鍐滄埛瑙嗗浘瀵硅薄 + */ + +@Data +public class VoClient { + private static final long serialVersionUID = 202408060947001L; + + /** + * 鍐滄埛ID + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long clientId; + + /** + * 鍐滄埛濮撳悕 + */ + private String clientName; + + /** + * 鍐滄埛缂栧彿 + */ + private String clientNum; + + /** + * 鍐滄埛鍦板潃 + */ + private String address; + + /** + * 鎵嬫満鍙� + */ + private String phone; + + /** + * 韬唤璇佸彿 + */ + private String idCard; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index 1c09121..682d4eb 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -72,7 +72,7 @@ pipIrr: global: - dev: flase #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse + dev: false #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse dsName: ym #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О mw: webPort: 8070 diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml index 366c85b..74ddee5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml @@ -435,30 +435,29 @@ where id = #{id,jdbcType=BIGINT} </update> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ュ巻鍙茶褰曟暟閲�--> - <select id="getOpenCloseValveReportsCount_history" resultType="java.lang.Long"> - SELECT - COUNT(*) AS recordCount - FROM rm_open_close_valve_history oh - INNER JOIN pr_intake inta ON inta.id = oh.intake_id - <where> - <if test="intakeId != null and intakeId >0"> - AND oh.intake_id = #{intakeId} - </if> - <if test = "intakeNum != null and intakeNum !=''"> - AND inta.name LIKE CONCAT('%',#{intakeNum},'%') - </if> - <if test = "rtuAddr != null and rtuAddr !=''"> - AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') - </if> - <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> - AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} - </if> - <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> - AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} - </if> - </where> - </select> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ュ巻鍙茶褰曟暟閲�--> + <select id="getOpenCloseValveReportsCount_history" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM rm_open_close_valve_history oh + INNER JOIN pr_intake inta ON inta.id = oh.intake_id + <where> + <if test="intakeId != null and intakeId > 0"> + AND oh.intake_id = #{intakeId} + </if> + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') + </if> + <if test="rtuAddr != null and rtuAddr != ''"> + AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%') + </if> + <if test="timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != ''"> + AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} + </if> + <if test="timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != ''"> + AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} + </if> + </where> + </select> <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ュ巻鍙茶褰曟暟閲�--> <select id="getOpenCloseValveReportsCount_history" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount @@ -552,170 +551,208 @@ </if> </trim> </select> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ュ巻鍙茶褰�--> - <select id="getOpenCloseValveReports_history" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> - SELECT - oh.intake_id AS intakeId, - inta.name AS intakenum, - oh.rtu_addr AS rtuAddr, - oh.client_name AS clientName, - oh.op_ic_card_no AS openIcNum, - oh.op_ic_card_addr AS openIcAddr, - oh.op_dt AS openTime, - CASE - WHEN oh.op_type = 1 THEN "鍒峰崱寮�闃�" - WHEN oh.op_type = 3 THEN "涓績绔欏紑闃�" - WHEN oh.op_type = 5 THEN "娆犺垂鍏抽榾" - WHEN oh.op_type = 8 THEN "鐢ㄦ埛杩滅▼寮�闃�" - WHEN oh.op_type = 11 THEN "寮�鍏抽榾鍗″紑闃�" - ELSE "鏈煡" - END AS openType, - oh.op_order_no AS openOrderNo, - oh.op_total_amount AS openTotalAmount, - oh.op_remain_money AS openRemainMoney, - oh.op_water_remain_user AS openWaterRemain, - oh.op_ele_total_amount AS openEleTotalAmount, - oh.cl_ic_card_no AS closeIcNum, - oh.cl_ic_card_addr AS closeIcAddr, - oh.cl_dt AS closeTime, - CASE - WHEN oh.cl_type = 2 THEN "鍒峰崱鍏抽榾" - WHEN oh.cl_type = 4 THEN "涓績绔欏叧闃�" - WHEN oh.cl_type = 5 THEN "娆犺垂鍏抽榾" - WHEN oh.cl_type = 6 THEN "娴侀噺璁℃晠闅滃叧闃�" - WHEN oh.cl_type = 7 THEN "绱ф�ュ叧闂�" - WHEN oh.cl_type = 9 THEN "鐢ㄦ埛杩滅▼鍏抽榾" - WHEN oh.cl_type = 10 THEN "寮�鍏抽榾鍗″叧闃�" - WHEN oh.cl_type = 12 THEN "榛戝悕鍗曞懡浠ゅ叧闃�" - WHEN oh.cl_type = 13 THEN "鐢ㄦ埛杩滅▼瀹氭椂鍏抽榾" - WHEN oh.cl_type = 14 THEN "鐢ㄦ埛杩滅▼瀹氶噺鍏抽榾" - ELSE "鏈煡" - END AS closeType, - oh.cl_this_amount AS closeThisAmount, - oh.cl_this_time AS thisTime, - oh.cl_this_money AS thisMoney, - oh.cl_remain_money AS closeRemainMoney, - oh.cl_total_amount AS closeTotalAmount - FROM rm_open_close_valve_history oh - INNER JOIN pr_intake inta ON inta.id = oh.intake_id - <where> - <if test="intakeId != null and intakeId >0"> - AND oh.intake_id = #{intakeId} - </if> - <if test = "intakeNum != null and intakeNum !=''"> - AND inta.name LIKE CONCAT('%',#{intakeNum},'%') - </if> - <if test = "rtuAddr != null and rtuAddr !=''"> - AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') - </if> - <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> - AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} - </if> - <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> - AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} - </if> - </where> - ORDER BY oh.op_dt DESC - <trim prefix="limit " > - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> - </select> - <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴浠庢湭寮�杩囬榾鐨勫彇姘村彛鏁伴噺--> - <select id="getNeverOpenValveIntakesCount" resultType="java.lang.Long"> - SELECT - COUNT(*) AS recordCount - FROM pr_intake inta - INNER JOIN ba_block blo ON blo.id = inta.blockId - WHERE inta.deleted = 0 - AND NOT EXISTS(SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop} AND intake_id = inta.id) + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ュ巻鍙茶褰�--> + <select id="getOpenCloseValveReports_history" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> + SELECT oh.intake_id AS intakeId, + inta.name AS intakenum, + oh.rtu_addr AS rtuAddr, + oh.client_name AS clientName, + oh.op_ic_card_no AS openIcNum, + oh.op_ic_card_addr AS openIcAddr, + oh.op_dt AS openTime, + CASE + WHEN oh.op_type = 1 THEN '鍒峰崱寮�闃�' + WHEN oh.op_type = 3 THEN '涓績绔欏紑闃�' + WHEN oh.op_type = 5 THEN '娆犺垂鍏抽榾' + WHEN oh.op_type = 8 THEN '鐢ㄦ埛杩滅▼寮�闃�' + WHEN oh.op_type = 11 THEN '寮�鍏抽榾鍗″紑闃�' + ELSE '鏈煡' + END AS openType, + oh.op_order_no AS openOrderNo, + oh.op_total_amount AS openTotalAmount, + oh.op_remain_money AS openRemainMoney, + oh.op_water_remain_user AS openWaterRemain, + oh.op_ele_total_amount AS openEleTotalAmount, + oh.cl_ic_card_no AS closeIcNum, + oh.cl_ic_card_addr AS closeIcAddr, + oh.cl_dt AS closeTime, + CASE + WHEN oh.cl_type = 2 THEN '鍒峰崱鍏抽榾' + WHEN oh.cl_type = 4 THEN '涓績绔欏叧闃�' + WHEN oh.cl_type = 5 THEN '娆犺垂鍏抽榾' + WHEN oh.cl_type = 6 THEN '娴侀噺璁℃晠闅滃叧闃�' + WHEN oh.cl_type = 7 THEN '绱ф�ュ叧闂�' + WHEN oh.cl_type = 9 THEN '鐢ㄦ埛杩滅▼鍏抽榾' + WHEN oh.cl_type = 10 THEN '寮�鍏抽榾鍗″叧闃�' + WHEN oh.cl_type = 12 THEN '榛戝悕鍗曞懡浠ゅ叧闃�' + WHEN oh.cl_type = 13 THEN '鐢ㄦ埛杩滅▼瀹氭椂鍏抽榾' + WHEN oh.cl_type = 14 THEN '鐢ㄦ埛杩滅▼瀹氶噺鍏抽榾' + ELSE '鏈煡' + END AS closeType, + oh.cl_this_amount AS closeThisAmount, + oh.cl_this_time AS thisTime, + oh.cl_this_money AS thisMoney, + oh.cl_remain_money AS closeRemainMoney, + oh.cl_total_amount AS closeTotalAmount + FROM rm_open_close_valve_history oh + INNER JOIN pr_intake inta ON inta.id = oh.intake_id + <where> + <if test="intakeId != null and intakeId > 0"> + AND oh.intake_id = #{intakeId} + </if> + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') + </if> + <if test="rtuAddr != null and rtuAddr != ''"> + AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%') + </if> + <if test="timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != ''"> + AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} + </if> + <if test="timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != ''"> + AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} + </if> + </where> + ORDER BY oh.op_dt DESC + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> </select> -<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴浠庢湭寮�杩囬榾鐨勫彇姘村彛--> - <select id="getNeverOpenValveIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntake"> - SELECT - inta.id AS intakeId, - inta.name AS intakeNum, - blo.name AS blockName - FROM pr_intake inta - INNER JOIN ba_block blo ON blo.id = inta.blockId - WHERE inta.deleted = 0 - AND NOT EXISTS(SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop} AND intake_id = inta.id) - ORDER BY inta.id - <trim prefix="limit " > - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> - </select> - <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> - <select id="getOpenValveGtIntakesCount" resultType="java.lang.Long"> - select count(*) - from (SELECT - COUNT(*) AS recordCount, - inta.id AS intakeId, - inta.name AS intakeNum, - blo.name AS blockName - FROM pr_intake inta - LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id - INNER JOIN ba_block blo ON blo.id = inta.blockId - WHERE inta.deleted = 0 - GROUP BY intakeId,intakeNum,blockName - HAVING recordCount > #{value}) a - </select> - <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�--> - <select id="getOpenValveGtIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> - SELECT - COUNT(*) AS recordCount, - inta.id AS intakeId, - inta.name AS intakeNum, - blo.name AS blockName - FROM pr_intake inta - LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id - INNER JOIN ba_block blo ON blo.id = inta.blockId - WHERE inta.deleted = 0 - GROUP BY intakeId,intakeNum,blockName - HAVING recordCount > #{value} - ORDER BY inta.id - <trim prefix="limit " > - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> - </select> - <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> - <select id="getOpenValveLtIntakesCount" resultType="java.lang.Long"> - select count(*) - from (SELECT - COUNT(*) AS recordCount, - inta.id AS intakeId, - inta.name AS intakeNum, - blo.name AS blockName - FROM pr_intake inta - LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id - INNER JOIN ba_block blo ON blo.id = inta.blockId - WHERE inta.deleted = 0 - GROUP BY intakeId,intakeNum,blockName - HAVING recordCount < #{value}) a - </select> - <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍙栨按鍙�--> - <select id="getOpenValveLtIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> - SELECT - COUNT(*) AS recordCount, - inta.id AS intakeId, - inta.name AS intakeNum, - blo.name AS blockName - FROM pr_intake inta - LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id - INNER JOIN ba_block blo ON blo.id = inta.blockId - WHERE inta.deleted = 0 - GROUP BY intakeId,intakeNum,blockName - HAVING recordCount < #{value} - ORDER BY inta.id - <trim prefix="limit " > - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> - </select> + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴浠庢湭寮�杩囬榾鐨勫彇姘村彛鏁伴噺--> + <select id="getNeverOpenValveIntakesCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_intake inta + INNER JOIN ba_block blo ON blo.id = inta.blockId + WHERE inta.deleted = 0 + AND NOT EXISTS(SELECT * + FROM rm_open_close_valve_history + WHERE op_dt BETWEEN #{timeStart} AND #{timeStop} + AND intake_id = inta.id) + </select> + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴浠庢湭寮�杩囬榾鐨勫彇姘村彛--> + <select id="getNeverOpenValveIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntake"> + SELECT inta.id AS intakeId, + inta.name AS intakeNum, + blo.name AS blockName + FROM pr_intake inta + INNER JOIN ba_block blo ON blo.id = inta.blockId + WHERE inta.deleted = 0 + AND NOT EXISTS(SELECT * + FROM rm_open_close_valve_history + WHERE op_dt BETWEEN #{timeStart} AND #{timeStop} + AND intake_id = inta.id) + ORDER BY inta.id + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> + <select id="getOpenValveGtIntakesCount" resultType="java.lang.Long"> + select count(*) + from (SELECT COUNT(*) AS recordCount, + inta.id AS intakeId, + inta.name AS intakeNum, + blo.name AS blockName + FROM pr_intake inta + LEFT JOIN (SELECT * + FROM rm_open_close_valve_history + WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id + INNER JOIN ba_block blo ON blo.id = inta.blockId + WHERE inta.deleted = 0 + GROUP BY intakeId, intakeNum, blockName + HAVING recordCount > #{value}) a + </select> + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�--> + <select id="getOpenValveGtIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> + SELECT COUNT(*) AS recordCount, + inta.id AS intakeId, + inta.name AS intakeNum, + blo.name AS blockName + FROM pr_intake inta + LEFT JOIN (SELECT * + FROM rm_open_close_valve_history + WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id + INNER JOIN ba_block blo ON blo.id = inta.blockId + WHERE inta.deleted = 0 + GROUP BY intakeId, intakeNum, blockName + HAVING recordCount > #{value} + <!-- ORDER BY inta.id--> + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> + <select id="getOpenValveLtIntakesCount" resultType="java.lang.Long"> + select count(*) + from (SELECT COUNT(*) AS recordCount, + inta.id AS intakeId, + inta.name AS intakeNum, + blo.name AS blockName + FROM pr_intake inta + LEFT JOIN (SELECT * + FROM rm_open_close_valve_history + WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id + INNER JOIN ba_block blo ON blo.id = inta.blockId + WHERE inta.deleted = 0 + GROUP BY intakeId, intakeNum, blockName + HAVING recordCount < #{value}) a + </select> + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍙栨按鍙�--> + <select id="getOpenValveLtIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> + SELECT COUNT(*) AS recordCount, + inta.id AS intakeId, + inta.name AS intakeNum, + blo.name AS blockName + FROM pr_intake inta + LEFT JOIN (SELECT * + FROM rm_open_close_valve_history + WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id + INNER JOIN ba_block blo ON blo.id = inta.blockId + WHERE inta.deleted = 0 + GROUP BY intakeId, intakeNum, blockName + HAVING recordCount < #{value} + <!-- ORDER BY inta.id--> + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺--> + <select id="getLargeOpenCountClientsCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM se_client cli + WHERE (SELECT COUNT(*) + FROM rm_open_close_valve_history his + WHERE his.client_id = cli.id + AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{openCount} + </select> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛--> + <select id="getLargeOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient"> + SELECT cli.id AS clientId, + cli.name AS clientName, + cli.clientNum, + CONCAT(cli.districtTitle, cli.address) AS address, + cli.phone, + cli.idCard + FROM se_client cli + WHERE (SELECT COUNT(*) + FROM rm_open_close_valve_history his + WHERE his.client_id = cli.id + AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{openCount} + ORDER BY cli.id + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml index c5a9b85..0896dac 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml @@ -454,101 +454,99 @@ where id = #{id,jdbcType=BIGINT} </update> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ユ渶鏂拌褰曟暟閲�--> - <select id="getOpenCloseValveReportsCount_last" resultType="java.lang.Long"> - SELECT - COUNT(*) AS recordCount - FROM rm_open_close_valve_last oh - INNER JOIN pr_intake inta ON inta.id = oh.intake_id - <where> - <if test="intakeId != null and intakeId >0"> - AND oh.intake_id = #{intakeId} - </if> - <if test = "intakeNum != null and intakeNum !=''"> - AND inta.name LIKE CONCAT('%',#{intakeNum},'%') - </if> - <if test = "rtuAddr != null and rtuAddr !=''"> - AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') - </if> - <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> - AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} - </if> - <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> - AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} - </if> - </where> - </select> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ユ渶鏂拌褰曟暟閲�--> + <select id="getOpenCloseValveReportsCount_last" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM rm_open_close_valve_last oh + INNER JOIN pr_intake inta ON inta.id = oh.intake_id + <where> + <if test="intakeId != null and intakeId > 0"> + AND oh.intake_id = #{intakeId} + </if> + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') + </if> + <if test="rtuAddr != null and rtuAddr != ''"> + AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%') + </if> + <if test="timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != ''"> + AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} + </if> + <if test="timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != ''"> + AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} + </if> + </where> + </select> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ユ渶鏂拌褰�--> - <select id="getOpenCloseValveReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> - SELECT - oh.intake_id AS intakeId, - inta.name AS intakeNum, - oh.rtu_addr AS rtuAddr, - oh.client_name AS clientName, - oh.op_ic_card_no AS openIcNum, - oh.op_ic_card_addr AS openIcAddr, - oh.op_dt AS openTime, - CASE - WHEN oh.op_type = 1 THEN "鍒峰崱寮�闃�" - WHEN oh.op_type = 3 THEN "涓績绔欏紑闃�" - WHEN oh.op_type = 5 THEN "娆犺垂鍏抽榾" - WHEN oh.op_type = 8 THEN "鐢ㄦ埛杩滅▼寮�闃�" - WHEN oh.op_type = 11 THEN "寮�鍏抽榾鍗″紑闃�" - ELSE "鏈煡" - END AS openType, - oh.op_order_no AS openOrderNo, - oh.op_total_amount AS openTotalAmount, - oh.op_remain_money AS openRemainMoney, - oh.op_water_remain_user AS openWaterRemain, - oh.op_ele_total_amount AS openEleTotalAmount, - oh.cl_ic_card_no AS closeIcNum, - oh.cl_ic_card_addr AS closeIcAddr, - oh.cl_dt AS closeTime, - CASE - WHEN oh.cl_type = 2 THEN "鍒峰崱鍏抽榾" - WHEN oh.cl_type = 4 THEN "涓績绔欏叧闃�" - WHEN oh.cl_type = 5 THEN "娆犺垂鍏抽榾" - WHEN oh.cl_type = 6 THEN "娴侀噺璁℃晠闅滃叧闃�" - WHEN oh.cl_type = 7 THEN "绱ф�ュ叧闂�" - WHEN oh.cl_type = 9 THEN "鐢ㄦ埛杩滅▼鍏抽榾" - WHEN oh.cl_type = 10 THEN "寮�鍏抽榾鍗″叧闃�" - WHEN oh.cl_type = 12 THEN "榛戝悕鍗曞懡浠ゅ叧闃�" - WHEN oh.cl_type = 13 THEN "鐢ㄦ埛杩滅▼瀹氭椂鍏抽榾" - WHEN oh.cl_type = 14 THEN "鐢ㄦ埛杩滅▼瀹氶噺鍏抽榾" - ELSE "鏈煡" - END AS closeType, - oh.cl_this_amount AS closeThisAmount, - oh.cl_this_time AS thisTime, - oh.cl_this_money AS thisMoney, - oh.cl_remain_money AS closeRemainMoney, - oh.cl_total_amount AS closeTotalAmount - FROM rm_open_close_valve_last oh - INNER JOIN pr_intake inta ON inta.id = oh.intake_id - <where> - <if test="intakeId != null and intakeId >0"> - AND oh.intake_id = #{intakeId} - </if> - <if test = "intakeNum != null and intakeNum !=''"> - AND inta.name LIKE CONCAT('%',#{intakeNum},'%') - </if> - <if test = "rtuAddr != null and rtuAddr !=''"> - AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') - </if> - <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> - AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} - </if> - <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> - AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} - </if> - </where> - ORDER BY oh.op_dt DESC - <trim prefix="limit " > - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> - </select> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ユ渶鏂拌褰�--> + <select id="getOpenCloseValveReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> + SELECT oh.intake_id AS intakeId, + inta.name AS intakeNum, + oh.rtu_addr AS rtuAddr, + oh.client_name AS clientName, + oh.op_ic_card_no AS openIcNum, + oh.op_ic_card_addr AS openIcAddr, + oh.op_dt AS openTime, + CASE + WHEN oh.op_type = 1 THEN '鍒峰崱寮�闃�' + WHEN oh.op_type = 3 THEN '涓績绔欏紑闃�' + WHEN oh.op_type = 5 THEN '娆犺垂鍏抽榾' + WHEN oh.op_type = 8 THEN '鐢ㄦ埛杩滅▼寮�闃�' + WHEN oh.op_type = 11 THEN '寮�鍏抽榾鍗″紑闃�' + ELSE '鏈煡' + END AS openType, + oh.op_order_no AS openOrderNo, + oh.op_total_amount AS openTotalAmount, + oh.op_remain_money AS openRemainMoney, + oh.op_water_remain_user AS openWaterRemain, + oh.op_ele_total_amount AS openEleTotalAmount, + oh.cl_ic_card_no AS closeIcNum, + oh.cl_ic_card_addr AS closeIcAddr, + oh.cl_dt AS closeTime, + CASE + WHEN oh.cl_type = 2 THEN '鍒峰崱鍏抽榾' + WHEN oh.cl_type = 4 THEN '涓績绔欏叧闃�' + WHEN oh.cl_type = 5 THEN '娆犺垂鍏抽榾' + WHEN oh.cl_type = 6 THEN '娴侀噺璁℃晠闅滃叧闃�' + WHEN oh.cl_type = 7 THEN '绱ф�ュ叧闂�' + WHEN oh.cl_type = 9 THEN '鐢ㄦ埛杩滅▼鍏抽榾' + WHEN oh.cl_type = 10 THEN '寮�鍏抽榾鍗″叧闃�' + WHEN oh.cl_type = 12 THEN '榛戝悕鍗曞懡浠ゅ叧闃�' + WHEN oh.cl_type = 13 THEN '鐢ㄦ埛杩滅▼瀹氭椂鍏抽榾' + WHEN oh.cl_type = 14 THEN '鐢ㄦ埛杩滅▼瀹氶噺鍏抽榾' + ELSE '鏈煡' + END AS closeType, + oh.cl_this_amount AS closeThisAmount, + oh.cl_this_time AS thisTime, + oh.cl_this_money AS thisMoney, + oh.cl_remain_money AS closeRemainMoney, + oh.cl_total_amount AS closeTotalAmount + FROM rm_open_close_valve_last oh + INNER JOIN pr_intake inta ON inta.id = oh.intake_id + <where> + <if test="intakeId != null and intakeId > 0"> + AND oh.intake_id = #{intakeId} + </if> + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') + </if> + <if test="rtuAddr != null and rtuAddr != ''"> + AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%') + </if> + <if test="timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != ''"> + AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} + </if> + <if test="timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != ''"> + AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} + </if> + </where> + ORDER BY oh.op_dt DESC + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍏抽榾鎶ユ渶鏂拌褰�--> <select id="getOpenCloseValveReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> SELECT oh.intake_id AS intakeId, diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java new file mode 100644 index 0000000..5beecb3 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java @@ -0,0 +1,53 @@ +package com.dy.pipIrrStatistics.client; + +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.voSt.VoClient; +import com.dy.pipIrrStatistics.client.qo.OpenCountQO; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Objects; + +/** + * @author ZhuBaoMin + * @date 2024-08-06 9:43 + * @LastEditTime 2024-08-06 9:43 + * @Description + */ + +@Slf4j +@RestController +@RequestMapping(path="statistics") +@RequiredArgsConstructor +public class ClientCtrl { + private final ClientSv clientSv; + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @return + */ + @GetMapping(path = "/getLargeOpenCountClients") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoClient>>> getLargeOpenCountClients(@Valid OpenCountQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + try { + return BaseResponseUtils.buildSuccess(clientSv.getLargeOpenCountClients(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java new file mode 100644 index 0000000..d2fa9c7 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java @@ -0,0 +1,67 @@ +package com.dy.pipIrrStatistics.client; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; +import com.dy.pipIrrGlobal.voSt.VoClient; +import com.dy.pipIrrStatistics.client.qo.OpenCountQO; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * @author ZhuBaoMin + * @date 2024-08-06 9:43 + * @LastEditTime 2024-08-06 9:43 + * @Description + */ + +@Slf4j +@Service +public class ClientSv { + @Autowired + private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getLargeOpenCountClients(OpenCountQO qo) { + /** + * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 + */ + String timeStart = qo.getTimeStart(); + String timeStop = qo.getTimeStop(); + if(timeStart != null) { + timeStart = timeStart + " 00:00:00"; + }else { + timeStart = LocalDate.now() + " 00:00:00"; + } + if(timeStop != null) { + timeStop = timeStop + " 23:59:59"; + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getLargeOpenCountClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getLargeOpenCountClients(params); + return rsVo ; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/CloseCountQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/CloseCountQO.java new file mode 100644 index 0000000..af064a6 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/CloseCountQO.java @@ -0,0 +1,22 @@ +package com.dy.pipIrrStatistics.client.qo; + +import com.dy.pipIrrStatistics.intake.qo.CommonQO; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-08-06 9:58 + * @LastEditTime 2024-08-06 9:58 + * @Description 鍏抽榾娆℃暟鏌ヨ瀵硅薄 + */ + +@Data +public class CloseCountQO extends CommonQO { + + /** + * 鍏抽榾娆℃暟 + */ + @NotNull(message = "鍏抽榾娆℃暟涓嶈兘涓虹┖") + private Integer closeCount; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/OpenCountQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/OpenCountQO.java new file mode 100644 index 0000000..48db4b8 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/OpenCountQO.java @@ -0,0 +1,22 @@ +package com.dy.pipIrrStatistics.client.qo; + +import com.dy.pipIrrStatistics.intake.qo.CommonQO; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-08-06 9:55 + * @LastEditTime 2024-08-06 9:55 + * @Description 寮�闃�娆℃暟鏌ヨ瀵硅薄 + */ + +@Data +public class OpenCountQO extends CommonQO { + + /** + * 寮�闃�娆℃暟 + */ + @NotNull(message = "寮�闃�娆℃暟涓嶈兘涓虹┖") + private Integer openCount; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java index 24b04e4..0bc6f0d 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java @@ -14,7 +14,7 @@ import com.dy.pipIrrGlobal.voSt.VoSignalIntensity; import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO; import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; -import com.dy.pipIrrStatistics.intake.qo.IntakeQO; +import com.dy.pipIrrStatistics.intake.qo.CommonQO; import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO; import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO; import lombok.extern.slf4j.Slf4j; @@ -63,7 +63,7 @@ * @param qo * @return */ - public QueryResultVo<List<VoIntake>> getNotOnlineIntakes(IntakeQO qo) { + public QueryResultVo<List<VoIntake>> getNotOnlineIntakes(CommonQO qo) { DecimalFormat df = new DecimalFormat("0.00"); /** * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 @@ -193,7 +193,7 @@ * 鑾峰彇浠庢湭寮�杩囬榾鐨勫彇姘村彛 * @return */ - public QueryResultVo<List<VoIntake>> getNeverOpenValveIntakes(IntakeQO qo) { + public QueryResultVo<List<VoIntake>> getNeverOpenValveIntakes(CommonQO qo) { String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java index 1353e04..9affdc2 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java @@ -6,24 +6,17 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.voSt.*; import com.dy.pipIrrStatistics.intake.qo.*; -import com.dy.pipIrrGlobal.voSt.VoBatteryVolt; -import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow; -import com.dy.pipIrrGlobal.voSt.VoIntake; -import com.dy.pipIrrGlobal.voSt.VoSignalIntensity; -import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO; -import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; -import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; -import com.dy.pipIrrStatistics.intake.qo.IntakeQO; -import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO; -import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO; import com.dy.pipIrrStatistics.result.StatisticlResultCode; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; +import java.util.Objects; /** * @author ZhuBaoMin @@ -46,7 +39,11 @@ */ @GetMapping(path = "/getNotOnlineIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(IntakeQO qo) { + public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(@Valid CommonQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { return BaseResponseUtils.buildSuccess(intakeSv.getNotOnlineIntakes(qo)); } catch (Exception e) { @@ -62,7 +59,10 @@ */ @GetMapping(path = "/getLargeFlowIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getLargeFlowIntakes(CumulativeFlowQO qo) { + public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getLargeFlowIntakes(@Valid CumulativeFlowQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { return BaseResponseUtils.buildSuccess(intakeSv.getLargeFlowIntakes(qo)); } catch (Exception e) { @@ -78,7 +78,10 @@ */ @GetMapping(path = "/getSmallFlowIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getSmallFlowIntakes(CumulativeFlowQO qo) { + public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getSmallFlowIntakes(@Valid CumulativeFlowQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { return BaseResponseUtils.buildSuccess(intakeSv.getSmallFlowIntakes(qo)); } catch (Exception e) { @@ -94,7 +97,10 @@ */ @GetMapping(path = "/getUnderVoltIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoBatteryVolt>>> getUnderVoltIntakes(BatteryVoltQO qo) { + public BaseResponse<QueryResultVo<List<VoBatteryVolt>>> getUnderVoltIntakes(@Valid BatteryVoltQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { return BaseResponseUtils.buildSuccess(intakeSv.getUnderVoltIntakes(qo)); } catch (Exception e) { @@ -110,7 +116,10 @@ */ @GetMapping(path = "/getSpecifiedSignalIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoSignalIntensity>>> getSpecifiedSignalIntakes(SignalIntensityQO qo) { + public BaseResponse<QueryResultVo<List<VoSignalIntensity>>> getSpecifiedSignalIntakes(@Valid SignalIntensityQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { return BaseResponseUtils.buildSuccess(intakeSv.getSpecifiedSignalIntakes(qo)); } catch (Exception e) { @@ -126,7 +135,10 @@ */ @GetMapping(path = "/getCountByOpenType") @SsoAop() - public BaseResponse<QueryResultVo<VoCountOfOpenType>> getCountByOpenType(OpenTypeQO qo) { + public BaseResponse<QueryResultVo<VoCountOfOpenType>> getCountByOpenType(@Valid OpenTypeQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { return BaseResponseUtils.buildSuccess(intakeSv.getCountByOpenType(qo)); } catch (Exception e) { @@ -142,7 +154,10 @@ */ @GetMapping(path = "/getCountByCloseType") @SsoAop() - public BaseResponse<QueryResultVo<VoCountOfCloseType>> getCountByCloseType(CloseTypeQo qo) { + public BaseResponse<QueryResultVo<VoCountOfCloseType>> getCountByCloseType(@Valid CloseTypeQo qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } try { return BaseResponseUtils.buildSuccess(intakeSv.getCountByCloseType(qo)); } catch (Exception e) { @@ -159,7 +174,7 @@ */ @GetMapping(path = "/getNeverOpenValveIntakes") @SsoAop() - public BaseResponse<QueryResultVo<List<VoIntake>>> getNeverOpenValveIntakes(IntakeQO qo) { + public BaseResponse<QueryResultVo<List<VoIntake>>> getNeverOpenValveIntakes(CommonQO qo) { try { QueryResultVo<List<VoIntake>> res = intakeSv.getNeverOpenValveIntakes(qo); if(res.itemTotal == 0) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/CommonQO.java similarity index 92% rename from pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeQO.java rename to pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/CommonQO.java index 2b494af..1ebbfaa 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeQO.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/CommonQO.java @@ -13,7 +13,7 @@ */ @Data -public class IntakeQO extends QueryConditionVo { +public class CommonQO extends QueryConditionVo { /** * 寮�濮嬫椂闂� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeValueQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeValueQO.java index bbb1729..edaec7e 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeValueQO.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeValueQO.java @@ -1,7 +1,5 @@ package com.dy.pipIrrStatistics.intake.qo; -import com.dy.common.webUtil.QueryConditionVo; -import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotBlank; import lombok.Data; @@ -12,7 +10,7 @@ * @Description */ @Data -public class IntakeValueQO extends IntakeQO { +public class IntakeValueQO extends CommonQO { /** -- Gitblit v1.8.0