Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.logging.log4j</groupId> |
| | | <artifactId>log4j-slf4j-impl</artifactId> |
| | | <version>2.17.2</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | <artifactId>easyexcel</artifactId> |
| | | <version>3.1.0</version> |
| | | </dependency> |
| | | <!--OkHttp--> |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>4.9.2</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * @return 实体集合 |
| | | */ |
| | | List<VoFlowMeter> getFlowMeters(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 得到全部实体 |
| | | * @return 全部实体 |
| | | * */ |
| | | List<PrFlowmeter> selectAll(); |
| | | /** |
| | | * 给流量计表加监测站ID外键 |
| | | * @param |
| | | * @return |
| | | */ |
| | | int flowmeterAddMonId(PrFlowmeter record); |
| | | } |
| | |
| | | * @param monitoringId 监测站编号 |
| | | * @return 绑定记录 |
| | | */ |
| | | List<Map<String, Object>> getBingRecordsByMonitoringId(Long monitoringId); |
| | | List<Map<String, Object>> getBingRecordsByMonitoringId(String monitoringId); |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountHistory; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在村不能为空") |
| | | private Long villageid; |
| | | |
| | | /** |
| | | * 监测站名称 |
| | | */ |
| | | @Schema(description = "监测站名称", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "监测站名称不能为空") |
| | | @Length(message = "监测站名称不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | private String name; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lng; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lat; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人ID不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:04 |
| | | * @LastEditTime 2024-01-05 9:04 |
| | | * @LastEditTime 2024-04-01 9:04 wuzeyu |
| | | * @Description |
| | | */ |
| | | |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 外键 监测站ID |
| | | */ |
| | | @Schema(description = "监测站ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "监测站ID不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | private String monitoringId; |
| | | |
| | | /** |
| | | * 流量计编号 |
| | | */ |
| | | @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | |
| | | * 在线状态;1-在线,2-离线 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlinestate; |
| | | private Byte onlineState; |
| | | |
| | | /** |
| | | * 最近上报时间 |
| | | */ |
| | | @Schema(description = "最近上报时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date reporttime; |
| | | private Date reportTime; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addways; |
| | | private Byte addWays; |
| | | |
| | | /** |
| | | * 操作人ID |
| | |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | private Date operateDt; |
| | | |
| | | /** |
| | | * 备注信息 |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2024/1/17 9:07 |
| | | * @LastEditTime 2024/1/17 9:07 |
| | | * @Description 取水口取水量 |
| | | */ |
| | | @TableName(value="rm_intake_amount", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口取水量") |
| | | public class RmIntakeAmountHistory implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202401170908001L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 取水口ID(外键) |
| | | */ |
| | | @Schema(description = "取水口实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long intakeid; |
| | | |
| | | /** |
| | | * 累计取水量(不包括漏损水量) |
| | | */ |
| | | @Schema(description = "累计取水量(不包括漏损水量)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double amount; |
| | | |
| | | /** |
| | | * 累计漏损水量 |
| | | */ |
| | | @Schema(description = "累计漏损水量", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double loss; |
| | | |
| | | /** |
| | | * 最后计水量的控制器ID(外键) |
| | | */ |
| | | @Schema(description = "控制器实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long controlleridlast; |
| | | |
| | | /** |
| | | * 最后计水量日期 |
| | | */ |
| | | @Schema(description = "最后计水量日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | public Date dtlast; |
| | | |
| | | /** |
| | | * 最后计水量时控制器取水量 |
| | | */ |
| | | @Schema(description = "最后计水量时控制器取水量", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double amountlast; |
| | | |
| | | /** |
| | | * 最后计水量时控制器累计水量 |
| | | */ |
| | | @Schema(description = "最后计水量时控制器累计水量", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double totalamountlast; |
| | | |
| | | /** |
| | | * 最后计水量来源(1开阀工作报,2关阀报,3自报) |
| | | */ |
| | | @Schema(description = "最后计水量来源(1开阀工作报,2关阀报,3自报)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte resourcetypelast; |
| | | |
| | | |
| | | } |
| | |
| | | @Schema(title = "ID") |
| | | @ExcelProperty("ID") |
| | | @ColumnWidth(10) |
| | | private Long id; |
| | | private String id; |
| | | |
| | | @Schema(title = "管网流量计编号") |
| | | @ExcelProperty("管网流量计编号") |
| | |
| | | @Schema(title = "绑定状态") |
| | | @ExcelProperty("绑定状态") |
| | | @ColumnWidth(15) |
| | | private Integer bindState; |
| | | private String bindState; |
| | | |
| | | @Schema(title = "地址") |
| | | @ExcelProperty("地址") |
| | |
| | | private String villageName; |
| | | |
| | | @Schema(title = "片区ID") |
| | | private String blockId; |
| | | private String blockid; |
| | | @Schema(title = "片区名称") |
| | | private String bolckName; |
| | | |
| | |
| | | |
| | | <select id="selectAll" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="part_Column_List" /> |
| | | <!-- <include refid="part_Column_List" />--> |
| | | <include refid="Base_Column_List" /> |
| | | from ba_block |
| | | </select> |
| | | |
| | |
| | | header like concat('%', #{header}, '%') and |
| | | </if> |
| | | <if test="phone != null and phone != ''"> |
| | | phone = '#{phone,jdbcType=VARCHAR}' and |
| | | phone = #{phone,jdbcType=VARCHAR} and |
| | | </if> |
| | | <if test="area != null"> |
| | | area = ${area} and |
| | |
| | | name like concat('%', #{name}, '%') and |
| | | </if> |
| | | <if test="header != null and header != ''"> |
| | | header = '#{header,jdbcType=VARCHAR}' and |
| | | header = #{header,jdbcType=VARCHAR} and |
| | | </if> |
| | | <if test="phone != null and phone != ''"> |
| | | phone = '#{phone,jdbcType=VARCHAR}' and |
| | | phone = #{phone,jdbcType=VARCHAR} and |
| | | </if> |
| | | <if test="area != null"> |
| | | area = ${area} and |
| | |
| | | <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 |
| | | LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id |
| | | LEFT JOIN pr_flowmeter pf ON pf.monitoringId = pfm.id |
| | | LEFT JOIN ba_district country ON pfm.countyId = country.id |
| | | LEFT JOIN ba_district town ON pfm.townId = town.id |
| | | LEFT JOIN ba_district village ON pfm.villageId = village.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 test = "bindState ==1 "> |
| | | AND pf.monitoringId IS NOT NULL |
| | | </if> |
| | | <if test = "bindState ==2 or bindState =='' "> |
| | | AND pf.monitoringId IS NULL |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取流量监测站实体记录--> |
| | | <select id="getPrFlowMonitoring" parameterType="map" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMonitoring"> |
| | | select CAST(pfm.id AS char) AS id, |
| | | select CAST(pfm.id AS char) AS id, |
| | | CONCAT(country.`name`, town.`name`, village.`name`) AS address, |
| | | pfm.`name` AS `name`, |
| | | pmofl.operateType AS bindState |
| | | (CASE |
| | | WHEN pf.monitoringId IS NOT NULL THEN "已绑定" |
| | | WHEN pf.monitoringId IS NULL THEN "未绑定" |
| | | END) 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 |
| | | LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id |
| | | LEFT JOIN pr_flowmeter pf ON pf.monitoringId = pfm.id |
| | | LEFT JOIN ba_district country ON pfm.countyId = country.id |
| | | LEFT JOIN ba_district town ON pfm.townId = town.id |
| | | LEFT JOIN ba_district village ON pfm.villageId = village.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 test = "bindState ==1 "> |
| | | AND pf.monitoringId IS NOT NULL |
| | | </if> |
| | | <if test = "bindState ==2 or bindState =='' "> |
| | | AND pf.monitoringId IS NULL |
| | | </if> |
| | | </where> |
| | | ORDER BY pmofl.operateDt DESC |
| | | ORDER BY pfm.operateDt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_flowmeter--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="monitoringId" jdbcType="BIGINT" property="monitoringId" /> |
| | | <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="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="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, |
| | | id, monitoringId, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks, |
| | | deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | |
| | | `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}, |
| | | #{onlineState,jdbcType=TINYINT}, #{reportTime,jdbcType=TIMESTAMP}, #{addWays,jdbcType=TINYINT}, |
| | | #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, |
| | | #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | |
| | |
| | | <if test="protocol != null"> |
| | | protocol, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | <if test="onlineState != null"> |
| | | onlineState, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | <if test="reportTime != null"> |
| | | reportTime, |
| | | </if> |
| | | <if test="addways != null"> |
| | | <if test="addWays != null"> |
| | | addWays, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | <if test="operateDt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="remarks != null"> |
| | |
| | | <if test="protocol != null"> |
| | | #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | #{onlinestate,jdbcType=TINYINT}, |
| | | <if test="onlineState != null"> |
| | | #{onlineState,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | #{reporttime,jdbcType=TIMESTAMP}, |
| | | <if test="reportTime != null"> |
| | | #{reportTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | #{addways,jdbcType=TINYINT}, |
| | | <if test="addWays != null"> |
| | | #{addWays,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | #{operatedt,jdbcType=TIMESTAMP}, |
| | | <if test="operateDt != null"> |
| | | #{operateDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | |
| | | <if test="protocol != null"> |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | <if test="onlineState != null"> |
| | | onlineState = #{onlineState,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | <if test="reportTime != null"> |
| | | reportTime = #{reportTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | <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 test="operateDt != null"> |
| | | operateDt = #{operateDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | |
| | | update pr_flowmeter |
| | | set code = #{code,jdbcType=VARCHAR}, |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | onlineState = #{onlineState,jdbcType=TINYINT}, |
| | | reportTime = #{reportTime,jdbcType=TIMESTAMP}, |
| | | addWays = #{addWays,jdbcType=TINYINT}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | operateDt = #{operateDt,jdbcType=TIMESTAMP}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | 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 |
| | | SELECT COUNT(*) AS recordCountOfFlowmeter |
| | | from pr_flowmeter pfm |
| | | Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId |
| | | <where> |
| | | deleted = 0 AND |
| | | <if test="code != null"> |
| | | code = #{code,jdbcType=VARCHAR}, |
| | | pfm.deleted = 0 AND pfmt.deleted = 0 |
| | | <if test = "code != null and code !=''"> |
| | | AND pfm.code like CONCAT('%',#{code},'%') |
| | | </if> |
| | | <if test="onlineState != null "> |
| | | onlineState = #{onlineState,jdbcType=TINYINT} |
| | | AND pfm.onlineState = #{onlineState} |
| | | </if> |
| | | </where> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据流量计编号 或者 在线状态 获取未删除的流量计记录 --> |
| | | <!--根据流量计编号 或者 在线状态 获取未删除的绑定的流量计记录 --> |
| | | <select id="getFlowMeters" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMeter"> |
| | | select (@i:=@i+1) AS id, |
| | | select CAST(pfm.id AS char) 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 |
| | | Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId |
| | | <where> |
| | | pfm.deleted = 0 AND pfmt.deleted = 0 AND pmofl.operateType = 1 |
| | | <if test="code != null"> |
| | | AND code = #{code,jdbcType=VARCHAR} |
| | | pfm.deleted = 0 AND pfmt.deleted = 0 |
| | | <if test = "code != null and code !=''"> |
| | | AND pfm.code like CONCAT('%',#{code},'%') |
| | | </if> |
| | | <if test="onlineState != null "> |
| | | AND onlineState = #{onlineState,jdbcType=TINYINT} |
| | | AND pfm.onlineState = #{onlineState} |
| | | </if> |
| | | </where> |
| | | ORDER BY pfm.operateDt DESC |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <select id="selectAll" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from pr_flowmeter pfm |
| | | where deleted != 1 |
| | | </select> |
| | | <update id="flowmeterAddMonId"> |
| | | update pr_flowmeter |
| | | set monitoringId = #{monitoringId,jdbcType=BIGINT}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operateDt,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | </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 |
| | | <select id="getBingRecordsByMonitoringId" parameterType="string" resultType="java.util.Map"> |
| | | select CAST(id AS char) as id, |
| | | CAST(monitoringId AS char)as monitoringId, |
| | | CAST(flowmeterId AS char)as flowmeterId, |
| | | operateType, |
| | | remarks, |
| | | `operator`, |
| | | operateDt |
| | | from pr_monitoring_flowmeter pmf |
| | | where |
| | | monitoringId=#{monitoringId,jdbcType=BIGINT} |
| | | order by operateDt desc |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, countyId, townId, villageId, blockId, divideId, `name`, virtualId, clientNum, |
| | | id, countyId, townId, villageId, blockid, divideId, `name`, virtualId, clientNum, |
| | | districtNum, districtTitle, phone, idCard, area, typeId, address, remarks, `operator`, |
| | | operateDt, disabled, deleted |
| | | </sql> |
| | |
| | | operateDt, disabled, deleted |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{countyid,jdbcType=BIGINT}, #{townid,jdbcType=BIGINT}, |
| | | #{villageid,jdbcType=BIGINT}, #{blockid,jdbcType=BIGINT}, #{divideid,jdbcType=BIGINT}, |
| | | #{villageid,jdbcType=BIGINT}, #{blockid,jdbcType=BIGINT}, #{divideid,jdbcType=BIGINT}, |
| | | #{name,jdbcType=VARCHAR}, #{virtualid,jdbcType=BIGINT}, #{clientnum,jdbcType=VARCHAR}, |
| | | #{districtnum,jdbcType=BIGINT}, #{districttitle,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, |
| | | #{idcard,jdbcType=VARCHAR}, #{area,jdbcType=DOUBLE}, #{typeid,jdbcType=BIGINT}, |
| | |
| | | <name>pipIrr-web-base</name> |
| | | <description>web基础信息系统</description> |
| | | |
| | | <dependencies> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestClientException; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | import static com.dy.common.mw.protocol.CommandType.innerCommand; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | @Autowired |
| | | private PrIntakeControllerMapper prIntakeControllerMapper; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | |
| | | /** |
| | | * 根据指定获取控制器记录 |
| | | * |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | |
| | | |
| | | Long itemTotal = prControllerMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoController>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | QueryResultVo<List<VoController>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = queryVo.pageSize; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prControllerMapper.getControllers(params); |
| | | return rsVo ; |
| | | |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 添加控制器 |
| | | * |
| | | * @param po |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据控制器地址获取控制器列表 |
| | | * |
| | | * @param rtuAddr |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据控制器编号逻辑删除控制 |
| | | * |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据指定条件导出控制器列表 |
| | | * |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | List<VoController> rsVo = new ArrayList<>(); |
| | | rsVo = prControllerMapper.getControllers(params); |
| | | return rsVo ; |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号获取未删除的控制器数量 |
| | | * |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfController(Long controllerId) { |
| | | return prControllerMapper.getRecordCountOfController(controllerId); |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号获取已绑定记录数 |
| | | * |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据主键删除外键 |
| | | * |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取未绑控制器的取水口列表 |
| | | * |
| | | * @return |
| | | */ |
| | | public JSONArray getNoBindingIntakes() { |
| | | List<Map<String, Object>> list = Optional.ofNullable(prIntakeMapper.getNoBindingIntakes()).orElse(new ArrayList<>()); |
| | | JSONArray array= null; |
| | | if(list.size() > 0) { |
| | | array= JSONArray.parseArray(JSON.toJSONString(list)); |
| | | JSONArray array = null; |
| | | if (list.size() > 0) { |
| | | array = JSONArray.parseArray(JSON.toJSONString(list)); |
| | | } |
| | | return array; |
| | | } |
| | |
| | | @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") |
| | | // @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); |
| | | } |
| | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站管理", description = "流量监测站操作") |
| | | @RestController |
| | | @RequestMapping(path="flow_monitoring") |
| | | @RequestMapping(path = "flow_monitoring") |
| | | @RequiredArgsConstructor |
| | | public class FlowMonitoringCtrl { |
| | | private final FlowMonitoringSv flowMonitoringSv; |
| | | |
| | | /** |
| | | * 添加管网流量监测站 |
| | | * |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid PrFlowMonitoring po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid PrFlowMonitoring po, 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("区划信息有误"); |
| | | if (villageId != null) { |
| | | /** |
| | | * 获取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); |
| | | } |
| | | |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | po.setCountyid(countryId); |
| | | po.setTownid(townId); |
| | | if (po.getName() == null){ |
| | | return BaseResponseUtils.buildFail("监测站名称不能为空");} |
| | | if (po.getName().length()>25||po.getName().length()<1){ |
| | | return BaseResponseUtils.buildFail("25>监测站名称>1");} |
| | | if (po.getLat()== null||po.getLng()== null){ |
| | | return BaseResponseUtils.buildFail("经纬度不能为空");} |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | po.setDeleted((byte) 0); |
| | | Integer rec = Optional.ofNullable(flowMonitoringSv.addFlowMonitoring(po)).orElse(0); |
| | | if(rec == 0) { |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.FLOW_MONITORING_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 flowMonitoringId = Long.parseLong(map.get("flowMonitoringId").toString()); |
| | | Integer recordCount = Optional.ofNullable(flowMonitoringSv.deleteFlowMonitoring(flowMonitoringId)).orElse(0); |
| | | if(recordCount == 0) { |
| | | if (recordCount == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_FLOW_MONITORING_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 编辑修改监测站 |
| | | * |
| | | * @param po 保存监测站form表单对象 |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | }) |
| | | @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()){ |
| | | 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("区划信息有误"); |
| | | if (villageId != null) { |
| | | /** |
| | | * 获取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); |
| | | } |
| | | 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); |
| | | po.setDeleted((byte) 0); |
| | | try { |
| | | count = this.flowMonitoringSv.update(po); |
| | | } catch (Exception e) { |
| | | log.error("保存监测站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if(count <= 0){ |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.UPDATE_FLOW_MONITORING_FAIL.getMessage()) ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.UPDATE_FLOW_MONITORING_FAIL.getMessage()); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 客户端请求得到所有监测站名字 |
| | | * |
| | | * @return 所有监测站名字 |
| | | */ |
| | | @Operation(summary = "获得全部监测站", description = "返回全部监测站数据") |
| | |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<PrFlowMonitoring>>> all(){ |
| | | public BaseResponse<QueryResultVo<List<PrFlowMonitoring>>> all() { |
| | | try { |
| | | QueryResultVo<List<PrFlowMonitoring>> res = this.flowMonitoringSv.selectAll(); |
| | | if(res == null) { |
| | | if (res == null) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOW_MONITORINGS.getMessage()); |
| | | }else { |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("查询监测站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 得到一个监测站数据 |
| | | * |
| | | * @return 一个监测站数据 |
| | | */ |
| | | @Operation(summary = "一个监测站", description = "得到一个监测站数据") |
| | |
| | | }) |
| | | @GetMapping(path = "one/{id}") |
| | | @SsoAop() |
| | | public BaseResponse<PrFlowMonitoring> one(@PathVariable("id") Long id){ |
| | | if(this.flowMonitoringSv.selectById(id) == null) { |
| | | public BaseResponse<PrFlowMonitoring> one(@PathVariable("id") Long id) { |
| | | if (this.flowMonitoringSv.selectById(id) == null) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOW_MONITORINGS.getMessage()); |
| | | }else { |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(this.flowMonitoringSv.selectById(id)); |
| | | } |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "getFlowMonitoring") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoFlowMonitoring>>> getFlowMonitoring(QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<VoFlowMonitoring>>> getFlowMonitoring(QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoFlowMonitoring>> res = flowMonitoringSv.getPrFlowMonitorings(vo); |
| | | if(res == null) { |
| | | 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()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | PrFlowmeter prFlowmeter = DtoToFlowmeterPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prFlowmeter.setOperatedt(operateTime); |
| | | prFlowmeter.setOperateDt(operateTime); |
| | | prFlowmeter.setDeleted((byte) 0); |
| | | prFlowmeter.setReporttime(operateTime); |
| | | prFlowmeter.setReportTime(operateTime); |
| | | Integer rec = Optional.ofNullable(flowmeterSv.addFlowmeter(prFlowmeter)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.ADD_FLOWMETER_FAIL.getMessage()); |
| | |
| | | schema = @Schema(implementation = PrFlowmeter.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getFlowMeters", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @GetMapping(path = "getFlowMeters") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoFlowMeter>>> getFlowMeters(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVoFlowMeter vo) { |
| | | public BaseResponse<QueryResultVo<List<VoFlowMeter>>> getFlowMeters(QueryVoFlowMeter vo) { |
| | | try { |
| | | QueryResultVo<List<VoFlowMeter>> res = flowmeterSv.getFlowMeters(vo); |
| | | if (res == null) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOWMETERS.getMessage()); |
| | | if (res.itemTotal != null && res.itemTotal > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_FLOWMETERS.getMessage()); |
| | | } catch (Exception e) { |
| | | log.error("获取流量计记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | @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 = "all") |
| | | @SsoAop() |
| | | public BaseResponse<List<PrFlowmeter>> getFlowMeterAll() { |
| | | try { |
| | | List<PrFlowmeter> res = flowmeterSv.getFlowMeterAll(); |
| | | if (res != null && res.size() > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_DATA.getMessage()); |
| | | } catch (Exception e) { |
| | | log.error("获取流量计数据异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public QueryResultVo<List<VoFlowMeter>> getFlowMeters(QueryVoFlowMeter queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | |
| | | Integer itemTotal = prFlowmeterMapper.getRecordCountOfFlowMeterByOthers(params); |
| | | QueryResultVo<List<VoFlowMeter>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | // 计算符合条件的记录数 |
| | | Integer itemTotal = prFlowmeterMapper.getRecordCountOfFlowMeterByOthers(params); |
| | | rsVo.calculateAndSet(itemTotal.longValue(), params); |
| | | rsVo.obj = prFlowmeterMapper.getFlowMeters(params); |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 得到全部流量计 |
| | | * @return |
| | | */ |
| | | public List<PrFlowmeter> getFlowMeterAll(){ |
| | | List<PrFlowmeter> all = prFlowmeterMapper.selectAll(); |
| | | return all; |
| | | } |
| | | |
| | | /** |
| | | * 给流量计表加监测站ID外键 |
| | | * @param |
| | | * @return |
| | | */ |
| | | public Integer flowmeterAddMonId(PrFlowmeter record){ |
| | | return prFlowmeterMapper.flowmeterAddMonId(record); |
| | | } |
| | | } |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | prMonitoringFlowmeter.setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte) 1); |
| | | |
| | | PrFlowmeter flowmeter = new PrFlowmeter(); |
| | | flowmeter.setMonitoringId(po.getMonitoringId().toString()); |
| | | flowmeter.setId(po.getFlowmeterId()); |
| | | flowmeter.setOperator(po.getOperator()); |
| | | flowmeter.setOperateDt(operateTime); |
| | | Integer shu = flowmeterSv.flowmeterAddMonId(flowmeter); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if (rec == 0) { |
| | | if (rec == 0 || shu == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | |
| | | PrMonitoringFlowmeter prMonitoringFlowmeter = DtoToMoniFlowPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prMonitoringFlowmeter.setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte) 1); |
| | | prMonitoringFlowmeter.setOperatetype((byte) 2); |
| | | |
| | | PrFlowmeter flowmeter = new PrFlowmeter(); |
| | | flowmeter.setMonitoringId(null); |
| | | flowmeter.setId(po.getFlowmeterId()); |
| | | flowmeter.setOperator(po.getOperator()); |
| | | flowmeter.setOperateDt(operateTime); |
| | | Integer shu = flowmeterSv.flowmeterAddMonId(flowmeter); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if (rec == 0) { |
| | | if (rec == 0 || shu == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | |
| | | }) |
| | | @GetMapping(path = "bingRecords/{monitoringId}") |
| | | @SsoAop() |
| | | public BaseResponse<List<Map<String, Object>>> getBingRecordsByMonitoringId(@PathVariable("monitoringId") Long monitoringId) { |
| | | public BaseResponse<List<Map<String, Object>>> getBingRecordsByMonitoringId(@PathVariable("monitoringId") String monitoringId) { |
| | | try { |
| | | List<Map<String, Object>> list = Optional.ofNullable(moniFlowSv.getBingRecordsByMonitoringId(monitoringId)).orElse(new ArrayList<>()); |
| | | if (list.size() <= 0) { |
| | |
| | | * @param monitoringId |
| | | * @return PrMonitoringFlowmeter |
| | | * */ |
| | | public List<Map<String, Object>> getBingRecordsByMonitoringId(Long monitoringId){ |
| | | public List<Map<String, Object>> getBingRecordsByMonitoringId(String monitoringId){ |
| | | return prMonitoringFlowmeterMapper.getBingRecordsByMonitoringId(monitoringId); |
| | | } |
| | | } |
| | |
| | | ADD_FLOWMETER_FAIL(60001, "流量计添加失败"), |
| | | DELETE_FLOWMETER_FAIL(60002, "流量计删除失败"), |
| | | NO_FLOWMETERS(60003, "没有符合条件流量计数据"), |
| | | NO_DATA(60004, "没有找到流量计数据"), |
| | | |
| | | /** |
| | | * 流量监测站、流量计关联 |
| | |
| | | |
| | | <dependencies> |
| | | <!--OkHttp--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.squareup.okhttp3</groupId>--> |
| | | <!-- <artifactId>okhttp</artifactId>--> |
| | | <!-- <version>4.9.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- 阿里云短信依赖 --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>aliyun-java-sdk-core</artifactId> |
| | | <version>4.5.16</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>aliyun-java-sdk-dysmsapi</artifactId> |
| | | <version>2.1.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-configuration-processor</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <!--OkHttp--> |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>4.9.2</version> |
| | | </dependency> |
| | | |
| | | <!-- <!–redis场景启动器–>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.springframework.boot</groupId>--> |
| | | <!-- <artifactId>spring-boot-starter-data-redis</artifactId>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- <!– redis 连接池,新版本连接池lettuce –>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.commons</groupId>--> |
| | | <!-- <artifactId>commons-pool2</artifactId>--> |
| | | <!-- </dependency>--> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.EnableAspectJAutoProxy; |
| | | |
| | |
| | | @SpringBootApplication |
| | | @EnableAspectJAutoProxy |
| | | @EnableMultiDataSource |
| | | @EnableConfigurationProperties |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrSell"}) |
| | | @MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) |
| | | public class PipIrrSellApplication { |
| | |
| | | SpringApplication.run(PipIrrSellApplication.class, args); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrSell.client; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import com.dy.pipIrrSell.sms.AliyunSmsSv; |
| | | import com.dy.pipIrrSell.sms.RandomCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | @RequiredArgsConstructor |
| | | public class ClientCtrl { |
| | | private final ClientSv clientSv; |
| | | private final AliyunSmsSv aliyunSmsSv; |
| | | //private final RedisUtils redisUtils; |
| | | |
| | | /** |
| | | * 获取农户列表 |
| | |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_WaterTypes); |
| | | } |
| | | |
| | | /** |
| | | * 发送验证码 |
| | | * @param phoneNumber |
| | | * @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 = "send_sms") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> sendSms(@RequestParam(name = "phoneNumber", required = true) String phoneNumber) throws ClientException { |
| | | if(phoneNumber == null || phoneNumber.length() <= 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.PHONE_NUMBER_CANNOT_BE_NULL.getMessage()); |
| | | } |
| | | |
| | | // 生成6位验证码并转为Json格式 |
| | | String securityCode = String.valueOf(RandomCode.genCode()); |
| | | JSONObject param = new JSONObject(); |
| | | param.put("code", securityCode); |
| | | String templateParam = param.toJSONString(); |
| | | |
| | | //redisUtils.set(phoneNumber, securityCode, 60); |
| | | |
| | | SendSmsResponse response = aliyunSmsSv.sendSms(phoneNumber, templateParam); |
| | | if (response.getCode().equals("OK")) { |
| | | // 发送成功处理逻辑 |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } else { |
| | | // 发送失败处理逻辑 |
| | | return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_SEND_FAIL.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验验证码 |
| | | * @param phoneNumber |
| | | * @param code |
| | | * @return |
| | | * @throws ClientException |
| | | */ |
| | | @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 = "verify") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> verify(@RequestParam("phoneNumber") String phoneNumber, @RequestParam("code") String code) throws ClientException { |
| | | if(phoneNumber == null || phoneNumber.length() <= 0 || code == null || code.length() <=0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.VERIFY_PARAMS_INCOMPLETE.getMessage()); |
| | | } |
| | | |
| | | // redis中键不存在或键值不存在则提示校验失败 |
| | | //if(!redisUtils.hasKey(phoneNumber) || redisUtils.get(phoneNumber) == null) |
| | | // return BaseResponseUtils.buildFail(SellResultCode.CODE_VERIFY_FAIL.getMessage()); |
| | | // |
| | | //String code_redis = redisUtils.get(phoneNumber).toString(); |
| | | //System.out.println("--------------------: " + code_redis); |
| | | // |
| | | //if(code_redis != null && code_redis.equals(code)) { |
| | | // return BaseResponseUtils.buildSuccess(true) ; |
| | | //}else { |
| | | // return BaseResponseUtils.buildFail(SellResultCode.CODE_VERIFY_FAIL.getMessage()); |
| | | //} |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| | |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | Integer pageCurr = vo.getPageCurr(); |
| | | // 起始索引位置 |
| | | Integer startIndex = (pageCurr - 1) * pageSize; |
| | | |
| | | |
| | | // 接收传入参数:交易起止日期、收银员ID |
| | | JSONArray array_paymentSums = new JSONArray(); |
| | | Date timeStart = dateFormat.parse(vo.getTimeStart()); |
| | |
| | | totalRefund = totalRefund + Optional.ofNullable(job_summary.getFloat("refundAmount")).orElse(0f); |
| | | } |
| | | |
| | | Map map_record = new HashMap(); |
| | | //map_record.put("itemTotal", itemTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalCount", totalCount); |
| | | map_result.put("totalReceived", totalReceived); |
| | | map_result.put("totalGift", totalGift); |
| | | map_result.put("totalRefund", totalRefund); |
| | | |
| | | // 分页格式组装记录列表 |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", list.size()); |
| | | map_record.put("pageCurr", pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", (int)Math.ceil((double)list.size() / pageSize)); |
| | | JSONArray array_record = (JSONArray) JSON.toJSON(list); |
| | | JSONArray array_record_page = (JSONArray)JSON.toJSON(array_record.subList(startIndex, Math.min(startIndex + pageSize, array_record.size()))); |
| | | map_record.put("list", array_record_page); |
| | | |
| | | // 分页格式组装支付方式列表 |
| | | Map map_paymentSums = new HashMap(); |
| | | map_paymentSums.put("itemTotal", array_paymentSums.size()); |
| | | map_paymentSums.put("pageCurr", pageCurr); |
| | | map_paymentSums.put("pageSize", pageSize); |
| | | map_paymentSums.put("pageTotal", (int)Math.ceil((double)array_paymentSums.size() / pageSize)); |
| | | JSONArray array_paymentSums_page = (JSONArray) JSON.toJSON(array_paymentSums.subList(startIndex, Math.min(startIndex + pageSize, array_paymentSums.size()))); |
| | | map_paymentSums.put("list", array_paymentSums_page); |
| | | |
| | | |
| | | map_result.put("records", map_record); |
| | | map_result.put("paymentSums", array_paymentSums); |
| | | map_result.put("paymentSums", map_paymentSums); |
| | | |
| | | return map_result; |
| | | } |
| | |
| | | */ |
| | | No_GENERALS(100001, "没有符合条件的总账记录"), |
| | | No_TRADE_SUMMARIES(100001, "没有符合条件的交易汇总记录"), |
| | | No_TRADE_DETAILS(100001, "没有符合条件的交易明细"); |
| | | No_TRADE_DETAILS(100001, "没有符合条件的交易明细"), |
| | | |
| | | /** |
| | | * 微信用户 |
| | | */ |
| | | PHONE_NUMBER_CANNOT_BE_NULL(20001, "手机号不能为空"), |
| | | SECURITY_CODE_SEND_FAIL(20001, "验证码发送失败"), |
| | | VERIFY_PARAMS_INCOMPLETE(20001, "验证参数不完整"), |
| | | CODE_VERIFY_FAIL(20001, "验证码校验失败"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
New file |
| | |
| | | package com.dy.pipIrrSell.sms; |
| | | |
| | | import com.aliyuncs.DefaultAcsClient; |
| | | import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest; |
| | | import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.aliyuncs.profile.DefaultProfile; |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-03-22 15:30 |
| | | * @LastEditTime 2024-03-22 15:30 |
| | | * @Description 发送短信服务类 |
| | | */ |
| | | |
| | | @Service |
| | | @Data |
| | | @ConfigurationProperties(prefix = "aliyun.sms") |
| | | public class AliyunSmsSv { |
| | | /** |
| | | * 访问键 |
| | | * 访问秘钥 |
| | | * 短信签名名称 |
| | | * 短信模板Code |
| | | */ |
| | | private String smsAccessKeyId; |
| | | private String smsAccessKeySecret; |
| | | private String smsSignName; |
| | | private String smsTemplateCode; |
| | | |
| | | public SendSmsResponse sendSms(String phoneNumber, String templateParam) throws ClientException { |
| | | DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", smsAccessKeyId, smsAccessKeySecret); |
| | | DefaultAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | SendSmsRequest request = new SendSmsRequest(); |
| | | request.setSignName(smsSignName); |
| | | request.setTemplateCode(smsTemplateCode); |
| | | request.setPhoneNumbers(phoneNumber); |
| | | request.setTemplateParam(templateParam); |
| | | SendSmsResponse response = client.getAcsResponse(request); |
| | | return response; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrSell.sms; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-03-22 15:34 |
| | | * @LastEditTime 2024-03-22 15:34 |
| | | * @Description |
| | | */ |
| | | |
| | | /** |
| | | * 生成6位随机数 |
| | | */ |
| | | public class RandomCode { |
| | | public static int genCode(){ |
| | | int code = (int)((Math.random() * 9 + 1) * 100000); |
| | | return code; |
| | | } |
| | | } |
| | |
| | | idSuffix: ${pipIrr.sell.idSuffix} |
| | | #ConfigListener中应用 |
| | | #configFileNames: config-global.xml,config-demo.xml |
| | | #阿里短信服务 |
| | | aliyun: |
| | | sms: |
| | | sms-access-key-id: LTAI5tPCmHqfyJ9YnoPorEwt |
| | | sms-access-key-secret: sU2CoLdNgcjnf5uPPU2dY7NNGNvOIX |
| | | sms-template-code: SMS_460776024 |
| | | sms-sign-name: 大禹节水 |
| | | #redis |
| | | redis: |
| | | host: localhost |
| | | #password:我是没配置密码的 |
| | | port: 6379 |
| | | database: 6 #操作的是6号数据库 |
| | | pool: |
| | | max-active: 8 #最大连接数 |
| | | max-wait: -1 #连接池最大阻塞等待时间 -1表示无限 |
| | | max-idle: 4 #连接池中的最大空闲连接 |
| | | min-idle: 0 #连接池中的最小空闲连接 |