流量监测站查询、修改
根据流量监测站编号获取绑定记录
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.voPr.VoIntake; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | |
| | | /** |
| | | * 根据监测站编号删除监测站 |
| | | * |
| | | * @param flowMonitoringId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据监测站编号获取未删除的监测站数量 |
| | | * |
| | | * @param flowMonitoringId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowMonitoring(@Param("flowMonitoringId") Long flowMonitoringId); |
| | | Integer getRecordCountOfFlowMonitoringByFlowMonitoringId(@Param("flowMonitoringId") Long flowMonitoringId); |
| | | |
| | | /** |
| | | * 根据监测站 名称 绑定状态 获取未删除的监测站数量 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowMonitoring(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取流量监测站实体记录 |
| | | * |
| | | * @param params |
| | | * @return 实体集合 |
| | | */ |
| | | List<VoFlowMonitoring> getPrFlowMonitoring(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 查询全部流量监测站实体记录 |
| | | * |
| | | * @return 实体集合 |
| | | */ |
| | | List<PrFlowMonitoring> selectAll(); |
| | | |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowmeter(@Param("flowmeterId") Long flowmeterId); |
| | | Integer getRecordCountOfFlowmeterByCode(@Param("flowmeterId") Long flowmeterId); |
| | | |
| | | /** |
| | | * 根据流量计 编号 在线状态 获取未删除的流量计数量 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowMeterByOthers(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取流量计实体记录 |
| | | * |
| | | * @param params |
| | | * @return 实体集合 |
| | | */ |
| | | List<VoFlowMeter> getFlowMeters(Map<?, ?> params); |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:18 |
| | |
| | | * @return 符合条件记录数量 |
| | | */ |
| | | Integer getBindRecordCount(@Param("monitoringId") Long monitoringId, @Param("flowmeterId") Long flowmeterId, @Param("operateType") Byte operateType); |
| | | |
| | | /** |
| | | * 根据 流量监测站编号 获取 绑定记录 按操作时间降序 |
| | | * @param monitoringId 监测站编号 |
| | | * @return 绑定记录 |
| | | */ |
| | | List<Map<String, Object>> getBingRecordsByMonitoringId(Long monitoringId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voPr; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/1/15 10:58 |
| | | * @LastEditTime :2024/1/15 10:58 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(title = "流量计视图对象") |
| | | public class VoFlowMeter implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "ID") |
| | | @ExcelProperty("ID") |
| | | @ColumnWidth(10) |
| | | private Long id; |
| | | |
| | | @Schema(title = "管网流量计编号") |
| | | @ExcelProperty("管网流量计编号") |
| | | @ColumnWidth(15) |
| | | private String code; |
| | | |
| | | @Schema(title = "在线状态") |
| | | @ExcelProperty("在线状态") |
| | | @ColumnWidth(1) |
| | | private Integer onlineState; |
| | | |
| | | @Schema(title = "管网流量监测站名称") |
| | | @ExcelProperty("管网流量监测站名称") |
| | | @ColumnWidth(15) |
| | | private String name; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "操作时间") |
| | | @ExcelProperty("操作时间") |
| | | @ColumnWidth(30) |
| | | private Date operateDt; |
| | | } |
| | |
| | | <?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.PrFlowMonitoringMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_flow_monitoring--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="countyId" jdbcType="BIGINT" property="countyid" /> |
| | | <result column="townId" jdbcType="BIGINT" property="townid" /> |
| | | <result column="villageId" jdbcType="BIGINT" property="villageid" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="lng" jdbcType="DOUBLE" property="lng" /> |
| | | <result column="lat" jdbcType="DOUBLE" property="lat" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, countyId, townId, villageId, `name`, lng, lat, remarks, `operator`, operateDt, |
| | | deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_flow_monitoring |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_flow_monitoring |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flow_monitoring (id, countyId, townId, |
| | | villageId, `name`, lng, |
| | | lat, remarks, `operator`, |
| | | operateDt, deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{countyid,jdbcType=BIGINT}, #{townid,jdbcType=BIGINT}, |
| | | #{villageid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, |
| | | #{lat,jdbcType=DOUBLE}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flow_monitoring |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_flow_monitoring--> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="countyId" jdbcType="BIGINT" property="countyid"/> |
| | | <result column="townId" jdbcType="BIGINT" property="townid"/> |
| | | <result column="villageId" jdbcType="BIGINT" property="villageid"/> |
| | | <result column="name" jdbcType="VARCHAR" property="name"/> |
| | | <result column="lng" jdbcType="DOUBLE" property="lng"/> |
| | | <result column="lat" jdbcType="DOUBLE" property="lat"/> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks"/> |
| | | <result column="operator" jdbcType="BIGINT" property="operator"/> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt"/> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, |
| | | </if> |
| | | <if test="countyid != null"> |
| | | countyId, |
| | | </if> |
| | | <if test="townid != null"> |
| | | townId, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | villageId, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="countyid != null"> |
| | | #{countyid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townid != null"> |
| | | #{townid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | #{villageid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DOUBLE}, |
| | | </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> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | update pr_flow_monitoring |
| | | <set> |
| | | <if test="countyid != null"> |
| | | countyId = #{countyid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townid != null"> |
| | | townId = #{townid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | villageId = #{villageid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | </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> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | update pr_flow_monitoring |
| | | set countyId = #{countyid,jdbcType=BIGINT}, |
| | | townId = #{townid,jdbcType=BIGINT}, |
| | | villageId = #{villageid,jdbcType=BIGINT}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from pr_flow_monitoring |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete |
| | | from pr_flow_monitoring |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <!--根据监测站编号删除监测站--> |
| | | <update id="deleteFlowMonitoringById"> |
| | | UPDATE pr_flow_monitoring SET deleted = 1 WHERE id = ${flowMonitoringId} |
| | | </update> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flow_monitoring (id, countyId, townId, |
| | | villageId, `name`, lng, |
| | | lat, remarks, `operator`, |
| | | operateDt, deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{countyid,jdbcType=BIGINT}, #{townid,jdbcType=BIGINT}, |
| | | #{villageid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, |
| | | #{lat,jdbcType=DOUBLE}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | |
| | | <!--根据监测站编号获取未删除的监测站数量--> |
| | | <select id="getRecordCountOfFlowMonitoring" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowMonitoring FROM pr_flow_monitoring WHERE deleted = 0 AND id = ${flowMonitoringId} |
| | | </select> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flow_monitoring |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="countyid != null"> |
| | | countyId, |
| | | </if> |
| | | <if test="townid != null"> |
| | | townId, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | villageId, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="countyid != null"> |
| | | #{countyid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townid != null"> |
| | | #{townid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | #{villageid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DOUBLE}, |
| | | </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> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | update pr_flow_monitoring |
| | | <set> |
| | | <if test="countyid != null"> |
| | | countyId = #{countyid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townid != null"> |
| | | townId = #{townid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | villageId = #{villageid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | </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> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | update pr_flow_monitoring |
| | | set countyId = #{countyid,jdbcType=BIGINT}, |
| | | townId = #{townid,jdbcType=BIGINT}, |
| | | villageId = #{villageid,jdbcType=BIGINT}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据监测站编号删除监测站--> |
| | | <update id="deleteFlowMonitoringById"> |
| | | UPDATE pr_flow_monitoring |
| | | SET deleted = 1 |
| | | WHERE id = ${flowMonitoringId} |
| | | </update> |
| | | |
| | | <!--根据监测站编号获取未删除的监测站数量--> |
| | | <select id="getRecordCountOfFlowMonitoringByFlowMonitoringId" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowMonitoring |
| | | FROM pr_flow_monitoring |
| | | WHERE deleted = 0 |
| | | AND id = ${flowMonitoringId} |
| | | </select> |
| | | |
| | | <!--查询全部监测站实体记录--> |
| | | <select id="selectAll" resultType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from pr_flow_monitoring |
| | | where deleted = 0 |
| | | </select> |
| | | |
| | | |
| | | <!--根据监测站编号获取未删除的监测站数量--> |
| | | <select id="getRecordCountOfFlowMonitoring" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowMonitoring |
| | | from pr_flow_monitoring pfm |
| | | INNER JOIN ba_district country ON pfm.countyId = country.id |
| | | INNER JOIN ba_district town ON pfm.townId = town.id |
| | | INNER JOIN ba_district village ON pfm.villageId = village.id |
| | | INNER JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id |
| | | <where> |
| | | pfm.deleted = 0 |
| | | <if test = "name != null and name !=''"> |
| | | AND pfm.`name` like CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test = "bindState != null and bindState > 0"> |
| | | AND pmofl.operateType = ${bindState} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取流量监测站实体记录--> |
| | | <select id="getPrFlowMonitoring" parameterType="map" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMonitoring"> |
| | | select (@i:=@i+1) AS id, |
| | | CONCAT(country.`name`, town.`name`, village.`name`) AS address, |
| | | pfm.`name` AS `name`, |
| | | pmofl.operateType AS bindState |
| | | from pr_flow_monitoring pfm |
| | | INNER JOIN ba_district country ON pfm.countyId = country.id |
| | | INNER JOIN ba_district town ON pfm.townId = town.id |
| | | INNER JOIN ba_district village ON pfm.villageId = village.id |
| | | INNER JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id, |
| | | (SELECT @i:=0) AS itable |
| | | <where> |
| | | pfm.deleted = 0 |
| | | <if test = "name != null and name !=''"> |
| | | AND pfm.`name` like CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test = "bindState != null and bindState > 0"> |
| | | AND pmofl.operateType = ${bindState} |
| | | </if> |
| | | </where> |
| | | ORDER BY pmofl.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | </update> |
| | | |
| | | <!--根据流量计编号获取未删除的流量计数量--> |
| | | <select id="getRecordCountOfFlowmeter" resultType="java.lang.Integer"> |
| | | <select id="getRecordCountOfFlowmeterByCode" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowmeter FROM pr_flowmeter WHERE deleted = 0 AND id = ${flowmeterId} |
| | | </select> |
| | | |
| | | <!--根据流量计编号 或者 在线状态 获取未删除的流量计数量 --> |
| | | <select id="getRecordCountOfFlowMeterByOthers" resultType="_integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowmeter FROM pr_flowmeter |
| | | <where> |
| | | deleted = 0 AND |
| | | <if test="code != null"> |
| | | code = #{code,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlineState != null "> |
| | | onlineState = #{onlineState,jdbcType=TINYINT} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据流量计编号 或者 在线状态 获取未删除的流量计记录 --> |
| | | <select id="getFlowMeters" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMeter"> |
| | | select (@i:=@i+1) AS id, |
| | | pfm.code AS code, |
| | | pfm.onlineState AS onlineState, |
| | | pfmt.`name` AS `name`, |
| | | pfm.operateDt AS operateDt |
| | | from pr_flowmeter pfm |
| | | inner join pr_monitoring_flowmeter pmofl on pmofl.flowmeterId = pfm.id |
| | | inner join pr_flow_monitoring pfmt on pfmt.id = pmofl.monitoringId, |
| | | (SELECT @i:=0) AS itable |
| | | <where> |
| | | pfm.deleted = 0 AND pfmt.deleted = 0 AND pmofl.operateType = 1 |
| | | <if test="code != null"> |
| | | AND code = #{code,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="onlineState != null "> |
| | | AND onlineState = #{onlineState,jdbcType=TINYINT} |
| | | </if> |
| | | </where> |
| | | ORDER BY pfm.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <!--@mbg.generated--> |
| | | id, monitoringId, flowmeterId, operateType, remarks, `operator`, operateDt |
| | | </sql> |
| | | <sql id="Base_Column_List_NoId"> |
| | | <!--@mbg.generated--> |
| | | monitoringId, flowmeterId, operateType, remarks, `operator`, operateDt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据 流量监测站编号 获取 绑定记录 按操作时间降序--> |
| | | <select id="getBingRecordsByMonitoringId" parameterType="_long" resultType="java.util.Map"> |
| | | select (@i:=@i+1) AS id, |
| | | <include refid="Base_Column_List_NoId" /> |
| | | from pr_monitoring_flowmeter |
| | | ,(SELECT @i:=0) AS itable |
| | | where |
| | | monitoringId=#{monitoringId,jdbcType=BIGINT} |
| | | order by operateDt desc |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | 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 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 编辑修改监测站 |
| | | * @param po 保存监测站form表单对象 |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "编辑修改监测站", description = "提交监测站数据(form表单),进行修改") |
| | | @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 = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrFlowMonitoring po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(flowMonitoringSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | po.setCountyid(countryId); |
| | | po.setTownid(townId); |
| | | int count; |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | try { |
| | | count = this.flowMonitoringSv.update(po); |
| | | } catch (Exception e) { |
| | | log.error("保存监测站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | if(count <= 0){ |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.UPDATE_FLOW_MONITORING_FAIL.getMessage()) ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 客户端请求得到所有监测站名字 |
| | | * @return 所有监测站名字 |
| | | */ |
| | | @Operation(summary = "获得全部监测站", description = "返回全部监测站数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回全部监测站数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = PrFlowMonitoring.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<PrFlowMonitoring>>> all(){ |
| | | try { |
| | | QueryResultVo<List<PrFlowMonitoring>> res = this.flowMonitoringSv.selectAll(); |
| | | if(res == null) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOW_MONITORINGS.getMessage()); |
| | | }else { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("查询监测站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 得到一个监测站数据 |
| | | * @return 一个监测站数据 |
| | | */ |
| | | @Operation(summary = "一个监测站", description = "得到一个监测站数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一个监测站数据(BaseResponse.content:{})", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = PrFlowMonitoring.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one/{id}") |
| | | @SsoAop() |
| | | public BaseResponse<PrFlowMonitoring> one(@PathVariable("id") Long id){ |
| | | if(this.flowMonitoringSv.selectById(id) == null) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOW_MONITORINGS.getMessage()); |
| | | }else { |
| | | return BaseResponseUtils.buildSuccess(this.flowMonitoringSv.selectById(id)); |
| | | } |
| | | } |
| | | |
| | | @Operation(summary = "获得一页监测站记录", description = "返回一页监测站数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页监测站数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = PrFlowMonitoring.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getFlowMonitoring", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoFlowMonitoring>>> getFlowMonitoring(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoFlowMonitoring>> res = flowMonitoringSv.getPrFlowMonitorings(vo); |
| | | if(res == null) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOW_MONITORINGS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取监测站记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrFlowMonitoringMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoDivide; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | * @param flowMonitoringId 流量监测站编号 |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfFlowMonitoring(Long flowMonitoringId) { |
| | | return prFlowMonitoringMapper.getRecordCountOfFlowMonitoring(flowMonitoringId); |
| | | public Integer getRecordCountOfFlowMonitoringByFlowMonitoringId(Long flowMonitoringId) { |
| | | return prFlowMonitoringMapper.getRecordCountOfFlowMonitoringByFlowMonitoringId(flowMonitoringId); |
| | | } |
| | | |
| | | /** |
| | | * 得到一个流量监测站 |
| | | * @param id 监测站ID |
| | | * @return 监测站实体 |
| | | */ |
| | | public PrFlowMonitoring selectById(Long id) { |
| | | return prFlowMonitoringMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | /** |
| | | * 得到全部流量监测站 |
| | | * @return 监测站实体集合 |
| | | */ |
| | | public QueryResultVo<List<PrFlowMonitoring>> selectAll(){ |
| | | QueryResultVo<List<PrFlowMonitoring>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.obj = this.prFlowMonitoringMapper.selectAll() ; |
| | | return rsVo ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件得到流量监测站实体记录 |
| | | * @param queryVo 给的条件 |
| | | * @return 监测站实体集合 |
| | | */ |
| | | public QueryResultVo<List<VoFlowMonitoring>> getPrFlowMonitorings(QueryVo queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | |
| | | QueryResultVo<List<VoFlowMonitoring>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | // 计算符合条件的记录数 |
| | | Integer itemTotal = prFlowMonitoringMapper.getRecordCountOfFlowMonitoring(params); |
| | | rsVo.calculateAndSet(itemTotal.longValue(), params); |
| | | rsVo.obj = prFlowMonitoringMapper.getPrFlowMonitoring(params); |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 保存修改一个流量监测站实体 |
| | | * @param po 修改的内容(id不为空) |
| | | * @return |
| | | */ |
| | | public int update (PrFlowMonitoring po){ |
| | | return prFlowMonitoringMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | } |
| | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | 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 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站管理", description = "流量监测站操作") |
| | | @RestController |
| | | @RequestMapping(path="flowmeter") |
| | | @RequestMapping(path = "flowmeter") |
| | | @RequiredArgsConstructor |
| | | public class FlowmeterCtrl { |
| | | private final FlowmeterSv flowmeterSv; |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoFlowmeter po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | 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.setDeleted((byte) 0); |
| | | prFlowmeter.setReporttime(operateTime); |
| | | Integer rec = Optional.ofNullable(flowmeterSv.addFlowmeter(prFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.ADD_FLOWMETER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除流量计 |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | |
| | | }) |
| | | @PostMapping(path = "delete") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map){ |
| | | if(map == null || map.size() <=0) { |
| | | 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) { |
| | | if (recordCount == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_FLOWMETER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | @Operation(summary = "获得一页流量计记录", description = "返回一页流量计数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页流量计数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = PrFlowmeter.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getFlowMeters", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoFlowMeter>>> getFlowMeters(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVoFlowMeter vo) { |
| | | try { |
| | | QueryResultVo<List<VoFlowMeter>> res = flowmeterSv.getFlowMeters(vo); |
| | | if (res == null) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOWMETERS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取流量计记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrFlowmeterMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfFlowmeter(Long flowmeterId) { |
| | | return prFlowmeterMapper.getRecordCountOfFlowmeter(flowmeterId); |
| | | public Integer getRecordCountOfFlowmeterByCode(Long flowmeterId) { |
| | | return prFlowmeterMapper.getRecordCountOfFlowmeterByCode(flowmeterId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件得到流量计实体记录 |
| | | * @param queryVo 给的条件 |
| | | * @return 流量计实体集合 |
| | | */ |
| | | public QueryResultVo<List<VoFlowMeter>> getFlowMeters(QueryVoFlowMeter queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | |
| | | QueryResultVo<List<VoFlowMeter>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | // 计算符合条件的记录数 |
| | | Integer itemTotal = prFlowmeterMapper.getRecordCountOfFlowMeterByOthers(params); |
| | | rsVo.calculateAndSet(itemTotal.longValue(), params); |
| | | rsVo.obj = prFlowmeterMapper.getFlowMeters(params); |
| | | |
| | | return rsVo ; |
| | | } |
| | | } |
| | |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站、流量计关联管理", description = "流量监测站、流量计关联操作") |
| | | @RestController |
| | | @RequestMapping(path="moni_flow") |
| | | @RequestMapping(path = "moni_flow") |
| | | @RequiredArgsConstructor |
| | | public class MoniFlowCtrl { |
| | | private final MoniFlowSv moniFlowSv; |
| | |
| | | |
| | | /** |
| | | * 流量监测站绑定流量计 |
| | | * 若流量监测站或流量计不存在需提示用户 |
| | | * 若流量监测站已经与流量计绑定需提示用户 |
| | | * @param po 绑定关系对象 |
| | | * 若流量监测站或流量计不存在需提示用户 |
| | | * 若流量监测站已经与流量计绑定需提示用户 |
| | | * |
| | | * @param po 绑定关系对象 |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | |
| | | @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()){ |
| | | 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) { |
| | | Integer recFlowMonitoring = Optional.ofNullable(flowMonitoringSv.getRecordCountOfFlowMonitoringByFlowMonitoringId(po.getMonitoringId())).orElse(0); |
| | | Integer recFlowmeter = Optional.ofNullable(flowmeterSv.getRecordCountOfFlowmeterByCode(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) { |
| | | 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); |
| | | prMonitoringFlowmeter.setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte) 1); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | @Operation(summary = "添加解绑记录", description = "添加解绑记录") |
| | |
| | | @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()){ |
| | | 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) { |
| | | Integer recFlowMonitoring = Optional.ofNullable(flowMonitoringSv.getRecordCountOfFlowMonitoringByFlowMonitoringId(po.getMonitoringId())).orElse(0); |
| | | Integer recFlowmeter = Optional.ofNullable(flowmeterSv.getRecordCountOfFlowmeterByCode(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) { |
| | | 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); |
| | | prMonitoringFlowmeter.setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte) 1); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 根据监测站编号获取绑定记录 按操作时间降序 |
| | | * |
| | | * @param monitoringId 监测站编号 |
| | | * @return 绑定记录 |
| | | */ |
| | | @Operation(summary = "获取绑定记录", description = "返回获取绑定记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回绑定记录(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = PrMonitoringFlowmeter.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "bingRecords/{monitoringId}") |
| | | @SsoAop() |
| | | public BaseResponse<List<Map<String, Object>>> getBingRecordsByMonitoringId(@PathVariable("monitoringId") Long monitoringId) { |
| | | try { |
| | | List<Map<String, Object>> list = Optional.ofNullable(moniFlowSv.getBingRecordsByMonitoringId(monitoringId)).orElse(new ArrayList<>()); |
| | | if (list.size() <= 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_MONITORING_FLOWMETERS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("查询绑定记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:25 |
| | |
| | | return prMonitoringFlowmeterMapper.getBindRecordCount(monitoringId, flowmeterId, operateType); |
| | | } |
| | | |
| | | /** |
| | | * 根据 流量监测站编号 获取 绑定记录 按操作时间降序 |
| | | * @param monitoringId |
| | | * @return PrMonitoringFlowmeter |
| | | * */ |
| | | public List<Map<String, Object>> getBingRecordsByMonitoringId(Long monitoringId){ |
| | | return prMonitoringFlowmeterMapper.getBingRecordsByMonitoringId(monitoringId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/1/15 11:12 |
| | | * @LastEditTime :2024/1/15 11:12 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "管网流量计查询条件") |
| | | public class QueryVoFlowMeter extends QueryConditionVo { |
| | | |
| | | @Schema(description = "流量计编号") |
| | | public String code; |
| | | |
| | | @Schema(title = "在线状态") |
| | | private Integer onlineState; |
| | | } |
| | |
| | | FLOW_MONITORING_FAIL(50001, "流量监测站添加失败"), |
| | | PLEASE_INPUT_FLOW_MONITORING_ID(50002, "请输入流量监测站编号"), |
| | | DELETE_FLOW_MONITORING_FAIL(50003, "流量监测站删除失败"), |
| | | |
| | | UPDATE_FLOW_MONITORING_FAIL(50004, "修改监测站数据失败"), |
| | | NO_FLOW_MONITORINGS(50005, "没有符合条件监测站数据"), |
| | | /** |
| | | * 流量计 |
| | | */ |
| | | ADD_FLOWMETER_FAIL(60001, "流量计添加失败"), |
| | | DELETE_FLOWMETER_FAIL(60002, "流量计删除失败"), |
| | | NO_FLOWMETERS(60003, "没有符合条件流量计数据"), |
| | | |
| | | /** |
| | | * 流量监测站、流量计关联 |
| | |
| | | MONITORING_HAS_BINDED_FLOWMETER(70001, "流量监测站与流量计已绑定"), |
| | | MONITORING_FLOWMETER_BIND_FAIL(70002, "流量监测站与流量计绑定失败"), |
| | | STATION_OR_FLOWMETER_NO_EXIST(70003, "流量监测站或流量计不存在"), |
| | | STATION_FLOWMETER_HAS_UNBOUND(70004, "流量监测站与流量计已解绑"); |
| | | STATION_FLOWMETER_HAS_UNBOUND(70004, "流量监测站与流量计已解绑"), |
| | | NO_MONITORING_FLOWMETERS(70005, "没有符合条件的绑定记录数据"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |