wuzeyu
2024-08-08 bc352eb500297445631fb02351e0c64e09631a3d
Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

 Conflicts:
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
11个文件已修改
4个文件已添加
1178 ■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountDayMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCardInfo1.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayIntakeAmount.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml 628 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/dbSv/DbSv.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealIcRemainMoney.java 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/RtuDataDealTree.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/DayIntakeAmountQO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java
@@ -4,6 +4,7 @@
import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
import com.dy.pipIrrGlobal.voSe.VoCardInfo;
import com.dy.pipIrrGlobal.voSe.VoCardInfo1;
import com.dy.pipIrrGlobal.voSe.VoCards;
import com.dy.pipIrrGlobal.voSe.VoCards2;
import com.dy.pipIrrGlobal.voSt.VoICCard;
@@ -70,6 +71,14 @@
     * @return
     */
    Map getClientIdAndNameByCardAddrAndCardNo(@Param("cardAddr") String cardAddr, @Param("cardNum") Long cardNum);
    /**
     * 得到水卡对象
     * @param cardAddr
     * @param cardNum
     * @return
     */
    List<VoCardInfo1> getCardsByAddrAndNum(@Param("cardAddr") String cardAddr, @Param("cardNum") Long cardNum);
    /**
     * 根据农户主键获取水卡列表
@@ -169,6 +178,13 @@
    List<VoCards3> getCardsByClientID(String clientId);
    /**
     * 更新实体卡剩余金额
     * @param id
     * @param money
     */
    void updateMoney(@Param("id")Long id , @Param("money")Double money);
    /**
     * 指定时间段内开卡总数量(物理卡)
     * @param params
     * @return
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.voSe.VoCardInfo1;
import com.dy.pipIrrGlobal.voSe.VoVcRecharge;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import org.apache.ibatis.annotations.Mapper;
@@ -66,6 +67,12 @@
     */
    Map getClientIdAndNameByVsCardNo(@Param("vcNum") Long vcNum);
    /**
     * 得到水卡对象
     * @param cardNum
     * @return
     */
    List<VoCardInfo1> getCardsByNum(@Param("cardNum") Long cardNum);
    /**
     * 根据虚拟卡编号获取虚拟卡ID
@@ -100,4 +107,11 @@
     * @return
     */
    Long getRechargeRecordCount(Map<?, ?> params);
    /**
     * 更新实体卡剩余金额
     * @param id
     * @param money
     */
    void updateMoney(@Param("id")Long id , @Param("money")Double money);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCardInfo1.java
New file
@@ -0,0 +1,25 @@
package com.dy.pipIrrGlobal.voSe;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2023-12-27 19:22
 * @LastEditTime 2023-12-27 19:22
 * @Description
 */
@Data
@Schema(title = "IC卡视图对象1")
public class VoCardInfo1 implements BaseEntity {
    private static final long serialVersionUID = 202408071750001L;
    @Schema(title = "主键")
    public Long id ;
    @Schema(title = "余额")
    public Float money;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoDayIntakeAmount.java
New file
@@ -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 取水口日用水视图
 */
@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;
    /**
     * 取水口ID
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long intakeId;
    /**
     * 取水口编号
     */
    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;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml
@@ -52,7 +52,7 @@
          phone = #{phone,jdbcType=VARCHAR} and
        </if>
        <if test="area != null">
          area = ${area} and
          area = #{area,jdbcType=INTEGER} and
        </if>
      </trim>
  </select>
@@ -73,7 +73,7 @@
        phone = #{phone,jdbcType=VARCHAR} and
      </if>
      <if test="area != null">
        area = ${area} and
        area = #{area,jdbcType=INTEGER} and
      </if>
    </trim>
    order by id DESC
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 &gt;= #{startDt,jdbcType=DATE}
      </if>
      <if test="endDt != null">
        and riad.dt &lt;= #{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 &gt;= #{startDt,jdbcType=DATE}
      </if>
      <if test="endDt != null">
        and riad.dt &lt;= #{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 &gt;= #{startDt,jdbcType=DATE}
            </if>
            <if test="endDt != null">
                and riad.dt &lt;= #{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 &gt;= #{startDt,jdbcType=DATE}
            </if>
            <if test="endDt != null">
                and riad.dt &lt;= #{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>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
@@ -75,6 +75,16 @@
    WHERE card.cardAddr = #{cardAddr} and  card.cardNum = #{cardNum}
  </select>
  <!-- 根据水卡编号获取水卡 -->
  <select id="getCardsByAddrAndNum"  resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo1">
    SELECT
    id,
    money
    FROM se_client_card
    WHERE cardAddr = #{cardAddr} and  cardNum = #{cardNum}
  </select>
  <!--根据行政区划串模糊查询水卡编号-->
  <select id="getCardNumOfMax"  resultType="java.lang.String">
    SELECT cardNum
@@ -104,6 +114,9 @@
    <!--@mbg.generated-->
    insert into se_client_card
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="protocol != null">
        protocol,
      </if>
@@ -160,6 +173,9 @@
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="protocol != null">
        #{protocol,jdbcType=VARCHAR},
      </if>
@@ -280,8 +296,8 @@
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
    <!--@mbg.generated-->
    update se_client_card
    set protocol = #{protocol,jdbcType=VARCHAR}
    cardAddr = #{cardaddr,jdbcType=VARCHAR},
    set protocol = #{protocol,jdbcType=VARCHAR},
      cardAddr = #{cardaddr,jdbcType=VARCHAR},
      cardNum = #{cardnum,jdbcType=BIGINT},
      clientId = #{clientid,jdbcType=BIGINT},
      money = #{money,jdbcType=FLOAT},
@@ -300,7 +316,11 @@
      remarks = #{remarks,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateMoney" >
    update se_client_card
    set money = #{money,jdbcType=FLOAT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据农户主键获取水卡列表-->
  <select id="getCardInfoByClientId" resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo">
    SELECT
@@ -308,22 +328,22 @@
        '用户卡' AS cardType,
        money,
        (CASE
            WHEN state = 1 THEN "正常"
            WHEN state = 2 THEN "已注销"
            ELSE "已挂失"
            WHEN state = 1 THEN '正常'
            WHEN state = 2 THEN '已注销'
            ELSE '已挂失'
        END) AS state
    FROM se_client_card
    WHERE clientId = ${clientId}
    WHERE clientId = #{clientId,jdbcType=BIGINT}
  </select>
  <!--根据水卡编号获取操作记录列表-->
  <select id="getOperateRecordsByCardNum" resultType="java.util.HashMap">
    SELECT * FROM v_operate WHERE cardNum = ${cardNum}
    SELECT * FROM v_operate WHERE cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据水卡编号获取余额-->
  <select id="getMoneyByCardNum" resultType="java.lang.Float">
    SELECT money FROM se_client_card WHERE cardNum = ${cardNum}
    SELECT money FROM se_client_card WHERE cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据水卡编号获取充值总额-->
@@ -332,7 +352,7 @@
      SUM(his.amount) AS amount
    FROM se_recharge_history his
        INNER JOIN se_client_card card ON his.cardId = card.id
    WHERE card.cardNum = ${cardNum}
    WHERE card.cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据水卡编号获取卡片状态:1-开卡,2-补卡,3-充值,4-挂失,5-注销,6-解锁,7-冲正,8-消费-->
@@ -357,7 +377,7 @@
            WHEN state = 3 THEN '已挂失'
        END) AS stateName
    FROM se_client_card
    WHERE cardNum = ${cardNum}
    WHERE cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据指定条件获取水卡列表记录数,应用程序使用-->
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
@@ -152,6 +152,11 @@
      intake_id = null
    where intake_id = #{intakeId,jdbcType=BIGINT}
  </update>
  <update id="updateMoney" >
    update se_virtual_card
    set money = #{money,jdbcType=FLOAT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--验证农户是否拥有指定名称的虚拟卡-->
  <select id="getRecordCountByName" resultType="java.lang.Integer">
    SELECT COUNT(*) AS recordCount
@@ -176,8 +181,8 @@
      money,
      in_use AS inUse,
      (CASE
        WHEN in_use = 0 THEN "未使用"
        WHEN in_use = 1 THEN "使用中"
        WHEN in_use = 0 THEN '未使用'
        WHEN in_use = 1 THEN '使用中'
      END) AS inUseName
    FROM se_virtual_card
    <where>
@@ -196,8 +201,8 @@
        money,
        in_use AS inUse,
        (CASE
            WHEN in_use = 0 THEN "未使用"
            WHEN in_use = 1 THEN "使用中"
            WHEN in_use = 0 THEN '未使用'
            WHEN in_use = 1 THEN '使用中'
        END) AS inUseName
    FROM se_virtual_card
    WHERE id = #{vcId}
@@ -225,6 +230,15 @@
    WHERE card.vc_num = #{vcNum}
  </select>
  <!-- 根据水卡编号获取虚拟水卡 -->
  <select id="getCardsByNum"  resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo1">
    SELECT
    id,
    money
    FROM se_virtual_card
    WHERE vc_num = #{cardNum}
  </select>
  <!--根据行政区划串模糊查询虚拟卡编号-->
  <select id="getVcCardNumOfMax"  resultType="java.lang.String">
    SELECT vc_num
@@ -248,14 +262,14 @@
      recharge_time AS rechargeTime,
      order_state AS orderState,
      (CASE
      WHEN order_state = 1 THEN "未支付"
      WHEN order_state = 2 THEN "已支付"
      WHEN order_state = 1 THEN '未支付'
      WHEN order_state = 2 THEN '已支付'
      END) AS orderStateName
    FROM se_vc_recharge
    where order_state = 2
    order by recharge_time DESC
    <if test="pageCurr != null and pageSize != null">
      LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
    <if test="start != null and count != null">
      LIMIT #{start}, #{count}
    </if>
  </select>
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/dbSv/DbSv.java
@@ -10,6 +10,8 @@
import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp;
import com.dy.pipIrrGlobal.pojoRm.*;
import com.dy.pipIrrGlobal.pojoSe.SeClient;
import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
import com.dy.pipIrrGlobal.voSe.VoCardInfo1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -27,9 +29,9 @@
@Service()
public class DbSv {
    @Autowired
    private SeClientCardMapper seClientCardMapperDao;//农户水卡DAO
    private SeClientCardMapper seClientCardDao;//农户水卡DAO
    @Autowired
    private SeVirtualCardMapper seVirtualCardMapper;//农户虚拟水卡DAO
    private SeVirtualCardMapper seVirtualCardDao ;//虚拟卡相关DAO
    @Autowired
    private PrControllerTrampMapper prControllerTrampMapperDao;//流浪控制器DAO
    @Autowired
@@ -60,8 +62,6 @@
    private RmLossDayMapper rmLossHistoryMapperDao ;//控制器漏损水量统计历史数据DAO
    @Autowired
    private RmCommandHistoryMapper rmCommandHistoryDao ;//远程命令日志相关
    @Autowired
    private SeVirtualCardMapper seVirtualCardDao ;//虚拟卡相关
    @Autowired
    private RmTimingReportHistoryMapper rmTimingReportHistoryDao; // 定点上报历史数据DAO
@@ -72,6 +72,7 @@
    private RmOnHourReportHistoryMapper rmOnHourReportHistoryDao; // 整点上报历史数据DAO
    @Autowired
    private RmOnHourReportLastMapper rmOnHourReportLastDao; // 整点上报最新数据DAO
    //@Autowired
    //@Lazy
@@ -93,7 +94,7 @@
        SeClient vo = null ;
        if(NumUtil.isPlusIntNumber(icCardNo)){
            Long icCardNoLong = Long.parseLong(icCardNo) ;
            Map<String, Object> map = seClientCardMapperDao.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNoLong) ;
            Map<String, Object> map = seClientCardDao.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNoLong) ;
            if(map != null && map.size() > 0) {
                vo = new SeClient() ;
                vo.setId(Long.parseLong(map.get("clientId").toString()));
@@ -111,7 +112,7 @@
        SeClient vo = null ;
        if(NumUtil.isPlusIntNumber(icCardNo)){
            Long icCardNoLong = Long.parseLong(icCardNo) ;
            Map<String, Object> map = seVirtualCardMapper.getClientIdAndNameByVsCardNo(icCardNoLong) ;
            Map<String, Object> map = seVirtualCardDao.getClientIdAndNameByVsCardNo(icCardNoLong) ;
            if(map != null && map.size() > 0) {
                vo = new SeClient() ;
                vo.setId(Long.parseLong(map.get("clientId").toString()));
@@ -634,12 +635,70 @@
    //////////////////////////////////////////////////////
    //
    // IC卡相关
    //
    //////////////////////////////////////////////////////
    /**
     * 得到农户卡
     * @param cardAddr
     * @param cardNo
     * @return
     */
    public VoCardInfo1 getIcCard(String cardAddr, String cardNo){
        if(NumUtil.isPlusIntNumber(cardNo)){
            Long icCardNoLong = Long.parseLong(cardNo) ;
            List<VoCardInfo1> list = seClientCardDao.getCardsByAddrAndNum(cardAddr, icCardNoLong) ;
            if(list != null && list.size() > 0){
                return list.get(0) ;
            }
        }
        return null ;
    }
    /**
     * 得到农户虚拟卡
     * @param cardNo
     * @return
     */
    public VoCardInfo1 getVirIcCard(String cardNo){
        if(NumUtil.isPlusIntNumber(cardNo)){
            Long icCardNoLong = Long.parseLong(cardNo) ;
            List<VoCardInfo1> list = seVirtualCardDao.getCardsByNum(icCardNoLong) ;
            if(list != null && list.size() > 0){
                return list.get(0) ;
            }
        }
        return null ;
    }
    /**
     * 更新实体卡剩余金额
     * @param id
     * @param remainMoney
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateIcCardRemainMoney(Long id , Double remainMoney){
        seClientCardDao.updateMoney(id,remainMoney);
    }
    /**
     * 更新虚拟卡剩余金额
     * @param id
     * @param remainMoney
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateVirIcCardRemainMoney(Long id , Double remainMoney){
        seVirtualCardDao.updateMoney(id,remainMoney);
    }
    //////////////////////////////////////////////////////
    //
    // 命令日志相关
    //
    //////////////////////////////////////////////////////
    public RmCommandHistory getCommandLog(String commandId){
        return rmCommandHistoryDao.selectByPrimaryKey(Long.parseLong(commandId)) ;
    }
    @Transactional(rollbackFor = Exception.class)
    public void updateCommandLog(RmCommandHistory po){
        rmCommandHistoryDao.updateByPrimaryKey(po) ;
    }
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealIcRemainMoney.java
New file
@@ -0,0 +1,167 @@
package com.dy.rtuMw.server.rtuData.p206V1_0_0;
import com.dy.common.mw.protocol.Data;
import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1;
import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd83CloseVo;
import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd83OpenVo;
import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd84Vo;
import com.dy.pipIrrGlobal.voSe.VoCardInfo1;
import com.dy.rtuMw.server.rtuData.TaskSurpport;
import com.dy.rtuMw.server.rtuData.dbSv.DbSv;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
 * @Author: liurunyu
 * @Date: 2024/8/7 17:05
 * @Description 处理IC卡剩余金额
 */
public class TkDealIcRemainMoney  extends TaskSurpport {
    private static final Logger log = LogManager.getLogger(TkDealIcRemainMoney.class.getName());
    //类ID,一定与Tree.xml配置文件中配置一致
    public static final String taskId = "TkDealIcRemainMoney";
    /**
     * 执行节点任务: 取水口日用水量和漏损量
     *
     * @param data 需要处理的数据
     */
    @Override
    public void execute(Object data) {
        Data d = (Data) data;
        DataV1_0_1 dV1_0_1 = (DataV1_0_1) d.getSubData();//前面任务已经判断不为null
        Object cdObj = dV1_0_1.subData;
        if (cdObj != null && (cdObj instanceof DataCd84Vo
                || cdObj instanceof DataCd83OpenVo
                || cdObj instanceof DataCd83CloseVo)){
            Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ;
            DbSv sv = (DbSv)objs[0] ;
            try{
                TkDealIcRemainMoney.UpDataVo vo = new TkDealIcRemainMoney.UpDataVo() ;
                if(cdObj instanceof DataCd84Vo){
                    vo.valueFrom( (DataCd84Vo)cdObj, null, null);
                }else if(cdObj instanceof DataCd83OpenVo){
                    vo.valueFrom(null,  (DataCd83OpenVo)cdObj,null);
                }else if(cdObj instanceof DataCd83CloseVo){
                    vo.valueFrom(null,null, (DataCd83CloseVo)cdObj);
                }
                this.doDeal(sv, dV1_0_1, vo);
            }catch (Exception e){
                log.error("保存取水口日用水量和漏损量数据时发生异常", e);
            }
        }
    }
    /**
     * 业务处理
     * @param sv             服务
     * @param dV1_0_1        上报数据
     * @param dataVo         上报数据对象
     */
    private void doDeal(DbSv sv, DataV1_0_1 dV1_0_1, TkDealIcRemainMoney.UpDataVo dataVo) throws Exception {
        if(dataVo.icCardNo != null){
            if(!dataVo.isVirIcCard){
                //实体卡
                if(dataVo.remainMoney != null){
                    VoCardInfo1 vo = sv.getIcCard(dataVo.icCardAddr, dataVo.icCardNo) ;
                    if(vo != null && vo.id != null){
                        if(vo.money != null){
                            if(vo.money > dataVo.remainMoney){
                                //本地的剩余金额 大于 RTU上报的剩余金额
                                this.updateIcCardRemainMoney(sv, vo.id, dataVo.remainMoney);
                            }else{
                                //本地的剩余金额 小于 RTU上报的剩余金额,说明当前上报可能是补报或其他原因造成的现象
                                //不做处理
                            }
                        }else{
                            //这种情况一般不会存在,除非有什么误操作造成
                            this.updateIcCardRemainMoney(sv, vo.id, dataVo.remainMoney);
                        }
                    }
                }
            }else{
                //虚拟卡
                if(dataVo.remainMoney != null){
                    VoCardInfo1 vo = sv.getVirIcCard(dataVo.icCardNo) ;
                    if(vo != null && vo.id != null){
                        if(vo.money != null){
                            if(vo.money > dataVo.remainMoney){
                                //本地的剩余金额 大于 RTU上报的剩余金额
                                this.updateVirIcCardRemainMoney(sv, vo.id, dataVo.remainMoney);
                            }else{
                                //本地的剩余金额 小于 RTU上报的剩余金额,说明当前上报可能是补报或其他原因造成的现象
                                //不做处理
                            }
                        }else{
                            //这种情况一般不会存在,除非有什么误操作造成
                            this.updateVirIcCardRemainMoney(sv, vo.id, dataVo.remainMoney);
                        }
                    }
                }
            }
        }
    }
    /**
     * 更新实体卡剩余金额
     * @param id
     * @param remainMoney
     */
    private void updateIcCardRemainMoney(DbSv sv, Long id , Double remainMoney){
        sv.updateIcCardRemainMoney(id,remainMoney);
    }
    /**
     * 更新虚拟卡剩余金额
     * @param id
     * @param remainMoney
     */
    private void updateVirIcCardRemainMoney(DbSv sv, Long id , Double remainMoney){
        sv.updateVirIcCardRemainMoney(id, remainMoney);
    }
    private class UpDataVo{
        public Boolean isVirIcCard ;//是否为虚拟卡
        public String icCardAddr ;//卡地址
        public String icCardNo ;//卡编号
        public Double remainMoney ; //剩余金额
        public void valueFrom(DataCd84Vo vo84, DataCd83OpenVo vo83Op, DataCd83CloseVo vo83Cl){
            if(this.isAll0(this.icCardAddr)){
                this.isVirIcCard = true ;
            }else{
                this.isVirIcCard = false ;
            }
            if(vo84 != null){
                this.icCardAddr = vo84.cardAddr ;
                this.icCardNo = vo84.cardNo ;
                this.remainMoney = vo84.remainMoney ;
            }else if(vo83Op != null){
                this.icCardAddr = vo83Op.icCardAddr ;
                this.icCardNo = vo83Op.icCardNo ;
                this.remainMoney = vo83Op.remainMoney ;
            }else if(vo83Cl != null){
                this.icCardAddr = vo83Cl.icCardAddr ;
                this.icCardNo = vo83Cl.icCardNo ;
                this.remainMoney = vo83Cl.remainMoney ;
            }
        }
        private boolean isAll0(String s){
            if(s != null && !s.trim().equals("")){
                s = s.replaceAll("0", "") ;
                if(s.equals("")){
                    return true ;
                }else{
                    return false ;
                }
            }
            return false ;
        }
    }
}
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/RtuDataDealTree.xml
@@ -22,7 +22,8 @@
                            <task id="TkDealCloseValveReport" name="控制器关阀上报(功能码83)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealCloseValveReport" />
                            <task id="TkDealLoss" name="取水口日漏损量(功能码C0)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealLoss" />
                            <task id="TkDealIntakeAmountDay" name="取水口日用水量(功能码84、功能码83、功能码C0)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealIntakeAmountDay" />
                            <task id="TkDealClientAmountDay" name="农户日用水量(功能码84、功能码83、功能码C0)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealClientAmountDay" />
                            <task id="TkDealClientAmountDay" name="农户日用水量(功能码83)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealClientAmountDay" />
                            <task id="TkDealIcRemainMoney" name="IC卡剩余金额(功能码84、功能码83)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealIcRemainMoney" />
                        </task>
                        <!-- 识别命令响应数据 -->
                        <task id="TkFindComResponse" name="识别响应命令数据" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkFindComResponse">
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,6 +12,8 @@
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;
@@ -45,9 +34,11 @@
    private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper;
    @Autowired
    private RmOnHourReportLastMapper rmOnHourReportLastMapper;
    @Autowired
    private RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper;
    @Autowired
    private RmIntakeAmountDayMapper rmIntakeAmountDayMapper;
    @Value("${rtu.batteryVolt}")
    private Double batteryVolt;
@@ -649,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 ;
    }
}
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()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/DayIntakeAmountQO.java
New file
@@ -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;
}