From 62a7f3228c94db41bf57858a6549eb0db033bf1e Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期三, 29 五月 2024 11:44:17 +0800 Subject: [PATCH] 2024-05-29 朱宝民 --- 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 | 3 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 | 30 ++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java | 17 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java | 46 +++ 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 | 105 +++++- 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-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/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-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java | 6 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 | 21 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 ++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java | 2 27 files changed, 785 insertions(+), 104 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/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 1cfbd29..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,7 +53,8 @@ @JSONField(serializeUsing= ObjectWriterImplToString.class) @TableId(value = "id", type = IdType.INPUT) @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - public Long userId; + //public Long userId; + public Long id; @Schema(description = "鎵�灞炵墖鍖篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) 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/resources/mapper/BaUserMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml index f99beee..88714b1 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml @@ -6,7 +6,7 @@ <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser"> <!--@mbg.generated--> <!--@Table ba_user--> - <id property="userId" column="id" /> + <id property="id" column="id" /> <result property="blockId" column="blockId"/> <result property="userName" column="name"/> <result property="phone" column="phone"/> @@ -20,7 +20,7 @@ <resultMap id="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser"> <!--@mbg.generated--> <!--@Table ba_user--> - <id property="userId" column="id" /> + <id property="id" column="id" /> <result property="userName" column="name"/> <result property="phone" column="phone"/> <result property="orgTag" column="orgTag"/> @@ -29,7 +29,7 @@ </resultMap> <resultMap id="loginResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser"> - <id property="userId" column="id" /> + <id property="id" column="id" /> <result property="blockId" column="blockId"/> <result property="userName" column="name"/> <result property="phone" column="phone"/> @@ -99,8 +99,9 @@ </trim> </select> <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> - insert into ba_user (<include refid="Base_Column_List" />) - values (#{userId,jdbcType=BIGINT}, +<!-- 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}, @@ -114,7 +115,7 @@ <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> insert into ba_user <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="userId != null"> + <if test="id != null"> id, </if> <if test="blockId != null"> @@ -143,8 +144,8 @@ </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="userId != null"> - #{userId,jdbcType=BIGINT}, + <if test="id != null"> + #{id,jdbcType=BIGINT}, </if> <if test="blockId != null"> #{blockId,jdbcType=BIGINT}, @@ -195,7 +196,7 @@ deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, </if> </set> - where id = #{userId, jdbcType=BIGINT} + where id = #{id, jdbcType=BIGINT} </update> <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> update ba_user @@ -205,7 +206,7 @@ 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 = #{userId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} </update> <update id="changePassword" > update ba_user 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/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-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java index 3604402..0072a8e 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java @@ -149,7 +149,7 @@ if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - po.userId = null; + po.id = null; Long userId; try { po.supperAdmin = Constant.no.byteValue() ; @@ -199,7 +199,7 @@ if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - if (po.userId == null) { + if (po.id == null) { return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D"); } int count; @@ -208,7 +208,7 @@ po.deleted = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� po.orgTag = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� count = this.sv.update(po); - this.sv.setRoles(po.userId, po.roleIds); + this.sv.setRoles(po.id, po.roleIds); } catch (Exception e) { log.error("淇濆瓨鐢ㄦ埛寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java index 9dce98e..02878a4 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java @@ -116,7 +116,7 @@ public Long save(BaUser po){ //return this.dao.putin(po) ; this.dao.putin(po) ; - return po.getUserId(); + return po.getId(); } /** 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..00296db 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; @@ -116,4 +117,33 @@ } } + /** + * 鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛 + * @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<>(); + } + } + } 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..9b4551d 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 @@ -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-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 7dea6ef..b6099e9 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,6 +53,18 @@ 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; /** * 鑾峰彇鍐滄埛鍒楄〃 @@ -363,6 +381,19 @@ //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")) { // 鍙戦�佹垚鍔熷鐞嗛�昏緫 @@ -375,10 +406,9 @@ /** * 鏍¢獙楠岃瘉鐮� - * @param phoneNumber - * @param code + * @param po + * @param bindingResult * @return - * @throws ClientException */ @Operation(summary = "鏍¢獙楠岃瘉鐮�", description = "鏍¢獙楠岃瘉鐮�") @ApiResponses(value = { @@ -389,27 +419,62 @@ 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()); + } } /** 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 25613ab..bb288c0 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 @@ -3,7 +3,11 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; 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; @@ -28,6 +32,12 @@ @Autowired private BaDistrictMapper baDistrictMapper; + + @Autowired + private SeCodeVerifyMapper seCodeVerifyMapper; + + @Autowired + private SeOpenIdMapper seOpenIdMapper; /** * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍐滄埛鏁版嵁 @@ -67,6 +77,23 @@ return seClientMapper.insert(po); } + /** + * 娣诲姞楠岃瘉鐮佽褰� + * @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 @@ -125,4 +152,23 @@ public List<Map<String, Object>> getWaterTypes() { return seClientMapper.getWaterTypes(); } + + /** + * 鏍规嵁鐢佃瘽鍙风爜鑾峰彇鍐滄埛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(); + } } 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