Browse Source

fix(commercial): 排除已退款的子订单用户

- 在查询课程核销记录时,过滤掉已退款的子订单用户
- 新增逻辑检查订单状态,避免重复处理退款用户
-优化用户体验,确保退款用户不显示在核销列表中
wzq 1 month ago
parent
commit
50e5b2b0ac

+ 18 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/commercial/CommercialController.java

@@ -118,6 +118,24 @@ public class CommercialController {
         }
         List<AppCoursesVerificationRecord> verificationRecords =
                 appCoursesVerificationRecordService.courseQueryUsersList(form.getCoursePriceRulesId(),form.getOrPostpone(), form.getVerifyStatus(),loginUser.getId());
+        //排除已退款的子订单用户
+        List<AppCoursesVerificationRecord> removes = new ArrayList<>();
+        for (AppCoursesVerificationRecord verificationRecord : verificationRecords) {
+            if (ObjectUtil.isNotEmpty(verificationRecord.getOrderId())) {
+                AppOrder appOrder = appOrderService.getById(verificationRecord.getOrderId());
+                //查询退款子订单
+                List<AppOrderProInfo> orderProInfoList = appOrderProInfoService.list(Wrappers.<AppOrderProInfo>lambdaQuery().eq(AppOrderProInfo::getOrderId, appOrder.getId()).in(AppOrderProInfo::getOrderStatus, 5, 6));
+                if (ObjectUtil.isNotEmpty(orderProInfoList)) {
+                    for (AppOrderProInfo orderProInfo : orderProInfoList) {
+                        if (orderProInfo.getFamilyUserId().equals(verificationRecord.getUseUserId())) {
+                            removes.add(verificationRecord);
+                        }
+                    }
+                }
+            }
+        }
+        verificationRecords.removeAll(removes);
+
         List<AppCoursesVerificationRecord> temporaryCourseList =
                 appCoursesVerificationRecordService.queryTemporaryCourseUser(form.getCoursePriceRulesId(),form.getOrPostpone(),form.getVerifyStatus(),loginUser.getId());
         verificationRecords.addAll(temporaryCourseList);