Browse Source

fix(pay):修复微信分账逻辑中对预分账金额的判断

- 在分账接收方匹配逻辑中增加对预分账金额不为0的判断
- 调整JSON转换代码格式,提升可读性
wangzq 3 weeks ago
parent
commit
8160ca4cc4

+ 3 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/pay/config/WeChatProfitSharingService.java

@@ -381,13 +381,14 @@ public class WeChatProfitSharingService {
                     Type receiverListType = new TypeToken<List<WechatReceiver>>() {}.getType();
                     // 转换
                     List<WechatReceiver> wechatReceivers = gson.fromJson(
-                            gson.toJson(res.get("receivers")), // 将receivers转为JSON字符串
+                            // 将receivers转为JSON字符串
+                            gson.toJson(res.get("receivers")),
                             receiverListType
                     );
                     for (WechatReceiver wechatReceiver : wechatReceivers) {
                         //关联订单分账详情
                         for (AppProfitSharingInfo appProfitSharingInfo : appProfitSharingInfos) {
-                            if (Objects.equals(wechatReceiver.getAccount(), appProfitSharingInfo.getMchId())) {
+                            if (Objects.equals(wechatReceiver.getAccount(), appProfitSharingInfo.getMchId()) && appProfitSharingInfo.getPreAmount() != 0) {
                                 appProfitSharingInfo.setProfitSharingRecordsId(appProfitSharingRecords.getId());
                                 appProfitSharingInfo.setAmount(wechatReceiver.getAmount());
                                 appProfitSharingInfo.setStatus(wechatReceiver.getResult());