From 894d733a70bd7b66b1f515a37c11c18c4ab1f151 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 09 八月 2024 10:10:33 +0800 Subject: [PATCH] Merge remote-tracking branch 'git-pipIrr/master' --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayIntakeAmount.java | 62 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayLoss.java | 62 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml | 27 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardCtrl.java | 86 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCardOperateMapper.java | 22 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java | 8 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoICCard.java | 25 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountDayMapper.java | 30 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml | 741 +++++++++++++----- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardqo/CommonQO.java | 29 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java | 74 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java | 137 +++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java | 149 +++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml | 8 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmLossDayLastMapper.java | 32 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeAmountQO.java | 30 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmLossDayLastMapper.xml | 737 +++++++++++++----- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoMonthAmount.java | 43 + 18 files changed, 1,856 insertions(+), 446 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..a934457 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 @@ -3,8 +3,9 @@ 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.VoIntakeAmountStatistics; -import com.dy.pipIrrGlobal.voSt.VoIntakeLossStatistics; +import com.dy.pipIrrGlobal.voSt.VoMonthAmount; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -91,4 +92,31 @@ */ 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); + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀鐢ㄦ按閲忚褰曟暟閲� + * @param params + * @return + */ + Long getMonthIntakeAmountCount(Map<?, ?> params); + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀鐢ㄦ按閲� + * @param params + * @return + */ + List<VoMonthAmount> getMonthIntakeAmount(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmLossDayLastMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmLossDayLastMapper.java index b2cc73d..255d4da 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmLossDayLastMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmLossDayLastMapper.java @@ -1,11 +1,11 @@ package com.dy.pipIrrGlobal.daoRm; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.dy.pipIrrGlobal.voRm.VoLossDay; -import com.dy.pipIrrGlobal.voSt.VoIntakeLossStatistics; import com.dy.pipIrrGlobal.pojoRm.RmLossDayLast; +import com.dy.pipIrrGlobal.voRm.VoLossDay; +import com.dy.pipIrrGlobal.voSt.VoDayLoss; +import com.dy.pipIrrGlobal.voSt.VoMonthAmount; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; @@ -88,6 +88,32 @@ */ List<VoLossDay> getLossDayLast(Map<?, ?> params); + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ婕忔崯閲忚褰曟暟閲� + * @param params + * @return + */ + Long getDayLossAmountCount(Map<?, ?> params); + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ婕忔崯閲� + * @param params + * @return + */ + List<VoDayLoss> getDayLossAmount(Map<?, ?> params); + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀婕忔崯閲忚褰曟暟閲� + * @param params + * @return + */ + Long getMonthLossAmountCount(Map<?, ?> params); + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀婕忔崯閲� + * @param params + * @return + */ + List<VoMonthAmount> getMonthLossAmount(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCardOperateMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCardOperateMapper.java index 69f2e43..20696bf 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCardOperateMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCardOperateMapper.java @@ -132,4 +132,26 @@ * @return */ Double getTradeAmountByCardNo(Long cardNum); + + + /** + * 鎸囧畾鏃堕棿娈靛唴寮�鍗℃�绘暟閲忥紙鐗╃悊鍗★級 + * @param params + * @return + */ + Long getOpenCountIcCardsCount(Map<String, Object> params); + + /** + * 鎸囧畾鏃堕棿娈靛唴鎸傚け鎬绘暟閲忥紙鐗╃悊鍗★級 + * @param params + * @return + */ + Long getLossCountIcCardsCount(Map<String, Object> params); + + /** + * 鎸囧畾鏃堕棿娈靛唴鍏呭�兼�绘暟閲忥紙鐗╃悊鍗★級 + * @param params + * @return + */ + Long getRechargeCountIcCardsCount(Map<String, Object> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java index 1536693..84522a1 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java @@ -7,6 +7,7 @@ import com.dy.pipIrrGlobal.voSe.VoCardInfo1; import com.dy.pipIrrGlobal.voSe.VoCards; import com.dy.pipIrrGlobal.voSe.VoCards2; +import com.dy.pipIrrGlobal.voSt.VoICCard; import com.dy.pipIrrGlobal.voWe.VoCards3; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -182,4 +183,11 @@ * @param money */ void updateMoney(@Param("id")Long id , @Param("money")Double money); + + /** + *褰撳墠浣欓鎬婚噺锛堢墿鐞嗗崱锛� + * @param + * @return + */ + Double getTotalMoneyIcCards(); } \ 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/java/com/dy/pipIrrGlobal/voSt/VoDayLoss.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayLoss.java new file mode 100644 index 0000000..3216a6e --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayLoss.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 15:21 + * @LastEditTime 2024-08-08 15:21 + * @Description 鏃ユ紡鎹熻鍥� + */ + +@Data +@JsonPropertyOrder({ "intakeId", "intakeNum", "lossAmount1" , "lossAmount2" , "lossAmount3" , "lossAmount4" , "lossAmount5" , "lossAmount6" , "lossAmount7" , "lossAmount8" , "lossAmount9" , "lossAmount10" , "lossAmount11" , "lossAmount12" , "lossAmount13" , "lossAmount14" , "lossAmount15" , "lossAmount16" , "lossAmount17" , "lossAmount18" , "lossAmount19" , "lossAmount20" , "lossAmount21" , "lossAmount22" , "lossAmount23" , "lossAmount24" , "lossAmount25" , "lossAmount26" , "lossAmount27" , "lossAmount28" , "lossAmount29" , "lossAmount30" , "lossAmount31" }) +public class VoDayLoss { + private static final long serialVersionUID = 202408081523001L; + + /** + * 鍙栨按鍙D + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long intakeId; + + /** + * 鍙栨按鍙g紪鍙� + */ + private String intakeNum; + + private Double lossAmount1; + private Double lossAmount2; + private Double lossAmount3; + private Double lossAmount4; + private Double lossAmount5; + private Double lossAmount6; + private Double lossAmount7; + private Double lossAmount8; + private Double lossAmount9; + private Double lossAmount10; + private Double lossAmount11; + private Double lossAmount12; + private Double lossAmount13; + private Double lossAmount14; + private Double lossAmount15; + private Double lossAmount16; + private Double lossAmount17; + private Double lossAmount18; + private Double lossAmount19; + private Double lossAmount20; + private Double lossAmount21; + private Double lossAmount22; + private Double lossAmount23; + private Double lossAmount24; + private Double lossAmount25; + private Double lossAmount26; + private Double lossAmount27; + private Double lossAmount28; + private Double lossAmount29; + private Double lossAmount30; + private Double lossAmount31; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoICCard.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoICCard.java new file mode 100644 index 0000000..982a7ca --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoICCard.java @@ -0,0 +1,25 @@ +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/8 9:49 + * @LastEditTime :2024/8/8 9:49 + * @Description + */ +@Data +public class VoICCard { + private static final long serialVersionUID = 202408311404001L; + /** + * 姘村崱ID + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long cardId; + /** + * 浣欓鎬婚噺 + */ + private Double totalMoney; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoMonthAmount.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoMonthAmount.java new file mode 100644 index 0000000..71d1525 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoMonthAmount.java @@ -0,0 +1,43 @@ +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 14:16 + * @LastEditTime 2024-08-08 14:16 + * @Description 鍙栨按鍙f湀鐢ㄦ按瑙嗗浘銆佹湀婕忔崯瑙嗗浘 + */ + +@Data +@JsonPropertyOrder({ "intakeId", "intakeNum", "month1" , "month2" , "month3" , "month4" , "month5" , "month6" , "month7" , "month8" , "month9" , "month10" , "month11" , "month12" }) +public class VoMonthAmount { + private static final long serialVersionUID = 202408081417001L; + + /** + * 鍙栨按鍙D + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long intakeId; + + /** + * 鍙栨按鍙g紪鍙� + */ + private String intakeNum; + + private Double month1; + private Double month2; + private Double month3; + private Double month4; + private Double month5; + private Double month6; + private Double month7; + private Double month8; + private Double month9; + private Double month10; + private Double month11; + private Double month12; +} 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..c68b2b7 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,552 @@ <?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> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + </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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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_last 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> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + 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="getMonthIntakeAmountCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_intake inta + <where> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + </select> + + <!--缁熻鎸囧畾骞翠唤鍚勬湀鐢ㄦ按閲�--> + <select id="getMonthIntakeAmount" resultType="com.dy.pipIrrGlobal.voSt.VoMonthAmount"> + SELECT inta.id AS intakeId, + inta.name AS intakeNum, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 1 + GROUP BY(intaDay.intake_id)), 0) AS month1, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 2 + GROUP BY(intaDay.intake_id)), 0) AS month2, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 3 + GROUP BY(intaDay.intake_id)), 0) AS month3, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 4 + GROUP BY(intaDay.intake_id)), 0) AS month4, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 5 + GROUP BY(intaDay.intake_id)), 0) AS month5, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 6 + GROUP BY(intaDay.intake_id)), 0) AS month6, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 7 + GROUP BY(intaDay.intake_id)), 0) AS month7, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 8 + GROUP BY(intaDay.intake_id)), 0) AS month8, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 9 + GROUP BY(intaDay.intake_id)), 0) AS month9, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 10 + GROUP BY(intaDay.intake_id)), 0) AS month10, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 11 + GROUP BY(intaDay.intake_id)), 0) AS month11, + IFNULL((SELECT SUM(amount) AS amount + FROM rm_intake_amount_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 12 + GROUP BY(intaDay.intake_id)), 0) AS month12 + FROM pr_intake inta + <where> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + 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-global/src/main/resources/mapper/RmLossDayLastMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmLossDayLastMapper.xml index fab983b..f70b447 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmLossDayLastMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmLossDayLastMapper.xml @@ -1,215 +1,548 @@ <?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.RmLossDayLastMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> - <!--@mbg.generated--> - <!--@Table rm_loss_day_last--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="last_history_id" jdbcType="BIGINT" property="lastHistoryId" /> - <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> - <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> - <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> - <result column="dt" jdbcType="DATE" property="dt" /> - <result column="dt_last" jdbcType="TIMESTAMP" property="dtLast" /> - <result column="dt_rtu" jdbcType="TIMESTAMP" property="dtRtu" /> - <result column="loss_amount" jdbcType="DOUBLE" property="lossAmount" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, last_history_id, controller_id, intake_id, rtu_addr, dt, dt_last, dt_rtu, loss_amount - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_day_last - where id = #{id,jdbcType=BIGINT} - </select> - <select id="selectByIntakeId" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_day_last - where intake_id = #{intakeId,jdbcType=BIGINT} - </select> - <select id="selectByDate" parameterType="java.util.Date" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_loss_day_last - where dt = #{dt,jdbcType=DATE} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from rm_loss_day_last - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> - <!--@mbg.generated--> - insert into rm_loss_day_last (id, last_history_id, controller_id, - intake_id, rtu_addr, dt, dt_last, dt_rtu, - loss_amount) - values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, - #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=DATE}, #{dtLast,jdbcType=TIMESTAMP}, #{dtRtu,jdbcType=TIMESTAMP}, - #{lossAmount,jdbcType=DOUBLE}) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> - <!--@mbg.generated--> - insert into rm_loss_day_last - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> + <!--@mbg.generated--> + <!--@Table rm_loss_day_last--> + <id column="id" jdbcType="BIGINT" property="id"/> + <result column="last_history_id" jdbcType="BIGINT" property="lastHistoryId"/> + <result column="controller_id" jdbcType="BIGINT" property="controllerId"/> + <result column="intake_id" jdbcType="BIGINT" property="intakeId"/> + <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr"/> + <result column="dt" jdbcType="DATE" property="dt"/> + <result column="dt_last" jdbcType="TIMESTAMP" property="dtLast"/> + <result column="dt_rtu" jdbcType="TIMESTAMP" property="dtRtu"/> + <result column="loss_amount" jdbcType="DOUBLE" property="lossAmount"/> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> id, - </if> - <if test="lastHistoryId != null"> last_history_id, - </if> - <if test="controllerId != null"> controller_id, - </if> - <if test="intakeId != null"> intake_id, - </if> - <if test="rtuAddr != null"> rtu_addr, - </if> - <if test="dt != null"> dt, - </if> - <if test="dtLast != null"> dt_last, - </if> - <if test="dtRtu != null"> dt_rtu, - </if> - <if test="lossAmount != null"> - loss_amount, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="lastHistoryId != null"> - #{lastHistoryId,jdbcType=BIGINT}, - </if> - <if test="controllerId != null"> - #{controllerId,jdbcType=BIGINT}, - </if> - <if test="intakeId != null"> - #{intakeId,jdbcType=BIGINT}, - </if> - <if test="rtuAddr != null"> - #{rtuAddr,jdbcType=VARCHAR}, - </if> - <if test="dt != null"> - #{dt,jdbcType=DATE}, - </if> - <if test="dtLast != null"> - #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="dtRtu != null"> - #{dtRtu,jdbcType=TIMESTAMP}, - </if> - <if test="lossAmount != null"> - #{lossAmount,jdbcType=DOUBLE}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> - <!--@mbg.generated--> - update rm_loss_day_last - <set> - <if test="lastHistoryId != null"> - last_history_id = #{lastHistoryId,jdbcType=BIGINT}, - </if> - <if test="controllerId != null"> - controller_id = #{controllerId,jdbcType=BIGINT}, - </if> - <if test="intakeId != null"> - intake_id = #{intakeId,jdbcType=BIGINT}, - </if> - <if test="rtuAddr != null"> - rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, - </if> - <if test="dt != null"> - dt = #{dt,jdbcType=DATE}, - </if> - <if test="dtLast != null"> - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - </if> - <if test="dtRtu != null"> - dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, - </if> - <if test="lossAmount != null"> - loss_amount = #{lossAmount,jdbcType=DOUBLE}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> - <!--@mbg.generated--> - update rm_loss_day_last - set last_history_id = #{lastHistoryId,jdbcType=BIGINT}, - controller_id = #{controllerId,jdbcType=BIGINT}, - intake_id = #{intakeId,jdbcType=BIGINT}, - rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, - dt = #{dt,jdbcType=DATE}, - dt_last = #{dtLast,jdbcType=TIMESTAMP}, - dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, - loss_amount = #{lossAmount,jdbcType=DOUBLE} - where id = #{id,jdbcType=BIGINT} - </update> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍鎬绘暟--> - <select id="getRecordCount" resultType="java.lang.Long"> - select count(*) - from rm_loss_day_last rldl - Left join pr_intake pint on pint.id = rldl.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 rldl.dt >= #{startDt,jdbcType=DATE} - </if> - <if test="endDt != null"> - and rldl.dt <= #{endDt,jdbcType=DATE} - </if> - </where> - </select> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍--> - <select id="getLossDayLast" resultType="com.dy.pipIrrGlobal.voRm.VoLossDay"> - select - CAST(rldl.intake_id AS char)AS intakeId, - CAST(rldl.controller_id AS char)AS controllerId, - pint.name as intakeName, - rldl.rtu_addr as rtuAddr, - rldl.dt as dt, - rldl.dt_last as dtLast, - rldl.dt_rtu as dtRtu, - rldl.loss_amount as lossAmount - from rm_loss_day_last rldl - Left join pr_intake pint on pint.id = rldl.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 rldl.dt >= #{startDt,jdbcType=DATE} - </if> - <if test="endDt != null"> - and rldl.dt <= #{endDt,jdbcType=DATE} - </if> - </where> - ORDER BY rldl.dt DESC , rldl.loss_amount DESC - <if test="pageCurr != null and pageSize != null"> - LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} - </if> - </select> + loss_amount + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from rm_loss_day_last + where id = #{id,jdbcType=BIGINT} + </select> + <select id="selectByIntakeId" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from rm_loss_day_last + where intake_id = #{intakeId,jdbcType=BIGINT} + </select> + <select id="selectByDate" parameterType="java.util.Date" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from rm_loss_day_last + where dt = #{dt,jdbcType=DATE} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete + from rm_loss_day_last + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> + <!--@mbg.generated--> + insert into rm_loss_day_last (id, last_history_id, controller_id, + intake_id, rtu_addr, dt, dt_last, dt_rtu, + loss_amount) + values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, + #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=DATE}, + #{dtLast,jdbcType=TIMESTAMP}, #{dtRtu,jdbcType=TIMESTAMP}, + #{lossAmount,jdbcType=DOUBLE}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> + <!--@mbg.generated--> + insert into rm_loss_day_last + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="lastHistoryId != null"> + last_history_id, + </if> + <if test="controllerId != null"> + controller_id, + </if> + <if test="intakeId != null"> + intake_id, + </if> + <if test="rtuAddr != null"> + rtu_addr, + </if> + <if test="dt != null"> + dt, + </if> + <if test="dtLast != null"> + dt_last, + </if> + <if test="dtRtu != null"> + dt_rtu, + </if> + <if test="lossAmount != null"> + loss_amount, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="lastHistoryId != null"> + #{lastHistoryId,jdbcType=BIGINT}, + </if> + <if test="controllerId != null"> + #{controllerId,jdbcType=BIGINT}, + </if> + <if test="intakeId != null"> + #{intakeId,jdbcType=BIGINT}, + </if> + <if test="rtuAddr != null"> + #{rtuAddr,jdbcType=VARCHAR}, + </if> + <if test="dt != null"> + #{dt,jdbcType=DATE}, + </if> + <if test="dtLast != null"> + #{dtLast,jdbcType=TIMESTAMP}, + </if> + <if test="dtRtu != null"> + #{dtRtu,jdbcType=TIMESTAMP}, + </if> + <if test="lossAmount != null"> + #{lossAmount,jdbcType=DOUBLE}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> + <!--@mbg.generated--> + update rm_loss_day_last + <set> + <if test="lastHistoryId != null"> + last_history_id = #{lastHistoryId,jdbcType=BIGINT}, + </if> + <if test="controllerId != null"> + controller_id = #{controllerId,jdbcType=BIGINT}, + </if> + <if test="intakeId != null"> + intake_id = #{intakeId,jdbcType=BIGINT}, + </if> + <if test="rtuAddr != null"> + rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, + </if> + <if test="dt != null"> + dt = #{dt,jdbcType=DATE}, + </if> + <if test="dtLast != null"> + dt_last = #{dtLast,jdbcType=TIMESTAMP}, + </if> + <if test="dtRtu != null"> + dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, + </if> + <if test="lossAmount != null"> + loss_amount = #{lossAmount,jdbcType=DOUBLE}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossDayLast"> + <!--@mbg.generated--> + update rm_loss_day_last + set last_history_id = #{lastHistoryId,jdbcType=BIGINT}, + controller_id = #{controllerId,jdbcType=BIGINT}, + intake_id = #{intakeId,jdbcType=BIGINT}, + rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, + dt = #{dt,jdbcType=DATE}, + dt_last = #{dtLast,jdbcType=TIMESTAMP}, + dt_rtu = #{dtRtu,jdbcType=TIMESTAMP}, + loss_amount = #{lossAmount,jdbcType=DOUBLE} + where id = #{id,jdbcType=BIGINT} + </update> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍鎬绘暟--> + <select id="getRecordCount" resultType="java.lang.Long"> + select count(*) + from rm_loss_day_last rldl + Left join pr_intake pint on pint.id = rldl.intake_id + <where> + <if test="intakeId != null and intakeId != ''"> + and rldl.intake_id = #{intakeId} + </if> + <if test="intakeName != null and intakeName != ''"> + and pint.name like CONCAT('%', #{intakeName,jdbcType=VARCHAR}, '%') + </if> + <if test="startDt != null"> + and rldl.dt >= #{startDt,jdbcType=DATE} + </if> + <if test="endDt != null"> + and rldl.dt <= #{endDt,jdbcType=DATE} + </if> + </where> + </select> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍--> + <select id="getLossDayLast" resultType="com.dy.pipIrrGlobal.voRm.VoLossDay"> + select CAST(rldl.intake_id AS char) AS intakeId, + CAST(rldl.controller_id AS char) AS controllerId, + pint.name as intakeName, + rldl.rtu_addr as rtuAddr, + rldl.dt as dt, + rldl.dt_last as dtLast, + rldl.dt_rtu as dtRtu, + rldl.loss_amount as lossAmount + from rm_loss_day_last rldl + Left join pr_intake pint on pint.id = rldl.intake_id + <where> + <if test="intakeId != null and intakeId != ''"> + and rldl.intake_id = #{intakeId} + </if> + <if test="intakeName != null and intakeName != ''"> + and pint.name like CONCAT('%', #{intakeName,jdbcType=VARCHAR}, '%') + </if> + <if test="startDt != null"> + and rldl.dt >= #{startDt,jdbcType=DATE} + </if> + <if test="endDt != null"> + and rldl.dt <= #{endDt,jdbcType=DATE} + </if> + </where> + ORDER BY rldl.dt DESC, rldl.loss_amount 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="getDayLossAmountCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_intake inta + <where> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + </select> + + <!--缁熻鎸囧畾鏈堜唤鍚勫ぉ婕忔崯閲�--> + <select id="getDayLossAmount" resultType="com.dy.pipIrrGlobal.voSt.VoDayLoss"> + SELECT inta.id AS intakeId, + inta.name AS intakeNum, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 1), 0) AS lossAmount1, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 2), 0) AS lossAmount2, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 3), 0) AS lossAmount3, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 4), 0) AS lossAmount4, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 5), 0) AS lossAmount5, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 6), 0) AS lossAmount6, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 7), 0) AS lossAmount7, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 8), 0) AS lossAmount8, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 9), 0) AS lossAmount9, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 10), 0) AS lossAmount10, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 11), 0) AS lossAmount11, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 12), 0) AS lossAmount12, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 13), 0) AS lossAmount13, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 14), 0) AS lossAmount14, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 15), 0) AS lossAmount15, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 16), 0) AS lossAmount16, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 17), 0) AS lossAmount17, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 18), 0) AS lossAmount18, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 19), 0) AS lossAmount19, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 20), 0) AS lossAmount20, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 21), 0) AS lossAmount21, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 22), 0) AS lossAmount22, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 23), 0) AS lossAmount23, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 24), 0) AS lossAmount24, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 25), 0) AS lossAmount25, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 26), 0) AS lossAmount26, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 27), 0) AS lossAmount27, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 28), 0) AS lossAmount28, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 29), 0) AS lossAmount29, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 30), 0) AS lossAmount30, + IFNULL((SELECT IFNULL(loss_amount, 0) + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = #{month} + AND DAY(intaDay.dt) = 31), 0) AS lossAmount31 + FROM pr_intake inta + <where> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + 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="getMonthLossAmountCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_intake inta + <where> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + </select> + + <!--缁熻鎸囧畾骞翠唤鍚勬湀婕忔崯閲�--> + <select id="getMonthLossAmount" resultType="com.dy.pipIrrGlobal.voSt.VoMonthAmount"> + SELECT inta.id AS intakeId, + inta.name AS intakeNum, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 1 + GROUP BY(intaDay.intake_id)), 0) AS month1, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 2 + GROUP BY(intaDay.intake_id)), 0) AS month2, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 3 + GROUP BY(intaDay.intake_id)), 0) AS month3, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 4 + GROUP BY(intaDay.intake_id)), 0) AS month4, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 5 + GROUP BY(intaDay.intake_id)), 0) AS month5, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 6 + GROUP BY(intaDay.intake_id)), 0) AS month6, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 7 + GROUP BY(intaDay.intake_id)), 0) AS month7, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 8 + GROUP BY(intaDay.intake_id)), 0) AS month8, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 9 + GROUP BY(intaDay.intake_id)), 0) AS month9, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 10 + GROUP BY(intaDay.intake_id)), 0) AS month10, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 11 + GROUP BY(intaDay.intake_id)), 0) AS month11, + IFNULL((SELECT SUM(loss_amount) AS amount + FROM rm_loss_day_last intaDay + WHERE intaDay.intake_id = inta.id + AND YEAR(intaDay.dt) = #{year} + AND MONTH(intaDay.dt) = 12 + GROUP BY(intaDay.intake_id)), 0) AS month12 + FROM pr_intake inta + <where> + AND inta.deleted = 0 + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name = #{intakeNum} + </if> + </where> + 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-global/src/main/resources/mapper/SeCardOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml index 8baa1e8..deac89d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml @@ -693,4 +693,31 @@ ORDER BY ope.operate_dt DESC LIMIT 0,1 </select> + <!--鎸囧畾鏃堕棿娈靛唴寮�鍗℃�绘暟閲忥紙鐗╃悊鍗★級--> + <select id="getOpenCountIcCardsCount" resultType="java.lang.Long"> + SELECT + count(*) + FROM + `se_card_operate` + WHERE + operate_dt BETWEEN #{timeStart} AND #{timeStop} AND operate_type = 1 + </select> + <!--鎸囧畾鏃堕棿娈靛唴鎸傚け鎬绘暟閲忥紙鐗╃悊鍗★級--> + <select id="getLossCountIcCardsCount" resultType="java.lang.Long"> + SELECT + count(*) + FROM + `se_card_operate` + WHERE + operate_dt BETWEEN #{timeStart} AND #{timeStop} AND operate_type = 6 + </select> + <!--鎸囧畾鏃堕棿娈靛唴鍏呭�兼�绘暟閲忥紙鐗╃悊鍗★級--> + <select id="getRechargeCountIcCardsCount" resultType="java.lang.Long"> + SELECT + count(*) + FROM + `se_card_operate` + WHERE + operate_dt BETWEEN #{timeStart} AND #{timeStop} AND operate_type = 2 + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml index 04879a7..1bdeb43 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml @@ -589,4 +589,12 @@ ORDER BY card.id </select> + <!--褰撳墠浣欓鎬婚噺锛堢墿鐞嗗崱锛�--> + <select id="getTotalMoneyIcCards" resultType="java.lang.Double"> + SELECT + IFNULL(SUM(money),0) AS totalMoney + FROM + `se_client_card` + WHERE state = 1 + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardCtrl.java index 41dbd5b..df89ee5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardCtrl.java @@ -1,9 +1,18 @@ package com.dy.pipIrrStatistics.card; +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.VoICCard; +import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +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; /** * @author ZhuBaoMin @@ -14,8 +23,83 @@ @Slf4j @RestController -@RequestMapping(path="ic-card") +@RequestMapping(path = "ic-card") @RequiredArgsConstructor public class IcCardCtrl { private final IcCardSv icCardSv; + + /** + * 鎸囧畾鏃堕棿娈靛唴寮�鍗℃�绘暟閲忥紙鐗╃悊鍗★級 + * + * @param qo + * @return + */ + @GetMapping(path = "/getOpenCountIcCards") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoICCard>>> getOpenCountIcCards(CommonQO qo) { + try { + QueryResultVo<List<VoICCard>> res = icCardSv.getOpenCountIcCards(qo); + return BaseResponseUtils.buildSuccess(res); + }catch (Exception e){ + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + /** + * 鎸囧畾鏃堕棿娈靛唴鎸傚け鎬绘暟閲忥紙鐗╃悊鍗★級 + * + * @param qo + * @return + */ + @GetMapping(path = "/getLossCountIcCards") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoICCard>>> getLossCountIcCards(CommonQO qo) { + try { + QueryResultVo<List<VoICCard>> res = icCardSv.getLossCountIcCards(qo); + return BaseResponseUtils.buildSuccess(res); + }catch (Exception e){ + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + /** + * 鎸囧畾鏃堕棿娈靛唴鍏呭�兼�绘暟閲忥紙鐗╃悊鍗★級 + * + * @param qo + * @return + */ + @GetMapping(path = "/getRechargeCountIcCards") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoICCard>>> getRechargeCountIcCards(CommonQO qo) { + try { + QueryResultVo<List<VoICCard>> res = icCardSv.getRechargeCountIcCards(qo); + return BaseResponseUtils.buildSuccess(res); + }catch (Exception e){ + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + /** + * 褰撳墠浣欓鎬婚噺锛堢墿鐞嗗崱锛� + * + * @param + * @return + */ + @GetMapping(path = "/getTotalMoneyIcCards") + @SsoAop() + public BaseResponse<Double> getTotalMoneyIcCards() { + try { + Double res = icCardSv.getTotalMoneyIcCards(); + return BaseResponseUtils.buildSuccess(res); + }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/card/IcCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java index 2ea84cd..c712949 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java @@ -1,7 +1,20 @@ package com.dy.pipIrrStatistics.card; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; +import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; +import com.dy.pipIrrGlobal.voSt.VoICCard; +import com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount; +import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; 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.time.LocalDateTime; +import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -13,4 +26,128 @@ @Slf4j @Service public class IcCardSv { + + @Autowired + private SeCardOperateMapper seCardOperateMapper; + @Autowired + private SeClientCardMapper seClientCardMapper; + + /** + * 鎸囧畾鏃堕棿娈靛唴寮�鍗℃�绘暟閲忥紙鐗╃悊鍗★級 + * @param qo + * @return + */ + public QueryResultVo<List<VoICCard>> getOpenCountIcCards(CommonQO 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 (timeStop != null && timeStop != ""){ + timeStop = timeStop + " 23:59:59"; + }else { + timeStop = LocalDateTime.now().toString(); + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); + Long itemTotal = seCardOperateMapper.getOpenCountIcCardsCount(params); + + QueryResultVo<List<VoICCard>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + + return rsVo ; + } + + /** + * 鎸囧畾鏃堕棿娈靛唴鎸傚け鎬绘暟閲忥紙鐗╃悊鍗★級 + * @param qo + * @return + */ + public QueryResultVo<List<VoICCard>> getLossCountIcCards(CommonQO 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 (timeStop != null && timeStop != ""){ + timeStop = timeStop + " 23:59:59"; + }else { + timeStop = LocalDateTime.now().toString(); + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); + Long itemTotal = seCardOperateMapper.getLossCountIcCardsCount(params); + + QueryResultVo<List<VoICCard>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + + return rsVo ; + } + + /** + * 鎸囧畾鏃堕棿娈靛唴鍏呭�兼�绘暟閲忥紙鐗╃悊鍗★級 + * @param qo + * @return + */ + public QueryResultVo<List<VoICCard>> getRechargeCountIcCards(CommonQO 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 (timeStop != null && timeStop != ""){ + timeStop = timeStop + " 23:59:59"; + }else { + timeStop = LocalDateTime.now().toString(); + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); + Long itemTotal = seCardOperateMapper.getRechargeCountIcCardsCount(params); + + QueryResultVo<List<VoICCard>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + + return rsVo ; + } + + /** + * 褰撳墠浣欓鎬婚噺锛堢墿鐞嗗崱锛� + * @param + * @return + */ + public Double getTotalMoneyIcCards() { + + Double totalMoney = seClientCardMapper.getTotalMoneyIcCards(); + return totalMoney ; + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardqo/CommonQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardqo/CommonQO.java new file mode 100644 index 0000000..16040e3 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardqo/CommonQO.java @@ -0,0 +1,29 @@ +package com.dy.pipIrrStatistics.card.IcCardqo; + +import com.dy.common.webUtil.QueryConditionVo; +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +/** + * @author :WuZeYu + * @Date :2024/8/8 9:33 + * @LastEditTime :2024/8/8 9:33 + * @Description + */ +@Data +public class CommonQO extends QueryConditionVo { + + /** + * 寮�濮嬫椂闂� + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private String timeStart; + + /** + * 缁撴潫鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @NotBlank(message = "缁撴潫鏃堕棿涓嶈兘涓虹┖") + private String timeStop; +} 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..704e2c0 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; @@ -25,7 +12,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 +33,13 @@ private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; @Autowired private RmOnHourReportLastMapper rmOnHourReportLastMapper; - @Autowired private RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper; + + @Autowired + private RmIntakeAmountDayMapper rmIntakeAmountDayMapper; + @Autowired + private RmLossDayLastMapper rmLossDayLastMapper; @Value("${rtu.batteryVolt}") private Double batteryVolt; @@ -201,7 +192,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -240,7 +231,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -279,7 +270,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -437,7 +428,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -477,7 +468,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -518,7 +509,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -557,7 +548,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -592,7 +583,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -627,7 +618,7 @@ if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; } else { - timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); + timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); @@ -650,4 +641,112 @@ rsVo.obj = rmOpenCloseValveHistoryMapper.getNoOpenHaveCloseIntakes(params); return rsVo ; } + + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲� + * @param qo + * @return + */ + public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(IntakeAmountQO 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 ; + } + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀鐢ㄦ按閲� + * @param qo + * @return + */ + public QueryResultVo<List<VoMonthAmount>> getMonthIntakeAmount(IntakeAmountQO qo) { + Calendar calendar = Calendar.getInstance(); + Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR)); + qo.setYear(year); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmIntakeAmountDayMapper.getMonthIntakeAmountCount(params)).orElse(0L); + + QueryResultVo<List<VoMonthAmount>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmIntakeAmountDayMapper.getMonthIntakeAmount(params); + return rsVo ; + } + + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ婕忔崯閲� + * @param qo + * @return + */ + public QueryResultVo<List<VoDayLoss>> getDayLossAmount(IntakeAmountQO 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(rmLossDayLastMapper.getDayLossAmountCount(params)).orElse(0L); + + QueryResultVo<List<VoDayLoss>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmLossDayLastMapper.getDayLossAmount(params); + return rsVo ; + } + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀婕忔崯閲� + * @param qo + * @return + */ + public QueryResultVo<List<VoMonthAmount>> getMonthLossAmount(IntakeAmountQO qo) { + Calendar calendar = Calendar.getInstance(); + Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR)); + qo.setYear(year); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmLossDayLastMapper.getMonthLossAmountCount(params)).orElse(0L); + + QueryResultVo<List<VoMonthAmount>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmLossDayLastMapper.getMonthLossAmount(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..948a8e2 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,68 @@ return BaseResponseUtils.buildException(e.getMessage()) ; } } + + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲� + * @param qo + * @return + */ + @GetMapping(path = "/getDayIntakeAmount") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoDayIntakeAmount>>> getDayIntakeAmount(IntakeAmountQO qo) { + try { + return BaseResponseUtils.buildSuccess(intakeSv.getDayIntakeAmount(qo)); + } catch (Exception e) { + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀鐢ㄦ按閲� + * @param qo + * @return + */ + @GetMapping(path = "/getMonthIntakeAmount") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoMonthAmount>>> getMonthIntakeAmount(IntakeAmountQO qo) { + try { + return BaseResponseUtils.buildSuccess(intakeSv.getMonthIntakeAmount(qo)); + } catch (Exception e) { + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 缁熻鎸囧畾鏈堜唤鍚勫ぉ婕忔崯閲� + * @param qo + * @return + */ + @GetMapping(path = "/getDayLossAmount") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoDayLoss>>> getDayLossAmount(IntakeAmountQO qo) { + try { + return BaseResponseUtils.buildSuccess(intakeSv.getDayLossAmount(qo)); + } catch (Exception e) { + log.error("鑾峰彇璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 缁熻鎸囧畾骞翠唤鍚勬湀婕忔崯閲� + * @param qo + * @return + */ + @GetMapping(path = "/getMonthLossAmount") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoMonthAmount>>> getMonthLossAmount(IntakeAmountQO qo) { + try { + return BaseResponseUtils.buildSuccess(intakeSv.getMonthLossAmount(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/IntakeAmountQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeAmountQO.java new file mode 100644 index 0000000..eea4659 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeAmountQO.java @@ -0,0 +1,30 @@ +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 鍙栨按鍙g敤姘存煡璇㈠璞°�佹紡绠楁煡璇㈠璞� + */ + +@Data +public class IntakeAmountQO extends QueryConditionVo { + + /** + * 骞� + */ + private Integer year; + + /** + * 鏈� + */ + private Integer month; + + /** + * 鍙栨按鍙g紪鍙� + */ + private String intakeNum; +} -- Gitblit v1.8.0