From 9c5e4aa959de194407b7c42f9bd165c862668120 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期四, 08 八月 2024 10:44:47 +0800 Subject: [PATCH] 2024-08-08 朱宝民 统计指定月份各天用水量 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayIntakeAmount.java | 62 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountDayMapper.java | 16 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml | 628 ++++++++++++++++++++++++++++++-------------- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java | 26 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/DayIntakeAmountQO.java | 25 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java | 48 ++- 6 files changed, 575 insertions(+), 230 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountDayMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountDayMapper.java index 7b8e54a..8b80aa8 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountDayMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountDayMapper.java @@ -2,9 +2,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; +import com.dy.pipIrrGlobal.voSt.VoDayIntakeAmount; import com.dy.pipIrrGlobal.voRm.VoIntakeAmountDay; import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics; -import com.dy.pipIrrGlobal.voSt.VoIntakeLossStatistics; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -91,4 +91,18 @@ */ List<VoIntakeAmountStatistics> statisticsByIntake(@Param("startId")Long statisticsStartId, @Param("endId")Long statisticsEndId) ; + /** + * 鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲忚褰曟暟閲� + * @param params + * @return + */ + Long getDayIntakeAmountCount(Map<?, ?> params); + + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲� + * @param params + * @return + */ + List<VoDayIntakeAmount> getDayIntakeAmount(Map<?, ?> params); + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayIntakeAmount.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayIntakeAmount.java new file mode 100644 index 0000000..5043751 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayIntakeAmount.java @@ -0,0 +1,62 @@ +package com.dy.pipIrrGlobal.voSt; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-08-08 9:31 + * @LastEditTime 2024-08-08 9:31 + * @Description 鍙栨按鍙f棩鐢ㄦ按瑙嗗浘 + */ + +@Data +@JsonPropertyOrder({ "intakeId", "intakeNum", "amount1" , "amount2" , "amount3" , "amount4" , "amount5" , "amount6" , "amount7" , "amount8" , "amount9" , "amount10" , "amount11" , "amount12" , "amount13" , "amount14" , "amount15" , "amount16" , "amount17" , "amount18" , "amount19" , "amount20" , "amount21" , "amount22" , "amount23" , "amount24" , "amount25" , "amount26" , "amount27" , "amount28" , "amount29" , "amount30" , "amount31" }) +public class VoDayIntakeAmount { + private static final long serialVersionUID = 202408080933001L; + + /** + * 鍙栨按鍙D + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long intakeId; + + /** + * 鍙栨按鍙g紪鍙� + */ + private String intakeNum; + + private Double amount1; + private Double amount2; + private Double amount3; + private Double amount4; + private Double amount5; + private Double amount6; + private Double amount7; + private Double amount8; + private Double amount9; + private Double amount10; + private Double amount11; + private Double amount12; + private Double amount13; + private Double amount14; + private Double amount15; + private Double amount16; + private Double amount17; + private Double amount18; + private Double amount19; + private Double amount20; + private Double amount21; + private Double amount22; + private Double amount23; + private Double amount24; + private Double amount25; + private Double amount26; + private Double amount27; + private Double amount28; + private Double amount29; + private Double amount30; + private Double amount31; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml index 96ecc72..5b247fb 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml @@ -1,219 +1,439 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.dy.pipIrrGlobal.daoRm.RmIntakeAmountDayMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> - <!--@mbg.generated--> - <!--@Table rm_intake_amount_day--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> - <result column="dt" jdbcType="DATE" property="dt" /> - <result column="amount" jdbcType="DOUBLE" property="amount" /> - <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" /> - <result column="total_amount_last" jdbcType="FLOAT" property="totalAmountLast" /> - <result column="rtu_dt_last" jdbcType="TIMESTAMP" property="rtuDtLast" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, intake_id, dt, amount, dt_last, rtu_addr_last, controller_id_last, total_amount_last, - rtu_dt_last - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_intake_amount_day - where id = #{id,jdbcType=BIGINT} - </select> - <select id="selectByDate" parameterType="java.util.Date" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_intake_amount_day - where dt = #{dt,jdbcType=DATE} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from rm_intake_amount_day - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> - <!--@mbg.generated--> - insert into rm_intake_amount_day (id, intake_id, dt, - amount, 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}, - #{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT}, - #{rtuDtLast,jdbcType=TIMESTAMP}) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> - <!--@mbg.generated--> - insert into rm_intake_amount_day - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> + <!--@mbg.generated--> + <!--@Table rm_intake_amount_day--> + <id column="id" jdbcType="BIGINT" property="id"/> + <result column="intake_id" jdbcType="BIGINT" property="intakeId"/> + <result column="dt" jdbcType="DATE" property="dt"/> + <result column="amount" jdbcType="DOUBLE" property="amount"/> + <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"/> + <result column="total_amount_last" jdbcType="FLOAT" property="totalAmountLast"/> + <result column="rtu_dt_last" jdbcType="TIMESTAMP" property="rtuDtLast"/> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> id, - </if> - <if test="intakeId != null"> intake_id, - </if> - <if test="dt != null"> dt, - </if> - <if test="amount != null"> amount, - </if> - <if test="dtLast != null"> dt_last, - </if> - <if test="rtuAddrLast != null"> rtu_addr_last, - </if> - <if test="controllerIdLast != null"> controller_id_last, - </if> - <if test="totalAmountLast != null"> total_amount_last, - </if> - <if test="rtuDtLast != null"> - rtu_dt_last, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="intakeId != null"> - #{intakeId,jdbcType=BIGINT}, - </if> - <if test="dt != null"> - #{dt,jdbcType=DATE}, - </if> - <if test="amount != null"> - #{amount,jdbcType=DOUBLE}, - </if> - <if test="dtLast != null"> - #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="rtuAddrLast != null"> - #{rtuAddrLast,jdbcType=VARCHAR}, - </if> - <if test="controllerIdLast != null"> - #{controllerIdLast,jdbcType=BIGINT}, - </if> - <if test="totalAmountLast != null"> - #{totalAmountLast,jdbcType=FLOAT}, - </if> - <if test="rtuDtLast != null"> - #{rtuDtLast,jdbcType=TIMESTAMP}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> - <!--@mbg.generated--> - update rm_intake_amount_day - <set> - <if test="intakeId != null"> - intake_id = #{intakeId,jdbcType=BIGINT}, - </if> - <if test="dt != null"> - dt = #{dt,jdbcType=DATE}, - </if> - <if test="amount != null"> - amount = #{amount,jdbcType=DOUBLE}, - </if> - <if test="dtLast != null"> - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="rtuAddrLast != null"> - rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR}, - </if> - <if test="controllerIdLast != null"> - controller_id_last = #{controllerIdLast,jdbcType=BIGINT}, - </if> - <if test="totalAmountLast != null"> - total_amount_last = #{totalAmountLast,jdbcType=FLOAT}, - </if> - <if test="rtuDtLast != null"> - rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> - <!--@mbg.generated--> - update rm_intake_amount_day - set intake_id = #{intakeId,jdbcType=BIGINT}, - dt = #{dt,jdbcType=DATE}, - amount = #{amount,jdbcType=DOUBLE}, - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR}, - controller_id_last = #{controllerIdLast,jdbcType=BIGINT}, - total_amount_last = #{totalAmountLast,jdbcType=FLOAT}, - rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - </update> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍鎬绘暟--> - <select id="getRecordCount" resultType="java.lang.Long"> - select count(*) - from rm_intake_amount_day riad - Left join pr_intake pint on pint.id = riad.intake_id - <where> - <if test="intakeId != null and intakeId != '' "> - and rash.intake_id = #{intakeId} - </if> - <if test="intakeName != null and intakeName != '' "> - and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') - </if> - <if test="startDt != null"> - and riad.dt >= #{startDt,jdbcType=DATE} - </if> - <if test="endDt != null"> - and riad.dt <= #{endDt,jdbcType=DATE} - </if> - </where> + rtu_dt_last + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from rm_intake_amount_day + where id = #{id,jdbcType=BIGINT} </select> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍--> - <select id="getIntakeAmountDayHistory" resultType="com.dy.pipIrrGlobal.voRm.VoIntakeAmountDay"> - select - CAST(riad.intake_id AS char)AS intakeId, - pint.name as intakeName, - riad.dt as dt, - riad.amount as amount, - riad.dt_last as dtLast, - riad.rtu_addr_last as rtuAddrLast, - CAST(riad.controller_id_last AS char)AS controllerIdLast, - riad.total_amount_last as totalAmountLast, - riad.rtu_dt_last as rtuDtLast - from rm_intake_amount_day riad - Left join pr_intake pint on pint.id = riad.intake_id - <where> - <if test="intakeId != null and intakeId != '' "> - and rash.intake_id = #{intakeId} - </if> - <if test="intakeName != null and intakeName != '' "> - and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') - </if> - <if test="startDt != null"> - and riad.dt >= #{startDt,jdbcType=DATE} - </if> - <if test="endDt != null"> - and riad.dt <= #{endDt,jdbcType=DATE} - </if> - </where> - ORDER BY riad.id DESC - <if test="pageCurr != null and pageSize != null"> - LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} - </if> - </select> + <select id="selectByDate" parameterType="java.util.Date" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from rm_intake_amount_day + where dt = #{dt,jdbcType=DATE} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete + from rm_intake_amount_day + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> + <!--@mbg.generated--> + insert into rm_intake_amount_day (id, intake_id, dt, + amount, 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}, + #{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT}, + #{rtuDtLast,jdbcType=TIMESTAMP}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> + <!--@mbg.generated--> + insert into rm_intake_amount_day + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="intakeId != null"> + intake_id, + </if> + <if test="dt != null"> + dt, + </if> + <if test="amount != null"> + amount, + </if> + <if test="dtLast != null"> + dt_last, + </if> + <if test="rtuAddrLast != null"> + rtu_addr_last, + </if> + <if test="controllerIdLast != null"> + controller_id_last, + </if> + <if test="totalAmountLast != null"> + total_amount_last, + </if> + <if test="rtuDtLast != null"> + rtu_dt_last, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="intakeId != null"> + #{intakeId,jdbcType=BIGINT}, + </if> + <if test="dt != null"> + #{dt,jdbcType=DATE}, + </if> + <if test="amount != null"> + #{amount,jdbcType=DOUBLE}, + </if> + <if test="dtLast != null"> + #{dtLast,jdbcType=TIMESTAMP}, + </if> + <if test="rtuAddrLast != null"> + #{rtuAddrLast,jdbcType=VARCHAR}, + </if> + <if test="controllerIdLast != null"> + #{controllerIdLast,jdbcType=BIGINT}, + </if> + <if test="totalAmountLast != null"> + #{totalAmountLast,jdbcType=FLOAT}, + </if> + <if test="rtuDtLast != null"> + #{rtuDtLast,jdbcType=TIMESTAMP}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> + <!--@mbg.generated--> + update rm_intake_amount_day + <set> + <if test="intakeId != null"> + intake_id = #{intakeId,jdbcType=BIGINT}, + </if> + <if test="dt != null"> + dt = #{dt,jdbcType=DATE}, + </if> + <if test="amount != null"> + amount = #{amount,jdbcType=DOUBLE}, + </if> + <if test="dtLast != null"> + dt_last = #{dtLast,jdbcType=TIMESTAMP}, + </if> + <if test="rtuAddrLast != null"> + rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR}, + </if> + <if test="controllerIdLast != null"> + controller_id_last = #{controllerIdLast,jdbcType=BIGINT}, + </if> + <if test="totalAmountLast != null"> + total_amount_last = #{totalAmountLast,jdbcType=FLOAT}, + </if> + <if test="rtuDtLast != null"> + rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> + <!--@mbg.generated--> + update rm_intake_amount_day + set intake_id = #{intakeId,jdbcType=BIGINT}, + dt = #{dt,jdbcType=DATE}, + amount = #{amount,jdbcType=DOUBLE}, + dt_last = #{dtLast,jdbcType=TIMESTAMP}, + rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR}, + controller_id_last = #{controllerIdLast,jdbcType=BIGINT}, + total_amount_last = #{totalAmountLast,jdbcType=FLOAT}, + rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + </update> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍鎬绘暟--> + <select id="getRecordCount" resultType="java.lang.Long"> + select count(*) + from rm_intake_amount_day riad + Left join pr_intake pint on pint.id = riad.intake_id + <where> + <if test="intakeId != null and intakeId != ''"> + and riad.intake_id = #{intakeId} + </if> + <if test="intakeName != null and intakeName != ''"> + and pint.name like CONCAT('%', #{intakeName,jdbcType=VARCHAR}, '%') + </if> + <if test="startDt != null"> + and riad.dt >= #{startDt,jdbcType=DATE} + </if> + <if test="endDt != null"> + and riad.dt <= #{endDt,jdbcType=DATE} + </if> + </where> + </select> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍--> + <select id="getIntakeAmountDayHistory" resultType="com.dy.pipIrrGlobal.voRm.VoIntakeAmountDay"> + select CAST(riad.intake_id AS char) AS intakeId, + pint.name as intakeName, + riad.dt as dt, + riad.amount as amount, + riad.dt_last as dtLast, + riad.rtu_addr_last as rtuAddrLast, + CAST(riad.controller_id_last AS char) AS controllerIdLast, + riad.total_amount_last as totalAmountLast, + riad.rtu_dt_last as rtuDtLast + from rm_intake_amount_day riad + Left join pr_intake pint on pint.id = riad.intake_id + <where> + <if test="intakeId != null and intakeId != ''"> + and riad.intake_id = #{intakeId} + </if> + <if test="intakeName != null and intakeName != ''"> + and pint.name like CONCAT('%', #{intakeName,jdbcType=VARCHAR}, '%') + </if> + <if test="startDt != null"> + and riad.dt >= #{startDt,jdbcType=DATE} + </if> + <if test="endDt != null"> + and riad.dt <= #{endDt,jdbcType=DATE} + </if> + </where> + ORDER BY riad.id DESC +<!-- <if test="pageCurr != null and pageSize != null">--> +<!-- LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}--> +<!-- </if>--> + <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="statisticsByIntake" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics"> - select intake_id, sum(amount) amount - from rm_intake_amount_day - where id <![CDATA[>=]]> #{startId, jdbcType=BIGINT} and id <![CDATA[<]]> #{endId, jdbcType=BIGINT} - group by intake_id - </select> + <select id="statisticsByIntake" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics"> + select intake_id, sum(amount) amount + from rm_intake_amount_day + where id <![CDATA[>=]]> #{startId, jdbcType=BIGINT} + and id <![CDATA[<]]> #{endId, jdbcType=BIGINT} + group by intake_id + </select> + + <!--鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲忚褰曟暟閲�--> + <select id="getDayIntakeAmountCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_intake inta + WHERE inta.deleted = 0 + </select> + + <!--缁熻鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲�--> + <select id="getDayIntakeAmount" resultType="com.dy.pipIrrGlobal.voSt.VoDayIntakeAmount"> + SELECT inta.id AS intakeId, + inta.name AS intakeNum, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 1), 0) AS amount1, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 2), 0) AS amount2, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 3), 0) AS amount3, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 4), 0) AS amount4, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 5), 0) AS amount5, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 6), 0) AS amount6, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 7), 0) AS amount7, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 8), 0) AS amount8, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 9), 0) AS amount9, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 10), 0) AS amount10, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 11), 0) AS amount11, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 12), 0) AS amount12, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 13), 0) AS amount13, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 14), 0) AS amount14, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 15), 0) AS amount15, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 16), 0) AS amount16, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 17), 0) AS amount17, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 18), 0) AS amount18, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 19), 0) AS amount19, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 20), 0) AS amount20, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 21), 0) AS amount21, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 22), 0) AS amount22, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 23), 0) AS amount23, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 24), 0) AS amount24, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 25), 0) AS amount25, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 26), 0) AS amount26, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 27), 0) AS amount27, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 28), 0) AS amount28, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 29), 0) AS amount29, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 30), 0) AS amount30, + IFNULL((SELECT IFNULL(amount, 0) + FROM rm_intake_amount_day intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 31), 0) AS amount31 + FROM pr_intake inta + WHERE inta.deleted = 0 + 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> \ No newline at end of file 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 9357183..08ea83e 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 @@ -1,22 +1,9 @@ package com.dy.pipIrrStatistics.intake; import com.dy.common.webUtil.QueryResultVo; -import com.dy.pipIrrGlobal.daoRm.RmOnHourReportHistoryMapper; -import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; -import com.dy.pipIrrGlobal.daoRm.RmOnHourReportLastMapper; -import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveLastMapper; +import com.dy.pipIrrGlobal.daoRm.*; import com.dy.pipIrrGlobal.voSt.*; import com.dy.pipIrrStatistics.intake.qo.*; -import com.dy.pipIrrGlobal.voSt.VoBatteryVolt; -import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow; -import com.dy.pipIrrGlobal.voSt.VoIntake; -import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; -import com.dy.pipIrrGlobal.voSt.VoSignalIntensity; -import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO; -import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; -import com.dy.pipIrrStatistics.intake.qo.IntakeCountValueQO; -import com.dy.pipIrrStatistics.intake.qo.CommonQO; -import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +13,7 @@ import java.text.DecimalFormat; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.Calendar; import java.util.List; import java.util.Map; import java.util.Optional; @@ -46,9 +34,11 @@ private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; @Autowired private RmOnHourReportLastMapper rmOnHourReportLastMapper; - @Autowired private RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper; + + @Autowired + private RmIntakeAmountDayMapper rmIntakeAmountDayMapper; @Value("${rtu.batteryVolt}") private Double batteryVolt; @@ -650,4 +640,32 @@ rsVo.obj = rmOpenCloseValveHistoryMapper.getNoOpenHaveCloseIntakes(params); return rsVo ; } + + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲� + * @param qo + * @return + */ + public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(DayIntakeAmountQO qo) { + Calendar calendar = Calendar.getInstance(); + Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR)); + Integer month = Optional.ofNullable(qo.getMonth()).orElse(calendar.get(Calendar.MONTH)); + qo.setYear(year); + qo.setMonth(month); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmIntakeAmountDayMapper.getDayIntakeAmountCount(params)).orElse(0L); + + QueryResultVo<List<VoDayIntakeAmount>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmIntakeAmountDayMapper.getDayIntakeAmount(params); + return rsVo ; + } } 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 6c4997e..ca2a113 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java @@ -6,16 +6,6 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.voSt.*; import com.dy.pipIrrStatistics.intake.qo.*; -import com.dy.pipIrrGlobal.voSt.VoBatteryVolt; -import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow; -import com.dy.pipIrrGlobal.voSt.VoIntake; -import com.dy.pipIrrGlobal.voSt.VoSignalIntensity; -import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO; -import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; -import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; -import com.dy.pipIrrStatistics.intake.qo.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; @@ -336,4 +326,20 @@ return BaseResponseUtils.buildException(e.getMessage()) ; } } + + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲� + * @param qo + * @return + */ + @GetMapping(path = "/getDayIntakeAmount") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoDayIntakeAmount>>> getDayIntakeAmount(DayIntakeAmountQO qo) { + try { + return BaseResponseUtils.buildSuccess(intakeSv.getDayIntakeAmount(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/intake/qo/DayIntakeAmountQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/DayIntakeAmountQO.java new file mode 100644 index 0000000..47a6ed5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/DayIntakeAmountQO.java @@ -0,0 +1,25 @@ +package com.dy.pipIrrStatistics.intake.qo; + +import com.dy.common.webUtil.QueryConditionVo; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-08-08 9:59 + * @LastEditTime 2024-08-08 9:59 + * @Description + */ + +@Data +public class DayIntakeAmountQO extends QueryConditionVo { + + /** + * 骞� + */ + private Integer year; + + /** + * 鏈� + */ + private Integer month; +} -- Gitblit v1.8.0