From 7bd7091b7ee72a2bb5737943af47862dbb272bfe Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期二, 06 八月 2024 15:32:28 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/AmountSpentQO.java | 22 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml | 532 ++++++++++++++------- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application.yml | 6 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java | 222 +++++++++ pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/log4j2.yml | 6 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java | 71 ++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java | 137 +++++ pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java | 40 + 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/client/qo/WaterConsumptionQO.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/qo/IntakeCountValueQO.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/WaterDurationQO.java | 22 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java | 41 + 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-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/ServerShutDownHook.java | 36 + pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 19 files changed, 1,110 insertions(+), 315 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..ba17e56 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,74 @@ * @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); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍐滄埛鏁伴噺 + * @param params + * @return + */ + Long getSmallOpenCountClientsCount(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍐滄埛 + * @param params + * @return + */ + List<VoClient> getSmallOpenCountClients(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛鏁伴噺 + * @param params + * @return + */ + Long getLargeWaterConsumptionClientsCount(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛 + * @param params + * @return + */ + List<VoClient> getLargeWaterConsumptionClients(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺 + * @param params + * @return + */ + Long getLargeAmountSpentClientsCount(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param params + * @return + */ + List<VoClient> getLargeAmountSpentClients(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺 + * @param params + * @return + */ + Long getLargeWaterDurationClientsCount(Map<String, Object> params); + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param params + * @return + */ + List<VoClient> getLargeWaterDurationClients(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 6d2c24c..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: true #鏄惁寮�鍙戦樁娈碉紝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..6c188cc 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,325 @@ </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> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍐滄埛鏁伴噺--> + <select id="getSmallOpenCountClientsCount" 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="getSmallOpenCountClients" 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> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛鏁伴噺--> + <select id="getLargeWaterConsumptionClientsCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM se_client cli + INNER JOIN rm_open_close_valve_history his ON his.client_id = cli.id + WHERE his.op_dt BETWEEN #{timeStart} AND #{timeStop} + AND his.cl_this_amount > #{waterConsumption} + </select> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛--> + <select id="getLargeWaterConsumptionClients" 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 + INNER JOIN rm_open_close_valve_history his ON his.client_id = cli.id + WHERE his.op_dt BETWEEN #{timeStart} AND #{timeStop} + AND his.cl_this_amount > #{waterConsumption} + 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> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺--> + <select id="getLargeAmountSpentClientsCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM se_client cli + INNER JOIN rm_open_close_valve_history his ON his.client_id = cli.id + WHERE his.op_dt BETWEEN #{timeStart} AND #{timeStop} + AND his.cl_this_money > #{amountSpent} + </select> + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛--> + <select id="getLargeAmountSpentClients" 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 + INNER JOIN rm_open_close_valve_history his ON his.client_id = cli.id + WHERE his.op_dt BETWEEN #{timeStart} AND #{timeStop} + AND his.cl_this_money > #{amountSpent} + 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> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺--> + <select id="getLargeWaterDurationClientsCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM se_client cli + INNER JOIN rm_open_close_valve_history his ON his.client_id = cli.id + WHERE his.op_dt BETWEEN #{timeStart} AND #{timeStop} + AND his.cl_this_time > #{waterDuration} + </select> + + <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛--> + <select id="getLargeWaterDurationClients" 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 + INNER JOIN rm_open_close_valve_history his ON his.client_id = cli.id + WHERE his.op_dt BETWEEN #{timeStart} AND #{timeStop} + AND his.cl_this_time > #{waterDuration} + 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-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java index 777c277..18b3460 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java @@ -9,8 +9,6 @@ import com.dy.rtuMw.server.tasks.FromRtuComResultConstantTask; import com.dy.rtuMw.server.tasks.FromRtuDataConstantTask; import com.dy.common.mw.UnitInterface; -import com.dy.common.mw.channel.rmi.RmiConfigVo; -import com.dy.common.mw.channel.rmi.RmiUnit; import com.dy.common.mw.channel.tcp.TcpConfigVo; import com.dy.common.mw.channel.tcp.TcpUnit; import com.dy.common.mw.core.CoreUnit; @@ -53,21 +51,29 @@ new Server().startServer(); } */ + + public void startServer(){ + /** + try { + URL url = Server.class.getResource("/config/this.licence"); + if(!new Lnp(null).parese(url.getPath())){ + System.out.println("licence error!") ; + return ; + } + } catch (Exception e) { + System.out.println("licence error!") ; + return ; + } + */ + if(this.doStartServer()){ + ServerShutDownHook.OnShutDown(); + } + } /** * 鍚姩鏈嶅姟 */ - public void startServer(){ -// try { -// URL url = Server.class.getResource("/config/this.licence"); -// if(!new Lnp(null).parese(url.getPath())){ -// System.out.println("licence error!") ; -// return ; -// } -// } catch (Exception e) { -// System.out.println("licence error!") ; -// return ; -// } - //Server sv = new Server(); + private boolean doStartServer(){ + boolean running = false ; long start = System.currentTimeMillis() ; try { //ConfigProperties.init(this.getClass().getResourceAsStream("/config/config.properties"), false); @@ -120,11 +126,13 @@ System.out.println("@@@@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ Runing in standalone mode" ) ; System.out.println("@@@@@@@@@@@@@@@@@@@@@& &@@@@@@@@ Startup in " + (System.currentTimeMillis() - start) + " MS" ) ; System.out.println("@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ " + company) ; - System.out.println("@@@@@@@@@@@@@@@@#O &@@@@@@@@") ; - + System.out.println("@@@@@@@@@@@@@@@@#O &@@@@@@@@") ; + running = true ; }catch(Exception e){ e.printStackTrace(); + running = false ; } + return running ; } private void startUnits(){ diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/ServerShutDownHook.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/ServerShutDownHook.java new file mode 100644 index 0000000..9f945ae --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/ServerShutDownHook.java @@ -0,0 +1,36 @@ +package com.dy.rtuMw; + +import com.dy.common.mw.protocol.Command; +import com.dy.common.mw.protocol.CommandType; +import com.dy.rtuMw.server.local.CommandInnerDeaLer; +import com.dy.rtuMw.server.local.localProtocol.CodeLocal; +import lombok.extern.slf4j.Slf4j; + +/** + * @Author: liurunyu + * @Date: 2024/8/6 9:51 + * @Description 绋嬪簭锛堟帶鍒跺彴锛夊叧闂鐞嗛挬瀛愮被 + */ +@Slf4j +public class ServerShutDownHook { + public static void OnShutDown(){ + Runtime.getRuntime().addShutdownHook(new Thread(){ + @Override + public void run(){ + try{ + // 纭繚杩欐浠g爜灏藉彲鑳藉揩閫熸墽琛岋紝閬垮厤褰卞搷JVM鐨勫叧闂� + log.info("绋嬪簭锛堟帶鍒跺彴锛夊叧闂挬瀛愮被鎵ц"); + Command com = new Command() ; + com.id = Command.defaultId ; + com.code = CodeLocal.stopTcpSv ; + com.type = CommandType.innerCommand ; + new CommandInnerDeaLer().deal(com) ; + //Thread.sleep(100L);//瀹炴祴涓嶆墽琛� + log.info("鍏抽棴绋嬪簭鍓嶏紝鍏抽棴浜員CP鏈嶅姟"); + }catch (Exception e){ + log.error("绋嬪簭锛堟帶鍒跺彴锛夊叧闂挬瀛愬彂鐢熷紓甯�", e); + } + } + }); + } +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application.yml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application.yml index 5741442..4d129e5 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application.yml @@ -1,3 +1,9 @@ +logging: + charset: + console: UTF-8 + config: + classpath: log4j2.yml + spring: profiles: include: global, database diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/log4j2.yml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/log4j2.yml index 91e1a72..aff06e8 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/log4j2.yml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/log4j2.yml @@ -19,7 +19,7 @@ name: CONSOLE target: SYSTEM_OUT ThresholdFilter: - level: debug #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 + level: DEBUG #杈撳嚭鏃ュ織绾у埆锛圖EBUG,INFO,WARN,ERROR,FATAL锛夛紝杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢盠oggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� #鏃ュ織鍐呭鏍峰紡 @@ -44,7 +44,7 @@ fileName: ${log.path}/${project.name}.log filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" ThresholdFilter: - level: error #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 + level: error #杈撳嚭鏃ュ織绾у埆锛圖EBUG,INFO,WARN,ERROR,FATAL锛夛紝杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢盠oggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� #鏃ュ織鍐呭鏍峰紡 @@ -58,7 +58,7 @@ Loggers: Root: - level: info #鏃ュ織杈撳嚭绾у埆锛屽叡鏈�8涓骇鍒紝鎸夌収浠庝綆鍒伴珮涓猴細all < trace < debug < info < warn < error < fatal < off + level: INFO #鏃ュ織杈撳嚭绾у埆锛圖EBUG,INFO,WARN,ERROR,FATAL锛夛紝鍏辨湁8涓骇鍒紝鎸夌収浠庝綆鍒伴珮涓猴細all < trace < debug < info < warn < error < fatal < off AppenderRef: #Root鐨勫瓙鑺傜偣锛岀敤鏉ユ寚瀹氳鏃ュ織杈撳嚭鍒板摢涓狝ppender. - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 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..e58b0cf --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java @@ -0,0 +1,137 @@ +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.AmountSpentQO; +import com.dy.pipIrrStatistics.client.qo.OpenCountQO; +import com.dy.pipIrrStatistics.client.qo.WaterConsumptionQO; +import com.dy.pipIrrStatistics.client.qo.WaterDurationQO; +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()) ; + } + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @param bindingResult + * @return + */ + @GetMapping(path = "/getSmallOpenCountClients") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoClient>>> getSmallOpenCountClients(@Valid OpenCountQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + try { + return BaseResponseUtils.buildSuccess(clientSv.getSmallOpenCountClients(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛 + * @param qo + * @param bindingResult + * @return + */ + @GetMapping(path = "/getLargeWaterConsumptionClients") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoClient>>> getLargeWaterConsumptionClients(@Valid WaterConsumptionQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { + return BaseResponseUtils.buildSuccess(clientSv.getLargeWaterConsumptionClients(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @param bindingResult + * @return + */ + @GetMapping(path = "/getLargeAmountSpentClients") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoClient>>> getLargeAmountSpentClients(@Valid AmountSpentQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { + return BaseResponseUtils.buildSuccess(clientSv.getLargeAmountSpentClients(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @param bindingResult + * @return + */ + @GetMapping(path = "/getLargeWaterDurationClients") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoClient>>> getLargeWaterDurationClients(@Valid WaterDurationQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + try { + return BaseResponseUtils.buildSuccess(clientSv.getLargeWaterDurationClients(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..f86b5db --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java @@ -0,0 +1,222 @@ +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.AmountSpentQO; +import com.dy.pipIrrStatistics.client.qo.OpenCountQO; +import com.dy.pipIrrStatistics.client.qo.WaterConsumptionQO; +import com.dy.pipIrrStatistics.client.qo.WaterDurationQO; +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 ; + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getSmallOpenCountClients(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.getSmallOpenCountClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getSmallOpenCountClients(params); + return rsVo ; + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getLargeWaterConsumptionClients(WaterConsumptionQO 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.getLargeWaterConsumptionClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getLargeWaterConsumptionClients(params); + return rsVo ; + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getLargeAmountSpentClients(AmountSpentQO 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.getLargeAmountSpentClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getLargeAmountSpentClients(params); + return rsVo ; + } + + /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getLargeWaterDurationClients(WaterDurationQO 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.getLargeWaterDurationClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getLargeWaterDurationClients(params); + return rsVo ; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/AmountSpentQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/AmountSpentQO.java new file mode 100644 index 0000000..366b1a5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/AmountSpentQO.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 11:31 + * @LastEditTime 2024-08-06 11:31 + * @Description 娑堣垂閲戦鏌ヨ瀵硅薄 + */ + +@Data +public class AmountSpentQO extends CommonQO { + + /** + * 娑堣垂閲戦 + */ + @NotNull(message = "娑堣垂閲戦涓嶈兘涓虹┖") + private Double amountSpent; +} 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/client/qo/WaterConsumptionQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/WaterConsumptionQO.java new file mode 100644 index 0000000..980c533 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/WaterConsumptionQO.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 11:28 + * @LastEditTime 2024-08-06 11:28 + * @Description 鐢ㄦ按閲忔煡璇㈠璞� + */ + +@Data +public class WaterConsumptionQO extends CommonQO { + + /** + * 鎸囧畾鐨勭敤姘撮噺 + */ + @NotNull(message = "鐢ㄦ按閲忎笉鑳戒负绌�") + private Double waterConsumption; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/WaterDurationQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/WaterDurationQO.java new file mode 100644 index 0000000..b447639 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/qo/WaterDurationQO.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 11:33 + * @LastEditTime 2024-08-06 11:33 + * @Description 鐢ㄦ按鏃堕暱鏌ヨ瀵硅薄 + */ + +@Data +public class WaterDurationQO extends CommonQO { + + /** + * 鐢ㄦ按鏃堕暱 + */ + @NotNull(message = "鐢ㄦ按鏃堕暱涓嶈兘涓虹┖") + private Integer waterDuration; +} 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 b4f38d1..4bdca3b 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 @@ -17,6 +17,8 @@ import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; import com.dy.pipIrrStatistics.intake.qo.IntakeQO; import com.dy.pipIrrStatistics.intake.qo.IntakeCountValueQO; +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; import org.apache.dubbo.common.utils.PojoUtils; @@ -65,7 +67,7 @@ * @param qo * @return */ - public QueryResultVo<List<VoIntake>> getNotOnlineIntakes(IntakeQO qo) { + public QueryResultVo<List<VoIntake>> getNotOnlineIntakes(CommonQO qo) { DecimalFormat df = new DecimalFormat("0.00"); /** * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 @@ -195,7 +197,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 b3e7e17..51217e2 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 @@ -17,13 +17,16 @@ import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO; import com.dy.pipIrrStatistics.intake.qo.IntakeCountValueQO; 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 +49,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 +69,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 +88,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 +107,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 +126,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 +145,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 +164,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 +184,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/IntakeCountValueQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeCountValueQO.java index c6dc097..0c46665 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeCountValueQO.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeCountValueQO.java @@ -12,7 +12,7 @@ * @Description */ @Data -public class IntakeCountValueQO extends IntakeQO { +public class IntakeCountValueQO extends CommonQO { /** -- Gitblit v1.8.0