1、取水口用水日统计表中增加金额、次数字段;
2、优化或重写“累计流量超过指定值的取水口”、“累计流量低于指定值的取水口”、“指定时间段内用水量超过指定值的取水口”、“指定时间段内消费金额超过指定值的取水口”几个统计查询;
3、改“指定时间段内用水时长超过指定值的取水口”为“指定时间段内用水次数超过指定值的取水口”
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.voRm.VoIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.voSt.VoDayIntakeAmount; |
| | | import com.dy.pipIrrGlobal.voSt.VoDayLoss; |
| | | import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics; |
| | | import com.dy.pipIrrGlobal.voSt.VoMonthAmount; |
| | | import com.dy.pipIrrGlobal.voSt.*; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | List<VoDayIntakeAmount> selectIntakeAmountOfDay16_20(Map<?, ?> params); |
| | | List<VoDayIntakeAmount> selectIntakeAmountOfDay21_25(Map<?, ?> params); |
| | | List<VoDayIntakeAmount> selectIntakeAmountOfDay26_31(Map<?, ?> params); |
| | | |
| | | |
| | | /** |
| | | * 指定时间段用水量超过指定值的取水口数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getUseWaterGtValueIntakesCount(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 指定时间段用水量超过指定值的取水口 |
| | | * @param params |
| | | * @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 getUseWaterTimesGtValueIntakesCount(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 指定时间段内取水次数超过指定值的取水口 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoIntakeAccumulateAmount> getUseWaterTimesGtValueIntakes(Map<String, Object> params); |
| | | |
| | | } |
| | |
| | | List<VoClient> getSmallWaterDurationClients(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 指定时间段用水量超过指定值的取水口数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getUseWaterGtValueIntakesCount(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 指定时间段用水量超过指定值的取水口 |
| | | * @param params |
| | | * @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 |
| | |
| | | public Double amount; |
| | | |
| | | /** |
| | | * 日取消费金额 |
| | | */ |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double money; |
| | | |
| | | /** |
| | | * 日取水次数 |
| | | */ |
| | | public Integer times; |
| | | |
| | | /** |
| | | * 累计日漏损水量 |
| | | */ |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | |
| | | public Double amount; |
| | | |
| | | /** |
| | | * 日取消费金额 |
| | | */ |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double money; |
| | | |
| | | /** |
| | | * 日取水次数 |
| | | */ |
| | | public Integer times; |
| | | |
| | | /** |
| | | * 最后计水量上报数据接收时间(yyyy-mm-dd hh:mm:ss) |
| | | */ |
| | | @Schema(description = "最后计水量上报数据接收时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({ "intakeId", "intakeNum", "blockName", "lng", "lat" |
| | | ,"cumulativeFlow" , "getDate" |
| | | }) |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class VoCumulativeFlow extends VoIntake { |
| | | |
| | | /** |
| | | * 累计流量 |
| | | */ |
| | | private Double cumulativeFlow; |
| | | public Double cumulativeFlow; |
| | | |
| | | /** |
| | | * 数据获取日期 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date getDate; |
| | | public Date getDate; |
| | | } |
| | |
| | | * 取水口ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long intakeId; |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 取水口编号 |
| | | */ |
| | | private String intakeNum; |
| | | public String intakeNum; |
| | | |
| | | /** |
| | | * 取水口所属片区 |
| | | */ |
| | | private String blockName; |
| | | public String blockName; |
| | | /** |
| | | * 取水口经度 |
| | | */ |
| | | public Double lng ; |
| | | /** |
| | | * 取水口纬度 |
| | | */ |
| | | public Double lat ; |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | |
| | | * 消费金额 大于 指定值 |
| | | */ |
| | | @Data |
| | | @JsonPropertyOrder({ "intakeId", "intakeNum", "blockName", "lng", "lat" |
| | | ,"value", "valueInt" |
| | | }) |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class VoIntakeAccumulateAmount extends VoIntake{ |
| | | private static final long serialVersionUID = 202408051046001L; |
| | |
| | | */ |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | private Double value; |
| | | |
| | | /** |
| | | * 指定值 |
| | | */ |
| | | private Integer valueInt; |
| | | } |
| | |
| | | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> |
| | | <result column="dt" jdbcType="DATE" property="dt" /> |
| | | <result column="amount" jdbcType="DOUBLE" property="amount" /> |
| | | <result column="money" jdbcType="DOUBLE" property="money" /> |
| | | <result column="times" jdbcType="INTEGER" property="times" /> |
| | | <result column="dt_last" jdbcType="TIMESTAMP" property="dtLast" /> |
| | | <result column="rtu_addr_last" jdbcType="VARCHAR" property="rtuAddrLast" /> |
| | | <result column="controller_id_last" jdbcType="BIGINT" property="controllerIdLast" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, last_history_id, intake_id, dt, amount, dt_last, rtu_addr_last, controller_id_last, total_amount_last, |
| | | id, last_history_id, intake_id, dt, amount, money, times, dt_last, rtu_addr_last, controller_id_last, total_amount_last, |
| | | rtu_dt_last |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDayLast"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_intake_amount_day_last (id, last_history_id, intake_id, dt, |
| | | amount, dt_last, |
| | | amount, money, times, dt_last, |
| | | rtu_addr_last, controller_id_last, total_amount_last, |
| | | rtu_dt_last) |
| | | values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{dt,jdbcType=DATE}, |
| | | #{amount,jdbcType=DOUBLE}, #{dtLast,jdbcType=TIMESTAMP}, |
| | | #{amount,jdbcType=DOUBLE}, #{money,jdbcType=DOUBLE},#{times,jdbcType=INTEGER}, |
| | | #{dtLast,jdbcType=TIMESTAMP}, |
| | | #{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT}, |
| | | #{rtuDtLast,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | |
| | | </if> |
| | | <if test="amount != null"> |
| | | amount, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | | </if> |
| | | <if test="times != null"> |
| | | times, |
| | | </if> |
| | | <if test="dtLast != null"> |
| | | dt_last, |
| | |
| | | </if> |
| | | <if test="amount != null"> |
| | | #{amount,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="times != null"> |
| | | #{times,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="dtLast != null"> |
| | | #{dtLast,jdbcType=TIMESTAMP}, |
| | |
| | | <if test="amount != null"> |
| | | amount = #{amount,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="times != null"> |
| | | times = #{times,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="dtLast != null"> |
| | | dt_last = #{dtLast,jdbcType=TIMESTAMP}, |
| | | </if> |
| | |
| | | intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | dt = #{dt,jdbcType=DATE}, |
| | | amount = #{amount,jdbcType=DOUBLE}, |
| | | money = #{money,jdbcType=DOUBLE}, |
| | | times = #{times,jdbcType=INTEGER}, |
| | | dt_last = #{dtLast,jdbcType=TIMESTAMP}, |
| | | rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR}, |
| | | controller_id_last = #{controllerIdLast,jdbcType=BIGINT}, |
| | |
| | | Left join pr_intake pint on pint.id = riadl.intake_id |
| | | <where> |
| | | <if test="intakeId != null and intakeId != '' "> |
| | | and rash.intake_id = #{intakeId} |
| | | riadl.intake_id = #{intakeId} |
| | | </if> |
| | | <if test="intakeName != null and intakeName != '' "> |
| | | and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') |
| | |
| | | pint.name as intakeName, |
| | | riadl.dt as dt, |
| | | riadl.amount as amount, |
| | | riadl.money as money, |
| | | riadl.times as times, |
| | | riadl.dt_last as dtLast, |
| | | riadl.rtu_addr_last as rtuAddrLast, |
| | | CAST(riadl.controller_id_last AS char)AS controllerIdLast, |
| | |
| | | Left join pr_intake pint on pint.id = riadl.intake_id |
| | | <where> |
| | | <if test="intakeId != null and intakeId != '' "> |
| | | and rash.intake_id = #{intakeId} |
| | | riadl.intake_id = #{intakeId} |
| | | </if> |
| | | <if test="intakeName != null and intakeName != '' "> |
| | | and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') |
| | |
| | | <result column="intake_id" jdbcType="BIGINT" property="intakeId"/> |
| | | <result column="dt" jdbcType="DATE" property="dt"/> |
| | | <result column="amount" jdbcType="DOUBLE" property="amount"/> |
| | | <result column="money" jdbcType="DOUBLE" property="money" /> |
| | | <result column="times" jdbcType="INTEGER" property="times" /> |
| | | <result column="dt_last" jdbcType="TIMESTAMP" property="dtLast"/> |
| | | <result column="rtu_addr_last" jdbcType="VARCHAR" property="rtuAddrLast"/> |
| | | <result column="controller_id_last" jdbcType="BIGINT" property="controllerIdLast"/> |
| | |
| | | id, |
| | | intake_id, |
| | | dt, |
| | | amount, |
| | | amount, money, times, |
| | | dt_last, |
| | | rtu_addr_last, |
| | | controller_id_last, |
| | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_intake_amount_day (id, intake_id, dt, |
| | | amount, dt_last, |
| | | amount, money, times, dt_last, |
| | | rtu_addr_last, controller_id_last, total_amount_last, |
| | | rtu_dt_last) |
| | | values (#{id,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{dt,jdbcType=DATE}, |
| | | #{amount,jdbcType=DOUBLE}, #{dtLast,jdbcType=TIMESTAMP}, |
| | | #{amount,jdbcType=DOUBLE}, #{money,jdbcType=DOUBLE}, #{times,jdbcType=INTEGER}, #{dtLast,jdbcType=TIMESTAMP}, |
| | | #{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT}, |
| | | #{rtuDtLast,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | |
| | | </if> |
| | | <if test="amount != null"> |
| | | amount, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | | </if> |
| | | <if test="times != null"> |
| | | times, |
| | | </if> |
| | | <if test="dtLast != null"> |
| | | dt_last, |
| | |
| | | </if> |
| | | <if test="amount != null"> |
| | | #{amount,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="times != null"> |
| | | #{times,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="dtLast != null"> |
| | | #{dtLast,jdbcType=TIMESTAMP}, |
| | |
| | | <if test="amount != null"> |
| | | amount = #{amount,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="times != null"> |
| | | times = #{times,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="dtLast != null"> |
| | | dt_last = #{dtLast,jdbcType=TIMESTAMP}, |
| | | </if> |
| | |
| | | set intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | dt = #{dt,jdbcType=DATE}, |
| | | amount = #{amount,jdbcType=DOUBLE}, |
| | | money = #{money,jdbcType=DOUBLE}, |
| | | times = #{times,jdbcType=INTEGER}, |
| | | dt_last = #{dtLast,jdbcType=TIMESTAMP}, |
| | | rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR}, |
| | | controller_id_last = #{controllerIdLast,jdbcType=BIGINT}, |
| | |
| | | pint.name as intakeName, |
| | | riad.dt as dt, |
| | | riad.amount as amount, |
| | | riad.money as money, |
| | | riad.times as times, |
| | | riad.dt_last as dtLast, |
| | | riad.rtu_addr_last as rtuAddrLast, |
| | | CAST(riad.controller_id_last AS char) AS controllerIdLast, |
| | |
| | | ) as tb31 on tb31.intakeId = inta.intakeId |
| | | </select> |
| | | |
| | | |
| | | <!--指定时间段用水量超过指定值的取水口数量--> |
| | | <select id="getUseWaterGtValueIntakesCount" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from ( |
| | | SELECT |
| | | SUM(riad.amount) AS value |
| | | FROM |
| | | pr_intake inta |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id |
| | | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} |
| | | GROUP BY inta.id |
| | | HAVING value > #{value} |
| | | ) c |
| | | </select> |
| | | <!--指定时间段用水量超过指定值的取水口--> |
| | | <select id="getUseWaterGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> |
| | | SELECT |
| | | inta.id AS intakeId, |
| | | inta.NAME AS intakeNum, |
| | | inta.lng AS lng, |
| | | inta.lat AS lat, |
| | | blo.NAME AS blockName , |
| | | SUM(riad.amount) AS value |
| | | FROM |
| | | pr_intake inta |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id |
| | | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} |
| | | GROUP BY inta.id |
| | | HAVING value > #{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="getExpenseGtValueIntakesCount" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from ( |
| | | SELECT |
| | | SUM(riad.money) AS value |
| | | FROM |
| | | pr_intake inta |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id |
| | | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} |
| | | GROUP BY inta.id |
| | | HAVING value > #{value} |
| | | ) c |
| | | </select> |
| | | <!--指定时间段内消费金额超过指定值的取水口--> |
| | | <select id="getExpenseGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> |
| | | SELECT |
| | | inta.id AS intakeId, |
| | | inta.NAME AS intakeNum, |
| | | inta.lng AS lng, |
| | | inta.lat AS lat, |
| | | blo.NAME AS blockName , |
| | | SUM(riad.money) AS value |
| | | FROM |
| | | pr_intake inta |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id |
| | | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} |
| | | GROUP BY inta.id |
| | | HAVING value > #{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="getUseWaterTimesGtValueIntakesCount" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from ( |
| | | SELECT |
| | | SUM(riad.times) AS valueInt |
| | | FROM |
| | | pr_intake inta |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id |
| | | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} |
| | | GROUP BY inta.id |
| | | HAVING value > #{value} |
| | | ) c |
| | | </select> |
| | | <!--指定时间段内取水次数超过指定值的取水口--> |
| | | <select id="getUseWaterTimesGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> |
| | | SELECT |
| | | inta.id AS intakeId, |
| | | inta.NAME AS intakeNum, |
| | | inta.lng AS lng, |
| | | inta.lat AS lat, |
| | | blo.NAME AS blockName , |
| | | SUM(riad.times) AS valueInt |
| | | FROM |
| | | pr_intake inta |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id |
| | | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} |
| | | GROUP BY inta.id |
| | | HAVING value > #{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> |
| | |
| | | |
| | | <!--获取累计流量超过指定值的取水口--> |
| | | <select id="getLargeFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow"> |
| | | SELECT inta.id AS intakeId, |
| | | inta.name AS intakeNum, |
| | | blo.name AS blockName, |
| | | CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow, |
| | | hou.dt AS getDate |
| | | SELECT inta.id AS intakeId, |
| | | inta.name AS intakeNum, |
| | | inta.lng AS lng, |
| | | inta.lat AS lat, |
| | | blo.name AS blockName, |
| | | hou.total_amount AS cumulativeFlow, |
| | | hou.dt AS getDate |
| | | FROM pr_intake inta |
| | | INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | |
| | | <select id="getSmallFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow"> |
| | | SELECT inta.id AS intakeId, |
| | | inta.name AS intakeNum, |
| | | inta.lng AS lng, |
| | | inta.lat AS lat, |
| | | blo.name AS blockName, |
| | | <!-- FORMAT(hou.total_amount,2) AS cumulativeFlow,--> |
| | | CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow, |
| | | hou.dt AS getDate |
| | | hou.total_amount AS cumulativeFlow, |
| | | hou.dt AS getDate |
| | | FROM pr_intake inta |
| | | INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id |
| | | INNER JOIN ba_block blo ON blo.id = inta.blockId |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | <!--指定时间段用水量超过指定值的取水口数量--> |
| | | <select id="getUseWaterGtValueIntakesCount" 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_amount),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_amount),0) > #{value}) c |
| | | </select> |
| | | <!--指定时间段用水量超过指定值的取水口--> |
| | | <select id="getUseWaterGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> |
| | | SELECT |
| | | inta.id AS intakeId, |
| | | inta.NAME AS intakeNum, |
| | | blo.NAME AS blockName , |
| | | IFNULL(SUM(rocvh.cl_this_amount),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_amount),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="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 |
| | |
| | | po.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1.dt); |
| | | po.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1.dt); |
| | | po.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | po.amount = 0.0D ; |
| | | if(cdData.isCloseValve != null && cdData.isCloseValve){ |
| | | po.amount = cdData.amount ; |
| | | po.money = cdData.money ; |
| | | po.times = 1 ; |
| | | }else{ |
| | | po.amount = 0.0D ; |
| | | po.money = 0.0D ; |
| | | po.times = 0 ; |
| | | } |
| | | po.rtuAddrLast = rtuAddr; |
| | | return po ; |
| | | } |
| | |
| | | po.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | if(lastPo != null){ |
| | | po.amount = lastPo.amount ; |
| | | po.money = lastPo.money ; |
| | | po.times = lastPo.times ; |
| | | }else{ |
| | | po.amount = 0.0D ; |
| | | po.money = 0.0D ; |
| | | po.times = 0 ; |
| | | } |
| | | po.totalAmountLast = cdData.totalAmount ; |
| | | return po ; |
| | |
| | | |
| | | |
| | | /** |
| | | * 生成新的控制器漏损日统计最新记录 |
| | | * 取水口更换了控制器在,此时只更新部分属性 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1 |
| | |
| | | //本次置量值不变,下次再上报时,就能正常计算了。 |
| | | //lastPo.amount = lastPo.amount ; //日累计取水量不变 |
| | | } |
| | | if(cdData.isCloseValve != null && cdData.isCloseValve.booleanValue()){ |
| | | //是从关阀报中得到的数据 |
| | | if(lastPo.money == null){ |
| | | lastPo.money = cdData.money ; |
| | | }else{ |
| | | lastPo.money += cdData.money ; |
| | | } |
| | | if(lastPo.times == null){ |
| | | lastPo.times = 1 ; |
| | | }else{ |
| | | lastPo.times += 1 ; |
| | | } |
| | | }else{ |
| | | lastPo.money = 0.0D ; |
| | | lastPo.times = 1 ; |
| | | } |
| | | lastPo.totalAmountLast = cdData.totalAmount ; |
| | | } |
| | | |
| | |
| | | lastPo.totalAmountLast = cdData.totalAmount ; |
| | | } |
| | | |
| | | if(cdData.isCloseValve != null && cdData.isCloseValve.booleanValue()){ |
| | | //是从关阀报中得到的数据 |
| | | lastPo.money = cdData.money ; |
| | | lastPo.times = 1 ; |
| | | }else{ |
| | | lastPo.money = 0.0D ; |
| | | lastPo.times = 0 ; |
| | | } |
| | | |
| | | return lastPo ; |
| | | } |
| | | |
| | | /** |
| | | * 生成新的控制器漏损日统计最新记录 |
| | | * 取水口更换了控制器在,此时只更新部分属性 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1 |
| | |
| | | po.rtuDtLast = lastPo.rtuDtLast; |
| | | |
| | | po.amount = lastPo.amount ; |
| | | po.money = lastPo.money ; |
| | | po.times = lastPo.times ; |
| | | po.totalAmountLast = lastPo.totalAmountLast ; |
| | | |
| | | return po ; |
| | |
| | | po.rtuDtLast = lastPo.rtuDtLast; |
| | | |
| | | po.amount = lastPo.amount ;//此时lastPo.amount已经增加上了增量 |
| | | po.money = lastPo.money ;//此时lastPo.money已经增加上了增量 |
| | | po.times = lastPo.times ;//此时lastPo.times已经增加上了增量 |
| | | po.totalAmountLast = lastPo.totalAmountLast ; |
| | | |
| | | return po ; |
| | |
| | | |
| | | public class UpDataVo{ |
| | | public Double totalAmount; //累计流量:5字节BCD码,取值范围0~9999999999,单位为m3。 |
| | | public Double amount; //农户用水量 |
| | | public Double money ;//农户消费金额 |
| | | public Boolean isCloseValve ;//是否是关阀上报 |
| | | public String rtuDt ;//控制器时钟 |
| | | |
| | | public void valueFrom(DataCdC0Vo voC0, DataCd84Vo vo84, DataCd83OpenVo vo83Op, DataCd83CloseVo vo83Cl){ |
| | |
| | | this.rtuDt = vo83Op.rtuDt ; |
| | | }else if(vo83Cl != null){ |
| | | this.totalAmount = vo83Cl.totalAmount ; |
| | | this.amount = vo83Cl.thisAmount ; |
| | | this.money = vo83Cl.thisMoney ; |
| | | this.isCloseValve = true ; |
| | | this.rtuDt = vo83Cl.rtuDt ; |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrStatistics.intake; |
| | | |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoRm.*; |
| | | import com.dy.pipIrrGlobal.voSt.*; |
| | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | /** ok 1 |
| | | * 获取累计流量超过指定值的取水口 |
| | | * @param qo |
| | | * @return |
| | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | /** ok 2 |
| | | * 获取累计流量低于指定值的取水口 |
| | | * @param qo |
| | | * @return |
| | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | /** ok 3 |
| | | * 指定时间段内用水量超过指定值的取水口 |
| | | * @param qo |
| | | * @return |
| | |
| | | public QueryResultVo<List<VoIntakeAccumulateAmount>> getUseWaterGtValueIntakes(IntakeAmountValueQO qo) { |
| | | String timeStart = qo.getTimeStart(); |
| | | String timeStop = qo.getTimeStop(); |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | if(timeStart == null || timeStart.trim().equals("")) { |
| | | timeStart = DateTime.yyyy_MM_dd() ; |
| | | qo.setTimeStart(timeStart); |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | | if(timeStop != null && timeStop != "") { |
| | | timeStop = timeStop + " 23:59:59"; |
| | | }else { |
| | | timeStop = LocalDate.now() + " 23:59:59"; |
| | | if(timeStop == null || timeStop.trim().equals("")) { |
| | | timeStop = DateTime.yyyy_MM_dd() ; |
| | | qo.setTimeStop(timeStop); |
| | | } |
| | | qo.setTimeStop(timeStop); |
| | | |
| | | if (qo.getValue() == null){ |
| | | qo.setValue(0.0); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); |
| | | Long itemTotal = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakesCount(params); |
| | | Long itemTotal = rmIntakeAmountDayMapper.getUseWaterGtValueIntakesCount(params); |
| | | |
| | | QueryResultVo<List<VoIntakeAccumulateAmount>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakes(params); |
| | | rsVo.obj = rmIntakeAmountDayMapper.getUseWaterGtValueIntakes(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | /** ok 4 |
| | | * 指定时间段内消费金额超过指定值的取水口 |
| | | * @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 = LocalDate.now() + " 00:00:00"; |
| | | if(timeStart == null || timeStart.trim().equals("")) { |
| | | timeStart = DateTime.yyyy_MM_dd() ; |
| | | qo.setTimeStart(timeStart); |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | | if(timeStop != null && timeStop != "") { |
| | | timeStop = timeStop + " 23:59:59"; |
| | | }else { |
| | | timeStop = LocalDate.now() + " 23:59:59"; |
| | | if(timeStop == null || timeStop.trim().equals("")) { |
| | | timeStop = DateTime.yyyy_MM_dd() ; |
| | | qo.setTimeStop(timeStop); |
| | | } |
| | | 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); |
| | | Long itemTotal = rmIntakeAmountDayMapper.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); |
| | | rsVo.obj = rmIntakeAmountDayMapper.getExpenseGtValueIntakes(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** ok 4 |
| | | * 指定时间段内消费金额超过指定值的取水口 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoIntakeAccumulateAmount>> getUseWaterTimesGtValueIntakes(IntakeCountValueQO qo) { |
| | | String timeStart = qo.getTimeStart(); |
| | | String timeStop = qo.getTimeStop(); |
| | | if(timeStart == null || timeStart.trim().equals("")) { |
| | | timeStart = DateTime.yyyy_MM_dd() ; |
| | | qo.setTimeStart(timeStart); |
| | | } |
| | | if(timeStop == null || timeStop.trim().equals("")) { |
| | | timeStop = DateTime.yyyy_MM_dd() ; |
| | | qo.setTimeStop(timeStop); |
| | | } |
| | | if (qo.getValue() == null){ |
| | | qo.setValue(0); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); |
| | | Long itemTotal = rmIntakeAmountDayMapper.getUseWaterTimesGtValueIntakesCount(params); |
| | | |
| | | QueryResultVo<List<VoIntakeAccumulateAmount>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmIntakeAmountDayMapper.getUseWaterTimesGtValueIntakes(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 指定时间段内用水时长超过指定值的取水口 |
| | | * @param qo |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | /** ok 1 |
| | | * 获取累计流量超过指定值的取水口 |
| | | * @param qo |
| | | * @return |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | /** ok 2 |
| | | * 获取累计流量低于指定值的取水口 |
| | | * @param qo |
| | | * @return |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | /** ok 3 |
| | | * 指定时间段内用水量超过指定值的取水口 |
| | | * @param |
| | | * @return |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | /** ok 4 |
| | | * 指定时间段内消费金额超过指定值的取水口 |
| | | * @param |
| | | * @return |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 指定时间段内用水次数超过指定值的取水口 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/getUseWaterTimesGtValueIntakes") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoIntakeAccumulateAmount>>> getUseWaterTimesGtValueIntakes(IntakeCountValueQO qo) { |
| | | try { |
| | | QueryResultVo<List<VoIntakeAccumulateAmount>> res = intakeSv.getUseWaterTimesGtValueIntakes(qo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 指定时间段内用水时长超过指定值的取水口 |
| | |
| | | * 值 |
| | | */ |
| | | @NotBlank(message = "值不能为空") |
| | | private int value; |
| | | private Integer value; |
| | | } |