From 0eaef592517ced667ed16413f9d22ab677915101 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 02 四月 2024 11:24:53 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java | 5 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml | 18 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml | 36 ++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java | 18 + pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowSv.java | 2 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml | 9 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java | 37 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java | 21 + pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java | 12 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java | 17 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java | 86 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java | 41 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java | 1 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml | 40 +- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowMonitoringCtrl.java | 115 ++++--- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountHistory.java | 90 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java | 46 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java | 13 pipIrr-platform/pipIrr-global/pom.xml | 6 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java | 2 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMeter.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java | 32 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowMonitoring.java | 7 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml | 110 ++++--- pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml | 14 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml | 4 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java | 2 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountHistoryMapper.java | 1 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrMonitoringFlowmeterMapper.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java | 23 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java | 10 pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml | 3 pipIrr-platform/pipIrr-common/pom.xml | 5 34 files changed, 657 insertions(+), 174 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/pom.xml b/pipIrr-platform/pipIrr-common/pom.xml index be19e3a..480dd56 100644 --- a/pipIrr-platform/pipIrr-common/pom.xml +++ b/pipIrr-platform/pipIrr-common/pom.xml @@ -139,6 +139,11 @@ <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> diff --git a/pipIrr-platform/pipIrr-global/pom.xml b/pipIrr-platform/pipIrr-global/pom.xml index a2dcd29..ed3c376 100644 --- a/pipIrr-platform/pipIrr-global/pom.xml +++ b/pipIrr-platform/pipIrr-global/pom.xml @@ -134,6 +134,12 @@ <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> diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java index 3cdb561..7cd45f5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java @@ -1,6 +1,7 @@ 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; @@ -56,4 +57,16 @@ * @return 瀹炰綋闆嗗悎 */ List<VoFlowMeter> getFlowMeters(Map<?, ?> params); + + /** + * 寰楀埌鍏ㄩ儴瀹炰綋 + * @return 鍏ㄩ儴瀹炰綋 + * */ + List<PrFlowmeter> selectAll(); + /** + * 缁欐祦閲忚琛ㄥ姞鐩戞祴绔橧D澶栭敭 + * @param + * @return + */ + int flowmeterAddMonId(PrFlowmeter record); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrMonitoringFlowmeterMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrMonitoringFlowmeterMapper.java index 4c14a98..ad58204 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrMonitoringFlowmeterMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrMonitoringFlowmeterMapper.java @@ -39,5 +39,5 @@ * @param monitoringId 鐩戞祴绔欑紪鍙� * @return 缁戝畾璁板綍 */ - List<Map<String, Object>> getBingRecordsByMonitoringId(Long monitoringId); + List<Map<String, Object>> getBingRecordsByMonitoringId(String monitoringId); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountHistoryMapper.java index d3a9951..1a5b875 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountHistoryMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmIntakeAmountHistoryMapper.java @@ -1,5 +1,6 @@ package com.dy.pipIrrGlobal.daoRm; +import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountHistory; import org.apache.ibatis.annotations.Mapper; /** diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowMonitoring.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowMonitoring.java index b156927..2182772 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowMonitoring.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowMonitoring.java @@ -58,43 +58,36 @@ */ @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; /** * 鎿嶄綔浜篒D */ @Schema(description = "鎿嶄綔浜篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @NotNull(message = "鎿嶄綔浜篒D涓嶈兘涓虹┖") private Long operator; /** diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java index 892d5cd..5c60c14 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java @@ -16,7 +16,7 @@ /** * @author ZhuBaoMin * @date 2024-01-05 9:04 - * @LastEditTime 2024-01-05 9:04 + * @LastEditTime 2024-04-01 9:04 wuzeyu * @Description */ @@ -39,6 +39,13 @@ private Long id; /** + * 澶栭敭 鐩戞祴绔橧D + */ + @Schema(description = "鐩戞祴绔橧D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Length(message = "鐩戞祴绔橧D涓嶅ぇ浜巤max}瀛楋紝涓嶅皬浜巤min}瀛�", min = 1, max = 25) + private String monitoringId; + + /** * 娴侀噺璁$紪鍙� */ @Schema(description = "娴侀噺璁$紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED) @@ -58,19 +65,19 @@ * 鍦ㄧ嚎鐘舵��;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; /** * 鎿嶄綔浜篒D @@ -82,7 +89,7 @@ * 鎿嶄綔鏃堕棿 */ @Schema(description = "鎿嶄綔鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - private Date operatedt; + private Date operateDt; /** * 澶囨敞淇℃伅 diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountHistory.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountHistory.java new file mode 100644 index 0000000..a8e6cff --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountHistory.java @@ -0,0 +1,90 @@ +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 鍙栨按鍙e彇姘撮噺 + */ +@TableName(value="rm_intake_amount", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "鍙栨按鍙e彇姘撮噺") +public class RmIntakeAmountHistory implements BaseEntity { + + public static final long serialVersionUID = 202401170908001L; + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + public Long id; + + /** + * 鍙栨按鍙D锛堝閿級 + */ + @Schema(description = "鍙栨按鍙e疄浣撳閿�", 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; + + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMeter.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMeter.java index 30d5f33..a064d3d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMeter.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMeter.java @@ -24,7 +24,7 @@ @Schema(title = "ID") @ExcelProperty("ID") @ColumnWidth(10) - private Long id; + private String id; @Schema(title = "绠$綉娴侀噺璁$紪鍙�") @ExcelProperty("绠$綉娴侀噺璁$紪鍙�") diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java index 7973e6f..df43622 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java @@ -31,7 +31,7 @@ @Schema(title = "缁戝畾鐘舵��") @ExcelProperty("缁戝畾鐘舵��") @ColumnWidth(15) - private Integer bindState; + private String bindState; @Schema(title = "鍦板潃") @ExcelProperty("鍦板潃") diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java index 76fe8c1..e895f37 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java @@ -39,7 +39,7 @@ private String villageName; @Schema(title = "鐗囧尯ID") - private String blockId; + private String blockid; @Schema(title = "鐗囧尯鍚嶇О") private String bolckName; diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml index 81d2965..93e6e80 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml @@ -31,7 +31,8 @@ <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> @@ -47,7 +48,7 @@ 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 @@ -64,10 +65,10 @@ 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 diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml index 65ce426..29835ac 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml @@ -211,42 +211,52 @@ <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} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml index 9a6cf6d..408b346 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml @@ -5,19 +5,20 @@ <!--@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"> @@ -40,8 +41,8 @@ `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> @@ -58,19 +59,19 @@ <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"> @@ -90,20 +91,20 @@ <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}, @@ -123,20 +124,20 @@ <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}, @@ -152,11 +153,11 @@ 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} @@ -172,38 +173,38 @@ 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 @@ -213,4 +214,19 @@ </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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml index 2c63ca8..916a032 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml @@ -149,11 +149,15 @@ </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 diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml index 5d33225..20c1c5e 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml @@ -28,7 +28,7 @@ </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> @@ -56,7 +56,7 @@ 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}, diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml index 77f0653..39504ec 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml @@ -15,6 +15,9 @@ <name>pipIrr-web-base</name> <description>web鍩虹淇℃伅绯荤粺</description> + <dependencies> + + </dependencies> <build> <plugins> diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java index 0979aad..2f6af24 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java @@ -187,4 +187,5 @@ return BaseResponseUtils.buildSuccess(true) ; } } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java index 70235e1..e0d70d1 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java @@ -2,6 +2,8 @@ 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; @@ -12,12 +14,20 @@ 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 @@ -38,8 +48,13 @@ @Autowired private PrIntakeControllerMapper prIntakeControllerMapper; + @Autowired + private RestTemplate restTemplate; + + /** * 鏍规嵁鎸囧畾鑾峰彇鎺у埗鍣ㄨ褰� + * * @param queryVo * @return */ @@ -48,17 +63,19 @@ 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 */ @@ -77,6 +94,7 @@ /** * 鏍规嵁鎺у埗鍣ㄥ湴鍧�鑾峰彇鎺у埗鍣ㄥ垪琛� + * * @param rtuAddr * @return */ @@ -86,6 +104,7 @@ /** * 鏍规嵁鎺у埗鍣ㄧ紪鍙烽�昏緫鍒犻櫎鎺у埗 + * * @param controllerId * @return */ @@ -95,6 +114,7 @@ /** * 鏍规嵁鎸囧畾鏉′欢瀵煎嚭鎺у埗鍣ㄥ垪琛� + * * @param queryVo * @return */ @@ -102,19 +122,22 @@ 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 */ @@ -124,6 +147,7 @@ /** * 鏍规嵁涓婚敭鍒犻櫎澶栭敭 + * * @param controllerId * @return */ @@ -133,13 +157,14 @@ /** * 鑾峰彇鏈粦鎺у埗鍣ㄧ殑鍙栨按鍙e垪琛� + * * @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; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java index 32ae88f..408f593 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java @@ -15,11 +15,11 @@ @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); } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowMonitoringCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowMonitoringCtrl.java index c30ad63..b58b548 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowMonitoringCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowMonitoringCtrl.java @@ -36,13 +36,14 @@ @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 @@ -58,38 +59,45 @@ }) @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 */ @@ -104,21 +112,22 @@ }) @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 淇濆瓨鐩戞祴绔檉orm琛ㄥ崟瀵硅薄 * @return 鏄惁鎴愬姛 */ @@ -133,42 +142,46 @@ }) @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 = "杩斿洖鍏ㄩ儴鐩戞祴绔欐暟鎹�") @@ -182,22 +195,23 @@ }) @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 = "寰楀埌涓�涓洃娴嬬珯鏁版嵁") @@ -211,10 +225,10 @@ }) @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)); } } @@ -230,19 +244,18 @@ }) @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()); } } - } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java index 96513c4..3cbbdeb 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java @@ -59,9 +59,9 @@ 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()); @@ -108,18 +108,41 @@ 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()); + } + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java index 3dff9b3..a1803ac 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java @@ -60,16 +60,33 @@ */ 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; + } + + /** + * 缁欐祦閲忚琛ㄥ姞鐩戞祴绔橧D澶栭敭 + * @param + * @return + */ + public Integer flowmeterAddMonId(PrFlowmeter record){ + return prFlowmeterMapper.flowmeterAddMonId(record); + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java index a2c12df..79b50a8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java @@ -5,6 +5,7 @@ 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; @@ -85,8 +86,15 @@ 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); @@ -125,10 +133,17 @@ 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); @@ -151,7 +166,7 @@ }) @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) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowSv.java index 2c74c88..617de69 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowSv.java @@ -47,7 +47,7 @@ * @param monitoringId * @return PrMonitoringFlowmeter * */ - public List<Map<String, Object>> getBingRecordsByMonitoringId(Long monitoringId){ + public List<Map<String, Object>> getBingRecordsByMonitoringId(String monitoringId){ return prMonitoringFlowmeterMapper.getBingRecordsByMonitoringId(monitoringId); } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java index b2d3a86..2df9954 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java @@ -63,6 +63,7 @@ ADD_FLOWMETER_FAIL(60001, "娴侀噺璁℃坊鍔犲け璐�"), DELETE_FLOWMETER_FAIL(60002, "娴侀噺璁″垹闄ゅけ璐�"), NO_FLOWMETERS(60003, "娌℃湁绗﹀悎鏉′欢娴侀噺璁℃暟鎹�"), + NO_DATA(60004, "娌℃湁鎵惧埌娴侀噺璁℃暟鎹�"), /** * 娴侀噺鐩戞祴绔欍�佹祦閲忚鍏宠仈 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml index 8511298..2efc9f8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml @@ -17,11 +17,47 @@ <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> diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java index a427049..f8b120d 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java @@ -4,6 +4,7 @@ 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; @@ -17,6 +18,7 @@ @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 { @@ -25,4 +27,7 @@ SpringApplication.run(PipIrrSellApplication.class, args); } + + + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java index 0aed5d4..ddd66a5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java @@ -1,5 +1,8 @@ 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; @@ -8,6 +11,9 @@ 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; @@ -38,6 +44,8 @@ @RequiredArgsConstructor public class ClientCtrl { private final ClientSv clientSv; + private final AliyunSmsSv aliyunSmsSv; + //private final RedisUtils redisUtils; /** * 鑾峰彇鍐滄埛鍒楄〃 @@ -324,4 +332,82 @@ } return BaseResponseUtils.buildSuccess(map_WaterTypes); } + + /** + * 鍙戦�侀獙璇佺爜 + * @param phoneNumber + * @return + */ + @Operation(summary = "鍙戦�侀獙璇佺爜", description = "鍙戦�侀獙璇佺爜") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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浣嶉獙璇佺爜骞惰浆涓篔son鏍煎紡 + 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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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) ; + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java index 83c819e..7c6804d 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java @@ -132,6 +132,12 @@ 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()); @@ -196,18 +202,34 @@ 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; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java index 6209612..6e74215 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java @@ -121,7 +121,15 @@ */ 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; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java new file mode 100644 index 0000000..6012b0b --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java @@ -0,0 +1,46 @@ +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; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java new file mode 100644 index 0000000..f2049c8 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java @@ -0,0 +1,18 @@ +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; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml index ae78be9..a0f8af1 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml @@ -16,3 +16,21 @@ 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 #杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺� \ No newline at end of file -- Gitblit v1.8.0