From f1599d8230e83fb08ebb0473bbe486979b4d1d38 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期三, 29 五月 2024 17:24:16 +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/virtualCard/VirtualCardCtrl.java | 95 ++-
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java | 1
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java | 2
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java | 2
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRegist.java | 7
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java | 77 +++
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java | 19
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java | 69 ++
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java | 2
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeOpenId.java | 70 +++
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java | 191 +++++---
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java | 7
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCodeVerifyMapper.java | 34 +
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java | 6
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCodeVerify.java | 64 ++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeOpenIdMapper.java | 27 +
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml | 102 ++++
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml | 29
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java | 38 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java | 4
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java | 10
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml | 5
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java | 15
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml | 25 +
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml | 16
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java | 9
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml | 227 ++++-----
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCodeVerifyMapper.xml | 99 ++++
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/dto/CodeVerifyDTO.java | 34 +
29 files changed, 979 insertions(+), 307 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
index 854b1eb..4d85be0 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
@@ -126,4 +126,10 @@
*/
//List<VoOnLineIntake> getOnLineIntakes(@Param("onLineMap") String onLineMap, @Param("isOnLine") Boolean isOnLine);
List<VoOnLineIntake> getOnLineIntakes(Map<?, ?> params);
+
+ /**
+ * 鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛
+ * @return
+ */
+ List<VoOnLineIntake> getUsedIntakes(@Param("onLineMap") String onLineMap, @Param("operator") Long operator);
}
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
index e4db94c..a38de92 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
@@ -4,6 +4,7 @@
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -29,9 +30,10 @@
int updateByPrimaryKey(RmCommandHistory record);
/**
- * 鏍规嵁鎿嶄綔鍛業D鑾峰彇鏈叧闃�璁板綍
- * @param operator 鎿嶄綔鍛業D
- * @return 鏈叧闃�璁板綍
+ * 鏍规嵁鎿嶄綔鍛業D鑾峰彇鏈叧闃�璁板綍锛堝寘鍚湪绾挎儏鍐碉級
+ * @param onLineMap
+ * @param operator
+ * @return
*/
- List<VoUnclosedValve> getUnclosedValves(Long operator);
+ List<VoUnclosedValve> getUnclosedValves(@Param("onLineMap") String onLineMap, @Param("operator") Long operator);
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java
index 907eab3..3ca9a2f 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java
@@ -59,6 +59,13 @@
Long getClientIdByNum(@Param("clientNum") String clientNum);
/**
+ * 鏍规嵁鐢佃瘽鍙风爜鑾峰彇鍐滄埛ID
+ * @param phoneNumber
+ * @return
+ */
+ Long getClientIdByPhone(String phoneNumber);
+
+ /**
* 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍐滄埛璁板綍鏁�
* @param params
* @return
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCodeVerifyMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCodeVerifyMapper.java
new file mode 100644
index 0000000..1fca3b9
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCodeVerifyMapper.java
@@ -0,0 +1,34 @@
+package com.dy.pipIrrGlobal.daoSe;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-05-28 14:54
+ * @LastEditTime 2024-05-28 14:54
+ * @Description
+ */
+
+@Mapper
+public interface SeCodeVerifyMapper extends BaseMapper<SeCodeVerify> {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(SeCodeVerify record);
+
+ int insertSelective(SeCodeVerify record);
+
+ SeCodeVerify selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(SeCodeVerify record);
+
+ int updateByPrimaryKey(SeCodeVerify record);
+
+ /**
+ * 鏍规嵁鎵嬫満鍙疯幏鍙栭獙璇佺爜楠岃瘉瀵硅薄
+ * @param phoneNumber
+ * @return
+ */
+ SeCodeVerify getCodeVerify(String phoneNumber);
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeOpenIdMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeOpenIdMapper.java
new file mode 100644
index 0000000..d20e663
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeOpenIdMapper.java
@@ -0,0 +1,27 @@
+package com.dy.pipIrrGlobal.daoSe;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-05-28 21:04
+ * @LastEditTime 2024-05-28 21:04
+ * @Description
+ */
+
+@Mapper
+public interface SeOpenIdMapper extends BaseMapper<SeOpenId> {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(SeOpenId record);
+
+ int insertSelective(SeOpenId record);
+
+ SeOpenId selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(SeOpenId record);
+
+ int updateByPrimaryKey(SeOpenId record);
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java
index 2ccecae..0efdb8a 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java
@@ -29,19 +29,19 @@
int updateByPrimaryKey(SeVirtualCard record);
- /**
+ /** 搴熷純
* 楠岃瘉鍐滄埛鏄惁鎷ユ湁鎸囧畾鍚嶇О鐨勮櫄鎷熷崱
* @param clientId 鍐滄埛缂栧彿
* @param vcName 铏氭嫙鍗″悕绉�
* @return 绗﹀悎鏉′欢璁板綍鏁�
*/
- int getRecordCountByName(@Param("clientId") Long clientId, @Param("vcName") String vcName);
+ //int getRecordCountByName(@Param("clientId") Long clientId, @Param("vcName") String vcName);
/**
- * 鑾峰彇鍏ㄩ儴铏氭嫙鍗�
+ * 鑾峰彇鍐滄埛鍏ㄩ儴铏氭嫙鍗�
* @return
*/
- List<VoVirtualCard> getVCs();
+ List<VoVirtualCard> getVCs(@Param("clientId") Long clientId);
/**
* 鏍规嵁铏氭嫙鍗D鑾峰彇铏氭嫙鍗″璞�
@@ -56,4 +56,11 @@
* @return
*/
Long getVcIdByNum(@Param("vcNum") String vcNum);
+
+ /**
+ * 鏍规嵁琛屾斂鍖哄垝涓叉ā绯婃煡璇㈣櫄鎷熷崱缂栧彿
+ * @param areaCode
+ * @return
+ */
+ String getVcCardNumOfMax(@Param("areaCode") String areaCode);
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java
index 3e31caf..a5bdf48 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java
@@ -53,6 +53,7 @@
@JSONField(serializeUsing= ObjectWriterImplToString.class)
@TableId(value = "id", type = IdType.INPUT)
@Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ //public Long userId;
public Long id;
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCodeVerify.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCodeVerify.java
new file mode 100644
index 0000000..925e555
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCodeVerify.java
@@ -0,0 +1,64 @@
+package com.dy.pipIrrGlobal.pojoSe;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-05-28 14:54
+ * @LastEditTime 2024-05-28 14:54
+ * @Description
+ */
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dy.common.po.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.*;
+
+/**
+ * 楠岃瘉鐮佽褰曡〃
+ */
+
+@TableName(value="se_code_verify", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Schema(name = "楠岃瘉鐮佽褰曞疄浣�")
+public class SeCodeVerify implements BaseEntity {
+ public static final long serialVersionUID = 202405281457001L;
+
+ /**
+ * 涓婚敭
+ */
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
+ @TableId(type = IdType.INPUT)
+ @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Long id;
+
+ /**
+ * 鎵嬫満鍙�
+ */
+ @Schema(description = "鎵嬫満鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "鎵嬫満鍙蜂笉鑳戒负绌�")
+ private String phoneNumber;
+
+ /**
+ * 楠岃瘉鐮�
+ */
+ @Schema(description = "楠岃瘉鐮�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "楠岃瘉鐮佷笉鑳戒负绌�")
+ private String securityCode;
+
+ /**
+ * 杩囨湡鏃堕棿
+ */
+ @Schema(description = "杩囨湡鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "杩囨湡鏃堕棿涓嶈兘涓虹┖")
+ private Long expires;
+
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeOpenId.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeOpenId.java
new file mode 100644
index 0000000..75deabe
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeOpenId.java
@@ -0,0 +1,70 @@
+package com.dy.pipIrrGlobal.pojoSe;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dy.common.po.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.*;
+
+import java.util.Date;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-05-28 21:04
+ * @LastEditTime 2024-05-28 21:04
+ * @Description
+ */
+/**
+ * 寰俊鐢ㄦ埛璐︽埛琛�
+ */
+
+@TableName(value="se_open_id", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Schema(name = "寰俊鐢ㄦ埛璐︽埛瀹炰綋")
+public class SeOpenId implements BaseEntity {
+ public static final long serialVersionUID = 202405282108001L;
+
+ /**
+ * 涓婚敭
+ */
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
+ @TableId(type = IdType.INPUT)
+ @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Long id;
+
+ /**
+ * 鍐滄埛ID
+ */
+ @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖")
+ private Long clientId;
+
+ /**
+ * 鐢ㄦ埛鍞竴鏍囪瘑
+ */
+ @Schema(description = "鐢ㄦ埛鍞竴鏍囪瘑", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "鐢ㄦ埛鍞竴鏍囪瘑涓嶈兘涓虹┖")
+ private String openId;
+
+ /**
+ * 浼氳瘽瀵嗛挜
+ */
+ @Schema(description = "浼氳瘽瀵嗛挜", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "浼氳瘽瀵嗛挜涓嶈兘涓虹┖")
+ private String sessionKey;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Date createTime;
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java
index 65dc623..b398d09 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java
@@ -20,6 +20,8 @@
private String intakeNum;
+ private Boolean isOnLine;
+
private String rtuAddr;
private String orderNo;
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
index 57cba07..3b273b9 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
@@ -2,10 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--namespace瀵瑰簲mapper鎺ュ彛鎵�鍦ㄧ殑浣嶇疆-->
<mapper namespace="com.dy.pipIrrGlobal.daoBa.BaUserMapper">
+
<resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
<!--@mbg.generated-->
<!--@Table ba_user-->
- <id property="id" column="id"/>
+ <id property="id" column="id" />
<result property="blockId" column="blockId"/>
<result property="userName" column="name"/>
<result property="phone" column="phone"/>
@@ -21,17 +22,16 @@
<resultMap id="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
<!--@mbg.generated-->
<!--@Table ba_user-->
- <id property="id" column="id"/>
+ <id property="id" column="id" />
<result property="userName" column="name"/>
<result property="phone" column="phone"/>
<result property="orgTag" column="orgTag"/>
<result property="supperAdmin" column="supperAdmin"/>
- <result property="disabled" column="disabled" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler"
- javaType="com.dy.common.mybatis.envm.Disabled"/>
+ <result property="disabled" column="disabled" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Disabled"/>
</resultMap>
<resultMap id="loginResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
- <id property="id" column="id"/>
+ <id property="id" column="id" />
<result property="blockId" column="blockId"/>
<result property="userName" column="name"/>
<result property="phone" column="phone"/>
@@ -40,101 +40,79 @@
</resultMap>
<resultMap id="someResultMap" extends="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
- <collection property="roleList" fetchType="eager" column="{userId=id}"
- select="com.dy.pipIrrGlobal.daoBa.BaRoleMapper.selectByUserId"/>
+ <collection property="roleList" fetchType="eager" column="{userId=id}" select="com.dy.pipIrrGlobal.daoBa.BaRoleMapper.selectByUserId" />
</resultMap>
<sql id="Base_Column_List">
- id,
- blockId,
- name,
- phone,
- password,
- orgTag,
- supperAdmin,
- disabled,
- deleted
+ id, blockId, name, phone, password, orgTag, supperAdmin, disabled, deleted
</sql>
<sql id="part_Column_List">
- ${alias}.id,
- ${alias}.name,
- ${alias}.phone,
- ${alias}.disabled
+ ${alias}.id, ${alias}.name, ${alias}.phone, ${alias}.disabled
</sql>
<sql id="Login_Column_List">
- id,
- blockId,
- name,
- phone,
- orgTag,
- supperAdmin
+ id, blockId, name, phone, orgTag, supperAdmin
</sql>
- <select id="login" resultMap="loginResultMap">
+ <select id="login" resultMap="loginResultMap" >
select
- <include refid="Login_Column_List"/>
+ <include refid="Login_Column_List" />
from ba_user
- where disabled!=1 and deleted!=1 and phone=#{phone}
- and password=#{password}
+ where disabled!=1 and deleted!=1 and phone=#{phone} and password=#{password}
</select>
<select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long">
- select count(*)
+ select
+ count(*)
from ba_user
where supperAdmin!=1 and deleted!=1
-
<trim prefix="and" suffixOverrides="and">
<if test="name != null and name != ''">
- name like concat('%', #{name}
- , '%')
- and
+ name like concat('%', #{name}, '%') and
</if>
- <if test="phone != null and phone != ''">
+ <if test="phone != null and phone !=''">
phone = #{phone,jdbcType=VARCHAR}
</if>
</trim>
</select>
<select id="selectSome" parameterType="java.util.Map" resultMap="someResultMap">
select
- <include refid="part_Column_List">
+ <include refid="part_Column_List" >
<property name="alias" value="bu"/>
- </include>
- ,
- bb.`name` blockName
+ </include>,
+ bb.`name` blockName
from ba_user bu
- left join ba_block bb on bu.blockId = bb.id
+ left join ba_block bb on bu.blockId = bb.id
where bu.supperAdmin!=1 and bu.deleted!=1
-
<trim prefix="and" suffixOverrides="and">
<if test="name != null and name != ''">
- bu.name like concat('%', #{name}
- , '%')
- and
+ bu.name like concat('%', #{name}, '%') and
</if>
- <if test="phone != null and phone != ''">
+ <if test="phone != null and phone !=''">
bu.phone = #{phone,jdbcType=VARCHAR}
</if>
</trim>
order by id DESC
- <trim prefix="limit ">
+ <trim prefix="limit " >
<if test="start != null and count != null">
#{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
</if>
</trim>
</select>
<insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
- insert into ba_user (<include refid="Base_Column_List"/>)
- values (#{id,jdbcType=BIGINT},
- #{blockId,jdbcType=BIGINT},
- #{userName,jdbcType=VARCHAR},
- #{phone,jdbcType=VARCHAR},
- #{password,jdbcType=VARCHAR},
- #{orgTag,jdbcType=VARCHAR},
- #{supperAdmin,jdbcType=TINYINT},
- #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
- #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT})
+<!-- insert into ba_user (<include refid="Base_Column_List" />)-->
+ insert into ba_user(id, blockId, name, phone, password, orgTag, supperAdmin, disabled, deleted)
+ values (#{id,jdbcType=BIGINT},
+ #{blockId,jdbcType=BIGINT},
+ #{userName,jdbcType=VARCHAR},
+ #{phone,jdbcType=VARCHAR},
+ #{password,jdbcType=VARCHAR},
+ #{orgTag,jdbcType=VARCHAR},
+ #{supperAdmin,jdbcType=TINYINT},
+ #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
+ #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
+ )
</insert>
<insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
insert into ba_user
@@ -145,7 +123,7 @@
<if test="blockId != null">
blockId,
</if>
- <if test="userName != null">
+ <if test="userName != null">
`name`,
</if>
<if test="phone != null">
@@ -160,10 +138,10 @@
<if test="supperAdmin != null">
supperAdmin,
</if>
- <if test="disabled != null">
- disabled,
+ <if test="disabled != null">
+ disabled,
</if>
- <if test="deleted != null">
+ <if test="deleted != null">
deleted,
</if>
</trim>
@@ -174,7 +152,7 @@
<if test="blockId != null">
#{blockId,jdbcType=BIGINT},
</if>
- <if test="userName != null">
+ <if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
<if test="phone != null">
@@ -204,7 +182,7 @@
<if test="blockId != null">
blockId = #{blockId,jdbcType=BIGINT},
</if>
- <if test="userName != null">
+ <if test="userName != null">
`name` = #{userName,jdbcType=VARCHAR},
</if>
<if test="phone != null">
@@ -224,46 +202,44 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
update ba_user
- set blockId = #{blockId,jdbcType=BIGINT},
- `name` = #{userName,jdbcType=VARCHAR},
- phone = #{phone,jdbcType=VARCHAR},
- password = #{password,jdbcType=VARCHAR},
- disabled = #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
- deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
+ set blockId = #{blockId,jdbcType=BIGINT},
+ `name` = #{userName,jdbcType=VARCHAR},
+ phone = #{phone,jdbcType=VARCHAR},
+ password = #{password,jdbcType=VARCHAR},
+ disabled = #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
+ deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
- <update id="changePassword">
+ <update id="changePassword" >
update ba_user
set password = #{password,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete
- from ba_user
+ delete from ba_user
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteLogicById" parameterType="java.lang.Long">
- update ba_user
- set deleted = 1
+ update ba_user set deleted = 1
where id = #{id,jdbcType=BIGINT}
</delete>
<!--鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鐢ㄦ埛淇℃伅-->
<!--2024-01-09 搴熷純-->
<select id="getUserInfos" resultType="com.dy.pipIrrGlobal.voBa.VoUserInfo">
- SELECT user.id AS userId,
- user.`name` AS userName,
- rol.id AS roleId,
- rol.`name` AS roleName,
- per.permissions
+ SELECT
+ user.id AS userId,
+ user.`name` AS userName,
+ rol.id AS roleId,
+ rol.`name` AS roleName,
+ per.permissions
FROM ba_user user
- INNER JOIN ba_user_role use_rol
- ON user.id = use_rol.userId
+ INNER JOIN ba_user_role use_rol ON user.id = use_rol.userId
INNER JOIN ba_role rol ON rol.id = use_rol.roleId
INNER JOIN ba_role_permissions per ON per.roleId = rol.id
<where>
- <if test="userId != null and userId > 0">
+ <if test = "userId != null and userId > 0">
AND user.id = ${userId}
</if>
</where>
@@ -271,17 +247,18 @@
<!--鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鐢ㄦ埛淇℃伅-->
<select id="getUserInfoById" resultType="java.util.Map">
- SELECT us.id AS userId,
- us.name AS userName,
- us.phone,
- IFNULL(us.blockId, 0) AS blockId,
- IFNULL(blo.name, 0) AS blockName
+ SELECT
+ us.id AS userId,
+ us.name AS userName,
+ us.phone,
+ IFNULL(us.blockId, 0) AS blockId,
+ IFNULL(blo.name, 0) AS blockName
FROM ba_user us
- LEFT JOIN ba_block blo ON us.blockId = blo.id
+ LEFT JOIN ba_block blo ON us.blockId = blo.id
<where>
AND us.disabled = 0
- AND us.deleted = 0
- <if test="userId != null and userId > 0">
+ AND us.deleted = 0
+ <if test = "userId != null and userId > 0">
AND us.id = ${userId}
</if>
</where>
@@ -289,26 +266,23 @@
<!--鏍规嵁鎸囧畾鐨勬潯浠惰幏鍙栫敤鎴疯褰曟暟-->
<select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
- SELECT COUNT(*) AS recordCount
+ SELECT
+ COUNT(*) AS recordCount
FROM ba_user user
-<!-- INNER JOIN ba_user_role usro ON usro.userId = user.id-->
+ INNER JOIN ba_user_role usro ON usro.userId = user.id
<where>
AND user.supperAdmin != 1
- AND user.deleted = 0
+ AND user.deleted = 0
- <if test="userName != null and userName != ''">
- AND user.name like CONCAT('%'
- , #{userName}
- , '%')
+ <if test = "userName != null and userName !=''">
+ AND user.name like CONCAT('%',#{userName},'%')
</if>
- <if test="phone != null and phone != ''">
- AND user.phone like CONCAT('%'
- , #{phone}
- , '%')
+ <if test = "phone != null and phone !=''">
+ AND user.phone like CONCAT('%',#{phone},'%')
</if>
- <if test="roleId != null and roleId > 0">
+ <if test = "roleId != null and roleId > 0">
AND usro.roleId = ${roleId}
</if>
</where>
@@ -316,36 +290,37 @@
<!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢ㄦ埛鍒楄〃-->
<select id="getUsers" resultType="com.dy.pipIrrGlobal.voBa.VoUserInfo">
- SELECT CAST(user.id AS char) AS userId,
- user.phone,
- user.name AS userName,
- user.disabled AS stateId,
- (CASE
- WHEN disabled = 0 THEN "姝e父"
- WHEN disabled = 1 THEN "宸茬鐢�"
- END) AS stateName,
- CAST(user.blockId AS char) AS blockId,
- (SELECT name FROM ba_block WHERE id = user.blockId) AS blockName
+ SELECT
+ CAST(id AS char) AS userId,
+ phone,
+ name AS userName,
+ disabled AS stateId,
+ (CASE
+ WHEN disabled = 0 THEN "姝e父"
+ WHEN disabled = 1 THEN "宸茬鐢�"
+ END) AS stateName,
+ CAST(blockId AS char) AS blockId,
+ (SELECT name FROM ba_block WHERE id = user.blockId) AS blockName
FROM ba_user user
-<!-- INNER JOIN ba_user_role usro ON usro.userId = user.id-->
+ INNER JOIN ba_user_role usro ON usro.userId = user.id
<where>
AND user.supperAdmin != 1
- AND user.deleted = 0
+ AND user.deleted = 0
- <if test="userName != null and userName != ''">
- AND user.name like CONCAT('%', #{userName}, '%')
+ <if test = "userName != null and userName !=''">
+ AND user.name like CONCAT('%',#{userName},'%')
</if>
- <if test="phone != null and phone != ''">
- AND user.phone like CONCAT('%', #{phone}, '%')
+ <if test = "phone != null and phone !=''">
+ AND user.phone like CONCAT('%',#{phone},'%')
</if>
- <if test="roleId != null and roleId > 0">
+ <if test = "roleId != null and roleId > 0">
AND usro.roleId = ${roleId}
</if>
</where>
ORDER BY user.id DESC
- <trim prefix="limit ">
+ <trim prefix="limit " >
<if test="start != null and count != null">
#{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
</if>
@@ -354,22 +329,18 @@
<!--鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇瑙掕壊ID鍒楄〃-->
<select id="getRoleIdsByUserId" resultType="java.util.HashMap">
- SELECT roleId
+ SELECT
+ roleId
FROM ba_user_role
WHERE userId = ${userId}
</select>
<select id="getRoleNamesByUserId" resultType="java.util.HashMap">
- SELECT ro.name AS roleName
+ SELECT
+ ro.name AS roleName
FROM ba_user_role usro
INNER JOIN ba_role ro ON usro.roleId = ro.id
WHERE userId = ${userId}
- </select>
- <select id="selectById" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from ba_user
- where id = #{id,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
index 920ffce..5560dca 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -411,4 +411,29 @@
LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
</if>
</select>
+
+ <!--鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛-->
+ <select id="getUsedIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
+ SELECT
+ DISTINCT con.intakeId,
+ con.rtuAddr,
+ inta.name AS intakeNum,
+ rtus.isOnLine
+ FROM pr_controller con
+ INNER JOIN pr_intake inta ON con.intakeId = inta.id
+ INNER JOIN rm_command_history com ON con.rtuAddr = com.rtuAddr
+ INNER JOIN JSON_TABLE(
+ <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
+ #{onLineMap},
+ '$[*]' COLUMNS(
+ rtuAddr VARCHAR(20) PATH '$.rtuAddr',
+ isOnLine BOOLEAN PATH '$.isOnLine'
+ )
+ ) rtus ON con.rtuAddr = rtus.rtuAddr
+ <where>
+ <if test="operator != null">
+ com.operator = #{operator}
+ </if>
+ </where>
+ </select>
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
index f656fde..3bc43bd 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -171,20 +171,29 @@
where id = #{id,jdbcType=BIGINT}
</update>
- <!--鏍规嵁鎿嶄綔鍛業D鑾峰彇鏈叧闃�璁板綍-->
+ <!--鏍规嵁鎿嶄綔鍛業D鑾峰彇鏈叧闃�璁板綍锛堝寘鍚湪绾挎儏鍐碉級-->
<select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve">
SELECT
- com.command_code AS commandCode,
- inta.name AS intakeNum,
- com.rtuAddr,
- com.param ->>'$.orderNo' AS orderNo,
- com.param ->>'$.icCardNo' AS vcNum,
- com.send_time AS openTime
+ com.command_code AS commandCode,
+ inta.name AS intakeNum,
+ rtus.isOnLine,
+ com.rtuAddr,
+ com.param ->>'$.orderNo' AS orderNo,
+ com.param ->>'$.icCardNo' AS vcNum,
+ com.send_time AS openTime
FROM rm_command_history com
- INNER JOIN pr_controller con ON com.rtuAddr = con.rtuAddr
- INNER JOIN pr_intake inta ON con.intakeId = inta.id
+ INNER JOIN pr_controller con ON com.rtuAddr = con.rtuAddr
+ INNER JOIN pr_intake inta ON con.intakeId = inta.id
+ INNER JOIN JSON_TABLE(
+ <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
+ #{onLineMap},
+ '$[*]' COLUMNS(
+ rtuAddr VARCHAR(20) PATH '$.rtuAddr',
+ isOnLine BOOLEAN PATH '$.isOnLine'
+ )
+ ) rtus ON com.rtuAddr = rtus.rtuAddr
WHERE (com.command_code = '92' OR com.command_code = 'A2') AND com.operator = #{operator}
- AND NOT EXISTS (SELECT * FROM rm_command_history WHERE (command_code = '93' OR command_code = 'A3') AND param ->>'$.orderNo' = com.param ->>'$.orderNo')
+ AND NOT EXISTS (SELECT * FROM rm_command_history WHERE (command_code = '93' OR command_code = 'A3') AND param ->>'$.orderNo' = com.param ->>'$.orderNo')
ORDER BY com.send_time DESC
</select>
</mapper>
\ No newline at end of file
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 20c1c5e..7adaf21 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml
@@ -406,6 +406,11 @@
SELECT id FROM se_client WHERE clientNum = ${clientNum}
</select>
+ <!--鏍规嵁鐢佃瘽鍙风爜鑾峰彇鍐滄埛ID-->
+ <select id="getClientIdByPhone" resultType="java.lang.Long">
+ SELECT id FROM se_client WHERE phone = #{phoneNumber}
+ </select>
+
<!--鏍规嵁鍐滄埛ID閫昏緫鍒犻櫎鍐滄埛-->
<update id="deleteClientById" parameterType="java.lang.Long">
update se_client set deleted = 1
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCodeVerifyMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCodeVerifyMapper.xml
new file mode 100644
index 0000000..48c3d89
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCodeVerifyMapper.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeCodeVerifyMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
+ <!--@mbg.generated-->
+ <!--@Table se_code_verify-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="phone_number" jdbcType="VARCHAR" property="phoneNumber" />
+ <result column="security_code" jdbcType="VARCHAR" property="securityCode" />
+ <result column="expires" jdbcType="BIGINT" property="expires" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, phone_number, security_code, expires
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from se_code_verify
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ delete from se_code_verify
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
+ <!--@mbg.generated-->
+ insert into se_code_verify (id, phone_number, security_code,
+ expires)
+ values (#{id,jdbcType=BIGINT}, #{phoneNumber,jdbcType=VARCHAR}, #{securityCode,jdbcType=VARCHAR},
+ #{expires,jdbcType=BIGINT})
+ </insert>
+ <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
+ <!--@mbg.generated-->
+ insert into se_code_verify
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="phoneNumber != null">
+ phone_number,
+ </if>
+ <if test="securityCode != null">
+ security_code,
+ </if>
+ <if test="expires != null">
+ expires,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=BIGINT},
+ </if>
+ <if test="phoneNumber != null">
+ #{phoneNumber,jdbcType=VARCHAR},
+ </if>
+ <if test="securityCode != null">
+ #{securityCode,jdbcType=VARCHAR},
+ </if>
+ <if test="expires != null">
+ #{expires,jdbcType=BIGINT},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
+ <!--@mbg.generated-->
+ update se_code_verify
+ <set>
+ <if test="phoneNumber != null">
+ phone_number = #{phoneNumber,jdbcType=VARCHAR},
+ </if>
+ <if test="securityCode != null">
+ security_code = #{securityCode,jdbcType=VARCHAR},
+ </if>
+ <if test="expires != null">
+ expires = #{expires,jdbcType=BIGINT},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
+ <!--@mbg.generated-->
+ update se_code_verify
+ set phone_number = #{phoneNumber,jdbcType=VARCHAR},
+ security_code = #{securityCode,jdbcType=VARCHAR},
+ expires = #{expires,jdbcType=BIGINT}
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+ <!--鏍规嵁鎵嬫満鍙疯幏鍙栭獙璇佺爜楠岃瘉瀵硅薄-->
+ <select id="getCodeVerify" resultType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
+ SELECT * FROM se_code_verify
+ WHERE phone_number = #{phoneNumber}
+ ORDER BY expires DESC
+ LIMIT 0,1
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml
new file mode 100644
index 0000000..def611f
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeOpenIdMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
+ <!--@mbg.generated-->
+ <!--@Table se_open_id-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="client_id" jdbcType="BIGINT" property="clientId" />
+ <result column="open_id" jdbcType="VARCHAR" property="openId" />
+ <result column="session_key" jdbcType="VARCHAR" property="sessionKey" />
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, client_id, open_id, session_key, create_time
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from se_open_id
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ delete from se_open_id
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
+ <!--@mbg.generated-->
+ insert into se_open_id (id, client_id, open_id,
+ session_key, create_time)
+ values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{openId,jdbcType=VARCHAR},
+ #{sessionKey,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
+ </insert>
+ <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
+ <!--@mbg.generated-->
+ insert into se_open_id
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="clientId != null">
+ client_id,
+ </if>
+ <if test="openId != null">
+ open_id,
+ </if>
+ <if test="sessionKey != null">
+ session_key,
+ </if>
+ <if test="createTime != null">
+ create_time,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=BIGINT},
+ </if>
+ <if test="clientId != null">
+ #{clientId,jdbcType=BIGINT},
+ </if>
+ <if test="openId != null">
+ #{openId,jdbcType=VARCHAR},
+ </if>
+ <if test="sessionKey != null">
+ #{sessionKey,jdbcType=VARCHAR},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
+ <!--@mbg.generated-->
+ update se_open_id
+ <set>
+ <if test="clientId != null">
+ client_id = #{clientId,jdbcType=BIGINT},
+ </if>
+ <if test="openId != null">
+ open_id = #{openId,jdbcType=VARCHAR},
+ </if>
+ <if test="sessionKey != null">
+ session_key = #{sessionKey,jdbcType=VARCHAR},
+ </if>
+ <if test="createTime != null">
+ create_time = #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
+ <!--@mbg.generated-->
+ update se_open_id
+ set client_id = #{clientId,jdbcType=BIGINT},
+ open_id = #{openId,jdbcType=VARCHAR},
+ session_key = #{sessionKey,jdbcType=VARCHAR},
+ create_time = #{createTime,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/SeVirtualCardMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
index d0bfda8..f579148 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
@@ -150,7 +150,7 @@
</where>
</select>
- <!--鑾峰彇鍏ㄩ儴铏氭嫙鍗�-->
+ <!--鑾峰彇鍐滄埛鍏ㄩ儴铏氭嫙鍗�-->
<select id="getVCs" resultType="com.dy.pipIrrGlobal.voSe.VoVirtualCard">
SELECT
CAST(id AS char) AS id,
@@ -162,6 +162,11 @@
WHEN in_use = 1 THEN "浣跨敤涓�"
END) AS inUseName
FROM se_virtual_card
+ <where>
+ <if test = "clientId != null">
+ AND client_id = #{clientId}
+ </if>
+ </where>
ORDER BY in_use, money
</select>
@@ -184,4 +189,13 @@
<select id="getVcIdByNum" resultType="java.lang.Long">
SELECT id FROM se_virtual_card WHERE vc_num = #{vcNum}
</select>
+
+ <!--鏍规嵁琛屾斂鍖哄垝涓叉ā绯婃煡璇㈣櫄鎷熷崱缂栧彿-->
+ <select id="getVcCardNumOfMax" resultType="java.lang.String">
+ SELECT vc_num
+ FROM se_virtual_card
+ WHERE vc_num LIKE CONCAT('%',#{areaCode},'%')
+ ORDER BY vc_num desc
+ LIMIT 0,1
+ </select>
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
index 7482f9d..cf75af5 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
@@ -18,6 +18,7 @@
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -66,16 +67,6 @@
return rmCommandHistoryMapper.updateByPrimaryKeySelective(po);
}
-
- /**
- * 鏍规嵁鎿嶄綔鍛業D鑾峰彇鏈叧闃�璁板綍
- * @param operator
- * @return
- */
- public List<VoUnclosedValve> getUnclosedValves(Long operator) {
- return rmCommandHistoryMapper.getUnclosedValves(operator);
- }
-
/**
* 鑾峰彇鍙栨按鍙e垪琛�
* @return
@@ -116,4 +107,70 @@
}
}
+ /**
+ * 鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛
+ * @param operator
+ * @return
+ */
+ public List<VoOnLineIntake> getUsedIntakes(Long operator) {
+ Command com = new Command() ;
+ com.id = Command.defaultId;
+ com.code = "LCD0001";
+ com.type = "innerCommand";
+ JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
+
+ if(response != null && response.getString("code").equals("0001")) {
+ JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
+ HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
+
+ JSONArray jsonArray = new JSONArray();
+ for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("rtuAddr", entry.getKey());
+ jsonObject.put("isOnLine", entry.getValue());
+ jsonArray.add(jsonObject);
+ }
+ return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator);
+ } else {
+ return new ArrayList<>();
+ }
+ }
+
+ /**
+ * 鏍规嵁鎿嶄綔鍛業D鑾峰彇鏈叧闃�璁板綍锛堝寘鍚湪绾挎儏鍐碉級
+ * @param operator
+ * @return
+ */
+ public List<VoUnclosedValve> getUnclosedValves(Long operator) {
+ Command com = new Command() ;
+ com.id = Command.defaultId;
+ com.code = "LCD0001";
+ com.type = "innerCommand";
+
+ JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
+
+ if(response != null && response.getString("code").equals("0001")) {
+ JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
+ HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
+
+ JSONArray jsonArray = new JSONArray();
+ for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("rtuAddr", entry.getKey());
+ jsonObject.put("isOnLine", entry.getValue());
+ jsonArray.add(jsonObject);
+ }
+
+ List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), operator);
+ if(res != null) {
+ return res;
+ } else {
+ return new ArrayList<>();
+ }
+ } else {
+ QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>();
+ return new ArrayList<>();
+ }
+ }
+
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java
index e86e811..c0fd553 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java
@@ -51,7 +51,7 @@
protected static String controllerType = "57";
/**
- * 鏌ヨ鎵�鏈塕TU鍦ㄧ嚎鎯呭喌
+ * 鏌ヨ鎵�鏈塕TU鍦ㄧ嚎鎯呭喌锛堜粎娴嬭瘯鐢級
* @return
*/
@GetMapping(path = "get_online")
@@ -86,6 +86,23 @@
}
/**
+ * 鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛
+ * @param operator
+ * @return
+ */
+ @GetMapping(path = "used_intakes")
+ @SsoAop()
+ public BaseResponse<List<VoOnLineIntake>> getUsedIntakes(Long operator) {
+ try {
+ List<VoOnLineIntake> res = commandSv.getUsedIntakes(operator);
+ return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鏌ヨ鍙栨按鍙e紓甯�", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ }
+
+ /**
* 璁剧疆璁惧缁堢鍦板潃
* @param addr 璁剧疆璁惧缁堢鍦板潃浼犲叆瀵硅薄
* @param bindingResult
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
index b2af522..aa2d7c7 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
@@ -280,7 +280,7 @@
@SsoAop()
public BaseResponse<List<VoUnclosedValve>> getUnclosedValves(@RequestParam Long operator){
try {
- List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(operator);
+ List<VoUnclosedValve> res = commandSv.getUnclosedValves(operator);
return BaseResponseUtils.buildSuccess(res);
} catch (Exception e) {
log.error("鑾峰彇鏈叧闃�璁板綍寮傚父", e);
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 bc45365..af54665 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
@@ -10,10 +10,15 @@
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoBa.BaClient;
import com.dy.pipIrrGlobal.pojoSe.SeClient;
+import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
+import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.voSe.VoClient;
+import com.dy.pipIrrSell.client.dto.CodeVerifyDTO;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.sms.AliyunSmsSv;
import com.dy.pipIrrSell.sms.RandomCode;
+import com.dy.pipIrrSell.util.RestTemplateUtil;
+import com.dy.pipIrrSell.wechatpay.PayInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -29,6 +34,7 @@
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
+import java.io.IOException;
import java.util.*;
/**
@@ -47,10 +53,21 @@
private final ClientSv clientSv;
private final AliyunSmsSv aliyunSmsSv;
//private final RedisUtils redisUtils;
+ private final RestTemplateUtil restTemplateUtil;
+
+ private final String privateCertFileName = PayInfo.privateCertFileName;
+ private final String appid = PayInfo.appid;
+ private final String secret = PayInfo.secret;
+ private final String mchid = PayInfo.mchid;
+ private final String schema = PayInfo.schema;
+ private final String signType = PayInfo.signType;
+ private final String description = PayInfo.description;
+ private final String loginUrl = PayInfo.loginUrl;
+ private final String notifyUrl = PayInfo.notifyUrl;
+ private final String grantType = PayInfo.grantType;
/**
* 鑾峰彇鍐滄埛鍒楄〃
- *
* @param vo
* @return
*/
@@ -65,19 +82,18 @@
})
@GetMapping(path = "get")
@SsoAop()
- public BaseResponse<QueryResultVo<List<VoClient>>> get(QueryVo vo) {
+ public BaseResponse<QueryResultVo<List<VoClient>>> get(QueryVo vo){
try {
QueryResultVo<List<VoClient>> res = clientSv.getClients(vo);
return BaseResponseUtils.buildSuccess(res);
} catch (Exception e) {
log.error("鏌ヨ鍐滄埛寮傚父", e);
- return BaseResponseUtils.buildException(e.getMessage());
+ return BaseResponseUtils.buildException(e.getMessage()) ;
}
}
/**
* 鏍规嵁涓婚敭鑾峰彇涓�涓啘鎴峰璞�
- *
* @param id
* @return
*/
@@ -92,20 +108,19 @@
})
@GetMapping(path = "/getone/{id}")
@SsoAop()
- public BaseResponse<VoClient> getOneClient(@PathVariable("id") Long id) {
+ public BaseResponse<VoClient> getOneClient(@PathVariable("id") Long id){
try {
VoClient res = clientSv.getOneClient(id);
return BaseResponseUtils.buildSuccess(res);
} catch (Exception e) {
log.error("鏌ヨ鍐滄埛寮傚父", e);
- return BaseResponseUtils.buildException(e.getMessage());
+ return BaseResponseUtils.buildException(e.getMessage()) ;
}
}
/**
* 娣诲姞涓�涓啘鎴峰璞�
- *
* @param po
* @param bindingResult
* @return
@@ -123,7 +138,7 @@
@Transactional(rollbackFor = Exception.class)
@SsoAop()
public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult) {
- if (bindingResult != null && bindingResult.hasErrors()) {
+ if(bindingResult != null && bindingResult.hasErrors()){
return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
@@ -134,7 +149,7 @@
* 鑾峰彇5绾ц鏀垮尯鍒掍俊鎭�
*/
Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
- if (map_districts.size() <= 0) {
+ if(map_districts.size() <= 0) {
return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎");
}
@@ -159,11 +174,11 @@
// 鐢熸垚铏氭嫙鍗″彿
Long virtualId = Optional.ofNullable(clientSv.getMa1xVirtualId()).orElse(0L);
- if (virtualId == 0) {
+ if(virtualId == 0) {
virtualId = 1000000000L;
- } else {
+ }else {
virtualId = virtualId + 1;
- if (virtualId > 10000000000L) {
+ if(virtualId > 10000000000L) {
return BaseResponseUtils.buildFail("铏氭嫙鍗″彿瓒呴檺");
}
}
@@ -178,33 +193,33 @@
Date operateTime = new Date();
seClient.setOperatedt(operateTime);
- seClient.setDisabled((byte) 0);
- seClient.setDeleted((byte) 0);
+ seClient.setDisabled((byte)0);
+ seClient.setDeleted((byte)0);
Integer rec = Optional.ofNullable(clientSv.addClient(seClient)).orElse(0);
- if (rec == 0) {
+ if(rec == 0) {
return BaseResponseUtils.buildFail("娣诲姞鍐滄埛澶辫触");
}
- return BaseResponseUtils.buildSuccess(true);
+ return BaseResponseUtils.buildSuccess(true) ;
}
/**
* 鐢熸垚10浣嶅啘鎴风紪鍙�
* 1. 鍒板啘鎴疯〃涓煡璇�6浣嶅尯鍒掍覆寮�澶寸殑鏈�澶х殑鍐滄埛缂栧彿
* 2. 鏄惁鍙栧埌璁板綍
- * 2.1 鍙栧埌
- * 2.1.1 鍙栧嚭鍚�4浣嶉『搴忓彿骞惰浆鎴愭暣褰�
- * 2.1.2. 鏁村舰鏍煎紡鐨勯『搴忓彿鍔�1骞跺垽鏂槸鍚﹀ぇ浜�9999
- * 2.1.2.1 濡傛灉澶т簬鍒欐彁绀虹敤鎴风紪鍙峰凡婊�
- * 2.1.2.2 濡傛灉涓嶅ぇ 6浣嶅尯鍒掑姞涓婃牸寮忓寲鍚庣殑椤哄簭鍙�
- * 2.2 鏈彇鍒� 6浣嶅尯鍒掑姞涓�0001
+ * 2.1 鍙栧埌
+ * 2.1.1 鍙栧嚭鍚�4浣嶉『搴忓彿骞惰浆鎴愭暣褰�
+ * 2.1.2. 鏁村舰鏍煎紡鐨勯『搴忓彿鍔�1骞跺垽鏂槸鍚﹀ぇ浜�9999
+ * 2.1.2.1 濡傛灉澶т簬鍒欐彁绀虹敤鎴风紪鍙峰凡婊�
+ * 2.1.2.2 濡傛灉涓嶅ぇ 6浣嶅尯鍒掑姞涓婃牸寮忓寲鍚庣殑椤哄簭鍙�
+ * 2.2 鏈彇鍒� 6浣嶅尯鍒掑姞涓�0001
* 3. 杩斿洖鍐滄埛缂栧彿
*/
private String generateClientNum(String district8) {
String clientNum = Optional.ofNullable(clientSv.getClientNumOfMax(district8)).orElse("");
- if (clientNum != null && clientNum.trim().length() > 0) {
+ if(clientNum != null && clientNum.trim().length() > 0) {
Integer number = Integer.parseInt(clientNum.substring(8));
number = number + 1;
- if (number > 9999) {
+ if(number > 9999) {
return "鍐滄埛缂栧彿瓒呴檺";
}
clientNum = clientNum.substring(0, 8) + String.format("%04d", number);
@@ -216,8 +231,7 @@
/**
* 淇敼鍐滄埛瀵硅薄锛堣櫄鎷熷崱鍙枫�佺姝㈡爣蹇椼�侀�昏緫鍒犻櫎鏍囪瘑涓嶅弬涓庝慨鏀癸級
- *
- * @param po 鍐滄埛瀵硅薄
+ * @param po 鍐滄埛瀵硅薄
* @param bindingResult
* @return
*/
@@ -233,8 +247,8 @@
@PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
@Transactional(rollbackFor = Exception.class)
@SsoAop()
- public BaseResponse<Boolean> update(@RequestBody @Valid DtoClient po, BindingResult bindingResult) {
- if (bindingResult != null && bindingResult.hasErrors()) {
+ public BaseResponse<Boolean> update(@RequestBody @Valid DtoClient po, BindingResult bindingResult){
+ if(bindingResult != null && bindingResult.hasErrors()){
return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
@@ -245,7 +259,7 @@
* 鑾峰彇5绾ц鏀垮尯鍒掍俊鎭�
*/
Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
- if (map_districts.size() <= 0) {
+ if(map_districts.size() <= 0) {
return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎");
}
@@ -278,15 +292,14 @@
seClient.setOperatedt(operateTime);
Integer rec = Optional.ofNullable(clientSv.updateByPrimaryKey(seClient)).orElse(0);
- if (rec == 0) {
+ if(rec == 0) {
return BaseResponseUtils.buildFail("鍐滄埛淇敼澶辫触");
}
- return BaseResponseUtils.buildSuccess(true);
+ return BaseResponseUtils.buildSuccess(true) ;
}
/**
* 鏍规嵁鍐滄埛ID閫昏緫鍒犻櫎鍐滄埛
- *
* @param id
* @return
*/
@@ -302,22 +315,21 @@
@GetMapping(path = "/delone/{id}")
@SsoAop()
- public BaseResponse<Boolean> deleteClientById(@PathVariable("id") Long id) {
+ public BaseResponse<Boolean> deleteClientById(@PathVariable("id") Long id){
try {
Integer res = Optional.ofNullable(clientSv.deleteClientById(id)).orElse(0);
- if (res == 0) {
+ if(res == 0) {
return BaseResponseUtils.buildFail("鍐滄埛鍒犻櫎澶辫触");
}
return BaseResponseUtils.buildSuccess(true);
} catch (Exception e) {
log.error("鏌ヨ鍐滄埛寮傚父", e);
- return BaseResponseUtils.buildException(e.getMessage());
+ return BaseResponseUtils.buildException(e.getMessage()) ;
}
}
/**
* 鑾峰彇鐢ㄦ按鏂瑰紡鍒楄〃
- *
* @param
* @return
*/
@@ -332,17 +344,16 @@
})
@GetMapping(path = "/watertypes")
@SsoAop()
- public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getWaterTypes() {
+ public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getWaterTypes(){
List<Map<String, Object>> map_WaterTypes = Optional.ofNullable(clientSv.getWaterTypes()).orElse(new ArrayList<>());
- if (map_WaterTypes == null || map_WaterTypes.size() == 0) {
- return BaseResponseUtils.buildFail("娌℃湁鐢ㄦ按鏂瑰紡");
+ if(map_WaterTypes == null || map_WaterTypes.size() == 0) {
+ return BaseResponseUtils.buildFail("娌℃湁鐢ㄦ按鏂瑰紡") ;
}
return BaseResponseUtils.buildSuccess(map_WaterTypes);
}
/**
* 鍙戦�侀獙璇佺爜
- *
* @param phoneNumber
* @return
*/
@@ -358,7 +369,7 @@
@PostMapping(path = "send_sms")
@SsoAop()
public BaseResponse<Boolean> sendSms(@RequestParam(name = "phoneNumber", required = true) String phoneNumber) throws ClientException {
- if (phoneNumber == null || phoneNumber.length() <= 0) {
+ if(phoneNumber == null || phoneNumber.length() <= 0) {
return BaseResponseUtils.buildFail(SellResultCode.PHONE_NUMBER_CANNOT_BE_NULL.getMessage());
}
@@ -370,23 +381,35 @@
//redisUtils.set(phoneNumber, securityCode, 60);
+ // 鑾峰彇褰撳墠鏃堕棿鎴冲苟寤跺悗3鍒嗛挓
+ Long timestamp = System.currentTimeMillis();
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(timestamp);
+ calendar.add(Calendar.SECOND, 180);
+ Long expires = calendar.getTimeInMillis();
+
+ SeCodeVerify codeVerify = new SeCodeVerify();
+ codeVerify.setPhoneNumber(phoneNumber);
+ codeVerify.setSecurityCode(securityCode);
+ codeVerify.setExpires(expires);
+ clientSv.addCodeVerify(codeVerify);
+
SendSmsResponse response = aliyunSmsSv.sendSms(phoneNumber, templateParam);
if (response.getCode().equals("OK")) {
// 鍙戦�佹垚鍔熷鐞嗛�昏緫
- return BaseResponseUtils.buildSuccess(true);
+ return BaseResponseUtils.buildSuccess(true) ;
} else {
// 鍙戦�佸け璐ュ鐞嗛�昏緫
- return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_SEND_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_SEND_FAIL.getMessage()) ;
}
}
/**
* 鏍¢獙楠岃瘉鐮�
- *
- * @param phoneNumber
- * @param code
+ * @param po
+ * @param bindingResult
* @return
- * @throws ClientException
+ * @throws IOException
*/
@Operation(summary = "鏍¢獙楠岃瘉鐮�", description = "鏍¢獙楠岃瘉鐮�")
@ApiResponses(value = {
@@ -397,32 +420,66 @@
schema = @Schema(implementation = Boolean.class))}
)
})
- @PostMapping(path = "verify")
+ @PostMapping(path = "verify", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @Transactional(rollbackFor = Exception.class)
@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());
+ public BaseResponse<Boolean> verify(@RequestBody @Valid CodeVerifyDTO po, BindingResult bindingResult) throws IOException {
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
- // 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());
- //}
+ String phoneNumber = po.getPhoneNumber();
+ String securityCode = po.getSecurityCode();
+ String code = po.getCode();
- return BaseResponseUtils.buildSuccess(true);
+ // 杩涜鎵嬫満鍙枫�侀獙璇佺爜銆佽繃鏈熸椂闂存牎楠�
+ SeCodeVerify codeVerify = clientSv.getCodeVerify(phoneNumber);
+ if(codeVerify == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.NO_SECURITY_CODE_FOR_PHONE.getMessage());
+ }
+
+ if(!codeVerify.getSecurityCode().equals(securityCode)) {
+ return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_ERROR.getMessage());
+ }
+
+ Long currentTimestamp = System.currentTimeMillis();
+ if(currentTimestamp > codeVerify.getExpires() ) {
+ return BaseResponseUtils.buildFail(SellResultCode.VALIDATION_TIMEOUT.getMessage());
+ }
+
+ // 鏍¢獙閫氳繃锛岃繘琛岀櫥褰曞嚟璇佹牎楠�
+ Map<String, Object> queryParams = new HashMap<>();
+ queryParams.put("appid", appid);
+ queryParams.put("secret", secret);
+ queryParams.put("js_code", code);
+ queryParams.put("grant_type", grantType);
+ Map<String, String> headerParams = new HashMap<>();
+ JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams);
+
+ if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) {
+ return BaseResponseUtils.buildFail("鐧诲綍鍑瘉鏍¢獙澶辫触");
+ }
+ String openid = job.getString("openid");
+ String sessionKey = job.getString("session_key");
+
+ Long clientId = clientSv.getClientIdByPhone(phoneNumber);
+ if(clientId != null) {
+ // 娣诲姞寰俊鐢ㄦ埛璐︽埛璁板綍
+ SeOpenId seOpenId = new SeOpenId();
+ seOpenId.setClientId(clientId);
+ seOpenId.setOpenId(openid);
+ seOpenId.setSessionKey(sessionKey);
+ seOpenId.setCreateTime(new Date());
+ Long SessionId = clientSv.addOpenId(seOpenId);
+ return BaseResponseUtils.buildSuccess(SessionId);
+
+ } else {
+ return BaseResponseUtils.buildError(SellResultCode.PHONE_NUMBER_IS_ERROR.getMessage());
+ }
}
/**
* 鏍规嵁鏉慖D鑾峰彇12浣嶈鏀垮尯鍒�
- *
* @param villageId
* @return
*/
@@ -437,12 +494,12 @@
})
@GetMapping(path = "district")
@SsoAop()
- public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "鏉戠紪鍙蜂笉鑳戒负绌�") Long villageId) {
+ public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "鏉戠紪鍙蜂笉鑳戒负绌�") Long villageId){
/**
* 鑾峰彇5绾ц鏀垮尯鍒掍俊鎭�
*/
Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
- if (map_districts.size() <= 0) {
+ if(map_districts.size() <= 0) {
return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎");
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java
index cc4f739..77e891b 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java
@@ -4,11 +4,14 @@
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientMapper;
+import com.dy.pipIrrGlobal.daoSe.SeCodeVerifyMapper;
+import com.dy.pipIrrGlobal.daoSe.SeOpenIdMapper;
import com.dy.pipIrrGlobal.pojoSe.SeClient;
+import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
+import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.voSe.VoClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
-import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -32,31 +35,35 @@
private BaDistrictMapper baDistrictMapper;
@Autowired
+ private SeCodeVerifyMapper seCodeVerifyMapper;
+
+ @Autowired
+ private SeOpenIdMapper seOpenIdMapper;
+
+ @Autowired
private BaSettingsMapper baSettingsMapper;
/**
* 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍐滄埛鏁版嵁
- *
* @param queryVo
* @return
*/
- public QueryResultVo<List<VoClient>> getClients(QueryVo queryVo) {
- Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+ public QueryResultVo<List<VoClient>> getClients(QueryVo queryVo){
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ;
Long itemTotal = seClientMapper.getRecordCount(params);
- QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>();
- rsVo.pageSize = queryVo.pageSize;
- rsVo.pageCurr = queryVo.pageCurr;
+ QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ;
+ rsVo.pageSize = queryVo.pageSize ;
+ rsVo.pageCurr = queryVo.pageCurr ;
rsVo.calculateAndSet(itemTotal, params);
rsVo.obj = seClientMapper.getClients(params);
- return rsVo;
+ return rsVo ;
}
/**
* 鏍规嵁涓婚敭鑾峰彇鍐滄埛瀵硅薄
- *
* @param id 鍐滄埛涓婚敭
* @return 鍐滄埛瀵硅薄
*/
@@ -65,10 +72,8 @@
VoClient voClient = SeClientToVoClient.INSTANCT.po2vo(seClient);
return voClient;
}
-
/**
* 澧炲紑鍐滄埛
- *
* @param po
* @return
*/
@@ -77,8 +82,24 @@
}
/**
+ * 娣诲姞楠岃瘉鐮佽褰�
+ * @param po
+ * @return
+ */
+ public Integer addCodeVerify(SeCodeVerify po) {
+ return seCodeVerifyMapper.insert(po);
+ }
+
+ /**
+ * 鏍规嵁鎵嬫満鍙疯幏鍙栭獙璇佺爜楠岃瘉瀵硅薄
+ * @param phoneNumber
+ * @return
+ */
+ public SeCodeVerify getCodeVerify(String phoneNumber) {
+ return seCodeVerifyMapper.getCodeVerify(phoneNumber);
+ }
+ /**
* 鏍规嵁6浣嶅尯鍒掍覆妯$硦鏌ヨ鍐滄埛缂栧彿
- *
* @param district6
* @return
*/
@@ -88,7 +109,6 @@
/**
* 鏍规嵁鏉戠紪鍙疯幏鍙�5绾у尯鍒掍俊鎭�
- *
* @param villageId 鏉戠紪鍙凤紙涓婚敭锛�
* @return 5绾ц鏀垮尯鍒掍俊鎭�
*/
@@ -105,7 +125,6 @@
/**
* 淇敼鍐滄埛瀵硅薄
- *
* @param po 鍐滄埛瀵硅薄
* @return 淇敼璁板綍鏉℃暟
*/
@@ -115,7 +134,6 @@
/**
* 鏍规嵁涓婚敭鑾峰彇鏉慖D
- *
* @param id
* @return
*/
@@ -125,7 +143,6 @@
/**
* 鑾峰彇铏氭嫙鍗″彿鏈�澶у��
- *
* @return
*/
public Long getMa1xVirtualId() {
@@ -134,7 +151,6 @@
/**
* 鑾峰彇鐢ㄦ按鏂瑰紡鍒楄〃
- *
* @return
*/
public List<Map<String, Object>> getWaterTypes() {
@@ -142,6 +158,25 @@
}
/**
+ * 鏍规嵁鐢佃瘽鍙风爜鑾峰彇鍐滄埛ID
+ * @param phoneNumber
+ * @return
+ */
+ public Long getClientIdByPhone(String phoneNumber) {
+ return seClientMapper.getClientIdByPhone(phoneNumber);
+ }
+
+ /**
+ * 娣诲姞寰俊鐢ㄦ埛璐︽埛璁板綍
+ * @param po
+ * @return
+ */
+ public Long addOpenId(SeOpenId po) {
+ seOpenIdMapper.insert(po);
+ return po.getClientId();
+ }
+
+ /**
* 鏍规嵁閰嶇疆椤硅幏鍙栭厤缃」鍊�
* @param itemName
* @return
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/dto/CodeVerifyDTO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/dto/CodeVerifyDTO.java
new file mode 100644
index 0000000..fa660bf
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/dto/CodeVerifyDTO.java
@@ -0,0 +1,34 @@
+package com.dy.pipIrrSell.client.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-05-28 18:41
+ * @LastEditTime 2024-05-28 18:41
+ * @Description
+ */
+
+@Data
+public class CodeVerifyDTO {
+
+ /**
+ * 鎵嬫満鍙�
+ */
+ @NotBlank(message = "鎵嬫満鍙蜂笉鑳戒负绌�")
+ private String phoneNumber;
+
+ /**
+ * 楠岃瘉鐮�
+ */
+ @NotBlank(message = "楠岃瘉鐮佷笉鑳戒负绌�")
+ private String securityCode;
+
+ /**
+ * 鐢ㄦ埛鐧诲綍鍑瘉
+ */
+ @NotBlank(message = "鐢ㄦ埛鐧诲綍鍑瘉涓嶈兘涓虹┖")
+ private String code;
+
+}
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 dc2c09e..48e66b5 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
@@ -92,7 +92,7 @@
CARD_NAME_ESIST(90001, "璇ュ悕绉拌櫄鎷熷崱宸茬粡瀛樺湪"),
CLIENT_ID_CANNOT_BE_NULL(90001, "鍐滄埛缂栧彿涓嶈兘涓虹┖"),
- WALLET_OPEN_ACCOUNT_FAIL(90002, "铏氭嫙鍗¤处鎴锋敞鍐屽け璐�"),
+ VC_OPEN_ACCOUNT_FAIL(90002, "铏氭嫙鍗¤处鎴锋敞鍐屽け璐�"),
//WALLET_ACCOUNT_EXIST(90003, "璇ュ啘鎴峰凡娉ㄥ唽鐢靛瓙閽卞寘"),
NO_ACCOUNT(90004, "鎮ㄦ寚瀹氱殑铏氭嫙鍗℃湭娉ㄥ唽"),
@@ -130,7 +130,12 @@
PHONE_NUMBER_CANNOT_BE_NULL(20001, "鎵嬫満鍙蜂笉鑳戒负绌�"),
SECURITY_CODE_SEND_FAIL(20001, "楠岃瘉鐮佸彂閫佸け璐�"),
VERIFY_PARAMS_INCOMPLETE(20001, "楠岃瘉鍙傛暟涓嶅畬鏁�"),
- CODE_VERIFY_FAIL(20001, "楠岃瘉鐮佹牎楠屽け璐�");
+ CODE_VERIFY_FAIL(20001, "楠岃瘉鐮佹牎楠屽け璐�"),
+
+ NO_SECURITY_CODE_FOR_PHONE(20002, "璇ユ墜鏈哄彿鏈彂閫侀獙璇佺爜"),
+ SECURITY_CODE_ERROR(20003, "楠岃瘉鐮侀敊璇�"),
+ VALIDATION_TIMEOUT(20004, "楠岃瘉瓒呮椂"),
+ PHONE_NUMBER_IS_ERROR(20004, "鎵嬫満鍙烽敊璇紝闈炴敞鍐屽啘鎴�");
private final Integer code;
private final String message;
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java
index 22f2cca..26cb867 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java
@@ -3,15 +3,24 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
+import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.util.PayHelper;
+import com.dy.pipIrrSell.virtualCard.dto.DtoRegist;
+import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import java.util.Date;
import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
/**
* @author ZhuBaoMin
@@ -31,14 +40,14 @@
private final PayHelper payHelper;
/**
- * 鑾峰彇鍏ㄩ儴铏氭嫙鍗�
+ * 鑾峰彇鍐滄埛鍏ㄩ儴铏氭嫙鍗�
* @return
*/
@GetMapping(path = "/get")
@SsoAop()
- public BaseResponse<List<VoVirtualCard>> getVCs(){
+ public BaseResponse<List<VoVirtualCard>> getVCs(Long clientId){
try {
- List<VoVirtualCard> res = virtualCardSv.getVCs();
+ List<VoVirtualCard> res = virtualCardSv.getVCs(clientId);
return BaseResponseUtils.buildSuccess(res);
} catch (Exception e) {
log.error("鑾峰彇鏀粯鏂瑰紡璁板綍寮傚父", e);
@@ -68,44 +77,48 @@
* @param bindingResult
* @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 = "add_vc")
- //@SsoAop()
- //public BaseResponse<Boolean> addVC(@RequestBody @Valid DtoRegist po, BindingResult bindingResult){
- // if(bindingResult != null && bindingResult.hasErrors()){
- // return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
- // }
- // Long clientId = po.getClientId();
- // String vcName = po.getVcName();
- //
- // // 鍚嶇О楠岄噸
- // Integer rc = virtualCardSv.getRecordCountByName(po);
- // if(rc != null && rc > 0) {
- // return BaseResponseUtils.buildFail(SellResultCode.CARD_NAME_ESIST.getMessage());
- // }
- //
- // SeVirtualCard seVirtualCard = new SeVirtualCard();
- // seVirtualCard.setVcName(vcName);
- // seVirtualCard.setClientId(clientId);
- // seVirtualCard.setMoney(0d);
- // seVirtualCard.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode());
- // seVirtualCard.setLastOperateTime(new Date());
- // seVirtualCard.setInUse((byte) 0);
- // seVirtualCard.setCreateTime(new Date());
- // Long rec = virtualCardSv.insertVirtualCard(seVirtualCard);
- // if(rec == null) {
- // return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
- // }
- // return BaseResponseUtils.buildSuccess(true) ;
- //}
+ @PostMapping(path = "add_vc")
+ @SsoAop()
+ public BaseResponse<Boolean> addVC(@RequestBody @Valid DtoRegist po, BindingResult bindingResult){
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ Long clientId = po.getClientId();
+
+ // 鑾峰彇5绾ц鏀垮尯鍒掍覆areaCode
+ String areaCode = String.valueOf(virtualCardSv.getAreaCodeById(clientId));
+ /**
+ * 鏍规嵁琛屾斂鍖哄垝涓诧紙areaCode锛夊湪铏氭嫙鍗¤〃涓拡瀵硅櫄鎷熷崱缂栧彿锛坴cNum锛夎繘琛屾ā绯婃煡璇�
+ * 濡傛灉5浣嶉『搴忓彿宸茬粡杈惧埌鏈�澶у�硷紝鎻愮ず鐢ㄦ埛鑱旂郴绯荤粺绠$悊鍛�
+ * 濡傛灉5浣嶉『搴忓彿鏈揪鍒版渶澶у�硷紝鍒欏姞1
+ * cardNum涓烘柊鐨勫崱鍙�
+ */
+ String vcNum = Optional.ofNullable(virtualCardSv.getVcCardNumOfMax(areaCode)).orElse("");
+ if(vcNum != null && vcNum.trim().length() > 0) {
+ Integer number = Integer.parseInt(vcNum.substring(12));
+ number = number + 1;
+ if(number > 99999) {
+ return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_OVERRUN.getMessage());
+ }
+ vcNum = vcNum.substring(0, 12) + String.format("%05d", number);
+ } else {
+ vcNum = areaCode + "00001";
+ }
+
+ SeVirtualCard seVirtualCard = new SeVirtualCard();
+ seVirtualCard.setVcNum(Long.parseLong(vcNum));
+ seVirtualCard.setClientId(clientId);
+ seVirtualCard.setMoney(0d);
+ seVirtualCard.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode());
+ seVirtualCard.setLastOperateTime(new Date());
+ seVirtualCard.setInUse((byte) 0);
+ seVirtualCard.setCreateTime(new Date());
+ Long rec = virtualCardSv.insertVirtualCard(seVirtualCard);
+ if(rec == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.VC_OPEN_ACCOUNT_FAIL.getMessage());
+ }
+ return BaseResponseUtils.buildSuccess(true) ;
+ }
/**
* 鐢ㄦ埛鐢宠閫�娆�
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
index d25ae40..e478388 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
@@ -2,10 +2,7 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
-import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper;
-import com.dy.pipIrrGlobal.daoSe.SeVcRefundItemMapper;
-import com.dy.pipIrrGlobal.daoSe.SeVcRefundMapper;
-import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
+import com.dy.pipIrrGlobal.daoSe.*;
import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefund;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem;
@@ -13,7 +10,6 @@
import com.dy.pipIrrGlobal.voSe.VoOrders;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrSell.result.SellResultCode;
-import com.dy.pipIrrSell.virtualCard.dto.DtoRegist;
import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import com.dy.pipIrrSell.virtualCard.enums.OrderStateENUM;
@@ -47,13 +43,24 @@
@Autowired
private SeVcRefundItemMapper seVcRefundItemMapper;
+ @Autowired
+ private SeClientMapper seClientMapper;
/**
- * 鑾峰彇鍏ㄩ儴铏氭嫙鍗�
+ * 鏍规嵁鍐滄埛ID鑾峰彇5绾ц鏀垮尯鍒掍唬鐮侊紝娉ㄥ唽铏氭嫙鍗′娇鐢�
+ * @param clientId 鍐滄埛ID
+ * @return 5绾ц鏀垮尯鍒掍唬鐮�
+ */
+ public Long getAreaCodeById(Long clientId) {
+ return seClientMapper.getAreaCodeById(clientId);
+ }
+
+ /**
+ * 鑾峰彇鍐滄埛鍏ㄩ儴铏氭嫙鍗�
* @return
*/
- public List<VoVirtualCard> getVCs() {
- return seVirtualCardMapper.getVCs();
+ public List<VoVirtualCard> getVCs(Long clientId) {
+ return seVirtualCardMapper.getVCs(clientId);
}
/**
@@ -76,13 +83,22 @@
}
/**
+ * 鏍规嵁琛屾斂鍖哄垝涓叉ā绯婃煡璇㈣櫄鎷熷崱缂栧彿锛屾敞鍐岃櫄鎷熷崱浣跨敤
+ * @param areaCode
+ * @return
+ */
+ String getVcCardNumOfMax(String areaCode) {
+ return seVirtualCardMapper.getVcCardNumOfMax(areaCode);
+ }
+
+ /** 搴熷純
* 楠岃瘉鍐滄埛鏄惁鎷ユ湁鎸囧畾鍚嶇О鐨勮櫄鎷熷崱
* @param po
* @return
*/
- public Integer getRecordCountByName(DtoRegist po) {
- return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName());
- }
+ //public Integer getRecordCountByName(DtoRegist po) {
+ // return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName());
+ //}
/**
* 淇敼铏氭嫙鍗�
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRegist.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRegist.java
index c898024..52f9a52 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRegist.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRegist.java
@@ -1,7 +1,6 @@
package com.dy.pipIrrSell.virtualCard.dto;
import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@@ -24,10 +23,4 @@
@NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖")
private Long clientId;
- /**
- * 铏氭嫙鍗″悕绉�
- */
- @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
- @NotBlank(message = "铏氭嫙鍗″悕绉颁笉鑳戒负绌�")
- private String vcName;
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
index 6250be5..d70c88d 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
@@ -87,7 +87,7 @@
seWallet.setCreateTime(new Date());
Long rec = Optional.ofNullable(walletSv.addWallet(seWallet)).orElse(0L);
if(rec == 0) {
- return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(SellResultCode.VC_OPEN_ACCOUNT_FAIL.getMessage());
}
return BaseResponseUtils.buildSuccess(true) ;
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java
index eb0827c..4e96448 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java
@@ -67,12 +67,12 @@
/*
* 灏忕▼搴忓敮涓�鏍囪瘑
*/
- public static String appid = "wxf776aebf73f34962";
+ public static String appid = "wxbc2b6a00dd904ead";
/*
* 灏忕▼搴忕殑 app secret
*/
- public static String secret = "b05862b7fa8a944114dbe970c2764ae6";
+ public static String secret = "796ffe3e9921f756db0499e80d6ed0cd";
/*
* 灏忕▼搴忕殑鎺堟潈绫诲瀷锛岀櫥褰曞嚟璇佹牎楠屼娇鐢�
--
Gitblit v1.8.0