指定时间段内消费金额超过指定值的取水口;
指定时间段内用水时长超过指定值的取水口;
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<VoIntakeAccumulateAmount> getUseWaterGtValueIntakes(Map<String, Object> params); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内消费金额超过指定值的取水口的数量 | 
 |  |  |      * @param params | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     Long getExpenseGtValueIntakesCount(Map<String, Object> params); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内消费金额超过指定值的取水口 | 
 |  |  |      * @param params | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<VoIntakeAccumulateAmount> getExpenseGtValueIntakes(Map<String, Object> params); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内用水时长超过指定值的取水口数量 | 
 |  |  |      * @param params | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     Long getUseWaterDurationGtValueIntakesCount(Map<String, Object> params); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内用水时长超过指定值的取水口 | 
 |  |  |      * @param params | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<VoIntakeOpenCount> getUseWaterDurationGtValueIntakes(Map<String, Object> params); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  * @author :WuZeYu | 
 |  |  |  * @Date :2024/8/5  10:45 | 
 |  |  |  * @LastEditTime :2024/8/5  10:45 | 
 |  |  |  * @Description 取水口累积流量 大于 指定值 | 
 |  |  |  * @Description 取水口 累积流量 大于 指定值  视图 | 
 |  |  |  *                    用水量 大于 指定值 | 
 |  |  |  *                    消费金额 大于 指定值 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class VoIntakeAccumulateAmount extends VoIntake{ | 
 
 |  |  | 
 |  |  | package com.dy.pipIrrGlobal.voSt; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson2.annotation.JSONField; | 
 |  |  | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author :WuZeYu | 
 |  |  |  * @Date :2024/8/5  10:45 | 
 |  |  |  * @LastEditTime :2024/8/5  10:45 | 
 |  |  |  * @Description 取水口开阀 指定值 次数 | 
 |  |  |  * @Description 取水口开阀 >  指定值 (次数) | 
 |  |  |  *                用水时长 > 指定值  (分钟) | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class VoIntakeOpenCount extends VoIntake{ | 
 
 |  |  | 
 |  |  |  | 
 |  |  | pipIrr: | 
 |  |  |     global: | 
 |  |  |         dev: true   #是否开发阶段,true或false | 
 |  |  |         dev: flase   #是否开发阶段,true或false | 
 |  |  |         dsName: ym  #开发阶段,设置临时的数据库名称 | 
 |  |  |     mw: | 
 |  |  |         webPort: 8070 | 
 
 |  |  | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段内消费金额超过指定值的取水口的数量--> | 
 |  |  |     <select id="getExpenseGtValueIntakesCount" resultType="java.lang.Long"> | 
 |  |  |         select | 
 |  |  |         count(*) | 
 |  |  |         from | 
 |  |  |         (        SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_money),0) AS value | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_money),0) > #{value}) c | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段内消费金额超过指定值的取水口--> | 
 |  |  |     <select id="getExpenseGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> | 
 |  |  |         SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_money),0) AS value | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_money),0) > #{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="getUseWaterDurationGtValueIntakesCount" resultType="java.lang.Long"> | 
 |  |  |         select | 
 |  |  |         count(*) | 
 |  |  |         from | 
 |  |  |         (        SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_time),0) AS recordCount | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_time),0) > #{value}) c | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段内用水时长超过指定值的取水口--> | 
 |  |  |     <select id="getUseWaterDurationGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> | 
 |  |  |         SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_time),0) AS recordCount | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_time),0) > #{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> | 
 |  |  | </mapper> | 
 
 |  |  | 
 |  |  |         rsVo.obj = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakes(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内消费金额超过指定值的取水口 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoIntakeAccumulateAmount>> getExpenseGtValueIntakes(IntakeAmountValueQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null && timeStart != "") { | 
 |  |  |             timeStart = timeStart + " 00:00:00"; | 
 |  |  |         } else { | 
 |  |  |             timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); | 
 |  |  |         } | 
 |  |  |         qo.setTimeStart(timeStart); | 
 |  |  |  | 
 |  |  |         if(timeStop != null && timeStop != "") { | 
 |  |  |             timeStop = timeStop + " 23:59:59"; | 
 |  |  |         }else { | 
 |  |  |             timeStop = LocalDate.now() + " 23:59:59"; | 
 |  |  |         } | 
 |  |  |         qo.setTimeStop(timeStop); | 
 |  |  |  | 
 |  |  |         if (qo.getValue() == null){ | 
 |  |  |             qo.setValue(0.0); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmOpenCloseValveHistoryMapper.getExpenseGtValueIntakesCount(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoIntakeAccumulateAmount>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmOpenCloseValveHistoryMapper.getExpenseGtValueIntakes(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内用水时长超过指定值的取水口 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoIntakeOpenCount>> getUseWaterDurationGtValueIntakes(IntakeCountValueQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null && timeStart != "") { | 
 |  |  |             timeStart = timeStart + " 00:00:00"; | 
 |  |  |         } else { | 
 |  |  |             timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); | 
 |  |  |         } | 
 |  |  |         qo.setTimeStart(timeStart); | 
 |  |  |  | 
 |  |  |         if(timeStop != null && timeStop != "") { | 
 |  |  |             timeStop = timeStop + " 23:59:59"; | 
 |  |  |         }else { | 
 |  |  |             timeStop = LocalDate.now() + " 23:59:59"; | 
 |  |  |         } | 
 |  |  |         qo.setTimeStop(timeStop); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmOpenCloseValveHistoryMapper.getUseWaterDurationGtValueIntakesCount(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoIntakeOpenCount>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmOpenCloseValveHistoryMapper.getUseWaterDurationGtValueIntakes(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |             return BaseResponseUtils.buildException(e.getMessage()) ; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内消费金额超过指定值的取水口 | 
 |  |  |      * @param | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @GetMapping(path = "/getExpenseGtValueIntakes") | 
 |  |  |     @SsoAop() | 
 |  |  |     public BaseResponse<QueryResultVo<List<VoIntakeAccumulateAmount>>> getExpenseGtValueIntakes(IntakeAmountValueQO qo) { | 
 |  |  |         try { | 
 |  |  |             QueryResultVo<List<VoIntakeAccumulateAmount>> res = intakeSv.getExpenseGtValueIntakes(qo); | 
 |  |  |             if(res.itemTotal == 0) { | 
 |  |  |                 return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); | 
 |  |  |             } | 
 |  |  |             return BaseResponseUtils.buildSuccess(res); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("获取记录异常", e); | 
 |  |  |             return BaseResponseUtils.buildException(e.getMessage()) ; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指定时间段内用水时长超过指定值的取水口 | 
 |  |  |      * @param | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @GetMapping(path = "/getUseWaterDurationGtValueIntakes") | 
 |  |  |     @SsoAop() | 
 |  |  |     public BaseResponse<QueryResultVo<List<VoIntakeOpenCount>>> getUseWaterDurationGtValueIntakes(IntakeCountValueQO qo) { | 
 |  |  |         try { | 
 |  |  |             QueryResultVo<List<VoIntakeOpenCount>> res = intakeSv.getUseWaterDurationGtValueIntakes(qo); | 
 |  |  |             if(res.itemTotal == 0) { | 
 |  |  |                 return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); | 
 |  |  |             } | 
 |  |  |             return BaseResponseUtils.buildSuccess(res); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("获取记录异常", e); | 
 |  |  |             return BaseResponseUtils.buildException(e.getMessage()) ; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |