TRX il y a 1 an
Parent
commit
621e4eea6b
19 fichiers modifiés avec 100 ajouts et 320 suppressions
  1. 0 41
      PaymentClient/src/main/java/com/zhongshu/payment/client/ret/CommentException.java
  2. 0 99
      PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultContent.java
  3. 0 33
      PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultException.java
  4. 0 11
      PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultMessage.java
  5. 0 39
      PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultState.java
  6. 3 2
      PaymentClient/src/main/java/com/zhongshu/payment/client/service/WalletFeignService.java
  7. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/controller/RechargeController.java
  8. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/controller/test/TestController.java
  9. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/controller/wxPaymentV3/WechatPayV3Controller.java
  10. 5 5
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/RechargeService.java
  11. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/TradeManageService.java
  12. 49 47
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/TransferService.java
  13. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/impl/WalletFeignServiceImpl.java
  14. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/pay/SuperPayService.java
  15. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/pay/impl/WeChatPayService.java
  16. 2 3
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/wallet/WalletService.java
  17. 3 3
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/wxPaymentV3/WxPayNotifyService.java
  18. 29 28
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/wxPaymentV3/WxPaymentService.java
  19. 2 2
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/utils/wx/WechatCUtil.java

+ 0 - 41
PaymentClient/src/main/java/com/zhongshu/payment/client/ret/CommentException.java

@@ -1,41 +0,0 @@
-package com.zhongshu.payment.client.ret;
-
-/**
- * @Author: wy
- * @Date: 2023/6/6 16:43
- */
-public class CommentException extends RuntimeException {
-
-    private ResultState resultState;
-
-    private String message;
-
-    /**
-     * 参数校验异常构造方法
-     */
-    public CommentException(String message) {
-        this.message = message;
-    }
-
-    public CommentException(ResultState resultState, String message) {
-        this.resultState = resultState;
-        this.message = message;
-    }
-
-    @Override
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-
-    public ResultState getResultState() {
-        return resultState;
-    }
-
-    public void setResultState(ResultState resultState) {
-        this.resultState = resultState;
-    }
-}

+ 0 - 99
PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultContent.java

@@ -1,99 +0,0 @@
-package com.zhongshu.payment.client.ret;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import lombok.*;
-
-import java.util.Optional;
-
-/**
- * 结果
- *
- * @param <T>
- */
-@Builder
-@ToString(callSuper = true)
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@AllArgsConstructor
-@NoArgsConstructor
-public class ResultContent<T> {
-
-    //内容
-    @Getter
-    @Setter
-    private T content;
-
-    //状态
-    @Getter
-    @Setter
-    private ResultState state;
-
-    //文本
-    @Getter
-    @Setter
-    private String msg;
-
-    public String getMsg() {
-        if (msg != null) {
-            return msg;
-        }
-        if (state != null) {
-            return state.getRemark();
-        }
-        return "";
-    }
-
-    //异常
-    @Getter
-    @Setter
-    private ResultException exception;
-
-
-    /**
-     * 获取内容
-     *
-     * @return
-     */
-    public Optional<T> optionalContent() {
-        return Optional.ofNullable(this.content);
-    }
-
-    public static <T> ResultContent build(ResultState state, T content) {
-        return ResultContent.builder().state(state).content(content).msg(state.getRemark()).build();
-    }
-
-    public static <T> ResultContent build(boolean bool) {
-        return build(bool ? ResultState.Success : ResultState.Fail, null);
-    }
-
-    public static <T> ResultContent build(ResultState state) {
-        return build(state, null);
-    }
-
-    public static <T> ResultContent buildContent(T content) {
-        return build(content == null ? ResultState.Fail : ResultState.Success, content);
-    }
-
-    public static <T> ResultContent buildFail(String msg) {
-        return ResultContent.builder().state(ResultState.Fail).msg(msg).build();
-    }
-
-    public static <T> ResultContent buildSuccess(String msg) {
-        return build(ResultState.Success, msg);
-    }
-
-    public static <T> ResultContent buildSuccess(T content) {
-        return build(ResultState.Success, content);
-    }
-
-    public static <T> ResultContent buildSuccess() {
-        return build(ResultState.Success, ResultState.Success.getRemark());
-    }
-
-    public boolean isSuccess() {
-        return ResultState.Success.equals(this.state);
-    }
-
-    public boolean isFailed() {
-        return !ResultState.Success.equals(this.state);
-    }
-}

+ 0 - 33
PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultException.java

@@ -1,33 +0,0 @@
-package com.zhongshu.payment.client.ret;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * 结果集异常
- */
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class ResultException {
-
-    private String type;
-    private String cls;
-    private String message;
-
-
-    /**
-     * 创建异常对象
-     *
-     * @param e
-     * @return
-     */
-    public static ResultException build(Exception e) {
-        ResultException exception = new ResultException();
-        exception.type = e.getClass().getSimpleName();
-        exception.cls = e.getClass().getName();
-        exception.message = e.getMessage();
-        return exception;
-    }
-}

+ 0 - 11
PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultMessage.java

@@ -1,11 +0,0 @@
-package com.zhongshu.payment.client.ret;
-
-/**
- * @author TRX
- * @date 2024/5/31
- */
-public class ResultMessage {
-    public static final String DATA_NOT_EXIST = "数据不存在:%s";
-
-    public static final String NAME_EXIST = "名称已存在:%s";
-}

+ 0 - 39
PaymentClient/src/main/java/com/zhongshu/payment/client/ret/ResultState.java

@@ -1,39 +0,0 @@
-package com.zhongshu.payment.client.ret;
-
-import lombok.Getter;
-
-/**
- * 结果状态模板
- */
-public enum ResultState {
-
-    Success("成功"),
-    Fail("失败"),
-    Error("错误"),
-    Exception("异常"),
-    Robot("机器验证"),
-
-    UserExit("用户存在"),
-    UserNotExit("用户不存在"),
-    UserOrPassWordError("用户名或密码错误"),
-
-    NOT_TOKEN_ERROR("token获取失败"),
-    NOT_AUTH_ERROR("需要授权"),
-    EXPIRE_ERROR( "token已过期"),
-    INVALID_TOKEN("无效token"),
-    LOGIN_REQUIRED("需要登录"),
-    CODE_ERROR("验证码错误"),
-
-    AccountNotNull("账户不能为空"),
-    AccountExists("用户存在"),
-    AccountNotExists("账户不存在"),
-    NOT_WECHAT_AUTH("用户微信未授权"),
-    ;
-
-    @Getter
-    private String remark;
-
-    ResultState(String remark) {
-        this.remark = remark;
-    }
-}

+ 3 - 2
PaymentClient/src/main/java/com/zhongshu/payment/client/service/WalletFeignService.java

@@ -1,8 +1,8 @@
 package com.zhongshu.payment.client.service;
 
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.client.model.WalletModel;
 import com.zhongshu.payment.client.model.param.AmountUpdateParam;
-import com.zhongshu.payment.client.ret.ResultContent;
 import com.zhongshu.payment.client.types.WalletType;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.http.MediaType;
@@ -20,7 +20,8 @@ public interface WalletFeignService {
 
     /** 获取钱包信息 */
     @RequestMapping(value = "getWallet", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
-    ResultContent<WalletModel> getWallet(@RequestParam("oid") String oid, @RequestParam("walletType") WalletType walletType, @RequestParam("shopId") String shopId, @RequestParam ("userId")String userId);
+    ResultContent<WalletModel> getWallet(@RequestParam("oid") String oid, @RequestParam("walletType") WalletType walletType, @RequestParam("shopId") String shopId,
+            @RequestParam ("userId")String userId);
 
     /** 充值 */
     @RequestMapping(value = "recharge", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/controller/RechargeController.java

@@ -3,7 +3,7 @@ package com.zhongshu.payment.server.core.controller;
 import com.zhongshu.payment.client.model.param.OrderParam;
 import com.zhongshu.payment.client.model.param.QueryWalletParam;
 import com.zhongshu.payment.client.model.param.RechargeParam;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.server.core.service.RechargeService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/controller/test/TestController.java

@@ -1,6 +1,6 @@
 package com.zhongshu.payment.server.core.controller.test;
 
-import com.zhongshu.card.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.card.client.service.ProjectPaySettingFeignService;
 import com.zhongshu.payment.server.core.dao.RechargeRecordDao;
 import io.swagger.v3.oas.annotations.Operation;

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/controller/wxPaymentV3/WechatPayV3Controller.java

@@ -2,7 +2,7 @@ package com.zhongshu.payment.server.core.controller.wxPaymentV3;
 
 import com.zhongshu.card.client.model.feign.ProjectWxPayParam;
 import com.zhongshu.card.client.model.payment.paySetting.WxPayConfigModel;
-import com.zhongshu.card.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.card.client.service.ProjectPaySettingFeignService;
 import com.zhongshu.payment.server.core.dataConfig.WxV3PayConfig;
 import com.zhongshu.payment.server.core.service.wxPaymentV3.WxPaymentService;

+ 5 - 5
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/RechargeService.java

@@ -17,7 +17,7 @@ import com.zhongshu.payment.client.model.PrePayModel;
 import com.zhongshu.payment.client.model.RechargeRecordModel;
 import com.zhongshu.payment.client.model.param.OrderParam;
 import com.zhongshu.payment.client.model.param.RechargeParam;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.client.types.*;
 import com.zhongshu.payment.server.core.dao.RechargeRecordDao;
 import com.zhongshu.payment.server.core.dao.WalletDao;
@@ -120,7 +120,7 @@ public class RechargeService {
         OrgUserDetailParam orgUserDetailParam = new OrgUserDetailParam();
         orgUserDetailParam.setOid(param.getSchoolId());
         orgUserDetailParam.setUserId(userWallet.getUserId());
-        com.zhongshu.card.client.ret.ResultContent<OrganizationUserModel> orgUserDetail = organizationFeignService.getOrgUserDetail(orgUserDetailParam);
+        ResultContent<OrganizationUserModel> orgUserDetail = organizationFeignService.getOrgUserDetail(orgUserDetailParam);
         if (orgUserDetail.isFailed()) {
             return ResultContent.buildFail("获取用户信息失败");
         }
@@ -176,7 +176,7 @@ public class RechargeService {
         // 根据appId 得到微信支付配置
         ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
         wxPayParam.setAppId(record.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
+        ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
         if (paySetResult.isFailed()) {
             return ResultContent.buildFail("获取微信支付配置失败");
         }
@@ -220,7 +220,7 @@ public class RechargeService {
 
         ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
         wxPayParam.setAppId(record.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
+        ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
         if (paySetResult.isFailed()) {
             return ResultContent.buildFail("获取微信支付配置失败");
         }
@@ -249,7 +249,7 @@ public class RechargeService {
 
         ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
         wxPayParam.setAppId(record.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
+        ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
         if (paySetResult.isFailed()) {
             return ResultContent.buildFail("获取微信支付配置失败");
         }

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/TradeManageService.java

@@ -4,7 +4,7 @@ import com.github.microservice.components.data.base.util.PageEntityUtil;
 import com.zhongshu.payment.client.model.RechargeRecordModel;
 import com.zhongshu.payment.client.model.WalletModel;
 import com.zhongshu.payment.client.model.param.RecordSearchParam;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.server.core.dao.RechargeRecordDao;
 import com.zhongshu.payment.server.core.domain.wallet.RechargeRecord;
 import com.zhongshu.payment.server.core.domain.wallet.Wallet;

+ 49 - 47
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/TransferService.java

@@ -13,7 +13,7 @@ import com.zhongshu.payment.client.model.TransferModel;
 import com.zhongshu.payment.client.model.param.AmountUpdateParam;
 import com.zhongshu.payment.client.model.param.ExamineParam;
 import com.zhongshu.payment.client.model.param.RechargeParam;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.client.types.DataState;
 import com.zhongshu.payment.client.types.RechargeState;
 import com.zhongshu.payment.client.types.TradeType;
@@ -36,6 +36,7 @@ import java.util.List;
 
 /**
  * 提现
+ *
  * @author wjf
  * @date 2024/7/29
  */
@@ -64,27 +65,27 @@ public class TransferService {
     OrganizationFeignService organizationFeignService;
 
     @Transactional
-    public Object transfer(RechargeParam param){
+    public Object transfer(RechargeParam param) {
         String userId = authHelper.getCurrentUser().getUserId();
         Wallet userWallet = walletDao.findTop1ById(param.getWalletId());
         //判断钱包是否初始化
-        if (userWallet==null){
+        if (userWallet == null) {
             return ResultContent.buildFail("用户钱包未开通");
         }
 
-        if (userWallet.getDataState().equals(DataState.Disable)){
+        if (userWallet.getDataState().equals(DataState.Disable)) {
             return ResultContent.buildFail("钱包已停用");
         }
 
-        if (userWallet.getWalletType().equals(WalletType.Shop)){
+        if (userWallet.getWalletType().equals(WalletType.Shop)) {
             return ResultContent.buildFail("商户提现暂未开通线上提现功能");
         }
 
         //判断微信支付配置
         ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
         wxPayParam.setAppId(param.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
-        if (paySetResult.isFailed()){
+        ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
+        if (paySetResult.isFailed()) {
             return ResultContent.buildFail("获取微信支付配置失败");
         }
 
@@ -92,8 +93,8 @@ public class TransferService {
         OrgUserDetailParam orgUserDetailParam = new OrgUserDetailParam();
         orgUserDetailParam.setOid(param.getSchoolId());
         orgUserDetailParam.setUserId(userWallet.getUserId());
-        com.zhongshu.card.client.ret.ResultContent<OrganizationUserModel> orgUserDetail = organizationFeignService.getOrgUserDetail(orgUserDetailParam);
-        if (orgUserDetail.isFailed()){
+        ResultContent<OrganizationUserModel> orgUserDetail = organizationFeignService.getOrgUserDetail(orgUserDetailParam);
+        if (orgUserDetail.isFailed()) {
             return ResultContent.buildFail("获取用户信息失败");
         }
 
@@ -125,11 +126,11 @@ public class TransferService {
         transferDetailInput.setOutDetailNo(rechargeRecord.getOutTradeNo());
         transferDetailInput.setTransferAmount(rechargeRecord.getTotal().longValue());
         transferDetailInput.setTransferRemark("余额提现");
-        if(rechargeRecord.getTotal().compareTo(BigDecimal.valueOf(2000L))>=0){
+        if (rechargeRecord.getTotal().compareTo(BigDecimal.valueOf(2000L)) >= 0) {
             //todo 获取用户信息
             transferDetailInput.setUserName("用户名");
         }
-        if (rechargeRecord.getTotal().compareTo(BigDecimal.valueOf(0.3))<0){
+        if (rechargeRecord.getTotal().compareTo(BigDecimal.valueOf(0.3)) < 0) {
             transferDetailInput.setUserName(null);
         }
         request.setTransferDetailList(List.of(transferDetailInput));
@@ -140,16 +141,16 @@ public class TransferService {
         TransferModel transferModel = new TransferModel();
         BeanUtils.copyProperties(initiateBatchTransferResponse, transferModel);
         rechargeRecord.setTransferModel(transferModel);
-        if (initiateBatchTransferResponse.getBatchStatus().equals("ACCEPTED")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("ACCEPTED")) {
             rechargeRecord.setRechargeState(RechargeState.Taking);
         }
-        if (initiateBatchTransferResponse.getBatchStatus().equals("PROCESSING")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("PROCESSING")) {
             rechargeRecord.setRechargeState(RechargeState.Taking);
         }
-        if (initiateBatchTransferResponse.getBatchStatus().equals("FINISHED")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("FINISHED")) {
             rechargeRecord.setRechargeState(RechargeState.TakeSuccess);
         }
-        if (initiateBatchTransferResponse.getBatchStatus().equals("CLOSED")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("CLOSED")) {
             rechargeRecord.setRechargeState(RechargeState.CLOSED);
             return ResultContent.buildFail("该订单已关闭");
         }
@@ -166,21 +167,23 @@ public class TransferService {
         return ResultContent.buildSuccess(toModel(record));
     }
 
-    /** 发起提现 */
+    /**
+     * 发起提现
+     */
     @Transactional
-    public Object create(RechargeParam param){
+    public Object create(RechargeParam param) {
         String userId = authHelper.getCurrentUser().getUserId();
         Wallet userWallet = walletDao.findTop1ById(param.getWalletId());
         //判断钱包是否初始化
-        if (userWallet==null){
+        if (userWallet == null) {
             return ResultContent.buildFail("用户钱包未开通");
         }
 
         //判断微信支付配置
         ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
         wxPayParam.setAppId(param.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
-        if (paySetResult.isFailed()){
+        ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
+        if (paySetResult.isFailed()) {
             return ResultContent.buildFail("获取微信支付配置失败");
         }
 
@@ -188,8 +191,8 @@ public class TransferService {
         OrgUserDetailParam orgUserDetailParam = new OrgUserDetailParam();
         orgUserDetailParam.setOid(userWallet.getOid());
         orgUserDetailParam.setUserId(userWallet.getUserId());
-        com.zhongshu.card.client.ret.ResultContent<OrganizationUserModel> orgUserDetail = organizationFeignService.getOrgUserDetail(orgUserDetailParam);
-        if (orgUserDetail.isFailed()){
+        ResultContent<OrganizationUserModel> orgUserDetail = organizationFeignService.getOrgUserDetail(orgUserDetailParam);
+        if (orgUserDetail.isFailed()) {
             return ResultContent.buildFail("获取用户信息失败");
         }
 
@@ -220,22 +223,22 @@ public class TransferService {
     }
 
     @Transactional
-    public Object passTransfer(ExamineParam param){
+    public Object passTransfer(ExamineParam param) {
         RechargeRecord record = rechargeRecordDao.findByOutTradeNo(param.getOutTradeNo());
-        if (record==null){
-            return ResultContent.buildFail("充值订单:"+param.getOutTradeNo()+"不存在");
+        if (record == null) {
+            return ResultContent.buildFail("充值订单:" + param.getOutTradeNo() + "不存在");
         }
         Wallet userWallet = walletDao.findTop1ById(record.getWallet().getId());
 
         //判断微信支付配置
         ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
         wxPayParam.setAppId(record.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
-        if (paySetResult.isFailed()){
+        ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
+        if (paySetResult.isFailed()) {
             return ResultContent.buildFail("获取微信支付配置失败");
         }
 
-        if (StringUtil.isNullOrEmpty(param.getRemark())){
+        if (StringUtil.isNullOrEmpty(param.getRemark())) {
             param.setRemark("余额提现");
         }
 
@@ -252,11 +255,11 @@ public class TransferService {
         transferDetailInput.setOutDetailNo(record.getOutTradeNo());
         transferDetailInput.setTransferAmount(record.getTotal().longValue());
         transferDetailInput.setTransferRemark(param.getRemark());
-        if(record.getTotal().compareTo(BigDecimal.valueOf(2000L))>=0){
+        if (record.getTotal().compareTo(BigDecimal.valueOf(2000L)) >= 0) {
             //获取用户信息
             transferDetailInput.setUserName("用户名");
         }
-        if (record.getTotal().compareTo(BigDecimal.valueOf(0.3))<0){
+        if (record.getTotal().compareTo(BigDecimal.valueOf(0.3)) < 0) {
             transferDetailInput.setUserName(null);
         }
         request.setTransferDetailList(List.of(transferDetailInput));
@@ -267,16 +270,16 @@ public class TransferService {
         TransferModel transferModel = new TransferModel();
         BeanUtils.copyProperties(initiateBatchTransferResponse, transferModel);
         record.setTransferModel(transferModel);
-        if (initiateBatchTransferResponse.getBatchStatus().equals("ACCEPTED")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("ACCEPTED")) {
 //            record.setRechargeState(RechargeState.RECHARGING);
         }
-        if (initiateBatchTransferResponse.getBatchStatus().equals("PROCESSING")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("PROCESSING")) {
             record.setRechargeState(RechargeState.Taking);
         }
-        if (initiateBatchTransferResponse.getBatchStatus().equals("FINISHED")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("FINISHED")) {
             record.setRechargeState(RechargeState.TakeSuccess);
         }
-        if (initiateBatchTransferResponse.getBatchStatus().equals("CLOSED")){
+        if (initiateBatchTransferResponse.getBatchStatus().equals("CLOSED")) {
             record.setRechargeState(RechargeState.CLOSED);
         }
         rechargeRecordDao.save(record);
@@ -284,10 +287,10 @@ public class TransferService {
     }
 
     @Transactional
-    public Object refuseTransfer(ExamineParam param){
+    public Object refuseTransfer(ExamineParam param) {
         RechargeRecord record = rechargeRecordDao.findByOutTradeNo(param.getOutTradeNo());
-        if (record==null){
-            return ResultContent.buildFail("充值订单:"+param.getOutTradeNo()+"不存在");
+        if (record == null) {
+            return ResultContent.buildFail("充值订单:" + param.getOutTradeNo() + "不存在");
         }
         record.setRechargeState(RechargeState.TakeRefuse);
         record.setRemark(param.getRemark());
@@ -304,39 +307,38 @@ public class TransferService {
     }
 
 
-
     @Transactional
-    public Object getTransferState(String outTradeNo){
+    public Object getTransferState(String outTradeNo) {
         RechargeRecord record = rechargeRecordDao.findByOutTradeNo(outTradeNo);
 
         ProjectWxPayParam param = new ProjectWxPayParam();
         param.setAppId(record.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> configResult = paySettingFeignService.getProjectWxPayConfig(param);
-        if (configResult.isFailed()){
+        ResultContent<WxPayConfigModel> configResult = paySettingFeignService.getProjectWxPayConfig(param);
+        if (configResult.isFailed()) {
             return ResultContent.buildFail("获取微信支付配置失败");
         }
         GetTransferDetailByOutNoRequest request = new GetTransferDetailByOutNoRequest();
         request.setOutBatchNo(record.getId());
         request.setOutDetailNo(record.getOutTradeNo());
         TransferDetailEntity transferDetailByOutNo = wxTransferBatchService.getTransferDetailByOutNo(request, configResult.getContent());
-        if (transferDetailByOutNo.getDetailStatus().equals("INIT")){
+        if (transferDetailByOutNo.getDetailStatus().equals("INIT")) {
             record.setRechargeState(RechargeState.Taking);
             record.setRechargeStateDesc("系统转账校验中");
         }
-        if (transferDetailByOutNo.getDetailStatus().equals("WAIT_PAY")){
+        if (transferDetailByOutNo.getDetailStatus().equals("WAIT_PAY")) {
             record.setRechargeState(RechargeState.Taking);
             record.setRechargeStateDesc("待商户确认");
         }
 
-        if (transferDetailByOutNo.getDetailStatus().equals("PROCESSING")){
+        if (transferDetailByOutNo.getDetailStatus().equals("PROCESSING")) {
             record.setRechargeState(RechargeState.Taking);
             record.setRechargeStateDesc("正在处理中");
         }
-        if (transferDetailByOutNo.getDetailStatus().equals("SUCCESS")){
+        if (transferDetailByOutNo.getDetailStatus().equals("SUCCESS")) {
             record.setRechargeState(RechargeState.TakeSuccess);
             record.setRechargeStateDesc("提现成功");
         }
-        if (transferDetailByOutNo.getDetailStatus().equals("FAIL")){
+        if (transferDetailByOutNo.getDetailStatus().equals("FAIL")) {
             record.setRechargeState(RechargeState.TakeFail);
             record.setRechargeStateDesc(transferDetailByOutNo.getFailReason().name());
             AmountUpdateParam amountUpdateParam = new AmountUpdateParam();
@@ -353,7 +355,7 @@ public class TransferService {
 
     private RechargeRecordModel toModel(RechargeRecord record) {
         RechargeRecordModel model = new RechargeRecordModel();
-        if (record!=null){
+        if (record != null) {
             org.springframework.beans.BeanUtils.copyProperties(record, model, "total");
             model.setTotal(record.getTotal().intValue());
             model.setUserInfo(record.getUserInfo());

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/impl/WalletFeignServiceImpl.java

@@ -2,7 +2,7 @@ package com.zhongshu.payment.server.core.service.impl;
 
 import com.zhongshu.payment.client.model.WalletModel;
 import com.zhongshu.payment.client.model.param.AmountUpdateParam;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.client.service.WalletFeignService;
 import com.zhongshu.payment.client.types.DataState;
 import com.zhongshu.payment.client.types.TradeType;

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/pay/SuperPayService.java

@@ -3,7 +3,7 @@ package com.zhongshu.payment.server.core.service.pay;
 import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
 import com.zhongshu.card.client.model.payment.paySetting.WxPayConfigModel;
 import com.zhongshu.payment.client.model.PrePayModel;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 
 /**
  * @author TRX

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/pay/impl/WeChatPayService.java

@@ -11,7 +11,7 @@ import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
 import com.wechat.pay.java.service.payments.jsapi.model.PrepayResponse;
 import com.zhongshu.card.client.model.payment.paySetting.WxPayConfigModel;
 import com.zhongshu.payment.client.model.PrePayModel;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.server.core.service.pay.SuperPayService;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;

+ 2 - 3
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/wallet/WalletService.java

@@ -2,6 +2,7 @@ package com.zhongshu.payment.server.core.service.wallet;
 
 import ch.qos.logback.core.util.StringUtil;
 import com.github.microservice.auth.security.helper.AuthHelper;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.card.client.model.feign.ProjectWxPayParam;
 import com.zhongshu.card.client.model.payment.paySetting.WxPayConfigModel;
 import com.zhongshu.card.client.service.OrganizationFeignService;
@@ -9,8 +10,6 @@ import com.zhongshu.card.client.service.ProjectPaySettingFeignService;
 import com.zhongshu.payment.client.model.WalletModel;
 import com.zhongshu.payment.client.model.WalletOrderModel;
 import com.zhongshu.payment.client.model.param.GetWalletParam;
-import com.zhongshu.payment.client.ret.ResultContent;
-import com.zhongshu.payment.client.types.DataState;
 import com.zhongshu.payment.client.types.WalletState;
 import com.zhongshu.payment.client.types.WalletType;
 import com.zhongshu.payment.server.core.dao.RechargeRecordDao;
@@ -68,7 +67,7 @@ public class WalletService {
 
         ProjectWxPayParam projectWxPayParam = new ProjectWxPayParam();
         projectWxPayParam.setAppId(param.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> payConfigResult = paySettingFeignService.getProjectWxPayConfig(projectWxPayParam);
+        ResultContent<WxPayConfigModel> payConfigResult = paySettingFeignService.getProjectWxPayConfig(projectWxPayParam);
         if (payConfigResult.isFailed()) {
             return ResultContent.buildFail("获取支付配置信息失败");
         }

+ 3 - 3
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/wxPaymentV3/WxPayNotifyService.java

@@ -12,7 +12,7 @@ import com.zhongshu.card.client.model.payment.paySetting.WxPayConfigModel;
 import com.zhongshu.card.client.service.MqttFeignService;
 import com.zhongshu.card.client.service.ProjectPaySettingFeignService;
 import com.zhongshu.payment.client.model.param.AmountUpdateParam;
-import com.zhongshu.payment.client.ret.ResultContent;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.client.types.RechargeState;
 import com.zhongshu.payment.server.core.dao.RechargeRecordDao;
 import com.zhongshu.payment.server.core.domain.wallet.RechargeRecord;
@@ -48,7 +48,7 @@ public class WxPayNotifyService {
 
     @Autowired
     MqttFeignService mqttFeignService;
-    
+
     @Autowired
     ProjectPaySettingFeignService paySettingFeignService;
 
@@ -146,7 +146,7 @@ public class WxPayNotifyService {
         RechargeRecord recordByOutTradeNo = rechargeRecordDao.findByOutTradeNo(outTradeNo);
         ProjectWxPayParam wxPayParam = new ProjectWxPayParam();
         wxPayParam.setAppId(recordByOutTradeNo.getAppid());
-        com.zhongshu.card.client.ret.ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
+        ResultContent<WxPayConfigModel> paySetResult = paySettingFeignService.getProjectWxPayConfig(wxPayParam);
         if (paySetResult.isFailed()){
             log.error("获取微信支付配置失败 \"outTradeNo\": {}", outTradeNo);
         }

+ 29 - 28
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/wxPaymentV3/WxPaymentService.java

@@ -11,8 +11,8 @@ import com.wechat.pay.java.service.payments.jsapi.model.*;
 import com.wechat.pay.java.service.payments.model.Transaction;
 import com.zhongshu.card.client.model.payment.paySetting.WxPayConfigModel;
 import com.zhongshu.card.client.model.wechat.MiniAppUserInfoVo;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.client.model.PrePayModel;
-import com.zhongshu.payment.client.ret.ResultContent;
 import com.zhongshu.payment.server.core.service.base.SuperService;
 import com.zhongshu.payment.server.core.utils.wx.WechatCUtil;
 import io.netty.util.internal.StringUtil;
@@ -41,7 +41,7 @@ public class WxPaymentService extends SuperService {
     public static com.wechat.pay.java.service.payments.jsapi.JsapiService service;
 
     // 初始化商户配置
-    public static Config RSAAutoCertificateConfig(String mchId, String privateKeyPath, String mchSerialNo, String apiV3Key){
+    public static Config RSAAutoCertificateConfig(String mchId, String privateKeyPath, String mchSerialNo, String apiV3Key) {
         return new RSAAutoCertificateConfig.Builder()
                 .merchantId(mchId)
                 // 使用 com.wechat.pay.java.core.util 中的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
@@ -52,9 +52,9 @@ public class WxPaymentService extends SuperService {
     }
 
     @SneakyThrows
-    public Object getOpenid(String jscode){
+    public Object getOpenid(String jscode) {
         MiniAppUserInfoVo miniAppUserInfo = wechatCUtil.getMiniAppUserInfo(jscode);
-        if (miniAppUserInfo==null || StringUtil.isNullOrEmpty(miniAppUserInfo.getOpenid())){
+        if (miniAppUserInfo == null || StringUtil.isNullOrEmpty(miniAppUserInfo.getOpenid())) {
             log.info("无法获取用户信息");
             return ResultContent.buildFail("无法获取用户信息");
         }
@@ -63,9 +63,9 @@ public class WxPaymentService extends SuperService {
     }
 
     @SneakyThrows
-    public String getOpenId(String jscode){
+    public String getOpenId(String jscode) {
         MiniAppUserInfoVo miniAppUserInfo = wechatCUtil.getMiniAppUserInfo(jscode);
-        if (miniAppUserInfo==null || StringUtil.isNullOrEmpty(miniAppUserInfo.getOpenid())){
+        if (miniAppUserInfo == null || StringUtil.isNullOrEmpty(miniAppUserInfo.getOpenid())) {
             log.info("无法获取用户信息");
             return null;
         }
@@ -128,16 +128,17 @@ public class WxPaymentService extends SuperService {
 //        }
 //    }
 
-    /** @Author wjf
+    /**
+     * @return
+     * @Author wjf
      * @Description //TODO 预支付下单
      * @Date 2024/7/24
      * @Param
-     * @return
-    **/
-    public ResultContent<PrePayModel> prepay(PrepayRequest request, WxPayConfigModel configModel){
+     **/
+    public ResultContent<PrePayModel> prepay(PrepayRequest request, WxPayConfigModel configModel) {
 
         String privateKeyPath = configModel.getPrivateKeyPath();
-        if (configModel.getPrivateKeyType().equals("local")){
+        if (configModel.getPrivateKeyType().equals("local")) {
             privateKeyPath = Thread.currentThread().getContextClassLoader().getResource("").getPath() + configModel.getPrivateKeyPath();
         }
 
@@ -184,15 +185,16 @@ public class WxPaymentService extends SuperService {
         }
     }
 
-    /** @Author wjf
+    /**
+     * @return
+     * @Author wjf
      * @Description //TODO 关闭订单
      * @Date 2024/7/24
      * @Param 商户订单号 outTradeNo
-     * @return
-    **/
-    public ResultContent closeOrder(String outTradeNo, WxPayConfigModel configModel){
+     **/
+    public ResultContent closeOrder(String outTradeNo, WxPayConfigModel configModel) {
         String privateKeyPath = configModel.getPrivateKeyPath();
-        if (configModel.getPrivateKeyType().equals("local")){
+        if (configModel.getPrivateKeyType().equals("local")) {
             privateKeyPath = Thread.currentThread().getContextClassLoader().getResource("").getPath() + configModel.getPrivateKeyPath();
         }
 
@@ -222,15 +224,16 @@ public class WxPaymentService extends SuperService {
         }
     }
 
-    /** @Author wjf
+    /**
+     * @return
+     * @Author wjf
      * @Description //TODO 商户订单号查询订单
      * @Date 2024/7/24
      * @Param 商户订单号 outTradeNo
-     * @return
      **/
-    public ResultContent<Transaction> queryOrderByOutTradeNo(String outTradeNo, WxPayConfigModel configModel){
+    public ResultContent<Transaction> queryOrderByOutTradeNo(String outTradeNo, WxPayConfigModel configModel) {
         String privateKeyPath = configModel.getPrivateKeyPath();
-        if (configModel.getPrivateKeyType().equals("local")){
+        if (configModel.getPrivateKeyType().equals("local")) {
             privateKeyPath = Thread.currentThread().getContextClassLoader().getResource("").getPath() + configModel.getPrivateKeyPath();
         }
 
@@ -260,15 +263,16 @@ public class WxPaymentService extends SuperService {
         }
     }
 
-    /** @Author wjf
+    /**
+     * @return
+     * @Author wjf
      * @Description //TODO 微信支付订单号查询订单
      * @Date 2024/7/24
      * @Param 商户订单号 outTradeNo
-     * @return
      **/
-    public ResultContent queryOrderById(String transactionId, WxPayConfigModel configModel){
+    public ResultContent queryOrderById(String transactionId, WxPayConfigModel configModel) {
         String privateKeyPath = configModel.getPrivateKeyPath();
-        if (configModel.getPrivateKeyType().equals("local")){
+        if (configModel.getPrivateKeyType().equals("local")) {
             privateKeyPath = Thread.currentThread().getContextClassLoader().getResource("").getPath() + configModel.getPrivateKeyPath();
         }
 
@@ -299,11 +303,8 @@ public class WxPaymentService extends SuperService {
     }
 
 
-
-
-
     @SneakyThrows
-    public String sign(String privateKeyPath, byte[] message){
+    public String sign(String privateKeyPath, byte[] message) {
         Signature sign = Signature.getInstance("SHA256withRSA");
         PrivateKey privateKey = PemUtil.loadPrivateKeyFromPath(privateKeyPath);
         sign.initSign(privateKey);

+ 2 - 2
PaymentServer/src/main/java/com/zhongshu/payment/server/core/utils/wx/WechatCUtil.java

@@ -7,12 +7,12 @@ import com.github.microservice.core.util.net.apache.HttpClientUtil;
 import com.github.microservice.core.util.net.apache.HttpModel;
 import com.github.microservice.core.util.net.apache.MethodType;
 import com.github.microservice.core.util.net.apache.ResponseModel;
+import com.github.microservice.models.ret.ResultState;
 import com.zhongshu.card.client.model.wechat.AccessTokenVo;
 import com.zhongshu.card.client.model.wechat.GenerateSchemeVo;
 import com.zhongshu.card.client.model.wechat.MiniAppUserInfoVo;
 import com.zhongshu.card.client.model.wechat.WechatPhoneNumber;
-import com.zhongshu.card.client.ret.ResultContent;
-import com.zhongshu.card.client.ret.ResultState;
+import com.github.microservice.models.ret.ResultContent;
 import com.zhongshu.payment.server.core.service.base.RedisService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;