| | |
| | | * @return |
| | | */ |
| | | Integer deleteControllerById(@Param("controllerId") Long controllerId); |
| | | |
| | | /** |
| | | * 根据控制器编号获取未删除的控制器数量 |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfController(@Param("controllerId") Long controllerId); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Integer deleteFlowMonitoringById(@Param("flowMonitoringId") Long flowMonitoringId); |
| | | |
| | | /** |
| | | * 根据监测站编号获取未删除的监测站数量 |
| | | * @param flowMonitoringId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowMonitoring(@Param("flowMonitoringId") Long flowMonitoringId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:04 |
| | | * @LastEditTime 2024-01-05 9:04 |
| | | * @Description |
| | | */ |
| | | public interface PrFlowmeterMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrFlowmeter record); |
| | | |
| | | int insertSelective(PrFlowmeter record); |
| | | |
| | | PrFlowmeter selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrFlowmeter record); |
| | | |
| | | int updateByPrimaryKey(PrFlowmeter record); |
| | | |
| | | /** |
| | | * 据编号删除流量计 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | Integer deleteFlowmeterById(@Param("flowmeterId") Long flowmeterId); |
| | | |
| | | /** |
| | | * 根据流量计编号获取未删除的流量计数量 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowmeter(@Param("flowmeterId") Long flowmeterId); |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoIntake; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | List<VoIntake> getIntakes(Map<?, ?> params); |
| | | |
| | | Long getSupperByVillageId(long vaId); |
| | | |
| | | /** |
| | | * 根据取水口编号获取未删除的取水口数量 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfIntake(@Param("intakeId") Long intakeId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:18 |
| | | * @LastEditTime 2024-01-05 10:18 |
| | | * @Description |
| | | */ |
| | | public interface PrMonitoringFlowmeterMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrMonitoringFlowmeter record); |
| | | |
| | | int insertSelective(PrMonitoringFlowmeter record); |
| | | |
| | | PrMonitoringFlowmeter selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrMonitoringFlowmeter record); |
| | | |
| | | int updateByPrimaryKey(PrMonitoringFlowmeter record); |
| | | |
| | | /** |
| | | * 根据流量监测站、流量计、操作类型获取记录数量 |
| | | * @param monitoringId 监测站编号 |
| | | * @param flowmeterId 流量计编号 |
| | | * @param operateType 操作类型 1-捆绑,2-解绑 |
| | | * @return 符合条件记录数量 |
| | | */ |
| | | Integer getBindRecordCount(@Param("monitoringId") Long monitoringId, @Param("flowmeterId") Long flowmeterId, @Param("operateType") Byte operateType); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:04 |
| | | * @LastEditTime 2024-01-05 9:04 |
| | | * @Description |
| | | */ |
| | | |
| | | @TableName(value="pr_flowmeter", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "流量计实体") |
| | | public class PrFlowmeter implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流量计编号 |
| | | */ |
| | | @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "流量计编号不能为空") |
| | | @Length(message = "流量计编号不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | private String code; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | | */ |
| | | @Schema(description = "通讯协议", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "通讯协议不能为空") |
| | | @Length(message = "通讯协议不大于{max}字",max = 25) |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 在线状态;1-在线,2-离线 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlinestate; |
| | | |
| | | /** |
| | | * 最近上报时间 |
| | | */ |
| | | @Schema(description = "最近上报时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date reporttime; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addways; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte deleted; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:18 |
| | | * @LastEditTime 2024-01-05 10:18 |
| | | * @Description |
| | | */ |
| | | |
| | | @TableName(value="pr_monitoring_flowmeter", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "监测站流量计关联实体") |
| | | public class PrMonitoringFlowmeter implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 监测站编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "监测站编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "监测站ID不能为空") |
| | | private Long monitoringid; |
| | | |
| | | /** |
| | | * 流量计编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "流量计ID不能为空") |
| | | private Long flowmeterid; |
| | | |
| | | /** |
| | | * 操作类型;1-捆绑,2-解绑 |
| | | */ |
| | | @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Max(message = "操作类型只能1或2", value = 2) |
| | | @Min(message = "操作类型只能1或2",value = 1) |
| | | private Byte operatetype; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | //@Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | } |
| | |
| | | <update id="deleteControllerById"> |
| | | UPDATE pr_controller SET deleted = 1 WHERE id = ${controllerId} |
| | | </update> |
| | | |
| | | <!--根据控制器编号获取未删除的控制器数量--> |
| | | <select id="getRecordCountOfController" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCount FROM pr_controller WHERE deleted = 0 AND id = ${controllerId} |
| | | </select> |
| | | </mapper> |
| | |
| | | <update id="deleteFlowMonitoringById"> |
| | | UPDATE pr_flow_monitoring SET deleted = 1 WHERE id = ${flowMonitoringId} |
| | | </update> |
| | | |
| | | <!--根据监测站编号获取未删除的监测站数量--> |
| | | <select id="getRecordCountOfFlowMonitoring" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowMonitoring FROM pr_flow_monitoring WHERE deleted = 0 AND id = ${flowMonitoringId} |
| | | </select> |
| | | </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.daoPr.PrFlowmeterMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_flowmeter--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="code" jdbcType="VARCHAR" property="code" /> |
| | | <result column="protocol" jdbcType="VARCHAR" property="protocol" /> |
| | | <result column="onlineState" jdbcType="TINYINT" property="onlinestate" /> |
| | | <result column="reportTime" jdbcType="TIMESTAMP" property="reporttime" /> |
| | | <result column="addWays" jdbcType="TINYINT" property="addways" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks, |
| | | deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flowmeter (id, code, protocol, |
| | | onlineState, reportTime, addWays, |
| | | `operator`, operateDt, remarks, |
| | | deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, |
| | | #{onlinestate,jdbcType=TINYINT}, #{reporttime,jdbcType=TIMESTAMP}, #{addways,jdbcType=TINYINT}, |
| | | #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, |
| | | #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flowmeter |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="code != null"> |
| | | code, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | onlineState, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | reportTime, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="code != null"> |
| | | #{code,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | #{onlinestate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | #{reporttime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | #{addways,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_flowmeter |
| | | <set> |
| | | <if test="code != null"> |
| | | code = #{code,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_flowmeter |
| | | set code = #{code,jdbcType=VARCHAR}, |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--据编号删除流量计--> |
| | | <update id="deleteFlowmeterById"> |
| | | UPDATE pr_flowmeter SET deleted = 1 WHERE id = ${flowmeterId} |
| | | </update> |
| | | |
| | | <!--根据流量计编号获取未删除的流量计数量--> |
| | | <select id="getRecordCountOfFlowmeter" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowmeter FROM pr_flowmeter WHERE deleted = 0 AND id = ${flowmeterId} |
| | | </select> |
| | | </mapper> |
| | |
| | | on dis_vil.supperId = dis_tow.id |
| | | where dis_vil.id = #{vaId,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <!--根据取水口编号获取未删除的取水口数量--> |
| | | <select id="getRecordCountOfIntake" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCount FROM pr_intake WHERE deleted = 0 AND id = ${intakeId} |
| | | </select> |
| | | </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.daoPr.PrMonitoringFlowmeterMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_monitoring_flowmeter--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="monitoringId" jdbcType="BIGINT" property="monitoringid" /> |
| | | <result column="flowmeterId" jdbcType="BIGINT" property="flowmeterid" /> |
| | | <result column="operateType" jdbcType="TINYINT" property="operatetype" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, monitoringId, flowmeterId, operateType, remarks, `operator`, operateDt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_monitoring_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_monitoring_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_monitoring_flowmeter (id, monitoringId, flowmeterId, |
| | | operateType, remarks, `operator`, |
| | | operateDt) |
| | | values (#{id,jdbcType=BIGINT}, #{monitoringid,jdbcType=BIGINT}, #{flowmeterid,jdbcType=BIGINT}, |
| | | #{operatetype,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_monitoring_flowmeter |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="monitoringid != null"> |
| | | monitoringId, |
| | | </if> |
| | | <if test="flowmeterid != null"> |
| | | flowmeterId, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | operateType, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="monitoringid != null"> |
| | | #{monitoringid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="flowmeterid != null"> |
| | | #{flowmeterid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | #{operatetype,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_monitoring_flowmeter |
| | | <set> |
| | | <if test="monitoringid != null"> |
| | | monitoringId = #{monitoringid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="flowmeterid != null"> |
| | | flowmeterId = #{flowmeterid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | operateType = #{operatetype,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_monitoring_flowmeter |
| | | set monitoringId = #{monitoringid,jdbcType=BIGINT}, |
| | | flowmeterId = #{flowmeterid,jdbcType=BIGINT}, |
| | | operateType = #{operatetype,jdbcType=TINYINT}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据流量监测站、流量计、操作类型获取记录数量--> |
| | | <select id="getBindRecordCount" resultType="java.lang.Integer"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM pr_monitoring_flowmeter |
| | | <where> |
| | | <if test = "monitoringId != null and monitoringId > 0"> |
| | | AND monitoringId = ${monitoringId} |
| | | </if> |
| | | |
| | | <if test = "flowmeterId != null and flowmeterId > 0"> |
| | | AND flowmeterId = ${flowmeterId} |
| | | </if> |
| | | |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND operateType = ${operateType} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | Date operateTime = new Date(); |
| | | prController.setOperatedt(operateTime); |
| | | prController.setDeleted((byte)0); |
| | | prController.setOnlinestate((byte)2); |
| | | prController.setReporttime(operateTime); |
| | | Integer rec = Optional.ofNullable(controllerSv.addController(prController)).orElse(0); |
| | | if(rec == 0) { |
| | |
| | | rsVo = prControllerMapper.getControllers(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | public Integer getRecordCountOfController(Long controllerId) { |
| | | return prControllerMapper.getRecordCountOfController(controllerId); |
| | | } |
| | | } |
| | |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 在线状态 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlineState; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | DtoToPojo INSTANCT = Mappers.getMapper(DtoToPojo.class); |
| | | @Mapping(target = "code", source = "code") |
| | | @Mapping(target = "protocol", source = "protocol") |
| | | @Mapping(target = "onlinestate", source = "onlineState") |
| | | @Mapping(target = "addways", source = "addWays") |
| | | @Mapping(target = "operator", source = "operator") |
| | | PrController po2vo(DtoController po); |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:33 |
| | | * @LastEditTime 2024-01-05 9:33 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "流量计传入对象") |
| | | public class DtoFlowmeter { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "控制器编号不能为空") |
| | | @Length(message = "控制器编号不大于{max}字",max = 25) |
| | | private String code; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | | */ |
| | | @Schema(description = "通讯协议", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "通讯协议不能为空") |
| | | @Length(message = "通讯协议不大于{max}字",max = 25) |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 在线状态 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlineState; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addWays; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) |
| | | private String remarks; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:36 |
| | | * @LastEditTime 2024-01-05 10:36 |
| | | * @Description 流量监测站、流量计绑定传入对象 |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "流量监测站、流量计绑定传入对象") |
| | | public class DtoMoniFlow { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 监测站编号 |
| | | */ |
| | | @Schema(description = "监测站编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "监测站ID不能为空") |
| | | private Long monitoringId; |
| | | |
| | | /** |
| | | * 流量计编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "流量计ID不能为空") |
| | | private Long flowmeterId; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:38 |
| | | * @LastEditTime 2024-01-05 9:38 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface DtoToFlowmeterPojo { |
| | | DtoToFlowmeterPojo INSTANCT = Mappers.getMapper(DtoToFlowmeterPojo.class); |
| | | @Mapping(target = "code", source = "code") |
| | | @Mapping(target = "protocol", source = "protocol") |
| | | @Mapping(target = "onlinestate", source = "onlineState") |
| | | @Mapping(target = "addways", source = "addWays") |
| | | @Mapping(target = "operator", source = "operator") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | | PrFlowmeter po2vo(DtoFlowmeter po); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:43 |
| | | * @LastEditTime 2024-01-05 10:43 |
| | | * @Description 流量监测站、流量计Dto转Pojo |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface DtoToMoniFlowPojo { |
| | | DtoToMoniFlowPojo INSTANCT = Mappers.getMapper(DtoToMoniFlowPojo.class); |
| | | @Mapping(target = "monitoringid", source = "monitoringId") |
| | | @Mapping(target = "flowmeterid", source = "flowmeterId") |
| | | @Mapping(target = "operator", source = "operator") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | | PrMonitoringFlowmeter po2vo(DtoMoniFlow po); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | //@Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid PrFlowMonitoring po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 删除流量监测站 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Operation(summary = "删除流量监测站记录", description = "删除流量监测站记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | public Integer deleteFlowMonitoring(Long flowMonitoringId) { |
| | | return prFlowMonitoringMapper.deleteFlowMonitoringById(flowMonitoringId); |
| | | } |
| | | |
| | | /** |
| | | * 根据监测站编号获取未删除的监测站数量 |
| | | * @param flowMonitoringId 流量监测站编号 |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfFlowMonitoring(Long flowMonitoringId) { |
| | | return prFlowMonitoringMapper.getRecordCountOfFlowMonitoring(flowMonitoringId); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:21 |
| | | * @LastEditTime 2024-01-05 9:21 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站管理", description = "流量监测站操作") |
| | | @RestController |
| | | @RequestMapping(path="flowmeter") |
| | | @RequiredArgsConstructor |
| | | public class FlowmeterCtrl { |
| | | private final FlowmeterSv flowmeterSv; |
| | | |
| | | @Operation(summary = "添加流量计记录", description = "添加流量计记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoFlowmeter po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | PrFlowmeter prFlowmeter = DtoToFlowmeterPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prFlowmeter.setOperatedt(operateTime); |
| | | prFlowmeter.setDeleted((byte)0); |
| | | prFlowmeter.setReporttime(operateTime); |
| | | Integer rec = Optional.ofNullable(flowmeterSv.addFlowmeter(prFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.ADD_FLOWMETER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 删除流量计 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Operation(summary = "删除流量计记录", description = "删除流量计记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "delete") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map){ |
| | | if(map == null || map.size() <=0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_FLOW_MONITORING_ID.getMessage()); |
| | | } |
| | | |
| | | Long flowmeterId = Long.parseLong(map.get("flowmeterId").toString()); |
| | | Integer recordCount = Optional.ofNullable(flowmeterSv.deleteFlowmeter(flowmeterId)).orElse(0); |
| | | if(recordCount == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_FLOWMETER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.daoPr.PrFlowmeterMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:20 |
| | | * @LastEditTime 2024-01-05 9:20 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class FlowmeterSv { |
| | | @Autowired |
| | | private PrFlowmeterMapper prFlowmeterMapper; |
| | | |
| | | /** |
| | | * 添加流量计 |
| | | * @param prFlowmeter |
| | | * @return |
| | | */ |
| | | public Integer addFlowmeter(PrFlowmeter prFlowmeter) { |
| | | return prFlowmeterMapper.insert(prFlowmeter); |
| | | } |
| | | |
| | | /** |
| | | * 删除流量计 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | public Integer deleteFlowmeter(Long flowmeterId) { |
| | | return prFlowmeterMapper.deleteFlowmeterById(flowmeterId); |
| | | } |
| | | |
| | | /** |
| | | * 根据流量计编号获取未删除的流量计数量 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfFlowmeter(Long flowmeterId) { |
| | | return prFlowmeterMapper.getRecordCountOfFlowmeter(flowmeterId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:26 |
| | | * @LastEditTime 2024-01-05 10:26 |
| | | * @Description 管网流量监测站、流量计关联控制类 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站、流量计关联管理", description = "流量监测站、流量计关联操作") |
| | | @RestController |
| | | @RequestMapping(path="moni_flow") |
| | | @RequiredArgsConstructor |
| | | public class MoniFlowCtrl { |
| | | private final MoniFlowSv moniFlowSv; |
| | | |
| | | private final FlowMonitoringSv flowMonitoringSv; |
| | | private final FlowmeterSv flowmeterSv; |
| | | |
| | | /** |
| | | * 流量监测站绑定流量计 |
| | | * 若流量监测站或流量计不存在需提示用户 |
| | | * 若流量监测站已经与流量计绑定需提示用户 |
| | | * @param po 绑定关系对象 |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "添加绑定记录", description = "添加绑定记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "bind", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> bind(@RequestBody @Valid DtoMoniFlow po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 根据编号分别获取流量监测站、流量计未删除记录数 |
| | | Integer recFlowMonitoring = Optional.ofNullable(flowMonitoringSv.getRecordCountOfFlowMonitoring(po.getMonitoringId())).orElse(0); |
| | | Integer recFlowmeter = Optional.ofNullable(flowmeterSv.getRecordCountOfFlowmeter(po.getFlowmeterId())).orElse(0); |
| | | if(recFlowMonitoring == 0 || recFlowmeter == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.STATION_OR_FLOWMETER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | // 根据编号获取已绑定数量 |
| | | Integer recordCount = Optional.ofNullable(moniFlowSv.getBindRecordCount(po.getMonitoringId(), po.getFlowmeterId(), (byte)1)).orElse(0); |
| | | if(recordCount > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_HAS_BINDED_FLOWMETER.getMessage()); |
| | | } |
| | | |
| | | PrMonitoringFlowmeter prMonitoringFlowmeter = DtoToMoniFlowPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prMonitoringFlowmeter .setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte)1); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | @Operation(summary = "添加解绑记录", description = "添加解绑记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "unbind", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> unbind(@RequestBody @Valid DtoMoniFlow po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 根据编号分别获取流量监测站、流量计未删除记录数 |
| | | Integer recFlowMonitoring = Optional.ofNullable(flowMonitoringSv.getRecordCountOfFlowMonitoring(po.getMonitoringId())).orElse(0); |
| | | Integer recFlowmeter = Optional.ofNullable(flowmeterSv.getRecordCountOfFlowmeter(po.getFlowmeterId())).orElse(0); |
| | | if(recFlowMonitoring == 0 || recFlowmeter == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.STATION_OR_FLOWMETER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | // 根据编号获取已绑定数量 |
| | | Integer recordCount = Optional.ofNullable(moniFlowSv.getBindRecordCount(po.getMonitoringId(), po.getFlowmeterId(), (byte)2)).orElse(0); |
| | | if(recordCount > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.STATION_FLOWMETER_HAS_UNBOUND.getMessage()); |
| | | } |
| | | |
| | | PrMonitoringFlowmeter prMonitoringFlowmeter = DtoToMoniFlowPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prMonitoringFlowmeter .setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte)1); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.daoPr.PrMonitoringFlowmeterMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:25 |
| | | * @LastEditTime 2024-01-05 10:25 |
| | | * @Description 管网流量监测站、流量计关联管理服务类 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class MoniFlowSv { |
| | | @Autowired |
| | | private PrMonitoringFlowmeterMapper prMonitoringFlowmeterMapper; |
| | | |
| | | /** |
| | | * 添加流量监测站、流量计关联关系 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer addRecord(PrMonitoringFlowmeter po) { |
| | | return prMonitoringFlowmeterMapper.insert(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据流量监测站、流量计、操作类型获取记录数量 |
| | | * @param monitoringId 监测站编号 |
| | | * @param flowmeterId 流量计编号 |
| | | * @param operateType 操作类型 1-捆绑,2-解绑 |
| | | * @return |
| | | */ |
| | | Integer getBindRecordCount(Long monitoringId, Long flowmeterId, Byte operateType) { |
| | | return prMonitoringFlowmeterMapper.getBindRecordCount(monitoringId, flowmeterId, operateType); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public int delete(Long id){ |
| | | return this.prIntakeMapper.deleteLogicById(id) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据取水口编号获取未删除的取水口数量 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfIntake(Long intakeId) { |
| | | return prIntakeMapper.getRecordCountOfIntake(intakeId); |
| | | } |
| | | } |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntakeController; |
| | | import com.dy.pipIrrProject.controller.ControllerSv; |
| | | import com.dy.pipIrrProject.intake.IntakeSv; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | |
| | | @RequiredArgsConstructor |
| | | public class IntakeControllerCtrl { |
| | | private final IntakeControllerSv intakeControllerSv; |
| | | private final IntakeSv intakeSv; |
| | | private final ControllerSv controllerSv; |
| | | |
| | | /** |
| | | * 添加取水口/控制器捆绑记录 |
| | | * 1. 判断取水口是否存在 |
| | | * 2. 判断控制器是否存在 |
| | | * 3. 判断取水口、控制器绑定关系是否已存在 |
| | | * 若取水口或控制器不存在需提示用户 |
| | | * 若取水口已经与控制器绑定需提示用户 |
| | | */ |
| | | @Operation(summary = "添加绑定记录", description = "添加绑定记录") |
| | | @ApiResponses(value = { |
| | |
| | | public BaseResponse<Boolean> bind(@RequestBody @Valid DtoIntakeController po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | // 根据编号分别获取取水口、控制器未删除记录数 |
| | | Integer recIntke = Optional.ofNullable(intakeSv.getRecordCountOfIntake(po.getIntakeId())).orElse(0); |
| | | Integer recController = Optional.ofNullable(controllerSv.getRecordCountOfController(po.getControllerId())).orElse(0); |
| | | if(recIntke == 0 || recController == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_OR_CONTROLLER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | Integer recordCount = Optional.ofNullable(intakeControllerSv.getBindRecordCount(po.getIntakeId(), po.getControllerId(), (byte)1)).orElse(0); |
| | |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 根据编号分别获取取水口、控制器未删除记录数 |
| | | Integer recIntke = Optional.ofNullable(intakeSv.getRecordCountOfIntake(po.getIntakeId())).orElse(0); |
| | | Integer recController = Optional.ofNullable(controllerSv.getRecordCountOfController(po.getControllerId())).orElse(0); |
| | | if(recIntke == 0 || recController == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_OR_CONTROLLER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | Integer recordCount = Optional.ofNullable(intakeControllerSv.getBindRecordCount(po.getIntakeId(), po.getControllerId(), (byte)2)).orElse(0); |
| | | if(recordCount > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_CONTROLLER_HAS_UNBOUND.getMessage()); |
| | |
| | | INTAKE_CONTROLLER_HAS_UNBOUND(40003, "取水口与控制器已解绑"), |
| | | INTAKE_NO_RECORDS(40004, "该取水口无绑定记录"), |
| | | CONTROLLER_NO_RECORDS(40005, "该控制器无绑定记录"), |
| | | INTAKE_OR_CONTROLLER_NO_EXIST(40006, "取水口或控制器不存在"), |
| | | |
| | | /** |
| | | * 流量监测站 |
| | | */ |
| | | FLOW_MONITORING_FAIL(50001, "流量监测站添加失败"), |
| | | PLEASE_INPUT_FLOW_MONITORING_ID(50002, "请输入流量监测站编号"), |
| | | DELETE_FLOW_MONITORING_FAIL(50003, "流量监测站删除失败"); |
| | | DELETE_FLOW_MONITORING_FAIL(50003, "流量监测站删除失败"), |
| | | |
| | | /** |
| | | * 流量计 |
| | | */ |
| | | ADD_FLOWMETER_FAIL(60001, "流量计添加失败"), |
| | | DELETE_FLOWMETER_FAIL(60002, "流量计删除失败"), |
| | | |
| | | /** |
| | | * 流量监测站、流量计关联 |
| | | */ |
| | | MONITORING_HAS_BINDED_FLOWMETER(70001, "流量监测站与流量计已绑定"), |
| | | MONITORING_FLOWMETER_BIND_FAIL(70002, "流量监测站与流量计绑定失败"), |
| | | STATION_OR_FLOWMETER_NO_EXIST(70003, "流量监测站或流量计不存在"), |
| | | STATION_FLOWMETER_HAS_UNBOUND(70004, "流量监测站与流量计已解绑"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |