1、开关阀报中增加农户关联;
2、工作报中增加农户关联;
3、取水口损失流量完善;
4、实现取水日取水量统计。
38个文件已修改
13个文件已添加
2个文件已删除
| | |
| | | public static final int dataIndex = 10 ;//具体数据字节数组下标 |
| | | |
| | | |
| | | public static final String vsCardAddr = "00000000";//本系统应用的虚拟卡,卡物理地址采用10个0作为模拟 |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCdC0Vo; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.dy.common.util.DateTime; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2024/2/28 15:31 |
| | | * @LastEditTime 2024/2/28 15:31 |
| | | * @Description 控制器日漏损水量历史数据 |
| | | */ |
| | | @TableName(value="rm_loss_history_history", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "控制器日漏损水量历史数据 ") |
| | | public class RmLossHistory implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202402281620001L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | public Long id; |
| | | |
| | | |
| | | /** |
| | | * 控制器实体ID(外键) |
| | | */ |
| | | @Schema(description = "控制器实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long controllerId; |
| | | |
| | | /** |
| | | * 取水口实体ID(外键) |
| | | */ |
| | | @Schema(description = "取水口实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 控制器地址 |
| | | */ |
| | | @Schema(description = "控制器地址", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String rtuAddr; |
| | | |
| | | /** |
| | | * 数据接收日期时间 |
| | | */ |
| | | @Schema(description = "上报日期时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | public Date dt; |
| | | |
| | | /** |
| | | * 控制器当日最后上报数据时间 |
| | | */ |
| | | @Schema(description = "控制器当日最后上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date dtLast; |
| | | |
| | | /** |
| | | * 控制器当日最后上报数据中的控制器时钟 |
| | | */ |
| | | @Schema(description = "控制器时钟", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date dtRtu; |
| | | |
| | | /** |
| | | * 日漏损流量 |
| | | */ |
| | | @Schema(description = "日漏损量(m3)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double lossAmount; |
| | | |
| | | |
| | | public void valueFrom(DataV1_0_1 dV1_0_1, DataCdC0Vo cdData) throws Exception{ |
| | | this.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); |
| | | this.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | this.dtRtu = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | this.lossAmount = cdData.lossAmount ;// 损失流量(从0时到当前的漏损累计流量,24时一个周期,0时归0)单位为m3。 |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2024/2/28 15:31 |
| | | * @LastEditTime 2024/2/28 15:31 |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmLossHistoryMapper { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | | * @return deleteCount |
| | | */ |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insert(RmLossHistory record); |
| | | |
| | | /** |
| | | * insert record to table selective |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insertSelective(RmLossHistory record); |
| | | |
| | | /** |
| | | * select by primary key |
| | | * @param id primary key |
| | | * @return object by primary key |
| | | */ |
| | | RmLossHistory selectByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * select by dt |
| | | * @param date 日期(yyyy-mm-dd) |
| | | * @return object by rtuAddr |
| | | */ |
| | | List<RmLossHistory> selectByDate(Date date) ; |
| | | |
| | | /** |
| | | * update record selective |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKeySelective(RmLossHistory record); |
| | | |
| | | /** |
| | | * update record |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(RmLossHistory record); |
| | | } |
New file |
| | |
| | | <?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.RmLossHistoryMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmLossHistory"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table rm_loss_history--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <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, 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_history |
| | | 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_loss_history |
| | | where dt = #{dt,jdbcType=DATE} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from rm_loss_history |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossHistory"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_loss_history (id, controller_id, intake_id, |
| | | rtu_addr, dt, dt_last, dt_rtu, loss_amount |
| | | ) |
| | | values (#{id,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.RmLossHistory"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_loss_history |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | 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="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.RmLossHistory"> |
| | | <!--@mbg.generated--> |
| | | update rm_loss_history |
| | | <set> |
| | | <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.RmLossHistory"> |
| | | <!--@mbg.generated--> |
| | | update rm_loss_history |
| | | set 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> |
| | | </mapper> |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCdC0Vo; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.dy.common.util.DateTime; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2024/2/28 15:31 |
| | | * @LastEditTime 2024/2/28 15:31 |
| | | * @Description 控制器日漏损水量最新数据 |
| | | */ |
| | | @TableName(value="rm_loss_last_history", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "控制器日漏损水量最新数据") |
| | | public class RmLossLast implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202402281621001L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 由最新数据持有历史数据中的最新记录ID,以方便快速查询 |
| | | * json不序列化此属性,即不向前端页面发送及显示 |
| | | */ |
| | | @Schema(hidden=true) |
| | | @JSONField(serialize = false) |
| | | public Long lastHistoryId; |
| | | |
| | | /** |
| | | * 控制器实体ID(外键) |
| | | */ |
| | | @Schema(description = "控制器实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long controllerId; |
| | | |
| | | /** |
| | | * 取水口实体ID(外键) |
| | | */ |
| | | @Schema(description = "取水口实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 控制器地址 |
| | | */ |
| | | @Schema(description = "控制器地址", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String rtuAddr; |
| | | |
| | | /** |
| | | * 统计日 |
| | | */ |
| | | @Schema(description = "统计日", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | public Date dt; |
| | | |
| | | /** |
| | | * 控制器当日最后上报数据时间 |
| | | */ |
| | | @Schema(description = "控制器当日最后上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date dtLast; |
| | | |
| | | /** |
| | | * 控制器当日最后上报数据中的控制器时钟 |
| | | */ |
| | | @Schema(description = "控制器时钟", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date dtRtu; |
| | | |
| | | /** |
| | | * 日漏损流量 |
| | | */ |
| | | @Schema(description = "日漏损量(m3)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double lossAmount; |
| | | |
| | | public void valueFrom(DataV1_0_1 dV1_0_1, DataCdC0Vo cdData) throws Exception{ |
| | | this.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); |
| | | this.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | this.dtRtu = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | this.lossAmount = cdData.lossAmount ;// 损失流量(从0时到当前的漏损累计流量,24时一个周期,0时归0)单位为m3。 |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2024/2/28 15:31 |
| | | * @LastEditTime 2024/2/28 15:31 |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmLossLastMapper { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | | * @return deleteCount |
| | | */ |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insert(RmLossLast record); |
| | | |
| | | /** |
| | | * insert record to table selective |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insertSelective(RmLossLast record); |
| | | |
| | | /** |
| | | * select by primary key |
| | | * @param id primary key |
| | | * @return object by primary key |
| | | */ |
| | | RmLossLast selectByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * select by rtuAddr |
| | | * @param intakeId 控制器所绑取水口ID |
| | | * @return object by rtuAddr |
| | | */ |
| | | List<RmLossLast> selectByIntakeId(Long intakeId) ; |
| | | /** |
| | | * select by dt |
| | | * @param date 日期(yyyy-mm-dd) |
| | | * @return object by rtuAddr |
| | | */ |
| | | List<RmLossLast> selectByDate(Date date) ; |
| | | |
| | | /** |
| | | * update record selective |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKeySelective(RmLossLast record); |
| | | |
| | | /** |
| | | * update record |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(RmLossLast record); |
| | | } |
New file |
| | |
| | | <?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.RmLossLastMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmLossLast"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table rm_loss_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_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_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_last |
| | | where dt = #{dt,jdbcType=DATE} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from rm_loss_last |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmLossLast"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_loss_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.RmLossLast"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_loss_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.RmLossLast"> |
| | | <!--@mbg.generated--> |
| | | update rm_loss_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.RmLossLast"> |
| | | <!--@mbg.generated--> |
| | | update rm_loss_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> |
| | | </mapper> |
| | |
| | | * @return 5级行政区划代码 |
| | | */ |
| | | VoAreaCode getAreaCodeByNum(@Param("clientNum") String clientNum); |
| | | |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmAlarmStateLast; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmAlarmStateLastMapper { |
| | | public interface RmAlarmStateLastMapper extends BaseMapper<RmAlarmStateLast> { |
| | | /** |
| | | * delete by primary key |
| | | * |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDayLast; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossLast; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/8 19:19 |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmIntakeAmountDayLastMapper extends BaseMapper<RmIntakeAmountDayLast> { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | | * @return deleteCount |
| | | */ |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * select by rtuAddr |
| | | * @param intakeId 控制器所绑取水口ID |
| | | * @return object by rtuAddr |
| | | */ |
| | | List<RmIntakeAmountDayLast> selectByIntakeId(Long intakeId) ; |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insert(RmIntakeAmountDayLast record); |
| | | |
| | | /** |
| | | * insert record to table selective |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insertSelective(RmIntakeAmountDayLast record); |
| | | |
| | | /** |
| | | * select by primary key |
| | | * @param id primary key |
| | | * @return object by primary key |
| | | */ |
| | | RmIntakeAmountDayLast selectByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * update record selective |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKeySelective(RmIntakeAmountDayLast record); |
| | | |
| | | /** |
| | | * update record |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(RmIntakeAmountDayLast record); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOnHourReportHistory; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/8 18:53 |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmIntakeAmountDayMapper extends BaseMapper<RmIntakeAmountDay> { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | | * @return deleteCount |
| | | */ |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insert(RmIntakeAmountDay record); |
| | | |
| | | /** |
| | | * insert record to table selective |
| | | * @param record the record |
| | | * @return insert count |
| | | */ |
| | | int insertSelective(RmIntakeAmountDay record); |
| | | |
| | | /** |
| | | * select by primary key |
| | | * @param id primary key |
| | | * @return object by primary key |
| | | */ |
| | | RmIntakeAmountDay selectByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * select by dt |
| | | * @param date 日期(yyyy-mm-dd) |
| | | * @return object by rtuAddr |
| | | */ |
| | | List<RmIntakeAmountDay> selectByDate(Date date) ; |
| | | |
| | | /** |
| | | * update record selective |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKeySelective(RmIntakeAmountDay record); |
| | | |
| | | /** |
| | | * update record |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(RmIntakeAmountDay record); |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossLast; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmLossHistoryMapper { |
| | | public interface RmLossHistoryMapper extends BaseMapper<RmLossHistory> { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossLast; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmLossLastMapper { |
| | | public interface RmLossLastMapper extends BaseMapper<RmLossLast> { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOnHourReportHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmOnHourReportHistoryMapper { |
| | | public interface RmOnHourReportHistoryMapper extends BaseMapper<RmOnHourReportHistory> { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmOnHourReportLastMapper { |
| | | public interface RmOnHourReportLastMapper extends BaseMapper<RmOnHourReportLast> { |
| | | /** |
| | | * delete by primary key |
| | | * @param id primaryKey |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveLast; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmOpenCloseValveHistoryMapper { |
| | | public interface RmOpenCloseValveHistoryMapper extends BaseMapper<RmOpenCloseValveHistory> { |
| | | /** |
| | | * delete by primary key |
| | | * |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveLast; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmWorkReportHistory; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmOpenCloseValveLastMapper { |
| | | public interface RmOpenCloseValveLastMapper extends BaseMapper<RmOpenCloseValveLast> { |
| | | /** |
| | | * delete by primary key |
| | | * |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmWorkReportHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmWorkReportLast; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmWorkReportHistoryMapper { |
| | | public interface RmWorkReportHistoryMapper extends BaseMapper<RmWorkReportHistory> { |
| | | /** |
| | | * delete by primary key |
| | | * |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmTimingReportHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmWorkReportLast; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface RmWorkReportLastMapper { |
| | | public interface RmWorkReportLastMapper extends BaseMapper<RmWorkReportLast> { |
| | | /** |
| | | * delete by primary key |
| | | * |
| | |
| | | Map getCardIdAndClientNum(@Param("cardNum") Long cardNum); |
| | | |
| | | /** |
| | | * 根据水卡编号获取水卡对应的农户id和姓名 |
| | | * @param cardAddr |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | Map getClientIdAndNameByCardAddrAndCardNo(@Param("cardAddr") String cardAddr, @Param("cardNum") Long cardNum); |
| | | |
| | | /** |
| | | * 根据农户主键获取水卡列表 |
| | | * @param clientId |
| | | * @return |
| | |
| | | SeVirtualCard getVcCardByNum(@Param("vcNum") String vcNum); |
| | | |
| | | /** |
| | | * 根据虚拟水卡编号获取对应的农户id和姓名 |
| | | * @param vcNum |
| | | * @return |
| | | */ |
| | | Map getClientIdAndNameByVsCardNo(@Param("vcNum") Long vcNum); |
| | | |
| | | |
| | | /** |
| | | * 根据虚拟卡编号获取虚拟卡ID |
| | | * @param vcNum |
| | | * @return |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/8 18:53 |
| | | * @Description 取水口日取水量漏损量 |
| | | */ |
| | | @TableName(value="rm_intake_amount_day", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口日取水量漏损量") |
| | | public class RmIntakeAmountDay implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 2024007081854001L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 取水口ID(外键) |
| | | */ |
| | | @Schema(description = "取水口实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 统计日期(yyyy-mm-dd) |
| | | */ |
| | | @Schema(description = "统计日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | public Date dt; |
| | | |
| | | /** |
| | | * 日取水量(不包括漏损水量) |
| | | */ |
| | | public Double amount; |
| | | |
| | | /** |
| | | * 累计日漏损水量 |
| | | */ |
| | | public Double loss; |
| | | |
| | | /** |
| | | * 最后计水量上报数据接收时间(yyyy-mm-dd hh:mm:ss) |
| | | */ |
| | | @Schema(description = "最后计水量上报数据接收时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date dtLast; |
| | | |
| | | /** |
| | | * 最后计水量的控制器地址 |
| | | */ |
| | | public String rtuAddrLast; |
| | | |
| | | /** |
| | | * 最后计水量的控制器ID(外键) |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long controllerIdLast; |
| | | |
| | | /** |
| | | * 最后计水量时控制器累计水量 |
| | | */ |
| | | public Double totalAmountLast; |
| | | |
| | | /** |
| | | * 最后计水量时控制器时钟(yyyy-mm-dd HH:MM:SS) |
| | | */ |
| | | @Schema(description = "最后计水量时控制器时钟", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date rtuDtLast; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/8 19:19 |
| | | * @Description 取水口日取水量漏损量最新 |
| | | */ |
| | | @TableName(value="rm_intake_amount_day_last", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口日取水量漏损量最新") |
| | | public class RmIntakeAmountDayLast implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 2024007081854002L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | public Long id; |
| | | /** |
| | | * 由最新数据持有历史数据中的最新记录ID,以方便快速查询 |
| | | * json不序列化此属性,即不向前端页面发送及显示 |
| | | */ |
| | | @Schema(hidden=true) |
| | | @JSONField(serialize = false) |
| | | public Long lastHistoryId; |
| | | |
| | | /** |
| | | * 取水口ID(外键) |
| | | */ |
| | | @Schema(description = "取水口实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 统计日期(yyyy-mm-dd),统计日期采用RTU上报数据日期,因为有累计流量相差的计算方法,所以补报数据被忽略 |
| | | */ |
| | | @Schema(description = "统计日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | public Date dt; |
| | | |
| | | /** |
| | | * 日取水量(不包括漏损水量) |
| | | */ |
| | | public Double amount; |
| | | |
| | | /** |
| | | * 最后计水量上报数据接收时间(yyyy-mm-dd hh:mm:ss) |
| | | */ |
| | | @Schema(description = "最后计水量上报数据接收时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date dtLast; |
| | | |
| | | /** |
| | | * 最后计水量的控制器地址 |
| | | */ |
| | | public String rtuAddrLast; |
| | | |
| | | /** |
| | | * 最后计水量的控制器ID(外键) |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long controllerIdLast; |
| | | |
| | | /** |
| | | * 最后计水量时控制器累计水量 |
| | | */ |
| | | public Double totalAmountLast; |
| | | |
| | | /** |
| | | * 最后计水量时控制器时钟(yyyy-mm-dd HH:MM:SS) |
| | | */ |
| | | @Schema(description = "最后计水量时控制器时钟", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Date rtuDtLast; |
| | | |
| | | } |
| | |
| | | public String rtuAddr; |
| | | |
| | | /** |
| | | * 数据接收日期时间 |
| | | * 统计日,这个日期采用RTU时钟,因为有补报的问题 |
| | | */ |
| | | @Schema(description = "上报日期时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | |
| | | |
| | | |
| | | public void valueFrom(DataV1_0_1 dV1_0_1, DataCdC0Vo cdData) throws Exception{ |
| | | this.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); |
| | | this.dt = DateTime.dateFrom_yyyy_MM_dd1(cdData.rtuDt); |
| | | this.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | this.dtRtu = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | this.lossAmount = cdData.lossAmount ;// 损失流量(从0时到当前的漏损累计流量,24时一个周期,0时归0)单位为m3。 |
| | |
| | | public String rtuAddr; |
| | | |
| | | /** |
| | | * 统计日 |
| | | * 统计日,这个日期采用RTU时钟,因为有补报的问题 |
| | | */ |
| | | @Schema(description = "统计日", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | |
| | | public Double lossAmount; |
| | | |
| | | public void valueFrom(DataV1_0_1 dV1_0_1, DataCdC0Vo cdData) throws Exception{ |
| | | this.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); |
| | | this.dt = DateTime.dateFrom_yyyy_MM_dd1(cdData.rtuDt); |
| | | this.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | this.dtRtu = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | this.lossAmount = cdData.lossAmount ;// 损失流量(从0时到当前的漏损累计流量,24时一个周期,0时归0)单位为m3。 |
| | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 农户实体ID(外键) |
| | | */ |
| | | @Schema(description = "农户实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | @Schema(description = "农户姓名", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String clientName; |
| | | |
| | | /** |
| | | * 控制器实体ID(外键) |
| | | */ |
| | |
| | | this.clThisEle = cdData.thisEle; |
| | | } |
| | | |
| | | public void updateFrom(DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo, boolean clearCloseValve) throws Exception { |
| | | public void updateFrom(DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo, Boolean clearCloseValve) throws Exception { |
| | | this.opDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | this.opType = dataCd83OpenVo.type; |
| | | this.opTotalAmount = dataCd83OpenVo.totalAmount; |
| | |
| | | this.opIcCardAddr = dataCd83OpenVo.icCardAddr; |
| | | this.opRemainMoney = dataCd83OpenVo.remainMoney; |
| | | this.openDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt); |
| | | if (clearCloseValve) { |
| | | if (clearCloseValve != null && clearCloseValve.booleanValue()) { |
| | | this.clDt = null; |
| | | this.clType = null; |
| | | this.clTotalAmount = null; |
| | |
| | | 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.DataCd97Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.DataV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd84Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd85Vo; |
| | |
| | | @Schema(hidden=true) |
| | | @JSONField(serialize = false) |
| | | public Long lastHistoryId; |
| | | |
| | | /** |
| | | * 农户实体ID(外键) |
| | | */ |
| | | @Schema(description = "农户实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | @Schema(description = "农户姓名", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String clientName; |
| | | |
| | | /** |
| | | * 控制器实体ID(外键) |
| | |
| | | this.opEleTotalAmount = null; //江海协议特有 |
| | | this.opWaterRemainUser = null; //江海协议特有 |
| | | this.openDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt); |
| | | |
| | | } |
| | | |
| | | |
| | | public void valueFrom(DataV1_0_1 dV1_0_1, DataCd83CloseVo dataCd83CloseVo) throws Exception { |
| | | this.clDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | |
| | | this.clThisEle = cdData.thisEle; |
| | | } |
| | | |
| | | public void updateFrom(DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo, boolean clearCloseValve) throws Exception { |
| | | public void updateFrom(DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo, Boolean clearCloseValve) throws Exception { |
| | | this.opDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | this.opType = dataCd83OpenVo.type; |
| | | this.opTotalAmount = dataCd83OpenVo.totalAmount; |
| | |
| | | this.opRemainMoney = dataCd83OpenVo.remainMoney; |
| | | this.openDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt); |
| | | |
| | | if (clearCloseValve) { |
| | | if (clearCloseValve != null && clearCloseValve.booleanValue()) { |
| | | this.clearCloseValue(); |
| | | } |
| | | } |
| | | |
| | | public void updateFrom(DataV1_0_1 dV1_0_1, DataCd83CloseVo dataCd83CloseVo, boolean clearOpenValve) throws Exception { |
| | | public void updateFrom(DataV1_0_1 dV1_0_1, DataCd83CloseVo dataCd83CloseVo, Boolean clearLastOpenValve) throws Exception { |
| | | this.clDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | this.clType = dataCd83CloseVo.type; |
| | | this.clTotalAmount = dataCd83CloseVo.totalAmount; |
| | |
| | | this.clOpenDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.openDt); |
| | | this.closeDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.closeDt) ; |
| | | |
| | | if(clearOpenValve){ |
| | | if(clearLastOpenValve != null && clearLastOpenValve.booleanValue()){ |
| | | this.clearOpenValue(); |
| | | } |
| | | } |
| | |
| | | public Long id; |
| | | |
| | | /** |
| | | * 农户实体ID(外键) |
| | | */ |
| | | @Schema(description = "农户实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | @Schema(description = "农户姓名", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String clientName; |
| | | /** |
| | | * 控制器实体ID(外键) |
| | | */ |
| | | @Schema(description = "控制器实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | public Long id; |
| | | |
| | | /** |
| | | * 农户实体ID(外键) |
| | | */ |
| | | @Schema(description = "农户实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | @Schema(description = "农户姓名", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String clientName; |
| | | |
| | | /** |
| | | * 控制器实体ID(外键) |
| | | */ |
| | | @Schema(description = "控制器实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | <settings> |
| | | <item1 item_name="lng" item_value="101.87345" remarks="经度"/> |
| | | <item2 item_name="lat" item_value="25.70424" remarks="纬度"/> |
| | | <item3 item_name="projectNo" item_value="10" remarks="项目编号"/> |
| | | <item4 item_name="controllerType" item_value="57" remarks="控制器类型"/> |
| | | <item5 item_name="protocolName" item_value="p206V202404" remarks="协议名称"/> |
| | | </settings> |
| | | <waterTypes> |
| | | <item1 typeName="灌溉用水"/> |
| | |
| | | <item5 typeName="绿化用水"/> |
| | | </waterTypes> |
| | | </org1> |
| | | <org2 name="sp"> |
| | | <districts> |
| | | <province name="天津" num="53" level="1"> |
| | | <city name="天津市" num="23" level="2"> |
| | | <country name="武清区" num="28" level="3" /> |
| | | </city> |
| | | </province> |
| | | </districts> |
| | | <user name="超级管理员" phone="admin" password="admin" supperAdmin="1" /> |
| | | <payments> |
| | | <item1 name="现金"/> |
| | | <item2 name="微信支付"/> |
| | | <item3 name="支付宝支付"/> |
| | | <item4 name="银行转账"/> |
| | | </payments> |
| | | <settings> |
| | | <item1 item_name="lng" item_value="101.87345" remarks="经度"/> |
| | | <item2 item_name="lat" item_value="25.70424" remarks="纬度"/> |
| | | </settings> |
| | | <waterTypes> |
| | | <item1 typeName="灌溉用水"/> |
| | | <item2 typeName="工业用水"/> |
| | | <item3 typeName="生活用水"/> |
| | | <item4 typeName="养殖用水"/> |
| | | <item5 typeName="绿化用水"/> |
| | | </waterTypes> |
| | | </org2> |
| | | </orgs> |
| | | </config> |
New file |
| | |
| | | <?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.RmIntakeAmountDayLastMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDayLast"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table rm_intake_amount_day_last--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="last_history_id" jdbcType="BIGINT" property="lastHistoryId" /> |
| | | <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, last_history_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_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_intake_amount_day_last |
| | | where intake_id = #{intakeId,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from rm_intake_amount_day_last |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDayLast"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_intake_amount_day_last (id, last_history_id, intake_id, dt, |
| | | amount, dt_last, |
| | | rtu_addr_last, controller_id_last, total_amount_last, |
| | | rtu_dt_last) |
| | | values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{dt,jdbcType=DATE}, |
| | | #{amount,jdbcType=DOUBLE}, #{dtLast,jdbcType=TIMESTAMP}, |
| | | #{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT}, |
| | | #{rtuDtLast,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDayLast"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_intake_amount_day_last |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="lastHistoryId != null"> |
| | | last_history_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="lastHistoryId != null"> |
| | | #{lastHistoryId,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.RmIntakeAmountDayLast"> |
| | | <!--@mbg.generated--> |
| | | update rm_intake_amount_day_last |
| | | <set> |
| | | <if test="lastHistoryId != null"> |
| | | last_history_id = #{lastHistoryId,jdbcType=BIGINT}, |
| | | </if> |
| | | <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.RmIntakeAmountDayLast"> |
| | | <!--@mbg.generated--> |
| | | update rm_intake_amount_day_last |
| | | set last_history_id = #{lastHistoryId,jdbcType=BIGINT}, |
| | | 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> |
| | | </mapper> |
New file |
| | |
| | | <?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"> |
| | | 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> |
| | | </mapper> |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table rm_open_close_valve_history--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="client_name" jdbcType="VARCHAR" property="clientName" /> |
| | | <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> |
| | | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> |
| | | <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, controller_id, intake_id, rtu_addr, op_dt, op_type, op_total_amount, op_ic_card_no, |
| | | id, client_id, client_name, |
| | | controller_id, intake_id, rtu_addr, op_dt, op_type, op_total_amount, op_ic_card_no, |
| | | op_ic_card_addr, op_remain_money, open_dt, op_order_no, op_ele_total_amount, op_water_remain_user, |
| | | cl_dt, cl_type, cl_total_amount, cl_ic_card_no, cl_ic_card_addr, cl_remain_money, |
| | | cl_this_amount, cl_this_money, cl_this_time, cl_open_dt, close_dt, cl_order_no, cl_ele_total_amount, |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_open_close_valve_history (id, controller_id, intake_id, |
| | | insert into rm_open_close_valve_history (id, client_id, client_name, |
| | | controller_id, intake_id, |
| | | rtu_addr, op_dt, op_type, |
| | | op_total_amount, op_ic_card_no, op_ic_card_addr, |
| | | op_remain_money, open_dt, op_order_no, |
| | |
| | | cl_this_money, cl_this_time, cl_open_dt, |
| | | close_dt, cl_order_no, cl_ele_total_amount, |
| | | cl_water_remain_user, cl_this_ele) |
| | | values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{clientName,jdbcType=VARCHAR}, |
| | | #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, #{opDt,jdbcType=TIMESTAMP}, #{opType,jdbcType=TINYINT}, |
| | | #{opTotalAmount,jdbcType=DOUBLE}, #{opIcCardNo,jdbcType=VARCHAR}, #{opIcCardAddr,jdbcType=VARCHAR}, |
| | | #{opRemainMoney,jdbcType=DOUBLE}, #{openDt,jdbcType=TIMESTAMP}, #{opOrderNo,jdbcType=VARCHAR}, |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id, |
| | |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | #{controllerId,jdbcType=BIGINT}, |
| | |
| | | <!--@mbg.generated--> |
| | | update rm_open_close_valve_history |
| | | <set> |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | </if> |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory"> |
| | | <!--@mbg.generated--> |
| | | update rm_open_close_valve_history |
| | | set controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | set client_id = #{clientId,jdbcType=BIGINT}, |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, |
| | | op_dt = #{opDt,jdbcType=TIMESTAMP}, |
| | |
| | | <!--@Table rm_open_close_valve_last--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="last_history_id" jdbcType="BIGINT" property="lastHistoryId" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="client_name" jdbcType="VARCHAR" property="clientName" /> |
| | | <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> |
| | | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> |
| | | <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, last_history_id, controller_id, intake_id, rtu_addr, op_dt, op_type, op_total_amount, |
| | | id, last_history_id, client_id, client_name, |
| | | controller_id, intake_id, rtu_addr, op_dt, op_type, op_total_amount, |
| | | op_ic_card_no, op_ic_card_addr, op_remain_money, open_dt, op_order_no, op_ele_total_amount, |
| | | op_water_remain_user, cl_dt, cl_type, cl_total_amount, cl_ic_card_no, cl_ic_card_addr, |
| | | cl_remain_money, cl_this_amount, cl_this_money, cl_this_time, cl_open_dt, close_dt, |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveLast"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_open_close_valve_last (id, last_history_id, controller_id, |
| | | insert into rm_open_close_valve_last (id, last_history_id, |
| | | client_id, client_name, controller_id, |
| | | intake_id, rtu_addr, op_dt, |
| | | op_type, op_total_amount, op_ic_card_no, |
| | | op_ic_card_addr, op_remain_money, open_dt, |
| | |
| | | cl_open_dt, close_dt, cl_order_no, |
| | | cl_ele_total_amount, cl_water_remain_user, cl_this_ele |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, |
| | | values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, |
| | | #{clientId,jdbcType=BIGINT}, #{clientName,jdbcType=VARCHAR}, #{controllerId,jdbcType=BIGINT}, |
| | | #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{opDt,jdbcType=TIMESTAMP}, |
| | | #{opType,jdbcType=TINYINT}, #{opTotalAmount,jdbcType=DOUBLE}, #{opIcCardNo,jdbcType=VARCHAR}, |
| | | #{opIcCardAddr,jdbcType=VARCHAR}, #{opRemainMoney,jdbcType=DOUBLE}, #{openDt,jdbcType=TIMESTAMP}, |
| | |
| | | </if> |
| | | <if test="lastHistoryId != null"> |
| | | last_history_id, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id, |
| | |
| | | </if> |
| | | <if test="lastHistoryId != null"> |
| | | #{lastHistoryId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | #{controllerId,jdbcType=BIGINT}, |
| | |
| | | <if test="lastHistoryId != null"> |
| | | last_history_id = #{lastHistoryId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | </if> |
| | |
| | | <!--@mbg.generated--> |
| | | update rm_open_close_valve_last |
| | | set last_history_id = #{lastHistoryId,jdbcType=BIGINT}, |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table rm_work_report_history--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="client_name" jdbcType="VARCHAR" property="clientName" /> |
| | | <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> |
| | | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> |
| | | <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, controller_id, intake_id, rtu_addr, dt, rtu_dt, order_no, ic_card_addr, ic_card_no, |
| | | id, client_id, client_name, |
| | | controller_id, intake_id, rtu_addr, dt, rtu_dt, order_no, ic_card_addr, ic_card_no, |
| | | water_level, water_press, water_instant, water_total, ele_total, money_remain, water_remain, |
| | | this_ele, this_water, this_money, this_duration, water_price, ele_price, a_volt, |
| | | b_volt, c_volt, a_current, b_current, c_current, battery_volt, water_meter_trans_volt, |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmWorkReportHistory"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_work_report_history (id, controller_id, intake_id, |
| | | insert into rm_work_report_history (id, client_id, client_name, |
| | | controller_id, intake_id, |
| | | rtu_addr, dt, rtu_dt, |
| | | order_no, ic_card_addr, ic_card_no, |
| | | water_level, water_press, water_instant, |
| | |
| | | a_current, b_current, c_current, |
| | | battery_volt, water_meter_trans_volt, water_meter_work_volt |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{clientName,jdbcType=VARCHAR}, |
| | | #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP}, |
| | | #{orderNo,jdbcType=VARCHAR}, #{icCardAddr,jdbcType=VARCHAR}, #{icCardNo,jdbcType=VARCHAR}, |
| | | #{waterLevel,jdbcType=FLOAT}, #{waterPress,jdbcType=FLOAT}, #{waterInstant,jdbcType=FLOAT}, |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id, |
| | |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | #{controllerId,jdbcType=BIGINT}, |
| | |
| | | <!--@mbg.generated--> |
| | | update rm_work_report_history |
| | | <set> |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | </if> |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmWorkReportHistory"> |
| | | <!--@mbg.generated--> |
| | | update rm_work_report_history |
| | | set controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | set client_id = #{clientId,jdbcType=BIGINT}, |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, |
| | | dt = #{dt,jdbcType=TIMESTAMP}, |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table rm_work_report_last--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="client_name" jdbcType="VARCHAR" property="clientName" /> |
| | | <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> |
| | | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> |
| | | <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, controller_id, intake_id, rtu_addr, dt, rtu_dt, order_no, ic_card_addr, ic_card_no, |
| | | id, client_id, client_name, |
| | | controller_id, intake_id, rtu_addr, dt, rtu_dt, order_no, ic_card_addr, ic_card_no, |
| | | water_level, water_press, water_instant, water_total, ele_total, money_remain, water_remain, |
| | | this_ele, this_water, this_money, this_duration, water_price, ele_price, a_volt, |
| | | b_volt, c_volt, a_current, b_current, c_current, battery_volt, water_meter_trans_volt, |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmWorkReportLast"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_work_report_last (id, controller_id, intake_id, |
| | | insert into rm_work_report_last (id, client_id, client_name, |
| | | controller_id, intake_id, |
| | | rtu_addr, dt, rtu_dt, |
| | | order_no, ic_card_addr, ic_card_no, |
| | | water_level, water_press, water_instant, |
| | |
| | | a_current, b_current, c_current, |
| | | battery_volt, water_meter_trans_volt, water_meter_work_volt |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{clientName,jdbcType=VARCHAR}, |
| | | #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP}, |
| | | #{orderNo,jdbcType=VARCHAR}, #{icCardAddr,jdbcType=VARCHAR}, #{icCardNo,jdbcType=VARCHAR}, |
| | | #{waterLevel,jdbcType=FLOAT}, #{waterPress,jdbcType=FLOAT}, #{waterInstant,jdbcType=FLOAT}, |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id, |
| | |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | #{controllerId,jdbcType=BIGINT}, |
| | |
| | | <!--@mbg.generated--> |
| | | update rm_work_report_last |
| | | <set> |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientName != null"> |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="controllerId != null"> |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | </if> |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmWorkReportLast"> |
| | | <!--@mbg.generated--> |
| | | update rm_work_report_last |
| | | set controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | set client_id = #{clientId,jdbcType=BIGINT}, |
| | | client_name = #{clientName,jdbcType=VARCHAR}, |
| | | controller_id = #{controllerId,jdbcType=BIGINT}, |
| | | intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, |
| | | dt = #{dt,jdbcType=TIMESTAMP}, |
| | |
| | | |
| | | <!--根据水卡编号获取水卡表主键及农户编号--> |
| | | <select id="getCardIdAndClientNum" resultType="java.util.Map"> |
| | | <!-- SELECT id AS cardId, clientNum FROM se_client_card WHERE cardNum = #{cardNum}--> |
| | | <!-- SELECT id AS cardId, clientNum FROM se_client_card WHERE cardNum = #{cardNum}--> |
| | | SELECT |
| | | card.id AS cardId, |
| | | cli.clientNum, |
| | | cli.id AS clientId |
| | | card.id AS cardId, |
| | | cli.clientNum, |
| | | cli.id AS clientId |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | WHERE card.cardNum = #{cardNum} |
| | | </select> |
| | | |
| | | <!-- 根据水卡编号获取水卡对应的农户id和姓名 --> |
| | | <select id="getClientIdAndNameByCardAddrAndCardNo" resultType="java.util.Map"> |
| | | SELECT |
| | | cli.id AS clientId, |
| | | cli.name AS clientName |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | WHERE card.cardAddr = #{cardAddr} and card.cardNum = #{cardNum} |
| | | </select> |
| | | |
| | | <!--根据行政区划串模糊查询水卡编号--> |
| | | <select id="getCardNumOfMax" resultType="java.lang.String"> |
| | |
| | | SELECT id FROM se_virtual_card WHERE vc_num = #{vcNum} |
| | | </select> |
| | | |
| | | <!--根据虚拟卡编号获取虚拟卡ID--> |
| | | <select id="getClientIdAndNameByVsCardNo" resultType="java.util.Map"> |
| | | SELECT |
| | | cli.id AS clientId, |
| | | cli.name AS clientName |
| | | FROM se_virtual_card card |
| | | INNER JOIN se_client cli ON card.client_id = cli.id |
| | | WHERE card.vc_num = #{vcNum} |
| | | </select> |
| | | |
| | | <!--根据行政区划串模糊查询虚拟卡编号--> |
| | | <select id="getVcCardNumOfMax" resultType="java.lang.String"> |
| | | SELECT vc_num |
| | |
| | | //不在线缓存的命令最大缓存时长 |
| | | ServerProperties.offLineCachTimeout = conf.getSetAttrPlusInt(doc, "config.base", "offLineCachTimeout", null, 15, 172800, null) * 1000L ; |
| | | //TCP上行数据时刻缓存时长,当达到时长时,TCP上行数据时刻被清空,采用TCP上行数据时刻目的是,阻止上数据同时下发数据,因为RTU处理不过来 |
| | | ServerProperties.lastUpDataTimeLive = conf.getSetAttrPlusInt(doc, "config.base", "lastUpDataTimeLive", null, 0, 5, null) * 1000L ; |
| | | ServerProperties.lastUpDataTimeLive = conf.getSetAttrPlusInt(doc, "config.base", "lastUpDataTimeLive", null, 0, 5000, null) * 1L ; |
| | | //数据库数据id生成器的id后缀,0是默认的后缀,一般web系统应用,数据中间件id后缀大于等于1 |
| | | ServerProperties.dbDataIdSuffix = conf.getSetAttrInt(doc, "config.base", "dbDataIdSuffix", null, 0, 99, null); |
| | | //上下行数据缓存队列中缓存数据个数的报警量,这个与现实项目所接水表数相关 |
| | |
| | | package com.dy.rtuMw.server.rtuData.dbSv; |
| | | |
| | | import com.dy.common.util.NumUtil; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.daoBa.BaClientMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerTrampMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.*; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; |
| | | import com.dy.pipIrrGlobal.pojoRm.*; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | |
| | | */ |
| | | @Service() |
| | | public class DbSv { |
| | | @Autowired |
| | | private SeClientCardMapper seClientCardMapperDao;//农户水卡DAO |
| | | @Autowired |
| | | private SeVirtualCardMapper seVirtualCardMapper;//农户虚拟水卡DAO |
| | | @Autowired |
| | | private PrControllerTrampMapper prControllerTrampMapperDao;//流浪控制器DAO |
| | | @Autowired |
| | |
| | | private RmWorkReportLastMapper rmWorkReportLastMapperDao ;//控制器最新工作报数据DAO |
| | | @Autowired |
| | | private RmWorkReportHistoryMapper rmWorkReportHistoryMapperDao ;//控制器历史工作报数据DAO |
| | | @Autowired |
| | | private RmIntakeAmountDayLastMapper rmIntakeAmountDayLastMapperDao ;//取水口取水和漏损统计最新数据DAO |
| | | @Autowired |
| | | private RmIntakeAmountDayMapper rmIntakeAmountDayMapperDao ;//取水口取水和漏损统计DAO |
| | | @Autowired |
| | | private RmLossLastMapper rmLossLastMapperDao ;//控制器漏损水量统计最新数据DAO |
| | | @Autowired |
| | |
| | | // 基础功能 |
| | | // |
| | | //////////////////////////////////////////////// |
| | | |
| | | /** |
| | | * 通过物理IC地址及卡号得到农户id和姓名 |
| | | * @param icCardAddr |
| | | * @param icCardNo |
| | | * @return |
| | | */ |
| | | public SeClient getClientIdAndNameByCardAddrAndCardNo(String icCardAddr, String icCardNo){ |
| | | SeClient vo = null ; |
| | | if(NumUtil.isPlusIntNumber(icCardNo)){ |
| | | Long icCardNoLong = Long.parseLong(icCardNo) ; |
| | | Map<String, Object> map = seClientCardMapperDao.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNoLong) ; |
| | | if(map != null && map.size() > 0) { |
| | | vo = new SeClient() ; |
| | | vo.setId(Long.parseLong(map.get("clientId").toString())); |
| | | vo.setName(map.get("clientName").toString()); |
| | | } |
| | | } |
| | | return vo ; |
| | | } |
| | | /** |
| | | * 通过虚拟IC卡号得到农户id和姓名 |
| | | * @param icCardNo |
| | | * @return |
| | | */ |
| | | public SeClient getClientIdAndNameByVsCardNo(String icCardNo){ |
| | | SeClient vo = null ; |
| | | if(NumUtil.isPlusIntNumber(icCardNo)){ |
| | | Long icCardNoLong = Long.parseLong(icCardNo) ; |
| | | Map<String, Object> map = seVirtualCardMapper.getClientIdAndNameByVsCardNo(icCardNoLong) ; |
| | | if(map != null && map.size() > 0) { |
| | | vo = new SeClient() ; |
| | | vo.setId(Long.parseLong(map.get("clientId").toString())); |
| | | vo.setName(map.get("clientName").toString()); |
| | | } |
| | | } |
| | | return vo ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过控制器地址从数据库表中查询控制器 |
| | | * @param rtuAddr 控制器地址 |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updatePrConctrollerTramp(PrControllerTramp po){ |
| | | this.prControllerTrampMapperDao.updateByPrimaryKeySelective(po) ; |
| | | this.prControllerTrampMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmAlarmStateLast(RmAlarmStateLast po){ |
| | | this.rmAlarmStateLastMapperDao.updateByPrimaryKeySelective(po) ; |
| | | this.rmAlarmStateLastMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器报警与状态历史记录 |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmTimingReportLast(RmTimingReportLast po) { |
| | | this.rmTimingReportLastDao.updateByPrimaryKeySelective(po); |
| | | this.rmTimingReportLastDao.updateByPrimaryKey(po); |
| | | } |
| | | |
| | | ///////////////////////////////////////////////// |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmOnHourReportLast(RmOnHourReportLast po) { |
| | | this.rmOnHourReportLastDao.updateByPrimaryKeySelective(po); |
| | | this.rmOnHourReportLastDao.updateByPrimaryKey(po); |
| | | } |
| | | |
| | | ///////////////////////////////////////////////// |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmOpenCloseValveLast(RmOpenCloseValveLast po){ |
| | | this.rmOpenCloseValveLastMapperDao.updateByPrimaryKeySelective(po) ; |
| | | this.rmOpenCloseValveLastMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | /** |
| | | * 得到控制器开关阀上报数据历史数据中的最新记录 |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmOpenCloseValveHistory(RmOpenCloseValveHistory po){ |
| | | this.rmOpenCloseValveHistoryMapperDao.updateByPrimaryKeySelective(po) ; |
| | | this.rmOpenCloseValveHistoryMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | |
| | | ///////////////////////////////////////////////// |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmWorkReportLast(RmWorkReportLast po){ |
| | | this.rmWorkReportLastMapperDao.updateByPrimaryKeySelective(po) ; |
| | | this.rmWorkReportLastMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器上报数据历史记录 |
| | |
| | | this.rmWorkReportHistoryMapperDao.insert(po) ; |
| | | } |
| | | |
| | | ///////////////////////////////////////////////// |
| | | // |
| | | // 取水口日取水量统计功能 |
| | | // |
| | | //////////////////////////////////////////////// |
| | | /** |
| | | * 得到控制器漏损水量统计最新记录 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | public RmIntakeAmountDayLast getRmIntakeAmountLast(Long intakeId){ |
| | | List<RmIntakeAmountDayLast> list = rmIntakeAmountDayLastMapperDao.selectByIntakeId(intakeId) ; |
| | | if(list != null && list.size() > 0){ |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRmIntakeAmountLast(RmIntakeAmountDayLast po){ |
| | | this.rmIntakeAmountDayLastMapperDao.insert(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRmIntakeAmountDay(RmIntakeAmountDay po){ |
| | | this.rmIntakeAmountDayMapperDao.insert(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmIntakeAmountLast(RmIntakeAmountDay po){ |
| | | this.rmIntakeAmountDayMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmIntakeAmountDay(RmIntakeAmountDay po){ |
| | | this.rmIntakeAmountDayMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | |
| | | /** |
| | | * 得到控制器漏损水量统计历史记录中的最新记录 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public RmIntakeAmountDay getRmIntakeAmountDay(Long id){ |
| | | return rmIntakeAmountDayMapperDao.selectByPrimaryKey(id) ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 得到控制器漏损水量统计最新记录 |
| | | * @param dt |
| | | * @return |
| | | */ |
| | | public RmIntakeAmountDay getRmIntakeAmountLastByDate(Date dt){ |
| | | List<RmIntakeAmountDay> list = rmIntakeAmountDayMapperDao.selectByDate(dt) ; |
| | | if(list != null && list.size() > 0){ |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | |
| | | /** |
| | | * 得到控制器漏损水量统计历史记录中的某日记录 |
| | | * @param dt |
| | | * @return |
| | | */ |
| | | public RmIntakeAmountDay getRmIntakeAmountDayByDate(Date dt){ |
| | | List<RmIntakeAmountDay> list = rmIntakeAmountDayMapperDao.selectByDate(dt) ; |
| | | if(list != null && list.size() > 0){ |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | |
| | | ///////////////////////////////////////////////// |
| | | // |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmLossLast(RmLossLast po){ |
| | | this.rmLossLastMapperDao.updateByPrimaryKeySelective(po) ; |
| | | this.rmLossLastMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmLossHistory(RmLossHistory po){ |
| | | this.rmLossHistoryMapperDao.updateByPrimaryKeySelective(po) ; |
| | | this.rmLossHistoryMapperDao.updateByPrimaryKey(po) ; |
| | | } |
| | | |
| | | /** |
| | |
| | | return rmCommandHistoryDao.selectByPrimaryKey(Long.parseLong(commandId)) ; |
| | | } |
| | | public void updateCommandLog(RmCommandHistory po){ |
| | | rmCommandHistoryDao.updateByPrimaryKeySelective(po) ; |
| | | rmCommandHistoryDao.updateByPrimaryKey(po) ; |
| | | } |
| | | |
| | | |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveLast; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import org.apache.logging.log4j.LogManager; |
| | |
| | | Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; |
| | | DbSv sv = (DbSv)objs[0] ; |
| | | PrController controller = (PrController)objs[1] ; |
| | | SeClient clientVo = (SeClient)objs[3] ;//这个值对象中只有id和name会有值 |
| | | try{ |
| | | this.doDeal(sv, controller, d.getRtuAddr(), dV1_0_1, (DataCd83CloseVo)cdObj) ; |
| | | this.doDeal(sv, clientVo, controller, d.getRtuAddr(), dV1_0_1, (DataCd83CloseVo)cdObj) ; |
| | | }catch (Exception e){ |
| | | log.error("保存控制器开阀上报时发生异常", e); |
| | | } |
| | |
| | | /** |
| | | * 保存数据 |
| | | * @param sv 服务 |
| | | * @param clientVo 农户对象(不为空时,只有id和name有值) |
| | | * @param clientVo 农户对象 |
| | | * @param controller 控制器对象 |
| | | * @param rtuAddr 控制器地址 |
| | | * @param dV1_0_1 上报数据 |
| | | * @param dataCd83CloseVo 关阀上报数据对象 |
| | | */ |
| | | private void doDeal(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83CloseVo dataCd83CloseVo) throws Exception { |
| | | private void doDeal(DbSv sv, SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83CloseVo dataCd83CloseVo) throws Exception { |
| | | RmOpenCloseValveLast poLast = sv.getRmOpenCloseValveLast(controller.getIntakeId()) ; |
| | | if(poLast == null){ |
| | | //数据库中不存在该控制器的开关阀数据 |
| | | //首先生成最新数据及历史数据,并先保存 |
| | | poLast = this.newRmOpenCloseValveLast(controller, rtuAddr, dV1_0_1, dataCd83CloseVo); |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | poLast = this.newRmOpenCloseValveLast(clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo); |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | //保存最新数据 |
| | | sv.saveRmOpenCloseValveLast(poLast); |
| | | }else{ |
| | | //数据库中存在该控制器的开关阀数据 |
| | | if(poLast.closeDt != null && poLast.clIcCardAddr != null && poLast.clIcCardNo != null){ |
| | | if(poLast.closeDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.closeDt)) |
| | | && poLast.clIcCardAddr.equals(dataCd83CloseVo.icCardAddr) |
| | | && poLast.clIcCardNo.equals(dataCd83CloseVo.icCardNo)){ |
| | | //重复上报,原因是下行数据处理慢了,就重复上报了 |
| | | return ; |
| | | } |
| | | } |
| | | if(poLast.clType == null){ |
| | | //原记录不存在关阀数据,所以当前关阀上报是新的一次关阀 |
| | | if(poLast.opType == null || poLast.openDt == null){ |
| | | //原记录中不存在开阀数据(即开阀与关阀数据都没有,这种情况一般不存在),没办法进行匹配 |
| | | //生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | }else{ |
| | | //原记录中存在开阀数据,进行历史数据匹配 |
| | | RmOpenCloseValveHistory poHistory = null ; |
| | |
| | | if(poHistory.openDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.openDt))){ |
| | | //匹配成功 |
| | | //当前关阀是原记录中开阀的对应关阀 |
| | | this.updateCloseValve(controller, poLast, poHistory, dV1_0_1, dataCd83CloseVo, false) ; |
| | | this.updateCloseValve(clientVo, controller, poLast, poHistory, dV1_0_1, dataCd83CloseVo, false) ; |
| | | sv.updateRmOpenCloseValveHistory(poHistory); |
| | | }else if(poHistory.openDt.after(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.openDt))){ |
| | | //匹配失败(对于after:等于或晚于都返回true) |
| | | //本地最新数据中的开阀时间晚于当前关阀上报中的开阀时间,说明是补报 |
| | | this.dealSupplyReport() ; |
| | | }else{ |
| | | //匹配失败 |
| | | //当前关阀不是原记录中开阀的对应关阀,生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | //本地最新数据中的开阀时间早于当前关阀上报中的开阀时间,说明是新的一次关阀报,而且对应关阀报的上一次开阀报未收到 |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | } |
| | | }else{ |
| | | //这种情况不存在,认为匹配失败 |
| | | //当前关阀不是原记录中开阀的对应关阀,生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | } |
| | | }else{ |
| | | //没有历史数据,生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | //没有历史数据,这种情况不存在,认为匹配失败,生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | } |
| | | }else{ |
| | | //没有历史数据,生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | //没有历史数据,这种情况不存在,认为匹配失败,生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, true); |
| | | } |
| | | } |
| | | }else if(poLast.opType != null){ |
| | | //原记录存在关阀数据,也存在开阀数据,首先进行开关阀时间对比 |
| | | if(poLast.closeDt != null && poLast.closeDt.after(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.closeDt))){ |
| | | //补报的许久之前的数据,不进行处理 |
| | | }else if(poLast.closeDt != null && poLast.closeDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.closeDt))){ |
| | | if(poLast.closeDt != null && poLast.closeDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.closeDt))){ |
| | | //重复上报了,不进行处理 |
| | | }else if(poLast.closeDt != null && poLast.closeDt.after(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.closeDt))){ |
| | | //补报的许久之前的数据(对于after:等于或晚于都返回true) |
| | | this.dealSupplyReport() ; |
| | | }else { |
| | | //当前上报的关阀数据晚于原来的关阀数据,是新的上报关阀数据 |
| | | this.updateCloseValve(controller, poLast, null, dV1_0_1, dataCd83CloseVo, true) ; |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | //是新的上报关阀数据 |
| | | //进行历史数据匹配 |
| | | RmOpenCloseValveHistory poHistory = null ; |
| | | if(poLast.lastHistoryId != null) { |
| | | poHistory = sv.getRmOpenCloseValveHistory(poLast.lastHistoryId); |
| | | if (poHistory != null) { |
| | | if(poHistory.openDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83CloseVo.openDt))){ |
| | | //匹配上了 |
| | | this.updateCloseValve(clientVo, controller, poLast, poHistory, dV1_0_1, dataCd83CloseVo, false) ; |
| | | sv.updateRmOpenCloseValveHistory(poHistory); |
| | | }else{ |
| | | //上个关阀报未上报 |
| | | this.updateCloseValve(clientVo, controller, poLast, null, dV1_0_1, dataCd83CloseVo, true) ; |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | } |
| | | }else{ |
| | | //这种情况不存在,但为安全也进行处理,也认为上个关阀报未上报 |
| | | this.updateCloseValve(clientVo, controller, poLast, null, dV1_0_1, dataCd83CloseVo, true) ; |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | } |
| | | }else{ |
| | | //这种情况不存在,但为安全也进行处理,也认为上个关阀报未上报 |
| | | this.updateCloseValve(clientVo, controller, poLast, null, dV1_0_1, dataCd83CloseVo, true) ; |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | } |
| | | } |
| | | }else{ |
| | | //if(po.opType == null) |
| | | //原记录不存在开阀数据也不存在关阀数据,这种情况不存在,但为安全也进行处理 |
| | | this.updateCloseValve(controller, poLast, null, dV1_0_1, dataCd83CloseVo, false) ; |
| | | //生成并保存新的关阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | //原记录不存在开阀数据也不存在关阀数据,这种情况不存在,但为安全也进行处理,也认为上个关阀报未上报 |
| | | this.updateCloseValve(clientVo, controller, poLast, null, dV1_0_1, dataCd83CloseVo, true) ; |
| | | //生成并保存新的关阀上报历史数据记录,没有对应的开发数据 |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo, poLast, null); |
| | | } |
| | | |
| | | sv.updateRmOpenCloseValveLast(poLast); |
| | | } |
| | | } |
| | | |
| | | private void dealSupplyReport(){ |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param dV1_0_1 |
| | | * @param dataCd83CloseVo |
| | | * @param poLast |
| | | * @param clearLastOpenValue |
| | | * @throws Exception |
| | | */ |
| | | private void newHistoryDataDeal(DbSv sv, |
| | | SeClient clientVo, |
| | | PrController controller, |
| | | String rtuAddr, |
| | | DataV1_0_1 dV1_0_1, |
| | | DataCd83CloseVo dataCd83CloseVo, |
| | | RmOpenCloseValveLast poLast, |
| | | Boolean clearOpenValue)throws Exception { |
| | | RmOpenCloseValveHistory poHistory = this.newRmOpenCloseValveHistory(controller, rtuAddr, dV1_0_1, dataCd83CloseVo) ; |
| | | Boolean clearLastOpenValue)throws Exception { |
| | | RmOpenCloseValveHistory poHistory = this.newRmOpenCloseValveHistory(clientVo, controller, rtuAddr, dV1_0_1, dataCd83CloseVo) ; |
| | | sv.saveRmOpenCloseValveHistory(poHistory); |
| | | //由最新数据持有历史数据中的最新记录ID,以方便快速查询 |
| | | poLast.lastHistoryId = poHistory == null ? null: poHistory.id ; |
| | | if(clearOpenValue != null && clearOpenValue.booleanValue()){ |
| | | if(clearLastOpenValue != null && clearLastOpenValue.booleanValue()){ |
| | | poLast.clearOpenValue(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成新的关阀上报最新数据记录 |
| | | * @param clientVo |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmOpenCloseValveLast newRmOpenCloseValveLast(PrController controller, |
| | | private RmOpenCloseValveLast newRmOpenCloseValveLast(SeClient clientVo, |
| | | PrController controller, |
| | | String rtuAddr, |
| | | DataV1_0_1 dV1_0_1, |
| | | DataCd83CloseVo dataCd83CloseVo)throws Exception { |
| | | RmOpenCloseValveLast po = new RmOpenCloseValveLast() ; |
| | | po.clientId = clientVo==null?null:clientVo.getId() ; |
| | | po.clientName = clientVo==null?null:clientVo.getName() ; |
| | | po.controllerId = controller==null?null:controller.getId() ; |
| | | po.intakeId = controller==null?null:controller.getIntakeId() ; |
| | | po.rtuAddr = rtuAddr ; |
| | |
| | | |
| | | /** |
| | | * 生成新的关阀上报历史数据记录 |
| | | * @param clientVo |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmOpenCloseValveHistory newRmOpenCloseValveHistory(PrController controller, |
| | | private RmOpenCloseValveHistory newRmOpenCloseValveHistory(SeClient clientVo, |
| | | PrController controller, |
| | | String rtuAddr, |
| | | DataV1_0_1 dV1_0_1, |
| | | DataCd83CloseVo dataCd83CloseVo)throws Exception { |
| | | RmOpenCloseValveHistory po = new RmOpenCloseValveHistory() ; |
| | | po.clientId = clientVo==null?null:clientVo.getId() ; |
| | | po.clientName = clientVo==null?null:clientVo.getName() ; |
| | | po.controllerId = controller==null?null:controller.getId() ; |
| | | po.intakeId = controller==null?null:controller.getIntakeId() ; |
| | | po.rtuAddr = rtuAddr ; |
| | |
| | | |
| | | /** |
| | | * 更新数据 |
| | | * @param clientVo |
| | | * @param controller |
| | | * @param poLast |
| | | * @param poHistory |
| | | * @param dV1_0_1 |
| | | * @param dataCd83CloseVo |
| | | * @param clearOpenValve |
| | | * @param clearLastOpenValue |
| | | * @throws Exception |
| | | */ |
| | | private void updateCloseValve(PrController controller, |
| | | private void updateCloseValve(SeClient clientVo, |
| | | PrController controller, |
| | | RmOpenCloseValveLast poLast, |
| | | RmOpenCloseValveHistory poHistory, |
| | | DataV1_0_1 dV1_0_1, |
| | | DataCd83CloseVo dataCd83CloseVo, |
| | | boolean clearOpenValve) throws Exception { |
| | | boolean clearLastOpenValue) throws Exception { |
| | | poLast.clientId = clientVo==null?null:clientVo.getId() ; |
| | | poLast.clientName = clientVo==null?null:clientVo.getName() ; |
| | | poLast.controllerId = controller==null?null:controller.getId(); |
| | | poLast.intakeId = controller==null?null:controller.getIntakeId(); |
| | | |
| | | poLast.updateFrom(dV1_0_1, dataCd83CloseVo, clearOpenValve); |
| | | poLast.updateFrom(dV1_0_1, dataCd83CloseVo, clearLastOpenValue); |
| | | |
| | | if(poHistory != null){ |
| | | poHistory.clientId = clientVo==null?null:clientVo.getId() ; |
| | | poHistory.clientName = clientVo==null?null:clientVo.getName() ; |
| | | poHistory.controllerId = controller==null?null:controller.getId(); |
| | | poHistory.intakeId = controller==null?null:controller.getIntakeId(); |
| | | |
| | | poHistory.updateFrom(dV1_0_1, dataCd83CloseVo, clearOpenValve); |
| | | poHistory.updateFrom(dV1_0_1, dataCd83CloseVo, false); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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.common.mw.protocol.p206V1_0_0.upVos.DataCdC0Vo; |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDayLast; |
| | | 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/7/8 19:00 |
| | | * @Description 取水口日用水量和漏损量 |
| | | */ |
| | | public class TkDealIntakeAmountDay extends TaskSurpport { |
| | | |
| | | private static final Logger log = LogManager.getLogger(TkDealLoss.class.getName()); |
| | | |
| | | //类ID,一定与Tree.xml配置文件中配置一致 |
| | | public static final String taskId = "TkDealIntakeAmountDay"; |
| | | |
| | | /** |
| | | * 执行节点任务: 取水口日用水量和漏损量 |
| | | * |
| | | * @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 DataCdC0Vo |
| | | || cdObj instanceof DataCd84Vo |
| | | || cdObj instanceof DataCd83OpenVo |
| | | || cdObj instanceof DataCd83CloseVo)){ |
| | | Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; |
| | | DbSv sv = (DbSv)objs[0] ; |
| | | PrController controller = (PrController)objs[1] ; |
| | | try{ |
| | | UpDataVo vo = new UpDataVo() ; |
| | | if(cdObj instanceof DataCdC0Vo){ |
| | | vo.valueFrom((DataCdC0Vo)cdObj, null, null, null); |
| | | }else if(cdObj instanceof DataCd84Vo){ |
| | | vo.valueFrom(null, (DataCd84Vo)cdObj, null, null); |
| | | }else if(cdObj instanceof DataCd83OpenVo){ |
| | | vo.valueFrom(null,null, (DataCd83OpenVo)cdObj,null); |
| | | }else if(cdObj instanceof DataCd83CloseVo){ |
| | | vo.valueFrom(null,null,null, (DataCd83CloseVo)cdObj); |
| | | } |
| | | this.doDeal(sv, controller, d.getRtuAddr(), dV1_0_1, vo); |
| | | }catch (Exception e){ |
| | | log.error("保存取水口日用水量和漏损量数据时发生异常", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 业务处理 |
| | | * @param sv 服务 |
| | | * @param controller 控制器对象 |
| | | * @param rtuAddr 控制器地址 |
| | | * @param dV1_0_1 上报数据 |
| | | * @param dataVo 上报数据对象 |
| | | */ |
| | | private void doDeal(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo dataVo) throws Exception { |
| | | RmIntakeAmountDayLast poLast = sv.getRmIntakeAmountLast(controller.getIntakeId()); |
| | | if (poLast == null) { |
| | | //数据库中不存在该取水口的漏损数据 |
| | | //首先生成最新数据及历史数据,并先保存 |
| | | poLast = this.newRmIntakeAmountLast(controller, rtuAddr, dV1_0_1, dataVo); |
| | | this.newAndSaveHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataVo, poLast); |
| | | sv.saveRmIntakeAmountLast(poLast); |
| | | } else { |
| | | if(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataVo.rtuDt).before(poLast.rtuDtLast)){ |
| | | //RTU时钟早于本地RTU时钟,是补报,补报没法计算取水口日累计取水量,因为采用的是累计流量相差的计算方法 |
| | | }else if(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataVo.rtuDt).equals(poLast.rtuDtLast)){ |
| | | //RTU时钟等于本地RTU时钟,重复上报数据,不进行任何处理 |
| | | }else{ |
| | | //上行数据中的日期时间符合可计算的条件 |
| | | if(!rtuAddr.equals(poLast.rtuAddrLast)){ |
| | | //更换了控制器,只更换控制器地址,不进行水量计算 |
| | | poLast = this.updateRmIntakeAmountLastByControllerChange(poLast, controller, rtuAddr, dV1_0_1, dataVo); |
| | | //因为上行数据中的日期时间是可进行计算的,所以新生成一个历史记录 |
| | | this.newAndSaveHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataVo, poLast); |
| | | sv.saveRmIntakeAmountLast(poLast); |
| | | }else{ |
| | | //未更换控制器 |
| | | if(DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt).equals(poLast.dt)){ |
| | | //同一天数据 |
| | | poLast = this.updateRmIntakeAmountLastBySameDateNewData(poLast, controller, rtuAddr, dV1_0_1, dataVo); |
| | | RmIntakeAmountDay poHistory = null ; |
| | | if(poLast.lastHistoryId != null){ |
| | | poHistory = sv.getRmIntakeAmountDay(poLast.lastHistoryId) ; |
| | | } |
| | | if(poHistory == null){ |
| | | this.newAndSaveHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataVo, poLast); |
| | | }else{ |
| | | poHistory = this.updateRmIntakeAmountBySameDateNewData(poHistory, poLast, controller, rtuAddr, dV1_0_1, dataVo); |
| | | sv.updateRmIntakeAmountDay(poHistory); |
| | | } |
| | | sv.saveRmIntakeAmountLast(poLast); |
| | | }else if(DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt).after(poLast.dt)){ |
| | | //新的日期 |
| | | poLast = this.updateRmIntakeAmountLastByNewDateNewData(poLast, controller, rtuAddr, dV1_0_1, dataVo); |
| | | this.newAndSaveHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataVo, poLast); |
| | | sv.saveRmIntakeAmountLast(poLast); |
| | | }else{ |
| | | //这种情况不存在 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成新的控制器漏损日统计最新记录 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmIntakeAmountDayLast newRmIntakeAmountLast(PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo cdData)throws Exception { |
| | | RmIntakeAmountDayLast po = new RmIntakeAmountDayLast() ; |
| | | po.intakeId = controller==null?null:controller.getIntakeId(); |
| | | po.controllerIdLast = controller==null?null:controller.getId(); |
| | | po.totalAmountLast = cdData.totalAmount ; |
| | | po.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); |
| | | po.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | po.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | po.amount = 0.0D ; |
| | | po.rtuAddrLast = rtuAddr; |
| | | return po ; |
| | | } |
| | | |
| | | /** |
| | | * 生成新的控制器漏损日统计历史记录 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmIntakeAmountDay newRmIntakeAmountDay(PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo cdData, RmIntakeAmountDayLast lastPo)throws Exception { |
| | | RmIntakeAmountDay po = new RmIntakeAmountDay() ; |
| | | po.intakeId = controller==null?null:controller.getIntakeId(); |
| | | po.controllerIdLast = controller==null?null:controller.getId(); |
| | | po.rtuAddrLast = rtuAddr; |
| | | po.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); |
| | | po.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | po.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | if(lastPo != null){ |
| | | po.amount = lastPo.amount ; |
| | | }else{ |
| | | po.amount = 0.0D ; |
| | | } |
| | | po.amount = lastPo==null?0.0D:lastPo.amount ; |
| | | po.totalAmountLast = cdData.totalAmount ; |
| | | return po ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存新的开阀上报历史数据记录,并把ID赋值给最新记录的 lastHistoryId |
| | | * @param sv |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param dataCdC0Vo |
| | | * @param poLast |
| | | * @throws Exception |
| | | * @return RmIntakeAmountDay |
| | | */ |
| | | private RmIntakeAmountDay newAndSaveHistoryDataDeal(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo dataCdC0Vo, RmIntakeAmountDayLast poLast)throws Exception { |
| | | RmIntakeAmountDay poHistory = this.newRmIntakeAmountDay(controller, rtuAddr, dV1_0_1, dataCdC0Vo, poLast) ; |
| | | sv.saveRmIntakeAmountDay(poHistory); |
| | | //由最新数据持有历史数据中的最新记录ID,以方便快速查询 |
| | | poLast.lastHistoryId = poHistory == null ? null: poHistory.id ; |
| | | return poHistory ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成新的控制器漏损日统计最新记录 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmIntakeAmountDayLast updateRmIntakeAmountLastByControllerChange(RmIntakeAmountDayLast lastPo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo cdData)throws Exception { |
| | | lastPo.intakeId = controller==null?null:controller.getIntakeId(); |
| | | lastPo.controllerIdLast = controller==null?null:controller.getId(); |
| | | lastPo.rtuAddrLast = rtuAddr; |
| | | lastPo.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt); |
| | | lastPo.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | lastPo.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | //lastPo.amount = lastPo.amount ; //累计取水量不变 |
| | | lastPo.totalAmountLast = cdData.totalAmount ; |
| | | return lastPo ; |
| | | } |
| | | |
| | | /** |
| | | * 更新最新记录 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmIntakeAmountDayLast updateRmIntakeAmountLastBySameDateNewData(RmIntakeAmountDayLast lastPo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo cdData)throws Exception { |
| | | lastPo.intakeId = controller==null?null:controller.getIntakeId(); |
| | | lastPo.controllerIdLast = controller==null?null:controller.getId(); |
| | | lastPo.rtuAddrLast = rtuAddr; |
| | | //lastPo.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt);//日期没变 |
| | | lastPo.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | lastPo.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | Double difference = cdData.totalAmount - lastPo.totalAmountLast ; |
| | | if(difference > 0){ |
| | | lastPo.amount = difference; |
| | | }else{ |
| | | //po.amount = po.amount ; //累计取水量不变 |
| | | } |
| | | lastPo.totalAmountLast = cdData.totalAmount ; |
| | | return lastPo ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新最新记录 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmIntakeAmountDayLast updateRmIntakeAmountLastByNewDateNewData(RmIntakeAmountDayLast lastPo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo cdData)throws Exception { |
| | | lastPo.intakeId = controller==null?null:controller.getIntakeId(); |
| | | lastPo.controllerIdLast = controller==null?null:controller.getId(); |
| | | lastPo.rtuAddrLast = rtuAddr; |
| | | lastPo.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt);//日期变了 |
| | | lastPo.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | lastPo.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | Double difference = cdData.totalAmount - lastPo.totalAmountLast ; |
| | | if(difference > 0){ |
| | | lastPo.amount = difference; |
| | | }else{ |
| | | lastPo.amount = 0.0D; //日累计水量归0 |
| | | } |
| | | lastPo.totalAmountLast = cdData.totalAmount ; |
| | | return lastPo ; |
| | | } |
| | | |
| | | /** |
| | | * 更新历史记录 |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmIntakeAmountDay updateRmIntakeAmountBySameDateNewData(RmIntakeAmountDay po, RmIntakeAmountDayLast lastPo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, UpDataVo cdData)throws Exception { |
| | | po.intakeId = controller==null?null:controller.getIntakeId(); |
| | | po.controllerIdLast = controller==null?null:controller.getId(); |
| | | po.rtuAddrLast = rtuAddr; |
| | | po.dt = lastPo.dt ; |
| | | po.dtLast = lastPo.dtLast; |
| | | po.rtuDtLast = lastPo.rtuDtLast; |
| | | |
| | | po.amount = lastPo.amount ; |
| | | po.totalAmountLast = lastPo.totalAmountLast ; |
| | | |
| | | return po ; |
| | | } |
| | | |
| | | |
| | | public class UpDataVo{ |
| | | public Double totalAmount; //累计流量:5字节BCD码,取值范围0~9999999999,单位为m3。 |
| | | public String rtuDt ;//控制器时钟 |
| | | |
| | | public void valueFrom(DataCdC0Vo voC0, DataCd84Vo vo84, DataCd83OpenVo vo83Op, DataCd83CloseVo vo83Cl){ |
| | | if(voC0 != null){ |
| | | this.totalAmount = voC0.totalAmount ; |
| | | this.rtuDt = voC0.rtuDt ; |
| | | }else if(vo84 != null){ |
| | | this.totalAmount = vo84.totalAmount ; |
| | | this.rtuDt = vo84.rtuDt ; |
| | | }else if(vo83Op != null){ |
| | | this.totalAmount = vo83Op.totalAmount ; |
| | | this.rtuDt = vo83Op.rtuDt ; |
| | | }else if(vo83Cl != null){ |
| | | this.totalAmount = vo83Cl.totalAmount ; |
| | | this.rtuDt = vo83Cl.rtuDt ; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.dy.rtuMw.server.rtuData.p206V1_0_0; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossLast; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import com.dy.common.mw.protocol.Data; |
| | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmLossLast; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | * @Author liurunyu |
| | | * @Date 2024/2/28 16:31 |
| | | * @LastEditTime 2024/2/28 16:31 |
| | | * @Description 控制器漏损统计 |
| | | * @Description 取水口漏损统计 |
| | | */ |
| | | public class TkDealLoss extends TaskSurpport { |
| | | |
| | |
| | | try{ |
| | | this.doDeal(sv, controller, d.getRtuAddr(), dV1_0_1, (DataCdC0Vo)cdObj); |
| | | }catch (Exception e){ |
| | | log.error("保存遥测站自报实时数据中的漏损数据时发生异常", e); |
| | | log.error("保存取水口漏损统计数据时发生异常", e); |
| | | } |
| | | } |
| | | } |
| | |
| | | private void doDeal(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCdC0Vo dataCdC0Vo) throws Exception { |
| | | RmLossLast poLast = sv.getRmLossLast(controller.getIntakeId()); |
| | | if (poLast == null) { |
| | | //数据库中不存在该控制器的漏损数据 |
| | | //数据库中不存在该取水口的漏损数据 |
| | | //首先生成最新数据及历史数据,并先保存 |
| | | poLast = this.newRmLossLast(controller, rtuAddr, dV1_0_1, dataCdC0Vo); |
| | | this.newAndSaveHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCdC0Vo, poLast); |
| | |
| | | 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.common.util.DateTime; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveLast; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import org.apache.logging.log4j.LogManager; |
| | |
| | | Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; |
| | | DbSv sv = (DbSv)objs[0] ; |
| | | PrController controller = (PrController)objs[1] ; |
| | | SeClient clientVo = (SeClient)objs[3] ;//这个值对象中只有id和name会有值 |
| | | try{ |
| | | this.doDeal(sv, controller, d.getRtuAddr(), dV1_0_1, (DataCd83OpenVo)cdObj) ; |
| | | this.doDeal(sv, clientVo, controller, d.getRtuAddr(), dV1_0_1, (DataCd83OpenVo)cdObj) ; |
| | | }catch (Exception e){ |
| | | log.error("保存控制器开阀上报时发生异常", e); |
| | | } |
| | |
| | | /** |
| | | * 业务处理 |
| | | * @param sv 服务 |
| | | * @param clientVo 农户对象(不为空时,只有id和name有值) |
| | | * @param controller 控制器对象 |
| | | * @param rtuAddr 控制器地址 |
| | | * @param dV1_0_1 上报数据 |
| | | * @param dataCd83OpenVo 开阀上报数据对象 |
| | | */ |
| | | private void doDeal(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo) throws Exception { |
| | | private void doDeal(DbSv sv, SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo) throws Exception { |
| | | RmOpenCloseValveLast poLast = sv.getRmOpenCloseValveLast(controller.getIntakeId()) ; |
| | | if(poLast == null){ |
| | | //数据库中不存在该控制器的开关阀数据 |
| | | //首先生成开关阀的最新数据及历史数据,并先保存 |
| | | poLast = this.newRmOpenCloseValveLast(controller, rtuAddr, dV1_0_1, dataCd83OpenVo); |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | poLast = this.newRmOpenCloseValveLast(clientVo, controller, rtuAddr, dV1_0_1, dataCd83OpenVo); |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | sv.saveRmOpenCloseValveLast(poLast); |
| | | }else{ |
| | | //数据库中存在该控制器的开关阀数据 |
| | | if(poLast.opType != null){ |
| | | if(poLast.openDt != null && poLast.opIcCardAddr != null && poLast.opIcCardNo != null){ |
| | | if(poLast.openDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt)) |
| | | && poLast.opIcCardAddr.equals(dataCd83OpenVo.icCardAddr) |
| | | && poLast.opIcCardNo.equals(dataCd83OpenVo.icCardNo)){ |
| | | //重复上报,原因是下行数据处理慢了,就重复上报了 |
| | | return ; |
| | | } |
| | | } |
| | | if(poLast.opType != null){ |
| | | //原记录存在开阀数据,首先进行时间对比 |
| | | if(poLast.openDt != null && poLast.openDt.after(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //补报的许久之前的开阀数据,不进行处理 |
| | | }else if(poLast.openDt != null && poLast.openDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //重复上报的开阀数据,不进行处理 |
| | | }else{ |
| | | if(poLast.openDt != null && poLast.openDt.equals(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //重复上报的开阀数据,不进行处理 |
| | | }else if(poLast.openDt != null && poLast.openDt.after(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //补报的许久之前的开阀数据(对于after:等于或晚于都返回true) |
| | | this.dealSupplyReport() ; |
| | | }else { |
| | | //当前开阀上报是新的一次开阀,不管原记录是否存在关阀数据,一律清空关阀数据 |
| | | this.updateOpenValve(controller, poLast, null, dV1_0_1, dataCd83OpenVo, true) ; |
| | | this.updateOpenValve(clientVo, controller, poLast, null, dV1_0_1, dataCd83OpenVo, true) ; |
| | | //生成并保存新的开阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | } |
| | | }else if(poLast.clType != null){ |
| | | //原记录不存在开阀数据,但存在关阀数据,首先进行时间比对 |
| | | if(poLast.clOpenDt != null && poLast.clOpenDt.after(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //补报的许久之前的开阀报数据,不进行处理 |
| | | }else if(poLast.clOpenDt != null && poLast.clOpenDt.before(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //当前上报是新的开阀数据,把最新(last)数据中的关阀内容清空 |
| | | this.updateOpenValve(controller, poLast, null, dV1_0_1, dataCd83OpenVo, true) ; |
| | | //生成并保存新的开阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | if(poLast.clOpenDt != null && poLast.clOpenDt.before(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //当前上报是新的开阀数据,把最新(last)数据中的关阀内容清空 |
| | | this.updateOpenValve(clientVo, controller, poLast, null, dV1_0_1, dataCd83OpenVo, true) ; |
| | | //生成并保存新的开阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | }else if(poLast.clOpenDt != null && poLast.clOpenDt.after(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dataCd83OpenVo.openDt))){ |
| | | //补报的许久之前的开阀报数据(对于after:等于或晚于都返回true) |
| | | this.dealSupplyReport() ; |
| | | }else { |
| | | //当前上报的开阀数据与原来的关阀数据同一时间,这种情况应该不存在,但也处理 |
| | | RmOpenCloseValveHistory poHistory = null ; |
| | | if(poLast.lastHistoryId != null){ |
| | | poHistory = sv.getRmOpenCloseValveHistory(poLast.lastHistoryId) ; |
| | | } |
| | | this.updateOpenValve(controller, poLast, poHistory, dV1_0_1, dataCd83OpenVo, false) ; |
| | | this.updateOpenValve(clientVo, controller, poLast, poHistory, dV1_0_1, dataCd83OpenVo, false) ; |
| | | if(poHistory != null){ |
| | | sv.updateRmOpenCloseValveHistory(poHistory); |
| | | } |
| | |
| | | }else{ |
| | | //if(poLast.opType == null && po.clType == null) |
| | | //原记录不存在开阀数据也不存在关阀数据,这种情况不存在,但为安全也进行处理 |
| | | this.updateOpenValve(controller, poLast, null, dV1_0_1, dataCd83OpenVo, true) ; |
| | | this.updateOpenValve(clientVo, controller, poLast, null, dV1_0_1, dataCd83OpenVo, true) ; |
| | | //生成并保存新的开阀上报历史数据记录 |
| | | this.newHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | this.newHistoryDataDeal(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd83OpenVo, poLast); |
| | | } |
| | | |
| | | sv.updateRmOpenCloseValveLast(poLast); |
| | | } |
| | | } |
| | | |
| | | private void dealSupplyReport(){ |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 保存新的开阀上报历史数据记录,并把ID赋值给最新记录的 lastHistoryId |
| | | * @param sv |
| | | * @param clientVo |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | |
| | | * @param poLast |
| | | * @throws Exception |
| | | */ |
| | | private void newHistoryDataDeal(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo, RmOpenCloseValveLast poLast)throws Exception { |
| | | RmOpenCloseValveHistory poHistory = this.newRmOpenCloseValveHistory(controller, rtuAddr, dV1_0_1, dataCd83OpenVo) ; |
| | | private void newHistoryDataDeal(DbSv sv, SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo, RmOpenCloseValveLast poLast)throws Exception { |
| | | RmOpenCloseValveHistory poHistory = this.newRmOpenCloseValveHistory(clientVo, controller, rtuAddr, dV1_0_1, dataCd83OpenVo) ; |
| | | sv.saveRmOpenCloseValveHistory(poHistory); |
| | | //由最新数据持有历史数据中的最新记录ID,以方便快速查询 |
| | | poLast.lastHistoryId = poHistory == null ? null: poHistory.id ; |
| | |
| | | |
| | | /** |
| | | * 生成新的开阀上报最新数据记录 |
| | | * @param clientVo |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmOpenCloseValveLast newRmOpenCloseValveLast(PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo)throws Exception { |
| | | private RmOpenCloseValveLast newRmOpenCloseValveLast(SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo)throws Exception { |
| | | RmOpenCloseValveLast po = new RmOpenCloseValveLast() ; |
| | | po.clientId = clientVo==null?null:clientVo.getId() ; |
| | | po.clientName = clientVo==null?null:clientVo.getName() ; |
| | | po.controllerId = controller==null?null:controller.getId() ; |
| | | po.intakeId = controller==null?null:controller.getIntakeId() ; |
| | | po.rtuAddr = rtuAddr ; |
| | |
| | | |
| | | /** |
| | | * 生成新的开阀上报历史数据记录 |
| | | * @param clientVo |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private RmOpenCloseValveHistory newRmOpenCloseValveHistory(PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo)throws Exception { |
| | | private RmOpenCloseValveHistory newRmOpenCloseValveHistory(SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo)throws Exception { |
| | | RmOpenCloseValveHistory po = new RmOpenCloseValveHistory() ; |
| | | po.clientId = clientVo==null?null:clientVo.getId() ; |
| | | po.clientName = clientVo==null?null:clientVo.getName() ; |
| | | po.controllerId = controller==null?null:controller.getId() ; |
| | | po.intakeId = controller==null?null:controller.getIntakeId() ; |
| | | po.rtuAddr = rtuAddr ; |
| | |
| | | |
| | | /** |
| | | * 更新数据 |
| | | * @param clientVo |
| | | * @param controller |
| | | * @param poLast |
| | | * @param poHistory |
| | | * @param dV1_0_1 |
| | | * @param dataCd83OpenVo |
| | | * @param clearCloseValve |
| | | * @param clearLastCloseValve |
| | | * @throws Exception |
| | | */ |
| | | private void updateOpenValve(PrController controller, RmOpenCloseValveLast poLast, RmOpenCloseValveHistory poHistory, DataV1_0_1 dV1_0_1, DataCd83OpenVo dataCd83OpenVo, boolean clearCloseValve) throws Exception { |
| | | private void updateOpenValve(SeClient clientVo, |
| | | PrController controller, |
| | | RmOpenCloseValveLast poLast, |
| | | RmOpenCloseValveHistory poHistory, |
| | | DataV1_0_1 dV1_0_1, |
| | | DataCd83OpenVo dataCd83OpenVo, |
| | | boolean clearLastCloseValve) throws Exception { |
| | | poLast.clientId = clientVo==null?null:clientVo.getId() ; |
| | | poLast.clientName = clientVo==null?null:clientVo.getName() ; |
| | | poLast.controllerId = controller==null?null:controller.getId(); |
| | | poLast.intakeId = controller==null?null:controller.getIntakeId(); |
| | | poLast.updateFrom(dV1_0_1, dataCd83OpenVo, clearCloseValve); |
| | | poLast.updateFrom(dV1_0_1, dataCd83OpenVo, clearLastCloseValve); |
| | | |
| | | if(poHistory != null){ |
| | | poLast.clientId = clientVo==null?null:clientVo.getId() ; |
| | | poLast.clientName = clientVo==null?null:clientVo.getName() ; |
| | | poHistory.controllerId = controller==null?null:controller.getId(); |
| | | poHistory.intakeId = controller==null?null:controller.getIntakeId(); |
| | | poHistory.updateFrom(dV1_0_1, dataCd83OpenVo, clearCloseValve); |
| | | poHistory.updateFrom(dV1_0_1, dataCd83OpenVo, false); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.rtuMw.server.rtuData.p206V1_0_0; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import com.dy.common.mw.protocol.Data; |
| | |
| | | Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; |
| | | DbSv sv = (DbSv)objs[0] ; |
| | | PrController controller = (PrController)objs[1] ; |
| | | SeClient clientVo = (SeClient)objs[3] ;//这个值对象中只有id和name会有值 |
| | | try{ |
| | | this.doDeal(sv, controller, d.getRtuAddr(), dV1_0_1, (DataCd84Vo)cdObj) ; |
| | | this.doDeal(sv, clientVo, controller, d.getRtuAddr(), dV1_0_1, (DataCd84Vo)cdObj) ; |
| | | }catch (Exception e){ |
| | | log.error("保存控制器阀开工作报时发生异常", e); |
| | | } |
| | |
| | | /** |
| | | * 处理阀开工作报数据 |
| | | * @param sv 服务 |
| | | * @param clientVo 农户对象(不为空时,只有id和name有值) |
| | | * @param controller 控制器对象 |
| | | * @param rtuAddr 控制器地址 |
| | | * @param dataCd84Vo 工作报数据对象 |
| | | */ |
| | | private void doDeal(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd84Vo dataCd84Vo) throws Exception { |
| | | this.saveOrUpdateLast(sv, controller, rtuAddr, dV1_0_1, dataCd84Vo); |
| | | this.saveHistory(sv, controller, rtuAddr, dV1_0_1, dataCd84Vo); |
| | | private void doDeal(DbSv sv, SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd84Vo dataCd84Vo) throws Exception { |
| | | this.saveOrUpdateLast(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd84Vo); |
| | | this.saveHistory(sv, clientVo, controller, rtuAddr, dV1_0_1, dataCd84Vo); |
| | | } |
| | | |
| | | /** |
| | | * 保存阀开工作报最新数据 |
| | | * @param sv |
| | | * @param clientVo 农户对象(不为空时,只有id和name有值) |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | */ |
| | | private void saveOrUpdateLast(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd84Vo cdData) throws Exception { |
| | | private void saveOrUpdateLast(DbSv sv, SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd84Vo cdData) throws Exception { |
| | | RmWorkReportLast po = sv.getRmWorkReportLast(controller.getIntakeId()) ; |
| | | if(po == null){ |
| | | po = new RmWorkReportLast() ; |
| | | po.clientId = clientVo==null?null:clientVo.getId() ; |
| | | po.clientName = clientVo==null?null:clientVo.getName() ; |
| | | po.controllerId = controller==null?null:controller.getId(); |
| | | po.intakeId = controller==null?null:controller.getIntakeId(); |
| | | po.rtuAddr = rtuAddr; |
| | | po.valueFrom(dV1_0_1, cdData); |
| | | sv.saveRmWorkReportLast(po) ; |
| | | }else{ |
| | | po.clientId = clientVo==null?null:clientVo.getId() ; |
| | | po.clientName = clientVo==null?null:clientVo.getName() ; |
| | | po.controllerId = controller==null?null:controller.getId(); |
| | | po.intakeId = controller==null?null:controller.getIntakeId(); |
| | | po.valueFrom(dV1_0_1, cdData); |
| | |
| | | /** |
| | | * 保存阀开工作报历史数据 |
| | | * @param sv |
| | | * @param clientVo 农户对象(不为空时,只有id和name有值) |
| | | * @param controller |
| | | * @param rtuAddr |
| | | * @param dV1_0_1 |
| | | * @param cdData |
| | | */ |
| | | private void saveHistory(DbSv sv, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd84Vo cdData) throws Exception { |
| | | private void saveHistory(DbSv sv, SeClient clientVo, PrController controller, String rtuAddr, DataV1_0_1 dV1_0_1, DataCd84Vo cdData) throws Exception { |
| | | RmWorkReportHistory po = new RmWorkReportHistory(); |
| | | po.clientId = clientVo==null?null:clientVo.getId() ; |
| | | po.clientName = clientVo==null?null:clientVo.getName() ; |
| | | po.controllerId = controller==null?null:controller.getId(); |
| | | po.intakeId = controller==null?null:controller.getIntakeId(); |
| | | po.rtuAddr = rtuAddr; |
| | |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.CommandType; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.*; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import com.dy.common.mw.protocol.Data; |
| | |
| | | if(sv != null){ |
| | | PrController controller = sv.getControllersByRtuAddrAndIntakeNotNull(rtuAddr) ; |
| | | PrControllerTramp controllerTramp = null ; |
| | | SeClient clientVo = null ;//这个值对象中只有id和name会有值 |
| | | if(controller == null){ |
| | | //数据库中未查询到控制器(RTU实体)(已经绑定且控制器地址相符) |
| | | //流浪者控制器 |
| | |
| | | //第一次发现,下发清空RTU历史命令,以使其重新开始记录新地点的数据 |
| | | this.sendClearCommand(rtuAddr, d.protocol); |
| | | } |
| | | }else{ |
| | | if(d.subData != null && d.subData instanceof DataV1_0_1){ |
| | | DataV1_0_1 d1 = (DataV1_0_1)d.subData ; |
| | | clientVo = this.getClient(sv, d1); |
| | | } |
| | | } |
| | | //不论是否为流浪控制器(RTU实体),都要进行下步工作,记录其上报的一些数据,当绑定控制器后,数据自动有了归属 |
| | | this.taskResult = new Object[]{sv, controller, controllerTramp} ; |
| | | this.taskResult = new Object[]{sv, controller, controllerTramp, clientVo} ; |
| | | this.toNextTasks(data); |
| | | }else{ |
| | | log.error("严重错误,未能得到DbSv对象"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 得到相关农户信息 |
| | | */ |
| | | private SeClient getClient(DbSv sv, DataV1_0_1 d1){ |
| | | SeClient clientVo = null ; |
| | | if(d1.subData != null && |
| | | (d1.subData instanceof DataCd83OpenVo || |
| | | d1.subData instanceof DataCd83CloseVo || |
| | | d1.subData instanceof DataCd84Vo)){ |
| | | //开阀后,关阀报,阀开工作报 |
| | | String icCardAddr = null ; |
| | | String icCardNo = null ; |
| | | if(d1.subData instanceof DataCd83OpenVo){ |
| | | DataCd83OpenVo vo = (DataCd83OpenVo)d1.subData ; |
| | | icCardAddr = vo.icCardAddr ; |
| | | icCardNo = vo.icCardNo ; |
| | | }else if(d1.subData instanceof DataCd83CloseVo){ |
| | | DataCd83CloseVo vo = (DataCd83CloseVo)d1.subData ; |
| | | icCardAddr = vo.icCardAddr ; |
| | | icCardNo = vo.icCardNo ; |
| | | }else if(d1.subData instanceof DataCd84Vo){ |
| | | DataCd84Vo vo = (DataCd84Vo)d1.subData ; |
| | | icCardAddr = vo.cardAddr ; |
| | | icCardNo = vo.cardNo ; |
| | | } |
| | | if(icCardAddr != null && icCardNo != null){ |
| | | if(icCardAddr.equals(ProtocolConstantV206V1_0_0.vsCardAddr)){ |
| | | clientVo = sv.getClientIdAndNameByVsCardNo(icCardNo) ; |
| | | }else{ |
| | | clientVo = sv.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNo) ; |
| | | } |
| | | } |
| | | } |
| | | return clientVo ; |
| | | } |
| | | |
| | | /** |
| | | * 发送清空RTU的命令 |
| | | * @param rtuAddr |
| | | * @param protocol |
| | |
| | | <task id="TkDealWorkReport" name="控制器阀开工作上报(功能码84)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealWorkReport" /> |
| | | <task id="TkDealOpenValveReport" name="控制器开阀上报(功能码83)" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkDealOpenValveReport" /> |
| | | <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="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> |
| | | <!-- 识别命令响应数据 --> |
| | | <task id="TkFindComResponse" name="识别响应命令数据" enable="true" class="com.dy.rtuMw.server.rtuData.p206V1_0_0.TkFindComResponse"> |
| | |
| | | datasource: #配置数据源 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | |
| | | commandSendInterval: 针对一个RTU,下发命令的时间间隔(秒) |
| | | cachWaitResultTimeout: 命令已经发送达最大次数,仍未收到命令结果,需要在缓存继续等待,其等待最大时长(秒),本系统RTU,对于开关泵命令,其先执行开关泵报,然后再进行命令应答,所以此值 要大一些 |
| | | offLineCachTimeout: 不在线缓存的命令最大缓存时长(秒) |
| | | lastUpDataTimeLive: TCP上行数据时刻缓存时长(秒),当达到时长时,TCP上行数据时刻被清空,采用TCP上行数据时刻目的是,阻止上行数据同时下发数据,因为RTU处理不过来(经初次实验,1秒还是有问题,2秒无问题) |
| | | lastUpDataTimeLive: TCP上行数据时刻缓存时长(毫秒),当达到时长时,TCP上行数据时刻被清空,采用TCP上行数据时刻目的是,阻止上行数据同时下发数据,因为RTU处理不过来(经初次实验,1秒还是有问题,2秒无问题) |
| | | dbDataIdSuffix:数据库数据id生成器的id后缀,0是默认的后缀,一般web系统应用,数据中间件id后缀大于等于1 |
| | | cacheUpDownDataWarnCount:上下行数据缓存队列中缓存数据个数的报警量,这个与现实项目所接水表数相关 |
| | | cacheUpDownDataMaxCount:上下行数据缓存队列中缓存数据个数的最大值,这个与现实项目所接水表数相关 |
| | |
| | | isLowPower="false" |
| | | onlyOneProtocol="true" |
| | | downComandMaxResendTimes="1" |
| | | commandSendInterval="3" |
| | | commandSendInterval="2" |
| | | cachWaitResultTimeout="60" |
| | | offLineCachTimeout="86400" |
| | | lastUpDataTimeLive="1" |
| | | lastUpDataTimeLive="500" |
| | | dbDataIdSuffix="0" |
| | | cacheUpDownDataWarnCount="100000" |
| | | cacheUpDownDataMaxCount="110000" |
| | |
| | | |
| | | protected static String rtuAddr = "532328059995" ; |
| | | protected static String rtuResultSendWebUrl = "http://127.0.0.1:65535/test/comRes/receive" ; |
| | | protected static String icCardNo = "7044010686" ;//IC卡编号(用户卡序列号) |
| | | protected static String vsIcCardNo = "7044010666" ;//虚拟IC卡编号(用户虚拟卡序列号) |
| | | |
| | | |
| | | @Autowired |
| | |
| | | //APP远程开阀 |
| | | private BaseResponse cd97(){ |
| | | Com97Vo comVo = new Com97Vo() ; |
| | | comVo.icCardNo = CommandP206V1_0_0Ctrl.icCardNo ; |
| | | comVo.icCardNo = CommandP206V1_0_0Ctrl.vsIcCardNo; |
| | | comVo.moneyRemain = 234.56 ; |
| | | comVo.waterPrice = 1.2 ; |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_97, comVo, null)) ; |
| | |
| | | //APP远程关阀 |
| | | private BaseResponse cd98(){ |
| | | Com98Vo comVo = new Com98Vo() ; |
| | | comVo.icCardNo = CommandP206V1_0_0Ctrl.icCardNo ; |
| | | comVo.icCardNo = CommandP206V1_0_0Ctrl.vsIcCardNo; |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_98, comVo, null)) ; |
| | | } |
| | | |