wujiefeng hace 1 año
padre
commit
858e99a191

+ 19 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/model/param/GetWalletParam.java

@@ -0,0 +1,19 @@
+package com.zhongshu.payment.client.model.param;
+
+import com.zhongshu.payment.client.types.WalletType;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author wjf
+ * @date 2024/7/29
+ */
+@Data
+public class GetWalletParam {
+
+    @Schema(name = "oid", description = "机构id")
+    private String oid;
+
+    @Schema(name = "walletType", description = "钱包类型:Shop, User")
+    private WalletType walletType;
+}

+ 21 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/model/param/QueryWalletParam.java

@@ -0,0 +1,21 @@
+package com.zhongshu.payment.client.model.param;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author wjf
+ * @date 2024/7/29
+ */
+@Data
+public class QueryWalletParam {
+
+    @Schema(name = "walletId", description = "钱包id")
+    private String walletId;
+
+    @Schema(name = "year", description = "年")
+    private Integer year;
+
+    @Schema(name = "month", description = "月")
+    private Integer month;
+}

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

@@ -1,6 +1,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.server.core.service.RechargeService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -54,13 +55,13 @@ public class RechargeController {
     /** 查询充值订单列表 */
     @Operation(summary = "查询充值订单列表", description = "查询充值订单列表")
     @PostMapping(value = "queryListByWallet")
-    public Object queryListByWallet(@RequestParam("walletId") String walletId, @RequestParam("year") Integer year, @RequestParam("month") Integer month){
-        return rechargeService.queryListByWallet(walletId, year, month);
+    public Object queryListByWallet(@RequestBody QueryWalletParam param){
+        return rechargeService.queryListByWallet(param.getWalletId(), param.getYear(), param.getMonth());
     }
 
     /** 查询充值订单详情 */
     @Operation(summary = "查询充值订单详情", description = "查询充值订单详情")
-    @PostMapping(value = "queryInfoById")
+    @GetMapping(value = "queryInfoById")
     public Object queryInfoById(@RequestParam("outTradeNo") String id){
         return rechargeService.queryInfoById(id);
     }

+ 3 - 3
PaymentServer/src/main/java/com/zhongshu/payment/server/core/controller/WalletController.java

@@ -1,6 +1,6 @@
 package com.zhongshu.payment.server.core.controller;
 
-import com.zhongshu.payment.client.types.WalletType;
+import com.zhongshu.payment.client.model.param.GetWalletParam;
 import com.zhongshu.payment.server.core.service.wallet.WalletService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -31,7 +31,7 @@ public class WalletController {
     /** 获取(开通)当前用户钱包信息 */
     @Operation(summary = "获取(开通)当前用户钱包信息", description = "获取(开通)当前用户钱包信息")
     @PostMapping("getWallet")
-    public Object getWalletByUser(@RequestParam(name = "oid")String oid, @RequestParam(name = "walletType") WalletType walletType){
-        return walletService.getWalletByUser(oid, walletType, null);
+    public Object getWalletByUser(@RequestBody GetWalletParam param){
+        return walletService.getWalletByUser(param.getOid(), param.getWalletType(), null);
     }
 }

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

@@ -109,7 +109,7 @@ public class RechargeService {
         if (record==null){
             return ResultContent.buildFail("充值订单:"+param.getOutTradeNo()+"不存在");
         }
-        Wallet userWallet = walletDao.findByUserIdAndOid(userId, record.getOid());
+        Wallet userWallet = walletDao.findTop1ById(record.getWallet().getId());
         String openId;
         if (StringUtil.notNullNorEmpty(param.getJscode())){
             openId = getOpenId(param.getJscode());
@@ -120,6 +120,9 @@ public class RechargeService {
             return ResultContent.buildFail("获取openid失败");
         }
 
+        userWallet.setOpenid(openId);
+        walletDao.save(userWallet);
+
         //判断微信支付配置
         WxPayConfig config = wxPayConfigDao.findByOid(record.getOid());
         //调用微信支付--下单接口