From 44b8fb1cec053b99b3dbccd66cd62723c37fb243 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期四, 07 三月 2024 10:49:14 +0800
Subject: [PATCH] 2024-03-07 朱宝民 虚拟卡注册接口、充值方法与微信支付整合、获取水卡列表接口优化
---
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java | 74 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java | 8
pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml | 9
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java | 10
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java | 70 +
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java | 34
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml | 171 ++++
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/SeVirtualCard.java | 76 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java | 2
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java | 21
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java | 6
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml | 2
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java | 114 ++
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java | 24
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java | 40 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java | 47 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java | 55 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java | 43 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java | 150 +++
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java | 36
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java | 39
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java | 21
pipIrr-platform/pipIrr-web/pom.xml | 1
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java | 28
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml | 116 ++
/dev/null | 13
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java | 344 ++++++++
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java | 21
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java | 51 +
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java | 81 ++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java | 102 ++
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java | 541 +++++++++++++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java | 6
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 4
35 files changed, 2,308 insertions(+), 54 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java
new file mode 100644
index 0000000..dcf8965
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java
@@ -0,0 +1,34 @@
+package com.dy.pipIrrGlobal.daoSe;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-05 20:21
+ * @LastEditTime 2024-03-05 20:21
+ * @Description
+ */
+
+@Mapper
+public interface SeVcRechargeMapper extends BaseMapper<SeVcRecharge> {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(SeVcRecharge record);
+
+ int insertSelective(SeVcRecharge record);
+
+ SeVcRecharge selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(SeVcRecharge record);
+
+ int updateByPrimaryKey(SeVcRecharge record);
+
+ /**
+ * 鏍规嵁璁㈠崟鍙疯幏鍙栬櫄鎷熷崱鍏呭�煎璞�
+ * @param orderNumber
+ * @return
+ */
+ SeVcRecharge getVCRechargeByorderNumber(String orderNumber);
+}
\ 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
new file mode 100644
index 0000000..8bac3d7
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java
@@ -0,0 +1,28 @@
+package com.dy.pipIrrGlobal.daoSe;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-05 20:45
+ * @LastEditTime 2024-03-05 20:45
+ * @Description
+ */
+
+@Mapper
+public interface SeVirtualCardMapper extends BaseMapper<SeVirtualCard> {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(SeVirtualCard record);
+
+ int insertSelective(SeVirtualCard record);
+
+ SeVirtualCard selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(SeVirtualCard record);
+
+ int updateByPrimaryKey(SeVirtualCard record);
+
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java
new file mode 100644
index 0000000..933faa1
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java
@@ -0,0 +1,102 @@
+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 org.hibernate.validator.constraints.Length;
+
+import java.util.Date;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-05 20:21
+ * @LastEditTime 2024-03-05 20:21
+ * @Description
+ */
+
+@TableName(value="se_vc_recharge", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Schema(name = "铏氭嫙鍗″厖鍊煎疄浣�")
+public class SeVcRecharge implements BaseEntity {
+ public static final long serialVersionUID = 202403052025001L;
+
+ /**
+ * 涓婚敭
+ */
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
+ @TableId(type = IdType.INPUT)
+ @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Long id;
+
+ /**
+ * 铏氭嫙鍗D
+ */
+ @Schema(description = "铏氭嫙鍗D", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "铏氭嫙鍗D涓嶈兘涓虹┖")
+ private Long vcId;
+
+ /**
+ * 鍐滄埛ID
+ */
+ @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖")
+ private Long clientId;
+
+ /**
+ * 閽卞寘浣欓
+ */
+ @Schema(description = "閽卞寘浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "閽卞寘浣欓涓嶈兘涓虹┖")
+ private Double money;
+
+ /**
+ * 鍏呭�煎悗浣欓
+ */
+ @Schema(description = "鍏呭�煎悗浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "鍏呭�煎悗浣欓涓嶈兘涓虹┖")
+ private Double afterRecharge;
+
+ /**
+ * 璁㈠崟鍙�
+ */
+ @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�")
+ private String orderNumber;
+
+ /**
+ * 鍏呭�奸噾棰�
+ */
+ @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "鍏呭�奸噾棰濅笉鑳戒负绌�")
+ private Integer rechargeAmount;
+
+ /**
+ * 涓嬪崟鏃堕棿
+ */
+ @Schema(description = "涓嬪崟鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Date orderTime;
+
+ /**
+ * 鍏呭�煎畬鎴愭椂闂�
+ */
+ @Schema(description = "鍏呭�煎畬鎴愭椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Date rechargeTime;
+
+ /**
+ * 璁㈠崟鐘舵��;1-鏈敮浠橈紝2-宸叉敮浠�
+ */
+ @Schema(description = "璁㈠崟鐘舵��", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @Length(message = "璁㈠崟鐘舵�佷笉澶т簬{max}锛屼笉灏忎簬{min}", min = 1, max = 2)
+ private Byte orderState;
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java
new file mode 100644
index 0000000..23484e2
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java
@@ -0,0 +1,76 @@
+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.Max;
+import jakarta.validation.constraints.Min;
+import jakarta.validation.constraints.NotNull;
+import lombok.*;
+
+import java.util.Date;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-05 20:45
+ * @LastEditTime 2024-03-05 20:45
+ * @Description
+ */
+
+@TableName(value="se_virtual_card", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Schema(name = "铏氭嫙鍗″疄浣�")
+public class SeVirtualCard implements BaseEntity {
+ public static final long serialVersionUID = 202403052048001L;
+
+ /**
+ * 涓婚敭
+ */
+ @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)
+ @Min(value = 0, message = "閽卞寘浣欓涓嶈兘灏忎簬0")
+ private Double money;
+
+ /**
+ * 鏈�鍚庢搷浣�;1-寮�鎴凤紝2-鍏呭�硷紝3-娑堣垂锛�4-鐢宠閫�娆撅紝5-閫�娆惧鏍�
+ */
+ @Schema(description = "鎿嶄綔绫诲瀷", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @Min(value = 1, message = "鏈�鍚庢搷浣滀笉鑳藉皬浜�1")
+ @Max(value = 5, message = "鏈�鍚庢搷浣滀笉鑳藉ぇ浜�5")
+ private Byte lastOperate;
+
+ /**
+ * 鏈�鍚庢搷浣滄椂闂�
+ */
+ @Schema(description = "鏈�鍚庢搷浣滄椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Date lastOperateTime;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @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/voSe/VoCards.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java
index 2ec42d9..95da821 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java
@@ -26,13 +26,13 @@
private String cardNum;
@Schema(title = "鐢佃瘽鍙风爜")
- private Float phone;
+ private String phone;
@Schema(title = "韬唤璇佸彿鐮�")
- private Float idCard;
+ private String idCard;
@Schema(title = "姘村崱鐘舵��")
- private Float cardState;
+ private Integer cardState;
@Schema(title = "姘村崱鐘舵�佸悕绉�")
private String stateName;
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
index ffa34fd..28bf7d0 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -112,10 +112,6 @@
webPort: 8085
actutorPort: 9085
idSuffix: 7
- webchat:
- webPort: 8086
- actutorPort: 9086
- idSuffix: 8
#椤圭洰缂栧彿
#projectCode:
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
index fbd6120..8fb2f81 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
@@ -364,7 +364,7 @@
WHEN card.state = 3 THEN '宸叉寕澶�'
End) AS stateName,
'鍐滄埛鍗�' AS cardType,
- card.money
+ FORMAT(card.money, 2) AS money
FROM se_client_card card
INNER JOIN se_client cli ON card.clientId = cli.id
<where>
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml
new file mode 100644
index 0000000..95b5342
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml
@@ -0,0 +1,171 @@
+<?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.SeVcRechargeMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge">
+ <!--@mbg.generated-->
+ <!--@Table se_vc_recharge-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="vc_id" jdbcType="BIGINT" property="vcId" />
+ <result column="client_id" jdbcType="BIGINT" property="clientId" />
+ <result column="money" jdbcType="FLOAT" property="money" />
+ <result column="after_recharge" jdbcType="FLOAT" property="afterRecharge" />
+ <result column="order_number" jdbcType="VARCHAR" property="orderNumber" />
+ <result column="recharge_amount" jdbcType="INTEGER" property="rechargeAmount" />
+ <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" />
+ <result column="recharge_time" jdbcType="TIMESTAMP" property="rechargeTime" />
+ <result column="order_state" jdbcType="TINYINT" property="orderState" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, vc_id, client_id, money, after_recharge, order_number, recharge_amount, order_time,
+ recharge_time, order_state
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from se_vc_recharge
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ delete from se_vc_recharge
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge">
+ <!--@mbg.generated-->
+ insert into se_vc_recharge (id, vc_id, client_id,
+ money, after_recharge, order_number,
+ recharge_amount, order_time, recharge_time,
+ order_state)
+ values (#{id,jdbcType=BIGINT}, #{vcId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT},
+ #{money,jdbcType=FLOAT}, #{afterRecharge,jdbcType=FLOAT}, #{orderNumber,jdbcType=VARCHAR},
+ #{rechargeAmount,jdbcType=INTEGER}, #{orderTime,jdbcType=TIMESTAMP}, #{rechargeTime,jdbcType=TIMESTAMP},
+ #{orderState,jdbcType=TINYINT})
+ </insert>
+ <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge">
+ <!--@mbg.generated-->
+ insert into se_vc_recharge
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="vcId != null">
+ vc_id,
+ </if>
+ <if test="clientId != null">
+ client_id,
+ </if>
+ <if test="money != null">
+ money,
+ </if>
+ <if test="afterRecharge != null">
+ after_recharge,
+ </if>
+ <if test="orderNumber != null">
+ order_number,
+ </if>
+ <if test="rechargeAmount != null">
+ recharge_amount,
+ </if>
+ <if test="orderTime != null">
+ order_time,
+ </if>
+ <if test="rechargeTime != null">
+ recharge_time,
+ </if>
+ <if test="orderState != null">
+ order_state,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=BIGINT},
+ </if>
+ <if test="vcId != null">
+ #{vcId,jdbcType=BIGINT},
+ </if>
+ <if test="clientId != null">
+ #{clientId,jdbcType=BIGINT},
+ </if>
+ <if test="money != null">
+ #{money,jdbcType=FLOAT},
+ </if>
+ <if test="afterRecharge != null">
+ #{afterRecharge,jdbcType=FLOAT},
+ </if>
+ <if test="orderNumber != null">
+ #{orderNumber,jdbcType=VARCHAR},
+ </if>
+ <if test="rechargeAmount != null">
+ #{rechargeAmount,jdbcType=INTEGER},
+ </if>
+ <if test="orderTime != null">
+ #{orderTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="rechargeTime != null">
+ #{rechargeTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="orderState != null">
+ #{orderState,jdbcType=TINYINT},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge">
+ <!--@mbg.generated-->
+ update se_vc_recharge
+ <set>
+ <if test="vcId != null">
+ vc_id = #{vcId,jdbcType=BIGINT},
+ </if>
+ <if test="clientId != null">
+ client_id = #{clientId,jdbcType=BIGINT},
+ </if>
+ <if test="money != null">
+ money = #{money,jdbcType=FLOAT},
+ </if>
+ <if test="afterRecharge != null">
+ after_recharge = #{afterRecharge,jdbcType=FLOAT},
+ </if>
+ <if test="orderNumber != null">
+ order_number = #{orderNumber,jdbcType=VARCHAR},
+ </if>
+ <if test="rechargeAmount != null">
+ recharge_amount = #{rechargeAmount,jdbcType=INTEGER},
+ </if>
+ <if test="orderTime != null">
+ order_time = #{orderTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="rechargeTime != null">
+ recharge_time = #{rechargeTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="orderState != null">
+ order_state = #{orderState,jdbcType=TINYINT},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge">
+ <!--@mbg.generated-->
+ update se_vc_recharge
+ set vc_id = #{vcId,jdbcType=BIGINT},
+ client_id = #{clientId,jdbcType=BIGINT},
+ money = #{money,jdbcType=FLOAT},
+ after_recharge = #{afterRecharge,jdbcType=FLOAT},
+ order_number = #{orderNumber,jdbcType=VARCHAR},
+ recharge_amount = #{rechargeAmount,jdbcType=INTEGER},
+ order_time = #{orderTime,jdbcType=TIMESTAMP},
+ recharge_time = #{rechargeTime,jdbcType=TIMESTAMP},
+ order_state = #{orderState,jdbcType=TINYINT}
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+ <!--鏍规嵁璁㈠崟鍙疯幏鍙栬櫄鎷熷崱鍏呭�煎璞�-->
+ <select id="getVCRechargeByorderNumber" resultMap="BaseResultMap">
+ SELECT
+ <include refid="Base_Column_List" />
+ FROM se_vc_recharge
+ WHERE order_number = #{orderNumber}
+ LIMIT 0,1
+ </select>
+</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
new file mode 100644
index 0000000..15614b3
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
@@ -0,0 +1,116 @@
+<?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.SeVirtualCardMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard">
+ <!--@mbg.generated-->
+ <!--@Table se_virtual_card-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="client_id" jdbcType="BIGINT" property="clientId" />
+ <result column="money" jdbcType="FLOAT" property="money" />
+ <result column="last_operate" jdbcType="TINYINT" property="lastOperate" />
+ <result column="last_operate_time" jdbcType="TIMESTAMP" property="lastOperateTime" />
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, client_id, money, last_operate, last_operate_time, create_time
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from se_virtual_card
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ delete from se_virtual_card
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard">
+ <!--@mbg.generated-->
+ insert into se_virtual_card (id, client_id, money,
+ last_operate, last_operate_time, create_time
+ )
+ values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{money,jdbcType=FLOAT},
+ #{lastOperate,jdbcType=TINYINT}, #{lastOperateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
+ )
+ </insert>
+ <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard">
+ <!--@mbg.generated-->
+ insert into se_virtual_card
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="clientId != null">
+ client_id,
+ </if>
+ <if test="money != null">
+ money,
+ </if>
+ <if test="lastOperate != null">
+ last_operate,
+ </if>
+ <if test="lastOperateTime != null">
+ last_operate_time,
+ </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="money != null">
+ #{money,jdbcType=FLOAT},
+ </if>
+ <if test="lastOperate != null">
+ #{lastOperate,jdbcType=TINYINT},
+ </if>
+ <if test="lastOperateTime != null">
+ #{lastOperateTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard">
+ <!--@mbg.generated-->
+ update se_virtual_card
+ <set>
+ <if test="clientId != null">
+ client_id = #{clientId,jdbcType=BIGINT},
+ </if>
+ <if test="money != null">
+ money = #{money,jdbcType=FLOAT},
+ </if>
+ <if test="lastOperate != null">
+ last_operate = #{lastOperate,jdbcType=TINYINT},
+ </if>
+ <if test="lastOperateTime != null">
+ last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP},
+ </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.SeVirtualCard">
+ <!--@mbg.generated-->
+ update se_virtual_card
+ set client_id = #{clientId,jdbcType=BIGINT},
+ money = #{money,jdbcType=FLOAT},
+ last_operate = #{lastOperate,jdbcType=TINYINT},
+ last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP},
+ create_time = #{createTime,jdbcType=TIMESTAMP}
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml
index 841fc87..8511298 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml
@@ -15,6 +15,15 @@
<name>pipIrr-web-sell</name>
<description>web钀ラ攢淇℃伅绯荤粺</description>
+ <dependencies>
+ <!--OkHttp-->
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>4.9.2</version>
+ </dependency>
+ </dependencies>
+
<build>
<plugins>
<!-- 鐢熸垚涓嶅寘鍚緷璧杍ar鐨勫彲鎵цjar鍖�
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 29de085..0aed5d4 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
@@ -110,7 +110,7 @@
@PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE)
@Transactional(rollbackFor = Exception.class)
@SsoAop()
- public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult){
+ public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult) {
if(bindingResult != null && bindingResult.hasErrors()){
return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java
similarity index 95%
rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateConfig.java
rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java
index 0cbc9c1..3ba853d 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateConfig.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java
@@ -1,4 +1,4 @@
-package com.dy.pipirrWebChat.config;
+package com.dy.pipIrrSell.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -9,12 +9,11 @@
import java.nio.charset.StandardCharsets;
import java.util.List;
-//import org.apache.http.client.HttpClient;
/**
* @author ZhuBaoMin
- * @date 2024-02-23 15:42
- * @LastEditTime 2024-02-23 15:42
+ * @date 2024-03-06 11:43
+ * @LastEditTime 2024-03-06 11:43
* @Description
*/
@@ -77,5 +76,4 @@
return restTemplate;
}
-}
-
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateWechatCertConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java
similarity index 93%
rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateWechatCertConfig.java
rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java
index f566a74..5a3c7d4 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateWechatCertConfig.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java
@@ -1,6 +1,6 @@
-package com.dy.pipirrWebChat.config;
+package com.dy.pipIrrSell.config;
-import com.dy.pipirrWebChat.payment.PayInfo;
+import com.dy.pipIrrSell.wechatpay.PayInfo;
import okhttp3.OkHttpClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -18,8 +18,8 @@
/**
* @author ZhuBaoMin
- * @date 2024-02-23 19:18
- * @LastEditTime 2024-02-23 19:18
+ * @date 2024-03-06 11:44
+ * @LastEditTime 2024-03-06 11:44
* @Description
*/
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 a0b2d7c..db843e7 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
@@ -79,14 +79,27 @@
AUDITS_ADD_FAIL(80001, "鎬昏处瀹℃牳璁板綍娣诲姞澶辫触"),
/**
- * 鐢靛瓙閽卞寘
+ * 铏氭嫙鍗�
*/
+
+ VERIFY_FAIL(10001, "楠岀澶辫触"),
+
+ TOTAL_REFUND_EXCEED_TRADE(10001, "閫�娆炬�婚瓒呰繃璁㈠崟閲戦"),
+ ACCEPTED(10001, "閫�娆剧敵璇峰凡鍙楃悊"),
+ PROCESSING(10001, "閫�娆惧鐞嗕腑"),
+ ABNORMAL(10001, "閫�娆惧紓甯�"),
+ RECHARGE_ADD_FAIL(10001, "鍏呭�艰褰曟坊鍔犲け璐�"),
+
CLIENT_ID_CANNOT_BE_NULL(90001, "鍐滄埛缂栧彿涓嶈兘涓虹┖"),
- WALLET_OPEN_ACCOUNT_FAIL(90002, "鐢靛瓙閽卞寘璐︽埛娉ㄥ唽澶辫触"),
- WALLET_ACCOUNT_EXIST(90003, "璇ュ啘鎴峰凡娉ㄥ唽鐢靛瓙閽卞寘"),
- NO_ACCOUNT(90004, "鎮ㄥ皻鏈敞鍐岀數瀛愰挶鍖呰处鎴�"),
+ WALLET_OPEN_ACCOUNT_FAIL(90002, "铏氭嫙鍗¤处鎴锋敞鍐屽け璐�"),
+ //WALLET_ACCOUNT_EXIST(90003, "璇ュ啘鎴峰凡娉ㄥ唽鐢靛瓙閽卞寘"),
+ NO_ACCOUNT(90004, "鎮ㄦ寚瀹氱殑铏氭嫙鍗℃湭娉ㄥ唽"),
+
UPDATE_ACCOUNT_FAIL(90005, "鍏呭�煎け璐ワ紝鐢靛瓙閽卞寘璐︽埛鏇存柊澶辫触"),
RECHARGE_FAIL(90006, "鍏呭�煎け璐�"),
+ RECHARGE_NOT_EXIST(90006, "鍏呭�艰褰曚笉瀛樺湪"),
+ VIRTUAL_CARD_NOT_EXIST(90006, "铏氭嫙鍗¤处鎴蜂笉瀛樺湪"),
+
BALANCE_IS_INSUFFICIENT(90007, "娑堣垂澶辫触锛屼綑棰濅笉瓒�"),
CONSUME_FAIL(90008, "娑堣垂澶辫触"),
REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY(90009, "鐢宠閫�娆惧け璐ワ紝閫�娆鹃噾棰濅笉鑳藉ぇ浜庝綑棰�"),
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java
new file mode 100644
index 0000000..0d70bd5
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java
@@ -0,0 +1,51 @@
+package com.dy.pipIrrSell.util;
+
+import javax.crypto.Cipher;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.Base64;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 11:46
+ * @LastEditTime 2024-03-06 11:46
+ * @Description
+ */
+
+public class AesUtil {
+ static final int KEY_LENGTH_BYTE = 32;
+ static final int TAG_LENGTH_BIT = 128;
+
+ /**
+ * 瑙e瘑
+ * @param apiV3Key apiV3瀵嗛挜
+ * @param associatedData 闄勫姞鏁版嵁
+ * @param nonce 闅忔満涓�
+ * @param ciphertext 鏁版嵁瀵嗘枃
+ * @return 瑙e瘑鍚庡瓧绗︿覆
+ * @throws GeneralSecurityException
+ * @throws IOException
+ */
+ public static String decryptToString(byte[] apiV3Key, byte[] associatedData, byte[] nonce, String ciphertext) throws GeneralSecurityException, IOException {
+ try {
+ Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
+ SecretKeySpec key = new SecretKeySpec(apiV3Key, "AES");
+ GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce);
+
+ cipher.init(Cipher.DECRYPT_MODE, key, spec);
+ cipher.updateAAD(associatedData);
+
+ return new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), "utf-8");
+ } catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
+ throw new IllegalStateException(e);
+ } catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java
new file mode 100644
index 0000000..176dd63
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java
@@ -0,0 +1,43 @@
+package com.dy.pipIrrSell.util;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 11:47
+ * @LastEditTime 2024-03-06 11:47
+ * @Description
+ */
+public class HmacSha256 {
+ public static String getSignature(String secretKey, String data) throws NoSuchAlgorithmException, InvalidKeyException {
+ // 鍒涘缓瀵嗛挜瀵硅薄
+ byte[] keyBytes = secretKey.getBytes(StandardCharsets.UTF_8);
+ SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "HmacSHA256");
+
+ // 鍒涘缓Mac瀵硅薄骞跺垵濮嬪寲
+ Mac mac = Mac.getInstance("HmacSHA256");
+ mac.init(secretKeySpec);
+
+ // 灏嗗緟鍔犲瘑鐨勬暟鎹浆鎹负瀛楄妭鏁扮粍
+ byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
+
+ // 浣跨敤瀵嗛挜瀵规暟鎹繘琛屽姞瀵�
+ byte[] encryptedBytes = mac.doFinal(dataBytes);
+
+ // 灏嗗姞瀵嗗悗鐨勭粨鏋滆浆鎹负鍗佸叚杩涘埗瀛楃涓�
+ StringBuilder hexString = new StringBuilder();
+ for (byte b : encryptedBytes) {
+ String hex = Integer.toHexString(0xff & b);
+ if (hex.length() == 1) {
+ hexString.append('0');
+ }
+ hexString.append(hex);
+ }
+ String hmacSha256 = hexString.toString();
+ return hmacSha256;
+ }
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java
new file mode 100644
index 0000000..032a5d6
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java
@@ -0,0 +1,344 @@
+package com.dy.pipIrrSell.util;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+
+import com.dy.pipIrrSell.wechatpay.PayInfo;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+
+import javax.crypto.NoSuchPaddingException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.*;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 11:47
+ * @LastEditTime 2024-03-06 11:47
+ * @Description
+ */
+@Component
+@RequiredArgsConstructor
+public class PayHelper {
+ private final RestTemplateUtil restTemplateUtil;
+
+ private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+ private String checkSessionUrl = PayInfo.checkSessionUrl;
+ private String tokenUrl = PayInfo.tokenUrl;
+ private String resetUserSessionKeyUrl = PayInfo.resetUserSessionKeyUrl;
+
+ // 骞冲彴璇佷功鍏挜
+ public Map<String, Certificate> CERTIFICATE_MAP = new HashMap();
+
+ /**
+ * 鑾峰彇32浣嶉殢鏈哄瓧绗︿覆
+ * @return 闅忔満涓�
+ */
+ public String generateRandomString() {
+ Random random = new Random();
+ StringBuilder sb = new StringBuilder(32);
+ for (int i = 0; i < 32; i++) {
+ int index = random.nextInt(CHARACTERS.length());
+ sb.append(CHARACTERS.charAt(index));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 鑾峰彇鍟嗘埛璇佷功绉侀挜瀵硅薄
+ * @param filename 绉侀挜鏂囦欢璺緞
+ * @return 绉侀挜瀵硅薄
+ * @throws IOException
+ */
+ public PrivateKey getPrivateKey(String filename) throws IOException {
+ String content = new String(Files.readAllBytes(Paths.get(filename)), "utf-8");
+ try {
+ String privateKey = content.replace("-----BEGIN PRIVATE KEY-----", "")
+ .replace("-----END PRIVATE KEY-----", "")
+ .replaceAll("\\s+", "");
+ KeyFactory kf = KeyFactory.getInstance("RSA");
+ return kf.generatePrivate(new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey)));
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException("褰撳墠Java鐜涓嶆敮鎸丷SA", e);
+ } catch (InvalidKeySpecException e) {
+ throw new RuntimeException("鏃犳晥鐨勫瘑閽ユ牸寮�");
+ }
+ }
+
+ /**
+ * 妫�楠岀櫥褰曟��
+ * @param appid 灏忕▼搴� appId
+ * @param secret 灏忕▼搴� appSecret
+ * @param openid 鐢ㄦ埛鍞竴鏍囪瘑绗�
+ * @param sessionKey 浼氳瘽瀵嗛挜
+ * @return
+ * @throws IOException
+ */
+ public JSONObject checkSessionKey(String appid, String secret, String openid, String sessionKey) throws IOException, NoSuchAlgorithmException, InvalidKeyException {
+ String accessToken = "";
+ Integer expiresIn = 0;
+ String signature = HmacSha256.getSignature(sessionKey, "");
+ String sigMethod = "hmac_sha256";
+
+ JSONObject job_token = getAccessToken(appid, secret);
+ if(job_token != null) {
+ accessToken = job_token.getString("access_token");
+ expiresIn = job_token.getInteger("expires_in");
+ }
+
+ Map<String, Object> queryParams = new HashMap<>();
+ queryParams.put("access_token", accessToken);
+ queryParams.put("openid", openid);
+ queryParams.put("signature", signature);
+ queryParams.put("sig_method", sigMethod);
+ Map<String, String> headerParams = new HashMap<>();
+ JSONObject result = restTemplateUtil.get(checkSessionUrl, queryParams, headerParams);
+ return result;
+ }
+
+ /**
+ * 閲嶇疆鐧诲綍鎬�
+ * @param appid 灏忕▼搴� appId
+ * @param secret 灏忕▼搴� appSecret
+ * @param openid 鐢ㄦ埛鍞竴鏍囪瘑绗�
+ * @param sessionKey 浼氳瘽瀵嗛挜
+ * @return
+ * @throws NoSuchAlgorithmException
+ * @throws InvalidKeyException
+ * @throws IOException
+ */
+ public JSONObject resetUserSessionKey(String appid, String secret, String openid, String sessionKey) throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+ String accessToken = "";
+ Integer expiresIn = 0;
+ String signature = HmacSha256.getSignature(sessionKey, "");
+ String sigMethod = "hmac_sha256";
+
+ JSONObject job_token = getAccessToken(appid, secret);
+ if(job_token != null) {
+ accessToken = job_token.getString("access_token");
+ expiresIn = job_token.getInteger("expires_in");
+ }
+
+ Map<String, Object> queryParams = new HashMap<>();
+ queryParams.put("access_token", accessToken);
+ queryParams.put("openid", openid);
+ queryParams.put("signature", signature);
+ queryParams.put("sig_method", sigMethod);
+ Map<String, String> headerParams = new HashMap<>();
+ JSONObject result = restTemplateUtil.get(resetUserSessionKeyUrl, queryParams, headerParams);
+ return result;
+ }
+
+ /**
+ * 鑾峰彇鎺ュ彛璋冪敤鍑嵁
+ * @param appid 灏忕▼搴� appId
+ * @param secret 灏忕▼搴� appSecret
+ * @return 鍑嵁鍙婂嚟鎹湁鏁堟椂闂�
+ * @throws IOException
+ */
+ public JSONObject getAccessToken(String appid, String secret) throws IOException {
+ Map<String, Object> queryParams = new HashMap<>();
+ queryParams.put("grant_type", "client_credential");
+ queryParams.put("appid", appid);
+ queryParams.put("secret", secret);
+ Map<String, String> headerParams = new HashMap<>();
+ JSONObject job_result = restTemplateUtil.get(tokenUrl, queryParams, headerParams);
+ return job_result;
+ }
+
+ /**
+ * 鏋勯�犵鍚嶄覆_涓嬪崟
+ * @param method HTTP璇锋眰鏂规硶
+ * @param url URL
+ * @param timestamp 鏃堕棿鎴�
+ * @param nonceStr 闅忔満涓�
+ * @param body 鎶ユ枃涓婚
+ * @return 绛惧悕涓�
+ */
+ public String buildMessage_order(String method, String url, long timestamp, String nonceStr, String body) {
+ return method + "\n"
+ + url + "\n"
+ + timestamp + "\n"
+ + nonceStr + "\n"
+ + body + "\n";
+ }
+
+ /**
+ * 鏋勯�犵鍚嶄覆_鍐嶆涓嬪崟
+ * @param appid 灏忕▼搴忓敮涓�鏍囪瘑
+ * @param timestamp 鏃堕棿鎴�
+ * @param nonceStr 闅忔満涓�
+ * @param pkg package
+ * @return 绛惧悕涓�
+ */
+ public String buildMessage_signAgain(String appid, String timestamp, String nonceStr, String pkg) {
+ return appid + "\n"
+ + timestamp + "\n"
+ + nonceStr + "\n"
+ + pkg + "\n";
+ }
+
+ /**
+ * 绛惧悕
+ * @param message 琚鍚嶄俊鎭�
+ * @param certFileName 绉侀挜璇佷功鏂囦欢璺緞
+ * @return signature绛惧悕鍊硷紝绛惧悕淇℃伅涓殑涓�椤癸紝鍙備笌鐢熸垚绛惧悕淇℃伅
+ * @throws NoSuchAlgorithmException
+ * @throws InvalidKeyException
+ * @throws SignatureException
+ * @throws IOException
+ */
+ public String sign(byte[] message, String certFileName) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException {
+ Signature sign = Signature.getInstance("SHA256withRSA");
+ sign.initSign(getPrivateKey(certFileName));
+ sign.update(message);
+ return Base64.getEncoder().encodeToString(sign.sign());
+ }
+
+ /**
+ * 鑾峰彇绛惧悕淇℃伅
+ * @param method
+ * @param url
+ * @param body
+ * @return 绛惧悕淇℃伅锛孒TTP澶翠腑鐨勭鍚嶄俊鎭�
+ * HTTP澶达細Authorization: 璁よ瘉绫诲瀷 绛惧悕淇℃伅
+ * 璁よ瘉绫诲瀷锛學ECHATPAY2-SHA256-RSA2048
+ */
+ public String getToken(String method, String url, String body, String nonceStr, Long timestamp, String certFileName) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException, NoSuchPaddingException {
+ String message = buildMessage_order(method, url, timestamp, nonceStr, body);
+ String signature = sign(message.getBytes("utf-8"), certFileName);
+
+ return "mchid=\"" + PayInfo.mchid + "\","
+ + "nonce_str=\"" + nonceStr + "\","
+ + "timestamp=\"" + timestamp + "\","
+ + "serial_no=\"" + PayInfo.serial_no + "\","
+ + "signature=\"" + signature + "\"";
+ }
+
+ /**
+ * 鏋勯�犻獙閫犵鍚嶄覆
+ * @param wechatpayTimestamp 璇锋眰澶翠腑杩斿洖鐨勬椂闂存埑
+ * @param wechatpayNonce 璇锋眰澶翠腑杩斿洖鐨勯殢鏈轰覆
+ * @param boey 璇锋眰杩斿洖鐨刡ody
+ * @return signatureStr鏋勯�犵殑楠岀鍚嶄覆
+ */
+ public String responseSign(String wechatpayTimestamp, String wechatpayNonce, String boey) {
+ String signatureStr = wechatpayTimestamp + "\n"
+ + wechatpayNonce + "\n"
+ + boey + "\n";
+ return signatureStr;
+ }
+
+ /**
+ * 閲嶆柊涓嬭浇璇佷功
+ */
+ public void refreshCertificate() throws GeneralSecurityException, IOException {
+ String method = "GET";
+ String httpUrl = "/v3/certificates";
+ String nonceStr = generateRandomString();
+ Long timestamp = System.currentTimeMillis() / 1000;
+
+ String header = PayInfo.schema + " " + getToken(method, httpUrl, "", nonceStr, timestamp, PayInfo.privateCertFileName);
+
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Authorization", header);
+ headers.put("Accept", "application/json");
+
+ JSONObject job_result = restTemplateUtil.getHeaders(PayInfo.certificates,null, headers);
+ JSONObject job_headers = job_result.getJSONObject("headers");
+
+ String wechatpayNonce = job_headers.getJSONArray("Wechatpay-Nonce").getString(0);
+ String wechatpaySerial = job_headers.getJSONArray("Wechatpay-Serial").getString(0);
+ String signature_h = job_headers.getJSONArray("Wechatpay-Signature").getString(0);
+ String signatureType_h = job_headers.getJSONArray("Wechatpay-Signature-Type").getString(0);
+ String wechatpayTimestamp = job_headers.getJSONArray("Wechatpay-Timestamp").getString(0);
+
+ JSONObject job_body = job_result.getJSONObject("body");
+ if(job_body != null) {
+ JSONArray array = job_body.getJSONArray("data");
+ if(array != null && array.size() > 0) {
+ for(int i = 0; i < array.size(); i++) {
+ JSONObject job_data = array.getJSONObject(i);
+ String certificateSerial = job_data.getString("serial_no");
+ String effective_time = job_data.getString("effective_time");
+ String expire_time = job_data.getString("expire_time");
+ JSONObject job_certificate = job_data.getJSONObject("encrypt_certificate");
+ String algorithm = job_certificate.getString("algorithm");
+ String nonce = job_certificate.getString("nonce");
+ String associated_data = job_certificate.getString("associated_data");
+ String ciphertext = job_certificate.getString("ciphertext");
+
+ //瀵硅瘉涔﹀瘑鏂囪繘琛岃В瀵嗗緱鍒板钩鍙拌瘉涔﹀叕閽�
+ String publicKey = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associated_data.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext);
+
+ // 灏嗗钩鍙板叕閽ュ瓧绗︿覆杞垚Certificate瀵硅薄
+ final CertificateFactory cf = CertificateFactory.getInstance("X509");
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(publicKey.getBytes(StandardCharsets.UTF_8));
+ Certificate certificate = null;
+ try {
+ certificate = cf.generateCertificate(inputStream);
+ } catch (CertificateException e) {
+ e.printStackTrace();
+ }
+
+ // 鍝嶅簲澶磋瘉涔﹀簭鍙蜂笌鍝嶅簲浣撹瘉涔﹀簭鍒楀彿涓�鑷达紝涓旀椂闂村樊灏忎簬5鍒嗛挓鏃舵墠灏嗚瘉涔﹀瓨鍌╩ap
+ Long timeDiff = (System.currentTimeMillis() / 1000 - Long.parseLong(wechatpayTimestamp))/60;
+ if(wechatpaySerial.equals(certificateSerial) && timeDiff <= 5) {
+ // 璇佷功鏀惧叆MAP
+ CERTIFICATE_MAP.put(certificateSerial, certificate);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * 浣跨敤寰俊骞冲彴璇佷功杩涜鍝嶅簲楠岀
+ * @param wechatpaySerial 鏉ヨ嚜鍝嶅簲澶寸殑寰俊骞冲彴璇佷功搴忓垪鍙�
+ * @param signatureStr 鏋勯�犵殑楠岀鍚嶄覆
+ * @param wechatpaySignature 鏉ヨ嚜鍝嶅簲澶寸殑寰俊骞冲彴绛惧悕
+ * @return
+ * @throws NoSuchAlgorithmException
+ * @throws InvalidKeyException
+ * @throws SignatureException
+ */
+ public Boolean responseSignVerify(String wechatpaySerial, String signatureStr, String wechatpaySignature) throws GeneralSecurityException, IOException {
+ if(CERTIFICATE_MAP.isEmpty() || !CERTIFICATE_MAP.containsKey(wechatpaySerial)) {
+ CERTIFICATE_MAP.clear();
+ refreshCertificate();
+ }
+ Certificate certificate = (Certificate)CERTIFICATE_MAP.get(wechatpaySerial);
+ if(certificate == null) {
+ return false;
+ }
+
+ // 鑾峰彇鍏挜
+ PublicKey publicKey = certificate.getPublicKey();
+
+ // 鍒濆鍖朣HA256withRSA鍓嶉潰鍣�
+ Signature signature = Signature.getInstance("SHA256withRSA");
+ // 鐢ㄥ井淇″钩鍙板叕閽ュ鍓嶉潰鍣ㄨ繘琛屽垵濮嬪寲
+ signature.initVerify(certificate);
+
+ // 灏嗘瀯閫犵殑楠岀鍚嶄覆鏇存柊鍒扮鍚嶅櫒涓�
+ signature.update(signatureStr.getBytes(StandardCharsets.UTF_8));
+
+ // 璇锋眰澶翠腑寰俊鏈嶅姟鍣ㄨ繑鍥炵殑绛惧悕鐢˙ase64瑙g爜锛屼娇鐢ㄧ鍚嶅櫒杩涜楠岃瘉
+ boolean valid = signature.verify(Base64.getDecoder().decode(wechatpaySignature));
+ return valid;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/RestTemplateUtil.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java
similarity index 82%
rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/RestTemplateUtil.java
rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java
index 980a121..7b89aea 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/RestTemplateUtil.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java
@@ -1,4 +1,4 @@
-package com.dy.pipirrWebChat.util;
+package com.dy.pipIrrSell.util;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,8 +13,8 @@
/**
* @author ZhuBaoMin
- * @date 2024-02-23 15:42
- * @LastEditTime 2024-02-23 15:42
+ * @date 2024-03-06 13:47
+ * @LastEditTime 2024-03-06 13:47
* @Description
*/
@@ -39,6 +39,19 @@
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers);
ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class);
return JSONObject.parseObject(response.getBody());
+ }
+
+ public JSONObject getHeaders(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException {
+ String tempUrl = setParamsByAppendUrl(queryParams, url);
+ HttpHeaders headers = new HttpHeaders();
+ headerParams.forEach(headers::add);
+ HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers);
+ ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class);
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("headers", response.getHeaders());
+ jsonObject.put("body", response.getBody());
+ return jsonObject;
}
public JSONObject get2(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException {
@@ -99,4 +112,4 @@
return url + sb;
}
-}
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..8593e8d
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java
@@ -0,0 +1,74 @@
+package com.dy.pipIrrSell.virtualCard;
+
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
+import com.dy.pipIrrSell.result.SellResultCode;
+import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.constraints.NotNull;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 8:40
+ * @LastEditTime 2024-03-06 8:40
+ * @Description
+ */
+
+@Slf4j
+@Tag(name = "铏氭嫙鍗$鐞�", description = "铏氭嫙鍗$鐞�")
+@RestController
+@RequestMapping(path="virtual_card")
+@RequiredArgsConstructor
+@Validated
+public class VirtualCardCtrl {
+ private final VirtualCardSv virtualCardSv;
+
+ @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> addWallet(@RequestParam("clientId") @NotNull(message = "鍐滄埛缂栧彿涓嶈兘涓虹┖") Long clientId){
+ if(clientId == null || clientId < 0) {
+ return BaseResponseUtils.buildFail(SellResultCode.CLIENT_ID_CANNOT_BE_NULL.getMessage());
+ }
+
+ SeVirtualCard seVirtualCard = new SeVirtualCard();
+ seVirtualCard.setClientId(clientId);
+ seVirtualCard.setMoney(0d);
+ seVirtualCard.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode());
+ seVirtualCard.setLastOperateTime(new Date());
+ 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) ;
+ }
+
+
+}
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
new file mode 100644
index 0000000..10caf9c
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
@@ -0,0 +1,150 @@
+package com.dy.pipIrrSell.virtualCard;
+
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper;
+import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
+import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
+import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
+import com.dy.pipIrrSell.result.SellResultCode;
+import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard;
+import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
+import com.dy.pipIrrSell.virtualCard.enums.OrderStateENUM;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 8:41
+ * @LastEditTime 2024-03-06 8:41
+ * @Description
+ */
+
+@Slf4j
+@Service
+public class VirtualCardSv {
+ @Autowired
+ private SeVirtualCardMapper seVirtualCardMapper;
+
+ @Autowired
+ private SeVcRechargeMapper seVcRechargeMapper;
+
+ /**
+ * 娉ㄥ唽铏氭嫙鍗�
+ * @param po
+ * @return
+ */
+ public Long insertVirtualCard(SeVirtualCard po) {
+ seVirtualCardMapper.insert(po);
+ return po.getId();
+ }
+
+ /**
+ * 淇敼铏氭嫙鍗�
+ * 鍏呭�笺�佹秷璐广�佺敵璇烽��娆俱�佸鏍搁��娆炬椂闇�瑕佷慨鏀硅櫄鎷熷崱鐨勶細浣欓銆佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂�
+ * @param po
+ * @return
+ */
+ public Integer updateVirtualCard(SeVirtualCard po) {
+ return seVirtualCardMapper.updateByPrimaryKeySelective(po);
+ }
+
+ /**
+ * 鏍规嵁铏氭嫙鍗$紪鍙疯幏鍙栬櫄鎷熷崱瀵硅薄
+ * @param virtualId
+ * @return
+ */
+ public SeVirtualCard selectVirtuCardById(Long virtualId) {
+ return seVirtualCardMapper.selectByPrimaryKey(virtualId);
+ }
+ /**
+ * 娣诲姞铏氭嫙鍗″厖鍊艰褰�
+ * JSAPI涓嬪崟鍚庣敓鎴愰儴鍒嗗厖鍊艰褰�
+ * @param po
+ * @return
+ */
+ public BaseResponse<Boolean> insertVCRecharge(DtoVirtualCard po) {
+ String orderNumber = po.getOrderNumber();
+ Long virtualId = po.getVirtualId();
+ Long clientId = po.getClientId();
+ Integer rechargeAmount = po.getRechargeAmount();
+
+ // 楠岃瘉璇ヨ櫄鎷熷崱璐︽埛鏄惁瀛樺湪骞跺彇鍑哄綋鍓嶈处鎴蜂綑棰�
+ SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId);
+ if(seVirtualCard == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage());
+ }
+ Double money = seVirtualCard.getMoney();
+
+ // 娣诲姞鍏呭�艰褰�
+ SeVcRecharge seVcRecharge = new SeVcRecharge();
+ seVcRecharge.setVcId(virtualId);
+ seVcRecharge.setClientId(clientId);
+ seVcRecharge.setMoney(money);
+ seVcRecharge.setOrderNumber(orderNumber);
+ seVcRecharge.setRechargeAmount(rechargeAmount);
+ seVcRecharge.setOrderTime(new Date());
+ seVcRecharge.setOrderState(OrderStateENUM.NON_PAYMENT.getCode());
+ Integer rec = seVcRechargeMapper.insert(seVcRecharge);
+ if(rec == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage());
+ }
+ return BaseResponseUtils.buildSuccess(true) ;
+ }
+
+ /**
+ * 淇敼铏氭嫙鍗″厖鍊艰褰�
+ * 寰俊鏀粯閫氱煡鍚庯細
+ * 1. 鏇存柊鍏呭�艰〃锛氬厖鍊煎悗浣欓銆佹敮浠樺畬鎴愭椂闂淬�佽鍗曠姸鎬�
+ * 2. 鏇存柊铏氭嫙鍗¤〃锛氳处鎴蜂綑棰濄�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂�
+ * @param orderNumber 璁㈠崟缂栧彿
+ * @return
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public BaseResponse<Boolean> updateVCRecharge(String orderNumber, Date rechargeTime) {
+ SeVcRecharge seVcRecharge = seVcRechargeMapper.getVCRechargeByorderNumber(orderNumber);
+ if(seVcRecharge == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_NOT_EXIST.getMessage());
+ }
+
+ Long virtualId = seVcRecharge.getVcId();
+ Double money = seVcRecharge.getMoney();
+ Integer rechargeAmount = seVcRecharge.getRechargeAmount();
+ Double afterRrecharge = money + rechargeAmount;
+
+ seVcRecharge.setAfterRecharge(afterRrecharge);
+ seVcRecharge.setRechargeTime(rechargeTime);
+ seVcRecharge.setOrderState(OrderStateENUM.PAID.getCode());
+ Integer rec = seVcRechargeMapper.updateByPrimaryKeySelective(seVcRecharge);
+ if(rec == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage());
+ }
+
+ SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId);
+ if(seVirtualCard == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.VIRTUAL_CARD_NOT_EXIST.getMessage());
+ }
+ seVirtualCard.setMoney(afterRrecharge);
+ seVirtualCard.setLastOperate(LastOperateENUM.RECHARGE.getCode());
+ seVirtualCard.setLastOperateTime(new Date());
+ Integer rec2 = seVirtualCardMapper.updateByPrimaryKeySelective(seVirtualCard);
+ if(rec2 == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage());
+ }
+ return BaseResponseUtils.buildSuccess(true) ;
+ }
+
+ /**
+ * 淇敼铏氭嫙鍗″厖鍊艰褰�
+ * 寰俊灏忕▼搴忔敮浠橀�氱煡鍚庝慨鏀癸細浣欓銆佸厖鍊煎悗浣欓銆佸厖鍊煎畬鎴愭椂闂�
+ * @param po
+ * @return
+ */
+ public Integer updateVCRecharge(SeVcRecharge po) {
+ return seVcRechargeMapper.updateByPrimaryKeySelective(po);
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java
new file mode 100644
index 0000000..381dd41
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java
@@ -0,0 +1,47 @@
+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;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 9:40
+ * @LastEditTime 2024-03-06 9:40
+ * @Description
+ */
+
+@Data
+@Schema(name = "铏氭嫙鍗″厖鍊间紶鍏ュ璞�")
+public class DtoVirtualCard {
+ public static final long serialVersionUID = 202403060943001L;
+
+ /**
+ * 璁㈠崟鍙�
+ */
+ @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�")
+ private String orderNumber;
+
+ /**
+ * 鍐滄埛ID
+ */
+ @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖")
+ private Long clientId;
+
+ /**
+ * 铏氭嫙鍗D
+ */
+ @Schema(description = "铏氭嫙鍗D", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "铏氭嫙鍗D涓嶈兘涓虹┖")
+ private Long virtualId;
+
+ /**
+ * 鍏呭�奸噾棰�
+ */
+ @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "鍏呭�奸噾棰濅笉鑳戒负绌�")
+ private Integer rechargeAmount;
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java
new file mode 100644
index 0000000..b9ac164
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java
@@ -0,0 +1,24 @@
+package com.dy.pipIrrSell.virtualCard.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 9:21
+ * @LastEditTime 2024-03-06 9:21
+ * @Description
+ */
+
+@Getter
+@AllArgsConstructor
+public enum LastOperateENUM {
+ OPEN_ACCOUNT((byte)1, "寮�鎴�"),
+ RECHARGE((byte)2, "鍏呭��"),
+ CONSUME((byte)3, "娑堣垂"),
+ APPLY_REFUND((byte)4, "鐢宠閫�娆�"),
+ AUDIT_REFUND((byte)5, "閫�娆惧鏍�");
+
+ private final Byte code;
+ private final String message;
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java
new file mode 100644
index 0000000..4af1b90
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java
@@ -0,0 +1,21 @@
+package com.dy.pipIrrSell.virtualCard.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 10:00
+ * @LastEditTime 2024-03-06 10:00
+ * @Description
+ */
+
+@Getter
+@AllArgsConstructor
+public enum OrderStateENUM {
+ NON_PAYMENT((byte)1, "鏈敮浠�"),
+ PAID((byte)2, "宸叉敮浠�");
+
+ private final Byte code;
+ private final String message;
+}
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 500dd92..6250be5 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
@@ -76,7 +76,7 @@
}
if(walletSv.getWalletByClientId(clientId) != null) {
- return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage());
+ //return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage());
}
SeWallet seWallet = new SeWallet();
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayInfo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java
similarity index 79%
rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayInfo.java
rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java
index ef11dac..4952e7a 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayInfo.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java
@@ -1,18 +1,33 @@
-package com.dy.pipirrWebChat.payment;
+package com.dy.pipIrrSell.wechatpay;
/**
* @author ZhuBaoMin
- * @date 2024-02-22 20:20
- * @LastEditTime 2024-02-22 20:20
+ * @date 2024-03-06 13:49
+ * @LastEditTime 2024-03-06 13:49
* @Description
*/
public class PayInfo {
- /*
+ /**
* 灏忕▼搴忕櫥褰旳PI
*/
public static String loginUrl = "https://api.weixin.qq.com/sns/jscode2session";
- /*
+ /**
+ * 妫�楠岀櫥褰曟��
+ */
+ public static String checkSessionUrl = "https://api.weixin.qq.com/wxa/checksession";
+
+ /**
+ * 閲嶇疆鐧诲綍鎬�
+ */
+ public static String resetUserSessionKeyUrl = "https://api.weixin.qq.com/wxa/resetusersessionkey";
+
+ /**
+ * 鑾峰彇鎺ュ彛璋冪敤鍑嵁
+ */
+ public static String tokenUrl = "https://api.weixin.qq.com/cgi-bin/token";
+
+ /**
* 缁熶竴涓嬪崟API
*/
//public static String orderUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder";
@@ -26,17 +41,18 @@
/*
* 鏀粯缁撴灉閫氱煡API
*/
- public static String notifyUrl = "https://www.muxiaobao.com/api/Payment/OrderNotify";
+ //public static String notifyUrl = "https://www.muxiaobao.com/api/Payment/OrderNotify";
+ public static String notifyUrl = "https://44978f7456.imdo.co/webchat/payment/orderNotify";
/*
* 鏌ヨ璁㈠崟API
*/
public static String queryUrl = "https://api.mch.weixin.qq.com/pay/orderquery";
- /*
+ /**
* 鐢宠閫�娆続PI
*/
- public static String refundUrl = "https://api.mch.weixin.qq.com/secapi/pay/refund";
+ public static String refundUrl = "https://api.mch.weixin.qq.co/v3/refund/domestic/refunds";
/*
* 閫�娆鹃�氱煡API
@@ -128,7 +144,9 @@
/**
* 绉侀挜鏂囦欢璺緞
*/
- public static String certFileName = "C:\\webchat\\apiclient_key.pem";
+ public static String privateCertFileName = "C:\\webchat\\apiclient_key.pem";
+
+ public static String publicCertFileName = "C:\\webchat\\wxp_cert.pem";
/*
* 寰俊璁㈠崟鍙凤紝浼樺厛浣跨敤
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java
new file mode 100644
index 0000000..5258444
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java
@@ -0,0 +1,541 @@
+package com.dy.pipIrrSell.wechatpay;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
+import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState;
+import com.dy.pipIrrGlobal.voSe.VoClient;
+import com.dy.pipIrrSell.client.ClientSv;
+import com.dy.pipIrrSell.result.SellResultCode;
+import com.dy.pipIrrSell.util.AesUtil;
+import com.dy.pipIrrSell.util.PayHelper;
+import com.dy.pipIrrSell.util.RestTemplateUtil;
+import com.dy.pipIrrSell.virtualCard.VirtualCardSv;
+import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard;
+import com.dy.pipIrrSell.wechatpay.dto.*;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import javax.crypto.NoSuchPaddingException;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SignatureException;
+import java.security.spec.InvalidKeySpecException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 13:49
+ * @LastEditTime 2024-03-06 13:49
+ * @Description
+ */
+
+@Slf4j
+@Tag(name = "寰俊鏀粯绠$悊", description = "寰俊鏀粯鍚勭鎿嶄綔")
+@RestController
+@RequestMapping(path="payment")
+@RequiredArgsConstructor
+public class PaymentCtrl {
+ private final PaymentSv paymentSv;
+ private final RestTemplateUtil restTemplateUtil;
+ private final PayHelper payHelper;
+ private final VirtualCardSv virtualCardSv;
+ private final ClientSv clientSv;
+
+ private String privateCertFileName = PayInfo.privateCertFileName;
+ private String appid = PayInfo.appid;
+ private String mchid = PayInfo.mchid;
+ private String schema = PayInfo.schema;
+ private String signType = PayInfo.signType;
+ private String description = PayInfo.description;
+ private String loginUrl = PayInfo.loginUrl;
+ private String notifyUrl = PayInfo.notifyUrl;
+ private String grantType = PayInfo.grantType;
+ private String refundUrl = PayInfo.refundUrl;
+
+ // 骞冲彴璇佷功鍏挜
+ private Map CERTIFICATE_MAP = new HashMap();
+
+ /**
+ * 鐧诲綍鍑瘉鏍¢獙
+ * @param appid 灏忕▼搴� appId
+ * @param secret 灏忕▼搴� appSecret
+ * @param js_code 涓存椂鐧诲綍鍑瘉code
+ * @return
+ * @throws Exception
+ */
+ @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 = "getSessionId")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> getSessionId(@RequestParam("appid") String appid, @RequestParam("secret") String secret, @RequestParam("js_code") String js_code) throws Exception {
+ Map<String, Object> queryParams = new HashMap<>();
+ queryParams.put("appid", appid);
+ queryParams.put("secret", secret);
+ queryParams.put("js_code", js_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");
+
+ // 妫�楠岀櫥褰曟��
+ JSONObject checkSessionKey = payHelper.checkSessionKey(appid, secret, openid, sessionKey);
+ if(checkSessionKey != null) {
+ Integer errcode = checkSessionKey.getInteger("errcode");
+ String errmsg = checkSessionKey.getString("errmsg");
+ }
+
+ // 閲嶇疆鐧诲綍鎬�
+ JSONObject resetUserSessionKey = payHelper.resetUserSessionKey(appid, secret, openid, sessionKey);
+ if(resetUserSessionKey != null) {
+ Integer errcode = checkSessionKey.getInteger("errcode");
+ String errmsg = checkSessionKey.getString("errmsg");
+ String openid_New = checkSessionKey.getString("openid");
+ String sessionKey_New = checkSessionKey.getString("session_key");
+ }
+
+ // 娣诲姞鐧诲綍鎬佽褰�
+ SeWebchatLogonState po = new SeWebchatLogonState();
+ po.setOpenId(openid);
+ po.setSessionKey(sessionKey);
+ Date createTime = new Date();
+ po.setCreateTime(createTime);
+ Long id = paymentSv.insert(po);
+ if(id == null || id <= 0) {
+ return BaseResponseUtils.buildFail("鐧诲綍鎬佽褰曟坊鍔犲け璐�");
+ }
+ String SessionId = String.valueOf(id);
+
+ return BaseResponseUtils.buildSuccess(SessionId) ;
+ }
+
+ /**
+ * 涓嬭浇寰俊鏀粯骞冲彴璇佷功 娴嬭瘯瀹屽簾闄�
+ * @return
+ * @throws Exception
+ */
+ @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))}
+ )
+ })
+ @GetMapping(path = "certificates")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> certificates() throws Exception {
+ String method = "GET";
+ String httpUrl = "/v3/certificates";
+ String nonceStr = payHelper.generateRandomString();
+ Long timestamp = System.currentTimeMillis() / 1000;
+
+ String header = schema + " " + payHelper.getToken(method, httpUrl, "", nonceStr, timestamp, privateCertFileName);
+
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Authorization", header);
+ headers.put("Accept", "application/json");
+ JSONObject job_result = restTemplateUtil.getHeaders(PayInfo.certificates,null, headers);
+ JSONObject job_headers = job_result.getJSONObject("headers");
+ String wechatpayNonce = job_headers.getJSONArray("Wechatpay-Nonce").getString(0);
+ String wechatpaySerial = job_headers.getJSONArray("Wechatpay-Serial").getString(0);
+ String wechatpaySignature = job_headers.getJSONArray("Wechatpay-Signature").getString(0);
+ String wechatpaySignatureType = job_headers.getJSONArray("Wechatpay-Signature-Type").getString(0);
+ String wechatpayTimestamp = job_headers.getJSONArray("Wechatpay-Timestamp").getString(0);
+
+ JSONObject job_body = job_result.getJSONObject("body");
+
+ // 鏋勯�犻獙绛惧悕涓�
+ String signatureStr = payHelper.responseSign(wechatpayTimestamp, wechatpayNonce, job_body.toJSONString());
+ // 楠岃瘉绛惧悕
+ Boolean valid = payHelper.responseSignVerify(wechatpaySerial, signatureStr, wechatpaySignature);
+
+ return BaseResponseUtils.buildSuccess();
+ }
+
+ /**
+ * JSAPI涓嬪崟
+ * @param order 涓嬪崟璇锋眰瀵硅薄锛屽寘鍚渶瑕佷紶鍏ョ殑鍙傛暟
+ * @param bindingResult
+ * @return
+ */
+ @Operation(summary = "JSAPI涓嬪崟", description = "JSAPI涓嬪崟")
+ @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 = "placeOrder")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> placeOrder(@RequestBody @Valid DtoOrder order, BindingResult bindingResult) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException {
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ // 鎺ユ敹鍙傛暟锛氱櫥褰曟�両D銆佸啘鎴稩D銆佽櫄鎷熷崱ID銆佸厖鍊奸噾棰�
+ String sessionId = order.getSessionId();
+ Long virtualId = order.getVirtualId();
+ Integer rechargeAmount = order.getRechargeAmount();
+
+ String prepayId = "";
+ SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId));
+ String openid = po.getOpenId();
+
+ SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(virtualId);
+ Long clientId = seVirtualCard.getClientId();
+
+ VoClient voClient = clientSv.getOneClient(clientId);
+ String clientNum = voClient.getClientNum();
+
+ // 鐢熸垚璁㈠崟鍙峰苟娣诲姞鍏呭�艰褰�
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String orderNumber = clientNum + dateFormat.format(new Date());
+
+ // 鐢熸垚铏氭嫙鍗″厖鍊艰褰曪紙閮ㄥ垎瀛楁锛�
+ DtoVirtualCard virtualCard = new DtoVirtualCard();
+ virtualCard.setOrderNumber(orderNumber);
+ virtualCard.setClientId(clientId);
+ virtualCard.setVirtualId(virtualId);
+ virtualCard.setRechargeAmount(rechargeAmount);
+ BaseResponse result = virtualCardSv.insertVCRecharge(virtualCard);
+ if(!result.getCode().equals("0001")) {
+ return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_ADD_FAIL.getMessage());
+ }
+
+ JSONObject job_body = new JSONObject();
+ job_body.put("appid", appid);
+ job_body.put("mchid", mchid);
+ job_body.put("description", description);
+ job_body.put("out_trade_no", orderNumber);
+ job_body.put("notify_url", notifyUrl);
+
+ //璁㈠崟閲戦
+ JSONObject job_amount = new JSONObject();
+ job_amount.put("total", 1);
+ job_amount.put("currency", "CNY");
+ job_body.put("amount", job_amount);
+
+ //鏀粯鑰�
+ JSONObject job_payer = new JSONObject();
+ job_payer.put("openid", openid);
+ job_body.put("payer", job_payer);
+
+ // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇�
+ String nonceStr = payHelper.generateRandomString();
+ Long timestamp = System.currentTimeMillis() / 1000;
+
+ String method = "POST";
+ String httpUrl = "/v3/pay/transactions/jsapi";
+
+ String body = job_body.toJSONString();
+ String header = schema + " " + payHelper.getToken(method, httpUrl, body, nonceStr, timestamp, privateCertFileName);
+
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Authorization", header);
+ headers.put("Accept", "application/json");
+ headers.put("Content-Type", "application/json");
+
+ JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers);
+ if(job_result != null) {
+ System.out.println(job_result.toString());
+ prepayId = job_result.getString("prepay_id");
+ }
+
+ return BaseResponseUtils.buildSuccess(prepayId) ;
+ }
+
+ /**
+ * 鐢宠閫�娆�
+ * @param po 閫�娆捐姹傚璞�
+ * @param bindingResult
+ * @return
+ * @throws NoSuchPaddingException
+ * @throws NoSuchAlgorithmException
+ * @throws InvalidKeySpecException
+ * @throws IOException
+ * @throws SignatureException
+ * @throws InvalidKeyException
+ */
+ @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 = "refunds")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> refunds(@RequestBody @Valid Refund po, BindingResult bindingResult) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException {
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+
+ /**
+ * 1. 鍒ゆ柇浜ゆ槗鏃堕棿鏄惁瓒呰繃涓�骞�
+ * 2. 鍒ゆ柇閫�娆炬�婚噾棰濇槸鍚﹁秴杩囪鍗曢噾棰�
+ * 3. 鍒ゆ柇褰撳墠璁㈠崟閫�娆炬鏁版槸鍚﹁秴杩�50娆�
+ * 4. 鍒ゆ柇涓庤璁㈠崟涓婃閫�娆炬槸鍚︾浉闅�1鍒嗛挓
+ */
+
+ String tradeNo = po.getTradeNo();
+ String refundNo = po.getRefundNo();
+ Integer refund = po.getRefund();
+ if(refundNo == null || refundNo.length() <= 0) {
+ // 鏂版彁閫�娆剧敵璇凤紝鐢熸垚閫�娆惧崟鍙�
+ //refundNo = generateRefundNo(tradeNo);
+ }
+
+ // 鏍规嵁璁㈠崟鍙疯幏鍙栨�绘敮浠橀噾棰濆拰鎬婚��娆鹃噾棰�
+ Integer totalTradeAmount = 0;
+ Integer totalRefundAmount = 0;
+ //Integer totalTradeAmount = getTotalTradeAmount(tradeNo);
+ //Integer totalRefundAmount = getTotalRefundAmount(tradeNo);
+ if(totalRefundAmount > totalTradeAmount) {
+ return BaseResponseUtils.buildFail(SellResultCode.TOTAL_REFUND_EXCEED_TRADE.getMessage());
+ }
+
+ // 鐢熸垚body
+ RefundRequest.Amount amount = new RefundRequest.Amount();
+ amount.setRefund(refund);
+ amount.setTotal(totalTradeAmount);
+ amount.setCurrency("CNY");
+
+ RefundRequest refundRequest = new RefundRequest();
+ refundRequest.setOut_trade_no(tradeNo);
+ refundRequest.setOut_refund_no(refundNo);
+ refundRequest.setNotify_url(notifyUrl);
+ refundRequest.setAmount(amount);
+
+ // 鐢熸垚header
+ String nonceStr = payHelper.generateRandomString();
+ Long timestamp = System.currentTimeMillis() / 1000;
+
+ String method = "POST";
+ String httpUrl = "/v3/refund/domestic/refunds";
+
+ String body = JSONObject.toJSONString(refundRequest);
+ String header = schema + " " + payHelper.getToken(method, httpUrl, body, nonceStr, timestamp, privateCertFileName);
+
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Authorization", header);
+ headers.put("Accept", "application/json");
+ headers.put("Content-Type", "application/json");
+
+ JSONObject job_refundResponse = restTemplateUtil.post(PayInfo.orderUrl, body, headers);
+ RefundResponse refundResponse = JSON.parseObject(job_refundResponse.toJSONString(), RefundResponse.class);
+
+ String status = refundResponse.getStatus();
+ if(status != null && status.equals("SUCCESS")) {
+ // 閫�娆剧敵璇峰凡鍙楃悊
+ return BaseResponseUtils.buildSuccess(true) ;
+ } else if(status != null && status.equals("PROCESSING")) {
+ // 閫�娆惧鐞嗕腑
+ return BaseResponseUtils.buildFail(SellResultCode.PROCESSING.getMessage());
+ } else {
+ // 閫�娆惧紓甯�
+ return BaseResponseUtils.buildError(SellResultCode.ABNORMAL.getMessage());
+ }
+
+ }
+
+ /**
+ * 鏀粯閫氱煡/閫�娆剧粨鏋滈�氱煡
+ * @param headers
+ * @param orderNotify
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws GeneralSecurityException
+ */
+ @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 = "orderNotify", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public JSONObject orderNotify(@RequestHeader HttpHeaders headers, @RequestBody OrderNotify orderNotify, HttpServletResponse response) throws IOException, GeneralSecurityException {
+ JSONObject result = new JSONObject();
+
+ /**
+ * 1.楠岀澶勭悊
+ * 浠巋eader涓彇鍑�4涓瓙鍙傛暟锛屽悓鏃跺彇鍑篵ody
+ * 楠屾椂闂村樊锛岃秴杩�5鍒嗛挓鐨勪笉澶勭悊
+ * 楠岃瘉绛惧悕
+ * 楠岃瘉涔﹀簭鍒楀彿锛屽繀椤讳笌鏌愪竴涓瘉涔︾殑搴忓垪鍙蜂竴鑷�
+ */
+ String wechatpayNonce = String.valueOf(headers.get("Wechatpay-Nonce").get(0));
+ String wechatpaySerial = String.valueOf(headers.get("Wechatpay-Serial").get(0));
+ String wechatpaySignature = String.valueOf(headers.get("Wechatpay-Signature").get(0));
+ String wechatpayTimestamp = String.valueOf(headers.get("Wechatpay-Timestamp").get(0));
+ String bodyStr = JSONObject.toJSONString(orderNotify);
+
+ // 楠屾椂闂存埑锛屾椂闂村樊澶т簬5鍒嗛挓鐨勬嫆缁�
+ Long timeDiff = (System.currentTimeMillis() / 1000 - Long.parseLong(wechatpayTimestamp))/60;
+ if(timeDiff > 5) {
+ response.setStatus(500);
+ result.put("code", "FAIL");
+ result.put("message", "澶辫触");
+ return result;
+ }
+
+ // 鏋勯�犻獙绛惧悕涓�
+ String signatureStr = payHelper.responseSign(wechatpayTimestamp, wechatpayNonce, bodyStr);
+ // 楠岃瘉绛惧悕
+ Boolean valid = payHelper.responseSignVerify(wechatpaySerial, signatureStr, wechatpaySignature);
+ if(!valid) {
+ response.setStatus(500);
+ result.put("code", "FAIL");
+ result.put("message", "澶辫触");
+ return result;
+ }
+
+ // 搴忓垪鍙烽獙璇佽鏀惧湪楠岀鍚庯紝鍥犱负楠岀鏃跺彲鑳戒細涓嬭浇鏂扮殑璇佷功
+ boolean SerialIsValid = false;
+ for (String key : payHelper.CERTIFICATE_MAP.keySet()) {
+ if(key.equals(wechatpaySerial)) {
+ SerialIsValid = true;
+ }
+ }
+ if(!SerialIsValid) {
+ response.setStatus(500);
+ result.put("code", "FAIL");
+ result.put("message", "澶辫触");
+ return result;
+ }
+
+ /**
+ * 瑙e瘑澶勭悊
+ * 1
+ */
+ String eventType = orderNotify.getEvent_type();
+
+ if(eventType != null && eventType.equals("TRANSACTION.SUCCESS")) {
+ // 鏀粯鎴愬姛鍥炶皟
+ /**
+ * 鏀粯鎴愬姛鐨勫洖璋�
+ * 鍙栧嚭閫氱煡鏁版嵁瀵硅薄锛岀户鑰屽彇鍑鸿В瀵嗘墍闇�鐨刟ssociatedData鍜宯once锛屼互鍙婂瘑鏂嘽iphertext
+ * 瑙e瘑ciphertext寰楀埌
+ */
+ OrderNotify.NotifyResource notifyResource = orderNotify.getResource();
+ String associatedData = notifyResource.getAssociated_data();
+ String nonce = notifyResource.getNonce();
+ String ciphertext = notifyResource.getCiphertext();
+
+ String resource = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associatedData.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext);
+ JSONObject job_resource = JSONObject.parseObject(resource);
+
+ // 瑙e瘑鍚庡彇鍑猴細鍟嗘埛璁㈠崟鍛樸�佸井淇℃敮浠樿鍗曞彿銆佷氦鏄撶姸鎬併�佹敮浠樺畬鎴愭椂闂�
+ String out_trade_no = job_resource.getString("out_trade_no");
+ String transaction_id = job_resource.getString("transaction_id");
+ String trade_state = job_resource.getString("trade_state");
+ Date success_time = job_resource.getDate("success_time");
+
+ // 鏇存柊铏氭嫙鍗¤〃鍙婂厖鍊艰〃鍝嶅簲瀛楁
+ BaseResponse result_ = virtualCardSv.updateVCRecharge(out_trade_no, success_time);
+ if(!result_.getCode().equals("0001")) {
+ response.setStatus(500);
+ result.put("code", "FAIL");
+ result.put("message", "澶辫触");
+ return result;
+ }
+ } else if(eventType != null && eventType.equals("REFUND.SUCCESS")) {
+ // 閫�娆炬垚鍔熷悗鍥炶皟
+
+ }
+
+ // 閫氱煡搴旂瓟
+ response.setStatus(200);
+ result.put("code", "SUCCESS");
+ result.put("message", "鎴愬姛");
+ return result;
+ }
+
+ /**
+ * 鍐嶆绛惧悕
+ * @param prepayId 棰勬敮浠樹氦鏄撲細璇濇爣璇�
+ * @return 灏忕▼搴忚皟璧锋敮浠樺弬鏁�
+ * @throws Exception
+ */
+ @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))}
+ )
+ })
+ @GetMapping(path = "/signAgain")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId") String prepayId) throws Exception {
+
+ // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇�
+ String appid = PayInfo.appid;
+ String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
+ String nonceStr = payHelper.generateRandomString();
+ String pkg = "prepay_id=" + prepayId;
+ String message = payHelper.buildMessage_signAgain(appid, timestamp, nonceStr, pkg);
+ String paySign = payHelper.sign(message.getBytes("utf-8"), privateCertFileName);
+
+ JSONObject job_result = new JSONObject();
+ job_result.put("timestamp", timestamp);
+ job_result.put("nonceStr", nonceStr);
+ job_result.put("package", pkg);
+ job_result.put("signType", signType);
+ job_result.put("paySign", paySign);
+
+ return BaseResponseUtils.buildSuccess(job_result) ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java
new file mode 100644
index 0000000..de4d16d
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java
@@ -0,0 +1,55 @@
+package com.dy.pipIrrSell.wechatpay;
+
+import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper;
+import com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper;
+import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
+import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 13:51
+ * @LastEditTime 2024-03-06 13:51
+ * @Description
+ */
+
+@Slf4j
+@Service
+public class PaymentSv {
+ @Autowired
+ private SeWebchatLogonStateMapper seWebchatLogonStateMapper;
+
+ @Autowired
+ private SeVcRechargeMapper seVcRechargeMapper;
+
+ /**
+ * 娣诲姞鐧诲綍鎬佺姸鎬佽褰�
+ * @param po
+ * @return
+ */
+ Long insert(SeWebchatLogonState po) {
+ seWebchatLogonStateMapper.insert(po);
+ return po.getId();
+ }
+
+ /**
+ * 鏍规嵁鐧诲綍鎬両D鑾峰彇鐧诲綍鎬佸璞�
+ * @param id
+ * @return
+ */
+ SeWebchatLogonState selectOne(Long id) {
+ return seWebchatLogonStateMapper.selectByPrimaryKey(id);
+ }
+
+ /**
+ * 娣诲姞铏氭嫙鍗″厖鍊艰褰�
+ * @param po
+ * @return
+ */
+ Long insertVCRecharge(SeVcRecharge po) {
+ seVcRechargeMapper.insert(po);
+ return po.getId();
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/dto/Code2Session.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java
similarity index 90%
rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/dto/Code2Session.java
rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java
index 21cc420..ad86942 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/dto/Code2Session.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java
@@ -1,4 +1,4 @@
-package com.dy.pipirrWebChat.payment.dto;
+package com.dy.pipIrrSell.wechatpay.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
@@ -6,8 +6,8 @@
/**
* @author ZhuBaoMin
- * @date 2024-02-22 15:34
- * @LastEditTime 2024-02-22 15:34
+ * @date 2024-03-06 13:53
+ * @LastEditTime 2024-03-06 13:53
* @Description
*/
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java
new file mode 100644
index 0000000..407f244
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java
@@ -0,0 +1,40 @@
+package com.dy.pipIrrSell.wechatpay.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 13:54
+ * @LastEditTime 2024-03-06 13:54
+ * @Description 涓嬪崟璇锋眰瀵硅薄锛屼笅鍗曟椂浼犵粰JSAPI涓嬪崟鎺ュ彛
+ */
+
+@Data
+@Schema(name = "涓嬪崟璇锋眰瀵硅薄")
+public class DtoOrder {
+ public static final long serialVersionUID = 202403012108001L;
+
+ /**
+ * 鐧诲綍鎬両D锛岀敤鏉ヨ幏鍙杘penID
+ */
+ @Schema(description = "鐧诲綍鎬両D", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "鐧诲綍鎬両D涓嶈兘涓虹┖")
+ private String sessionId;
+
+ /**
+ * 铏氭嫙鍗$紪鍙凤紝澶栭敭锛岀敤鏉ヨ幏鍙栬櫄鎷熷崱浣欓
+ */
+ @Schema(description = "铏氭嫙鍗$紪鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "铏氭嫙鍗$紪鍙蜂笉鑳戒负绌�")
+ private Long virtualId;
+
+ /**
+ * 鍏呭�奸噾棰濋噾棰�
+ */
+ @Schema(description = "鏀粯閲戦", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "铏氭敮浠橀噾棰濅笉鑳戒负绌�")
+ private Integer rechargeAmount;
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java
new file mode 100644
index 0000000..dff01c7
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java
@@ -0,0 +1,81 @@
+package com.dy.pipIrrSell.wechatpay.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 13:54
+ * @LastEditTime 2024-03-06 13:54
+ * @Description 鏀粯鍜岄��娆鹃�氱煡鎺ユ敹瀵硅薄
+ */
+
+@Data
+@Schema(name = "鏀粯鍜岄��娆惧洖璋冨璞�")
+public class OrderNotify {
+ public static final long serialVersionUID = 202402291431001L;
+
+ /**
+ * 閫氱煡ID
+ */
+ private String id;
+
+ /**
+ * 閫氱煡鍒涘缓鏃堕棿
+ */
+ private String create_time;
+
+ /**
+ * 閫氱煡绫诲瀷
+ * 鏀粯鎴愬姛閫氱煡鐨勭被鍨嬩负锛歍RANSACTION.SUCCESS
+ */
+ private String event_type;
+
+ /**
+ * 閫氱煡鏁版嵁绫诲瀷
+ * 鏀粯鎴愬姛閫氱煡涓猴細encrypt-resource
+ */
+ private String resource_type;
+
+ /**
+ * 閫氱煡鏁版嵁
+ */
+ private NotifyResource resource;
+
+ /**
+ * 鍥炶皟鎽樿锛岄��娆鹃�氱煡鏃犳灞炴��
+ */
+ private String summary;
+
+
+ @Data
+ public class NotifyResource {
+
+ /**
+ * 鍔犲瘑绠楁硶绫诲瀷
+ * 浠呮敮鎸丄EAD_AES_256_GCM
+ */
+ private String algorithm;
+
+ /**
+ * 鏁版嵁瀵嗘枃
+ */
+ private String ciphertext;
+
+ /**
+ * 闄勫姞鏁版嵁
+ */
+ public String associated_data;
+
+ /**
+ * 鍘熷绫诲瀷
+ * 鍘熷鍥炶皟绫诲瀷涓猴細transaction
+ */
+ private String original_type;
+
+ /**
+ * 闅忔満涓�
+ */
+ private String nonce;
+ }
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java
new file mode 100644
index 0000000..ebc7fc9
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java
@@ -0,0 +1,39 @@
+package com.dy.pipIrrSell.wechatpay.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 13:55
+ * @LastEditTime 2024-03-06 13:55
+ * @Description 閫�娆捐姹傚璞★紝灏忕▼搴忚皟鐢ㄦ帴鍙f椂浼犲弬鎵�鐢ㄥ璞�
+ */
+
+@Data
+@Schema(name = "閫�娆捐姹傚璞�")
+public class Refund {
+ public static final long serialVersionUID = 202403011607001L;
+
+ /**
+ * 鍟嗘埛璁㈠崟鍙�
+ */
+ @Schema(description = "鍟嗘埛璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "鍟嗘埛璁㈠崟鍙蜂笉鑳戒负绌�")
+ private String tradeNo;
+
+ /**
+ * 閫�娆惧崟鍙凤紝閫�娆惧崟鍙锋棤鍊硷細鏂版彁浜ら��娆剧敵璇枫�傞��娆惧崟鍙锋湁鍊硷細閲嶆柊鎻愪氦閫�娆�
+ */
+ @Schema(description = "閫�娆惧崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private String refundNo;
+
+ /**
+ * 閫�娆鹃噾棰�
+ */
+ @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�")
+ private Integer refund;
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java
new file mode 100644
index 0000000..ad42f4b
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java
@@ -0,0 +1,70 @@
+package com.dy.pipIrrSell.wechatpay.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 13:55
+ * @LastEditTime 2024-03-06 13:55
+ * @Description 閫�娆捐姹傚璞★紝瀵硅薄璧嬪�煎畬鏁村悗鍚戝井淇¤姹傞��娆�
+ */
+
+@Data
+@Schema(name = "閫�娆捐姹傚璞�")
+public class RefundRequest {
+ public static final long serialVersionUID = 202403011540001L;
+
+ /**
+ * 鍟嗘埛璁㈠崟鍙凤紝涓嬪崟鏃剁殑璁㈠崟鍙�
+ */
+ @Schema(description = "鍟嗘埛璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "鍟嗘埛璁㈠崟鍙蜂笉鑳戒负绌�")
+ private String out_trade_no;
+
+ /**
+ * 鍟嗘埛閫�娆惧崟鍙凤紝璁㈠崟鍙峰墠鍔犲墠缂�鈥淩鈥�
+ */
+ @Schema(description = "鍟嗘埛閫�娆惧崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "鍟嗘埛閫�娆惧崟鍙蜂笉鑳戒负绌�")
+ private String out_refund_no;
+
+ /**
+ * 閫�娆剧粨鏋滃洖璋僽rl锛宺efundUrl
+ */
+ @Schema(description = "閫�娆剧粨鏋滃洖璋僽rl", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "閫�娆剧粨鏋滃洖璋僽rl涓嶈兘涓虹┖")
+ private String notify_url;
+
+ /**
+ * 閲戦淇℃伅
+ */
+ @Schema(description = "閲戦淇℃伅", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ private Amount amount;
+
+ @Data
+ public static class Amount {
+ /**
+ * 閫�娆鹃噾棰�
+ */
+ @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�")
+ private Integer refund;
+
+ /**
+ * 鍘熻鍗曢噾棰濓紝鏍规嵁璁㈠崟鍙锋煡璇�
+ */
+ @Schema(description = "鍘熻鍗曢噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotNull(message = "鍘熻鍗曢噾棰濅笉鑳戒负绌�")
+ private Integer total;
+
+ /**
+ * 閫�娆惧竵绉嶏紝鍥哄畾涓衡�淐NY鈥�
+ */
+ @Schema(description = "閫�娆惧竵绉�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @NotBlank(message = "閫�娆惧竵绉嶄笉鑳戒负绌�")
+ private String currency;
+ }
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java
new file mode 100644
index 0000000..63c143a
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java
@@ -0,0 +1,114 @@
+package com.dy.pipIrrSell.wechatpay.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 13:56
+ * @LastEditTime 2024-03-06 13:56
+ * @Description 閫�娆剧敵璇疯繑鍥炵殑瀵硅薄
+ */
+
+@Data
+@Schema(name = "閫�娆剧敵璇疯繑鍥炲璞�")
+public class RefundResponse {
+ public static final long serialVersionUID = 202403011431001L;
+
+ /**
+ * 寰俊鏀粯閫�娆惧彿
+ */
+ private String refund_id;
+
+ /**
+ * 鍟嗘埛閫�娆惧崟鍙�
+ */
+ private String out_refund_no;
+
+ /**
+ * 寰俊鏀粯璁㈠崟鍙�
+ */
+ private String transaction_id;
+
+ /**
+ * 鍟嗘埛璁㈠崟鍙�
+ */
+ private String out_trade_no;
+
+ /**
+ * 閫�娆炬笭閬�
+ */
+ private String channel;
+
+ /**
+ * 閫�娆惧叆璐﹁处鎴�
+ */
+ private String user_received_account;
+
+ /**
+ * 閫�娆炬垚鍔熸椂闂�
+ */
+ private String success_time;
+
+ /**
+ * 閫�娆惧垱寤烘椂闂�
+ */
+ private String create_time;
+
+ /**
+ * 閫�娆剧姸鎬�
+ */
+ private String status;
+
+ /**
+ * 閲戦淇℃伅
+ */
+ private Amount amount;
+
+
+ @Data
+ private static class Amount {
+
+ /**
+ * 璁㈠崟鎬婚噾棰�
+ */
+ private Integer total;
+
+ /**
+ * 閫�娆鹃噾棰�
+ */
+ private Integer refund;
+
+ /**
+ * 鐢ㄦ埛鏀粯閲戦
+ */
+ private Integer payer_total;
+
+ /**
+ * 鐢ㄦ埛閫�娆鹃噾棰�
+ */
+ private Integer payer_refund;
+
+ /**
+ * 搴旂粨閫�娆鹃噾棰�
+ */
+ private Integer settlement_refund;
+
+ /**
+ * 搴旂粨璁㈠崟閲戦
+ */
+ private Integer settlement_total;
+
+ /**
+ * 浼樻儬閫�娆鹃噾棰�
+ */
+ private Integer discount_refund;
+
+ /**
+ * 閫�娆惧竵绉�
+ */
+ private String currency;
+
+ }
+
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.gitignore b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.gitignore
deleted file mode 100644
index 549e00a..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.gitignore
+++ /dev/null
@@ -1,33 +0,0 @@
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.jar b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100644
index cb28b0e..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.properties b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100644
index 5f0536e..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw
deleted file mode 100644
index 66df285..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw
+++ /dev/null
@@ -1,308 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Apache Maven Wrapper startup batch script, version 3.2.0
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /usr/local/etc/mavenrc ] ; then
- . /usr/local/etc/mavenrc
- fi
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "$(uname)" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
- else
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=$(java-config --jre-home)
- fi
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
- JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="$(which javac)"
- if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=$(which readlink)
- if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
- if $darwin ; then
- javaHome="$(dirname "\"$javaExecutable\"")"
- javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
- else
- javaExecutable="$(readlink -f "\"$javaExecutable\"")"
- fi
- javaHome="$(dirname "\"$javaExecutable\"")"
- javaHome=$(expr "$javaHome" : '\(.*\)/bin')
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
- fi
-
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=$(cd "$wdir/.." || exit 1; pwd)
- fi
- # end of workaround
- done
- printf '%s' "$(cd "$basedir" || exit 1; pwd)"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- # Remove \r in case we run on Windows within Git Bash
- # and check out the repository with auto CRLF management
- # enabled. Otherwise, we may read lines that are delimited with
- # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
- # splitting rules.
- tr -s '\r\n' ' ' < "$1"
- fi
-}
-
-log() {
- if [ "$MVNW_VERBOSE" = true ]; then
- printf '%s\n' "$1"
- fi
-}
-
-BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
-if [ -z "$BASE_DIR" ]; then
- exit 1;
-fi
-
-MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
-log "$MAVEN_PROJECTBASEDIR"
-
-##########################################################################################
-# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-# This allows using the maven wrapper in projects that prohibit checking in binary data.
-##########################################################################################
-wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
-if [ -r "$wrapperJarPath" ]; then
- log "Found $wrapperJarPath"
-else
- log "Couldn't find $wrapperJarPath, downloading it ..."
-
- if [ -n "$MVNW_REPOURL" ]; then
- wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- else
- wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- fi
- while IFS="=" read -r key value; do
- # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
- safeValue=$(echo "$value" | tr -d '\r')
- case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
- esac
- done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
- log "Downloading from: $wrapperUrl"
-
- if $cygwin; then
- wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
- fi
-
- if command -v wget > /dev/null; then
- log "Found wget ... using wget"
- [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
- else
- wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
- fi
- elif command -v curl > /dev/null; then
- log "Found curl ... using curl"
- [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
- else
- curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
- fi
- else
- log "Falling back to using Java to download"
- javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
- javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
- # For Cygwin, switch paths to Windows format before running javac
- if $cygwin; then
- javaSource=$(cygpath --path --windows "$javaSource")
- javaClass=$(cygpath --path --windows "$javaClass")
- fi
- if [ -e "$javaSource" ]; then
- if [ ! -e "$javaClass" ]; then
- log " - Compiling MavenWrapperDownloader.java ..."
- ("$JAVA_HOME/bin/javac" "$javaSource")
- fi
- if [ -e "$javaClass" ]; then
- log " - Running MavenWrapperDownloader.java ..."
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
- fi
- fi
- fi
-fi
-##########################################################################################
-# End of extension
-##########################################################################################
-
-# If specified, validate the SHA-256 sum of the Maven wrapper jar file
-wrapperSha256Sum=""
-while IFS="=" read -r key value; do
- case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
- esac
-done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
-if [ -n "$wrapperSha256Sum" ]; then
- wrapperSha256Result=false
- if command -v sha256sum > /dev/null; then
- if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
- wrapperSha256Result=true
- fi
- elif command -v shasum > /dev/null; then
- if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
- wrapperSha256Result=true
- fi
- else
- echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
- echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
- exit 1
- fi
- if [ $wrapperSha256Result = false ]; then
- echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
- echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
- echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
- exit 1
- fi
-fi
-
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
-fi
-
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
-export MAVEN_CMD_LINE_ARGS
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-# shellcheck disable=SC2086 # safe args
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- $MAVEN_DEBUG_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw.cmd b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw.cmd
deleted file mode 100644
index 95ba6f5..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw.cmd
+++ /dev/null
@@ -1,205 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM https://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Apache Maven Wrapper startup batch script, version 3.2.0
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
-if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
-
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
-)
-
-@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
- if "%MVNW_VERBOSE%" == "true" (
- echo Found %WRAPPER_JAR%
- )
-) else (
- if not "%MVNW_REPOURL%" == "" (
- SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- )
- if "%MVNW_VERBOSE%" == "true" (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %WRAPPER_URL%
- )
-
- powershell -Command "&{"^
- "$webclient = new-object System.Net.WebClient;"^
- "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
- "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
- "}"^
- "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
- "}"
- if "%MVNW_VERBOSE%" == "true" (
- echo Finished downloading %WRAPPER_JAR%
- )
-)
-@REM End of extension
-
-@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
-SET WRAPPER_SHA_256_SUM=""
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
-)
-IF NOT %WRAPPER_SHA_256_SUM%=="" (
- powershell -Command "&{"^
- "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
- "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
- " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
- " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
- " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
- " exit 1;"^
- "}"^
- "}"
- if ERRORLEVEL 1 goto error
-)
-
-@REM Provide a "standardized" way to retrieve the CLI args that will
-@REM work with both Windows and non-Windows executions.
-set MAVEN_CMD_LINE_ARGS=%*
-
-%MAVEN_JAVA_EXE% ^
- %JVM_CONFIG_MAVEN_PROPS% ^
- %MAVEN_OPTS% ^
- %MAVEN_DEBUG_OPTS% ^
- -classpath %WRAPPER_JAR% ^
- "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
- %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
-if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%"=="on" pause
-
-if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
-
-cmd /C exit /B %ERROR_CODE%
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/pom.xml
deleted file mode 100644
index 5cb8ab3..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/pom.xml
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>com.dy</groupId>
- <artifactId>pipIrr-web</artifactId>
- <version>1.0.0</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <packaging>jar</packaging>
-
- <artifactId>pipIrr-web-webchat</artifactId>
- <name>pipIrr-web-webchat</name>
- <description>web寰俊鏀粯妯″潡</description>
-
- <dependencies>
- <!--寰俊鏀粯-->
- <dependency>
- <groupId>com.github.wechatpay-apiv3</groupId>
- <artifactId>wechatpay-java</artifactId>
- <version>0.2.12</version>
- </dependency>
-
- <!--OkHttp-->
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>okhttp</artifactId>
- <version>4.9.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents.client5</groupId>
- <artifactId>httpclient5</artifactId>
- <version>5.1.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents.client5</groupId>
- <artifactId>httpclient5-fluent</artifactId>
- <version>5.1.3</version>
- </dependency>
-
- </dependencies>
- <build>
- <plugins>
- <!-- 鐢熸垚涓嶅寘鍚緷璧杍ar鐨勫彲鎵цjar鍖�
- <plugin>
- !- spring boot鎻愪緵鐨刴aven鎵撳寘鎻掍欢 -
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- !-
- <goals>
- <goal>repackage</goal>
- </goals>
- -
- <configuration>
- !- 涓嶅姞鐨勮瘽鏈�缁堝寘鍚嶄负: ${artifactId}-${version}.jar, 鍔犱簡鐨勮瘽鏈�缁堝寘鍚�: ${artifactId}-${version}-${classifier}.jar -
- <classifier>execute</classifier>
- !- 涓嶆寚瀹氱敓鎴愯矾寰勭殑璇�, 榛樿淇濆瓨鍦� ${build.directory} 涓� -
- <outputDirectory>${project.build.directory}/execute</outputDirectory>
- <finalName>${artifactId}-${version}</finalName>
- <layout>ZIP</layout>
- <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass>
- <includes>
- <include>
- <groupId>com.dy</groupId>
- <artifactId>pipIrr-common</artifactId>
- </include>
- <include>
- <groupId>com.dy</groupId>
- <artifactId>pipIrr-global</artifactId>
- </include>
- </includes>
- <excludes>
- <exclude>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- </exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
-
- </plugin>
- -->
- <!-- 鎷疯礉渚濊禆鐨刯ar鍖呭埌lib鐩綍-->
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- <configuration>
- <!-- 涓嶅姞鐨勮瘽鏈�缁堝寘鍚嶄负: ${artifactId}-${version}.jar, 鍔犱簡鐨勮瘽鏈�缁堝寘鍚�: ${artifactId}-${version}-${classifier}.jar
- <classifier>execute</classifier>
- -->
- <!-- ${project.build.directory}鏄痬aven鍙橀噺锛屽唴缃殑锛岃〃绀簍arget鐩綍,濡傛灉涓嶅啓锛屽皢鍦ㄦ牴鐩綍涓嬪垱寤�/lib -->
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- <!-- excludeTransitive:鏄惁涓嶅寘鍚棿鎺ヤ緷璧栧寘锛屾瘮濡傛垜浠緷璧朅锛屼絾鏄疉鍙堜緷璧栦簡B锛屾垜浠槸鍚︿篃瑕佹妸B鎵撹繘鍘� 榛樿涓嶆墦-->
- <excludeTransitive>false</excludeTransitive>
- <!-- 澶嶅埗鐨刯ar鏂囦欢鍘绘帀鐗堟湰淇℃伅 -->
- <stripVersion>false</stripVersion>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <layout>ZIP</layout>
- <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass>
- <includes>
- <include>
- <groupId>com.dy</groupId>
- <artifactId>pipIrr-common</artifactId>
- </include>
- <include>
- <groupId>com.dy</groupId>
- <artifactId>pipIrr-global</artifactId>
- </include>
- </includes>
- <excludes>
- <exclude>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- </exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <!-- 璁剧疆java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <!-- source锛� 婧愪唬鐮佺紪璇戠増鏈紱target锛� 鐩爣骞冲彴缂栬瘧鐗堟湰锛沞ncoding锛� 瀛楃闆嗙紪鐮併�� -->
- <configuration>
- <source>${java.version}</source>
- <target>${java.version}</target>
- <encoding>${encoding}</encoding>
- </configuration>
- </plugin>
- <plugin>
- <!-- 瑙e喅璧勬簮鏂囦欢鐨勭紪鐮侀棶棰� -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <configuration>
- <encoding>${encoding}</encoding>
- </configuration>
- </plugin>
- <plugin>
- <!-- maven閲屾墽琛屾祴璇曠敤渚嬬殑鎻掍欢 -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- <plugin>
- <!-- 涓嬮潰瑙e喅锛氬綋杩涜Maven Lifecycle package鏃舵姤閿欙細Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)-->
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/PipIrrWebChatApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/PipIrrWebChatApplication.java
deleted file mode 100644
index 2517c4a..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/PipIrrWebChatApplication.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.dy.pipirrWebChat;
-
-import com.dy.common.multiDataSource.EnableMultiDataSource;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-
-/**
- * @author ZhuBaoMin
- * @date 2024/02/21 16:07
- * @LastEditTime 2024/02/21 16:07
- * @Description
- */
-
-@SpringBootApplication
-@EnableAspectJAutoProxy
-@EnableMultiDataSource
-@ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipirrWebChat"})
-@MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"})
-public class PipIrrWebChatApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(PipIrrWebChatApplication.class, args);
- }
-
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebFilterConfiguration.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebFilterConfiguration.java
deleted file mode 100644
index fd118ff..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebFilterConfiguration.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.dy.pipirrWebChat.config;
-
-import com.dy.common.webFilter.DevOfDataSourceNameSetFilter;
-import com.dy.common.webFilter.UserTokenFilter;
-import jakarta.servlet.Filter;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.servlet.FilterRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-21 16:10
- * @LastEditTime 2024-02-21 16:10
- * @Description
- */
-
-@Configuration
-public class WebFilterConfiguration {
-
- @Value("${pipIrr.global.dev}")
- public String isDevStage ;//鏄惁涓哄紑鍙戦樁娈�
- @Value("${pipIrr.global.dsName}")
- public String dsName ;//寮�鍙戦樁娈电殑鏁版嵁婧愬悕绉�
-
- /**
- * DevOfDataSourceNameSetFilter涓嶶serTokenFilter鍙兘涓�涓閰嶇疆涓婏紝
- * 鎵�浠ヤ粬浠殑order閮芥槸1
- */
- private static final int order_UserTokenFilter = 1 ;//涓庝笅闈�
- private static final int order_DevOfDataSourceNameSetFilter = 1 ;
-
-
- @Bean
- public FilterRegistrationBean<? extends Filter> RegFilter() {
- FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>();
- if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){
- filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter());
- filterRegistrationBean.addUrlPatterns("/*");//閰嶇疆杩囨护瑙勫垯
- filterRegistrationBean.addInitParameter("dataSourceName",dsName);//璁剧疆init鍙傛暟
- filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//璁剧疆杩囨护鍣ㄥ悕绉�
- filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//鎵ц娆″簭
- }else{
- filterRegistrationBean.setFilter(new UserTokenFilter());
- filterRegistrationBean.addUrlPatterns("/*");//閰嶇疆杩囨护瑙勫垯
- filterRegistrationBean.setName("UserTokenFilter");//璁剧疆杩囨护鍣ㄥ悕绉�
- filterRegistrationBean.setOrder(order_UserTokenFilter);//鎵ц娆″簭
- }
- return filterRegistrationBean;
- }
-
-}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebListenerConfiguration.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebListenerConfiguration.java
deleted file mode 100644
index 7cd9d6e..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebListenerConfiguration.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.dy.pipirrWebChat.config;
-
-import com.dy.common.webListener.GenerateIdSetSuffixListener;
-import jakarta.servlet.ServletContextListener;
-import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-21 16:11
- * @LastEditTime 2024-02-21 16:11
- * @Description
- */
-
-@Configuration
-public class WebListenerConfiguration {
-
- /**
- * 鍚姩椤哄簭
- */
- //private static final int order_config = 0 ;
- private static final int order_idSetSuffix = 1 ;
- //private static final int order_init = 2 ;
-
- /*
- * 瑙f瀽鍚勭***.config閰嶇疆鐨凜onfigListener锛屾殏鏃朵笉閲囩敤姝ょ閰嶇疆鏂瑰紡
- *
- @Bean
- public ConfigListener getGlConfigListener(){
- return new ConfigListener() ;
- }
- /**
- * 澶栭儴鎻愪緵Listener
- * @param listener 澶栭儴鎻愪緵Listener
- * @return 娉ㄥ唽Bean
- @Bean
- public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) {
- ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
- listenerRegistrationBean.setListener(listener);
- listenerRegistrationBean.setOrder(order_config);
- return listenerRegistrationBean;
- }
- */
-
- /**
- * 鍐呴儴鎻愪緵listener锛岃listener鍦ㄧ郴缁熷惎鍔ㄦ椂锛屾牴鎹厤缃� 璁剧疆ID浜х敓鍣ㄧ殑鍚庣紑
- * @return 娉ㄥ唽Bean
- */
- @Bean
- public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() {
- ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
- listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener());
- listenerRegistrationBean.setOrder(order_idSetSuffix);
- return listenerRegistrationBean;
- }
-
-// /**
-// * 鍐呴儴鎻愪緵listener锛岃listener鍦ㄧ郴缁熷惎鍔ㄦ椂锛屽垵濮嬪寲鏁版嵁搴撴暟鎹�
-// * @return 娉ㄥ唽Bean
-// */
-// @Bean
-// public ServletListenerRegistrationBean<? extends ServletContextListener> regInitListener() {
-// ServletListenerRegistrationBean<InitListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
-// listenerRegistrationBean.setListener(new InitListener());
-// listenerRegistrationBean.setOrder(order_init);
-// return listenerRegistrationBean;
-// }
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayHelper.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayHelper.java
deleted file mode 100644
index 9412ba3..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayHelper.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.dy.pipirrWebChat.payment;
-
-import javax.crypto.NoSuchPaddingException;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.*;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.util.Base64;
-import java.util.Random;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-22 20:31
- * @LastEditTime 2024-02-22 20:31
- * @Description
- */
-public class PayHelper {
- private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
- /**
- * 鑾峰彇32浣嶉殢鏈哄瓧绗︿覆
- * @return 闅忔満涓�
- */
- public static String generateRandomString() {
- Random random = new Random();
- StringBuilder sb = new StringBuilder(32);
- for (int i = 0; i < 32; i++) {
- int index = random.nextInt(CHARACTERS.length());
- sb.append(CHARACTERS.charAt(index));
- }
- return sb.toString();
- }
-
- /**
- * 鑾峰彇绉侀挜瀵硅薄
- * @param filename 绉侀挜鏂囦欢璺緞
- * @return 绉侀挜瀵硅薄
- * @throws IOException
- */
- public static PrivateKey getPrivateKey(String filename) throws IOException {
- //String filename = "C:\\webchat\\apiclient_key.pem";
- String content = new String(Files.readAllBytes(Paths.get(filename)), "utf-8");
- try {
- String privateKey = content.replace("-----BEGIN PRIVATE KEY-----", "")
- .replace("-----END PRIVATE KEY-----", "")
- .replaceAll("\\s+", "");
- KeyFactory kf = KeyFactory.getInstance("RSA");
- return kf.generatePrivate(
- new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey)));
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("褰撳墠Java鐜涓嶆敮鎸丷SA", e);
- } catch (InvalidKeySpecException e) {
- throw new RuntimeException("鏃犳晥鐨勫瘑閽ユ牸寮�");
- }
- }
-
- /**
- * 鏋勯�犵鍚嶄覆_涓嬪崟
- * @param method HTTP璇锋眰鏂规硶
- * @param url URL
- * @param timestamp 鏃堕棿鎴�
- * @param nonceStr 闅忔満涓�
- * @param body 鎶ユ枃涓婚
- * @return 绛惧悕涓�
- */
- public static String buildMessage_order(String method, String url, long timestamp, String nonceStr, String body) {
- return method + "\n"
- + url + "\n"
- + timestamp + "\n"
- + nonceStr + "\n"
- + body + "\n";
- }
-
- public static String buildMessage_signAgain(String appid, String timestamp, String nonceStr, String pkg) {
- return appid + "\n"
- + timestamp + "\n"
- + nonceStr + "\n"
- + pkg + "\n";
- }
-
- /**
- * 绛惧悕
- * @param message 琚鍚嶄俊鎭�
- * @param certFileName 绉侀挜璇佷功鏂囦欢璺緞
- * @return signature绛惧悕鍊硷紝绛惧悕淇℃伅涓殑涓�椤癸紝鍙備笌鐢熸垚绛惧悕淇℃伅
- * @throws NoSuchAlgorithmException
- * @throws InvalidKeyException
- * @throws SignatureException
- * @throws IOException
- */
- public static String sign(byte[] message, String certFileName) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException {
- Signature sign = Signature.getInstance("SHA256withRSA");
- sign.initSign(getPrivateKey(certFileName));
- sign.update(message);
- return Base64.getEncoder().encodeToString(sign.sign());
- }
-
- /**
- * 鑾峰彇绛惧悕淇℃伅
- * @param method
- * @param url
- * @param body
- * @return 绛惧悕淇℃伅锛孒TTP澶翠腑鐨勭鍚嶄俊鎭�
- * HTTP澶达細Authorization: 璁よ瘉绫诲瀷 绛惧悕淇℃伅
- * 璁よ瘉绫诲瀷锛學ECHATPAY2-SHA256-RSA2048
- */
- public static String getToken(String method, String url, String body, String nonceStr, Long timestamp, String certFileName) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException, NoSuchPaddingException {
- String message = buildMessage_order(method, url, timestamp, nonceStr, body);
- String signature = sign(message.getBytes("utf-8"), certFileName);
-
- return "mchid=\"" + PayInfo.mchid + "\","
- + "nonce_str=\"" + nonceStr + "\","
- + "timestamp=\"" + timestamp + "\","
- + "serial_no=\"" + PayInfo.serial_no + "\","
- + "signature=\"" + signature + "\"";
- }
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentCtrl.java
deleted file mode 100644
index 4b4b246..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentCtrl.java
+++ /dev/null
@@ -1,258 +0,0 @@
-package com.dy.pipirrWebChat.payment;
-
-import com.alibaba.fastjson2.JSONArray;
-import com.alibaba.fastjson2.JSONObject;
-import com.dy.common.aop.SsoAop;
-import com.dy.common.webUtil.BaseResponse;
-import com.dy.common.webUtil.BaseResponseUtils;
-import com.dy.common.webUtil.ResultCodeMsg;
-import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState;
-import com.dy.pipirrWebChat.util.OkHttpUtil;
-import com.dy.pipirrWebChat.util.RestTemplateUtil;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import io.swagger.v3.oas.annotations.responses.ApiResponses;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.MediaType;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-22 15:24
- * @LastEditTime 2024-02-22 15:24
- * @Description
- */
-
-@Slf4j
-@Tag(name = "寰俊鏀粯绠$悊", description = "寰俊鏀粯鍚勭鎿嶄綔")
-@RestController
-@RequestMapping(path="payment")
-@RequiredArgsConstructor
-public class PaymentCtrl {
- private final PaymentSv paymentSv;
- private final RestTemplateUtil restTemplateUtil;
- private String certFileName = PayInfo.certFileName;
-
- /**
- * 鐧诲綍鍑瘉鏍¢獙
- * @param appid 灏忕▼搴� appId
- * @param secret 灏忕▼搴� appSecret
- * @param js_code 涓存椂鐧诲綍鍑瘉code
- * @return
- * @throws Exception
- */
- @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 = "getSessionId")
- @Transactional(rollbackFor = Exception.class)
- @SsoAop()
- public BaseResponse<Boolean> getSessionId(@RequestParam("appid") String appid, @RequestParam("secret") String secret, @RequestParam("js_code") String js_code) throws Exception {
- String result = OkHttpUtil.builder().url("https://api.weixin.qq.com/sns/jscode2session")
- .addParam("appid", appid)
- .addParam("secret", secret)
- .addParam("js_code", js_code)
- .initGet()
- .sync();
- JSONObject job = JSONObject.parseObject(result);
- System.out.println(job.getString("session_key"));
-
- if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) {
- return BaseResponseUtils.buildFail("鐧诲綍鍑瘉鏍¢獙澶辫触");
- }
-
- // 娣诲姞鐧诲綍鎬佽褰�
- SeWebchatLogonState po = new SeWebchatLogonState();
- po.setOpenId(job.getString("openid"));
- po.setSessionKey(job.getString("session_key"));
- Date createTime = new Date();
- po.setCreateTime(createTime);
- Long id = paymentSv.insert(po);
- if(id == null || id <= 0) {
- return BaseResponseUtils.buildFail("鐧诲綍鎬佽褰曟坊鍔犲け璐�");
- }
-
- String SessionId = String.valueOf(id);
- return BaseResponseUtils.buildSuccess(SessionId) ;
- }
-
- @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))}
- )
- })
- @GetMapping(path = "certificates")
- @Transactional(rollbackFor = Exception.class)
- @SsoAop()
- public BaseResponse<JSONObject> certificates() throws Exception {
- //String prepayId = "";
- //SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId));
- //String openid = po.getOpenId();
-
- String method = "GET";
- String httpUrl = "/v3/certificates";
- String nonceStr = PayHelper.generateRandomString();
- Long timestamp = System.currentTimeMillis() / 1000;
-
- String header = PayInfo.schema + " " + PayHelper.getToken(method, httpUrl, "", nonceStr, timestamp, certFileName);
-
- Map<String, String> headers = new HashMap<>();
- headers.put("Authorization", header);
- headers.put("Accept", "application/json");
- JSONObject job_result = restTemplateUtil.get(PayInfo.certificates,null, headers);
- if(job_result != null) {
- JSONArray array = job_result.getJSONArray("data");
- if(array != null && array.size() > 0) {
- for(int i = 0; i < array.size(); i++) {
- JSONObject job_data = array.getJSONObject(i);
- String serial_no = job_data.getString("serial_no");
- String effective_time = job_data.getString("effective_time");
- String expire_time = job_data.getString("expire_time");
- JSONObject job_certificate = job_data.getJSONObject("encrypt_certificate");
- String algorithm = job_certificate.getString("algorithm");
- String nonce = job_certificate.getString("nonce");
- String associated_data = job_certificate.getString("associated_data");
- String ciphertext = job_certificate.getString("ciphertext");
- }
- }
- }
- System.out.println(job_result.toJSONString());
- return BaseResponseUtils.buildSuccess(job_result.toJSONString()) ;
- }
-
- /**
- * JSAPI涓嬪崟
- * @param sessionId
- * @param orderNumber
- * @param payAmount
- * @return
- * @throws Exception
- */
- @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 = "unifiedOrder")
- @Transactional(rollbackFor = Exception.class)
- @SsoAop()
- public BaseResponse<Boolean> unifiedOrder(@RequestParam("sessionId") String sessionId, @RequestParam("orderNumber") String orderNumber, @RequestParam("payAmount") String payAmount) throws Exception {
- String prepayId = "";
- SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId));
- String openid = po.getOpenId();
-
- JSONObject job_body = new JSONObject();
- job_body.put("appid", PayInfo.appid);
- job_body.put("mchid", PayInfo.mchid);
- job_body.put("description", PayInfo.description);
- job_body.put("out_trade_no", orderNumber);
- job_body.put("notify_url", PayInfo.notifyUrl);
-
- //璁㈠崟閲戦
- JSONObject job_amount = new JSONObject();
- job_amount.put("total", 1);
- job_amount.put("currency", "CNY");
- job_body.put("amount", job_amount);
-
- //鏀粯鑰�
- JSONObject job_payer = new JSONObject();
- job_payer.put("openid", openid);
- job_body.put("payer", job_payer);
-
- // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇�
- String nonceStr = PayHelper.generateRandomString();
- Long timestamp = System.currentTimeMillis() / 1000;
-
- String method = "POST";
- String httpUrl = "/v3/pay/transactions/jsapi";
-
- String body = job_body.toJSONString();
- String header = PayInfo.schema + " " + PayHelper.getToken(method, httpUrl, body, nonceStr, timestamp, certFileName);
-
- Map<String, String> headers = new HashMap<>();
- headers.put("Authorization", header);
- headers.put("Accept", "application/json");
- headers.put("Content-Type", "application/json");
-
- JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers);
- if(job_result != null) {
- System.out.println(job_result.toString());
- prepayId = job_result.getString("prepay_id");
- }
-
-
-
- //String result = OkHttpUtil.builder().url(PayInfo.orderUrl)
- // .addBody(body)
- // .addHeader("Authorization", header)
- // .addHeader("Accept", "application/json")
- // .addHeader("Content-Type", "application/json")
- // .initPost(true)
- // .sync();
- //System.out.println(result);
-
- return BaseResponseUtils.buildSuccess(prepayId) ;
- }
-
- /**
- * 鍐嶆绛惧悕
- * @param prepayId 棰勬敮浠樹氦鏄撲細璇濇爣璇�
- * @return 灏忕▼搴忚皟璧锋敮浠樺弬鏁�
- * @throws Exception
- */
- @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))}
- )
- })
- @GetMapping(path = "/signAgain")
- @Transactional(rollbackFor = Exception.class)
- @SsoAop()
- public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId") String prepayId) throws Exception {
-
- // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇�
- String appid = PayInfo.appid;
- String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
- String nonceStr = PayHelper.generateRandomString();
- String pkg = "prepay_id=" + prepayId;
- String signType = PayInfo.signType;
- String message = PayHelper.buildMessage_signAgain(appid, timestamp, nonceStr, pkg);
- String paySign = PayHelper.sign(message.getBytes("utf-8"), certFileName);
-
- JSONObject job_result = new JSONObject();
- job_result.put("timestamp", timestamp);
- job_result.put("nonceStr", nonceStr);
- job_result.put("package", pkg);
- job_result.put("signType", signType);
- job_result.put("paySign", paySign);
-
- return BaseResponseUtils.buildSuccess(job_result) ;
- }
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentSv.java
deleted file mode 100644
index 11e8d4e..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentSv.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.dy.pipirrWebChat.payment;
-
-import com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper;
-import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-22 17:39
- * @LastEditTime 2024-02-22 17:39
- * @Description
- */
-
-@Slf4j
-@Service
-public class PaymentSv {
- @Autowired
- private SeWebchatLogonStateMapper seWebchatLogonStateMapper;
-
- /**
- * 娣诲姞鐧诲綍鎬佺姸鎬佽褰�
- * @param po
- * @return
- */
- Long insert(SeWebchatLogonState po) {
- seWebchatLogonStateMapper.insert(po);
- return po.getId();
- }
-
- SeWebchatLogonState selectOne(Long id) {
- return seWebchatLogonStateMapper.selectByPrimaryKey(id);
- }
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/result/WebChatResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/result/WebChatResultCode.java
deleted file mode 100644
index 2eb1327..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/result/WebChatResultCode.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.dy.pipirrWebChat.result;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-21 16:13
- * @LastEditTime 2024-02-21 16:13
- * @Description
- */
-
-@Getter
-@AllArgsConstructor
-public enum WebChatResultCode {
- /**
- * 寰俊鏀粯
- */
- DIVIDE_FAIL(10001, "鍒嗘按鎴挎坊鍔犲け璐�");
-
- private final Integer code;
- private final String message;
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/ICallback.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/ICallback.java
deleted file mode 100644
index a40aa1d..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/ICallback.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.dy.pipirrWebChat.util;
-
-import okhttp3.Call;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-22 15:22
- * @LastEditTime 2024-02-22 15:22
- * @Description
- */
-
-public interface ICallback {
- void onSuccess(Call call, String data);
- void onFail(Call call, String errorMsg);
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/OkHttpUtil.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/OkHttpUtil.java
deleted file mode 100644
index 67c6ae0..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/OkHttpUtil.java
+++ /dev/null
@@ -1,239 +0,0 @@
-package com.dy.pipirrWebChat.util;
-
-import okhttp3.*;
-import org.jetbrains.annotations.NotNull;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.security.SecureRandom;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author ZhuBaoMin
- * @date 2024-02-22 13:39
- * @LastEditTime 2024-02-22 13:39
- * @Description
- */
-
-public class OkHttpUtil {
-
- private static volatile OkHttpClient okHttpClient = null;
- private static volatile Semaphore semaphore = null;
- private Map<String, String> headerMap;
- private Map<String, Object> paramMap;
- private String url;
- private Request.Builder request;
- private String body;
-
- private OkHttpUtil() {
- if (Objects.isNull(okHttpClient)) {
- synchronized (OkHttpUtil.class) {
- if (Objects.isNull(okHttpClient)) {
- TrustManager[] trustManagers = buildTrustManager();
- okHttpClient = new OkHttpClient.Builder()
- .connectTimeout(15, TimeUnit.SECONDS)
- .writeTimeout(20, TimeUnit.SECONDS)
- .readTimeout(20, TimeUnit.SECONDS)
- .sslSocketFactory(createSSLSocketFactory(trustManagers), (X509TrustManager)trustManagers[0])
- .hostnameVerifier((hostname, session) -> true)
- .retryOnConnectionFailure(true)
- .build();
- addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36");
- }
- }
- }
- }
-
- public OkHttpUtil initGet() {
- request = new Request.Builder().get();
- StringBuilder builder = new StringBuilder(url);
- if (Objects.nonNull(paramMap)) {
- builder.append("?");
- paramMap.forEach((key, value) -> {
- try {
- builder.append(URLEncoder.encode(key, "utf-8"))
- .append("=")
- .append(URLEncoder.encode((String)value, "utf-8"))
- .append("&");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- });
- builder.deleteCharAt(builder.length() - 1);
- }
- request.url(builder.toString());
- return this;
- }
-
- public OkHttpUtil initPost(boolean isJson) {
- RequestBody requestBody = null;
- if (isJson) {
- requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), body);
- } else {
- FormBody.Builder formBody = new FormBody.Builder();
- if (Objects.nonNull(paramMap)) {
- paramMap.forEach((x, y) -> formBody.add(x, (String) y));
- }
- requestBody = formBody.build();
- }
- request = new Request.Builder().post(requestBody).url(url);
- return this;
- }
-
- /**
- * @Description:鍚屾璇锋眰
- * @Author: zzc
- * @Date: 2022-12-04 18:06
- * @return: java.lang.String
- **/
- public String sync() throws Exception {
- setHeader(request);
- try {
- Response result = okHttpClient.newCall(request.build()).execute();
- if (result.isSuccessful()) {
- return result.body().string();
- }
- throw new Exception(result.body().string());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
- }
-
- /**
- * @Description:寮傛璇锋眰锛屾湁杩斿洖鍊�
- * @Author: zzc
- * @Date: 2022-12-04 18:05
- * @return: java.lang.String
- **/
- public String async() {
- StringBuffer buffer = new StringBuffer();
- setHeader(request);
- okHttpClient.newCall(request.build()).enqueue(new Callback() {
- @Override
- public void onResponse(@NotNull okhttp3.Call call, @NotNull Response response) throws IOException {
- if (Objects.nonNull(response.body())) {
- buffer.append(response.body().string());
- getSemaphore().release();
- }
- }
- @Override
- public void onFailure(@NotNull okhttp3.Call call, @NotNull IOException e) {
- buffer.append("璇锋眰鍑洪敊").append(e.getMessage());
- }
- });
- try {
- getSemaphore().acquire();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return buffer.toString();
- }
-
- private static Semaphore getSemaphore() {
- synchronized (OkHttpUtil.class) {
- if (Objects.isNull(semaphore)) {
- semaphore = new Semaphore(0);
- }
- }
- return semaphore;
- }
-
- public static OkHttpUtil builder() {
- return new OkHttpUtil();
- }
-
- public OkHttpUtil url(String url) {
- this.url = url;
- return this;
- }
-
- public OkHttpUtil addParam(String key, String value) {
- if (Objects.isNull(paramMap)) {
- paramMap = new LinkedHashMap<>(16);
- }
- paramMap.put(key, value);
- return this;
- }
-
- public OkHttpUtil addBody(String body) {
- this.body = body;
- return this;
- }
-
- public void setHeader(Request.Builder request) {
- if (Objects.nonNull(headerMap)) {
- headerMap.forEach(request::addHeader);
- }
- }
-
- public OkHttpUtil addHeader(String key, String value) {
- if (Objects.isNull(headerMap)) {
- headerMap = new LinkedHashMap<>(16);
- }
- headerMap.put(key, value);
- return this;
- }
-
- /**
- * @Description:鐢熸垚瀹夊叏濂楁帴瀛楀伐鍘傦紝鐢ㄤ簬Https璇锋眰鐨勮瘉涔﹁烦杩�
- * @Author: zzc
- * @Date: 2022-11-30 16:03
- * @param trustManagers:
- * @return: javax.net.ssl.SSLSocketFactory
- **/
- //private static SSLSocketFactory createSSLSocketFactory(TrustManager[] trustManagers) {
- // SSLSocketFactory sslSocketFactory = null;
- // try {
- // SSLContext ssl = SSLContext.getInstance("SSL");
- // ssl.init(null, trustManagers, new SecureRandom());
- // sslSocketFactory = ssl.getSocketFactory();
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // return sslSocketFactory;
- //}
-
- private static SSLSocketFactory createSSLSocketFactory(TrustManager[] trustManagers) {
- SSLSocketFactory sslSocketFactory = null;
- try {
- SSLContext ssl = SSLContext.getInstance("SSL");
- ssl.init(null, trustManagers, new SecureRandom());
- sslSocketFactory = ssl.getSocketFactory();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- return sslSocketFactory;
- }
-
- private static TrustManager[] buildTrustManager() {
- return new TrustManager[] {
- new X509TrustManager() {
- @Override
- public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return new X509Certificate[]{};
- }
- }
- };
- }
-
-}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/application.yml
deleted file mode 100644
index 3702633..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/application.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-spring:
- profiles:
- include: global, database, database-ym, database-pj
-
-#actutor鐨剋eb绔彛
-management:
- server:
- port: ${pipIrr.webchat.actutorPort}
-#web鏈嶅姟绔彛锛�8086
-server:
- port: ${pipIrr.webchat.webPort}
- servlet:
- context-path: /webchat #webchat璁块棶涓婁笅鏂囪矾寰�
- context-parameters:
- #GenerateIdSetSuffixListener涓簲鐢紝鍙栧�艰寖鍥存槸0-99
- idSuffix: ${pipIrr.webchat.idSuffix}
- #ConfigListener涓簲鐢�
- #configFileNames: config-global.xml,config-demo.xml
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/log4j2.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/log4j2.yml
deleted file mode 100644
index 924901d..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/log4j2.yml
+++ /dev/null
@@ -1,73 +0,0 @@
-Configuration:
- #status锛岃繖涓敤浜庤缃甽og4j2鑷韩鍐呴儴鐨勪俊鎭緭鍑猴紝鍙互涓嶈缃紝褰撹缃垚trace鏃讹紝浣犱細鐪嬪埌log4j2鍐呴儴鍚勭璇︾粏杈撳嚭锛涘彲浠ヨ缃垚Off(鍏抽棴)鎴朎rror(鍙緭鍑洪敊璇俊鎭�)
- status: Error
-
- Properties: # 瀹氫箟鍏ㄥ眬鍙橀噺
- Property:
- #鏃ュ織鏂囦欢瀛樺偍鐨勭洰褰�
- - name: log.path
- value: ./logs
- #鏃ュ織鏂囦欢瀛樺偍鍚嶇О
- - name: project.name
- value: pipIrrBase
-
- #瀹氫箟杈撳嚭鍣紝鍙互杈撳嚭鍒版帶鍒跺彴鍜屾枃浠�.
- Appenders:
- #杈撳嚭鍒版帶鍒跺彴
- Console:
- #Appender鍛藉悕
- name: CONSOLE
- target: SYSTEM_OUT
- ThresholdFilter:
- level: debug #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭
- onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭
- onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑�
- #鏃ュ織鍐呭鏍峰紡
- PatternLayout:
- #%n-鎹㈣
- #%m-鏃ュ織鍐呭锛岃緭鍑轰唬鐮佷腑鎸囧畾鐨勬棩蹇椾俊鎭�
- #%p-杈撳嚭浼樺厛绾э紝鍗矰EBUG,INFO,WARN,ERROR,FATAL
- #%r-绋嬪簭鍚姩鍒扮幇鍦ㄧ殑姣鏁�
- #%%- 杈撳嚭涓�涓�"%" 瀛楃
- #%t-褰撳墠绾跨▼鍚�
- #%d-鏃ユ湡鍜屾椂闂�, 甯哥敤鐨勬牸寮忔湁%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS}
- #%l-鍚�%F%L%C%M
- #%F-java婧愭枃浠跺悕
- #%L-java婧愮爜琛屾暟
- #%C-java绫诲悕,%C{1}杈撳嚭鏈�鍚庝竴涓厓绱�
- #%M-java鏂规硶鍚�
- pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n"
- # 杈撳嚭鍒版枃浠讹紝瓒呰繃10MB褰掓。
- RollingFile:
- - name: ROLLING_FILE
- ignoreExceptions: false
- fileName: ${log.path}/${project.name}.log
- filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz"
- ThresholdFilter:
- level: error #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭
- onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭
- onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑�
- #鏃ュ織鍐呭鏍峰紡
- PatternLayout:
- pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n"
- Policies:
- SizeBasedTriggeringPolicy:
- size: "10 MB"
- DefaultRolloverStrategy:
- max: 1000
-
- Loggers:
- Root:
- level: info #鏃ュ織杈撳嚭绾у埆锛屽叡鏈�8涓骇鍒紝鎸夌収浠庝綆鍒伴珮涓猴細all < trace < debug < info < warn < error < fatal < off
- AppenderRef: #Root鐨勫瓙鑺傜偣锛岀敤鏉ユ寚瀹氳鏃ュ織杈撳嚭鍒板摢涓狝ppender.
- - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭
- - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭
- # 涓哄寘閰嶇疆鐗规畩鐨凩og绾у埆锛屾柟渚胯皟璇曪紝
- # 涓嶅彈Loggers.Root.level闄愬埗
- Logger:
- - name: com.dy.pipIrrGlobal.daoSe
- additivity: false #鍘婚櫎閲嶅鐨刲og
- level: debug #杈撳嚭鏃ュ織绾у埆
- AppenderRef:
- - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭
- - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/test/java/com/dy/pipirrWebChat/PipIrrWebWebchatApplicationTests.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/test/java/com/dy/pipirrWebChat/PipIrrWebWebchatApplicationTests.java
deleted file mode 100644
index e9dfe9d..0000000
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/test/java/com/dy/pipirrWebChat/PipIrrWebWebchatApplicationTests.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.dy.pipirrWebChat;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class PipIrrWebWebchatApplicationTests {
-
- @Test
- void contextLoads() {
- }
-
-}
diff --git a/pipIrr-platform/pipIrr-web/pom.xml b/pipIrr-platform/pipIrr-web/pom.xml
index 2562ee2..06ace49 100644
--- a/pipIrr-platform/pipIrr-web/pom.xml
+++ b/pipIrr-platform/pipIrr-web/pom.xml
@@ -26,7 +26,6 @@
<module>pipIrr-web-gis</module>
<module>pipIrr-web-sell</module>
<module>pipIrr-web-project</module>
- <module>pipIrr-web-webchat</module>
</modules>
<dependencies>
--
Gitblit v1.8.0