Browse Source

fix(order): 调整课程订单退款逻辑与券使用记录更新

- 注释掉课程开始时间判断退款逻辑,改为仅记录日志
- 更新券使用记录时增加图片与使用时间字段
-保持订单状态变更与券状态更新的一致性
wzq 1 month ago
parent
commit
fd0f59f982

+ 8 - 8
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java

@@ -2229,14 +2229,14 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
             if (Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_2)) {
                 throw new JeecgBootException("订单商品已使用,无法进行退款!");
             }
-            if (Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_5)) {
-                AppCourses appCourses = appCoursesMapper.selectById(appOrder.getProductIds());
-                Date startTime = appCourses.getStartTime();
-                Date now = new Date();
-                if(startTime.before(now)){
-                    throw new JeecgBootException("当前课程已开始,无法进行退款!");
-                }
-            }
+//            if (Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_5)) {
+//                AppCourses appCourses = appCoursesMapper.selectById(appOrder.getProductIds());
+//                Date startTime = appCourses.getStartTime();
+//                Date now = new Date();
+//                if(startTime.before(now)){
+//                    log.info("当前课程已开始,判断是否已使用");
+//                }
+//            }
             if (Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_1) || appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_2)){
                 //通过订单查询门店退款规则,判断是否可以进行退款
                 String s = appOrder.getProductIds().split(",")[0];

+ 5 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/job/OrTeachingJobService.java

@@ -287,7 +287,11 @@ public class OrTeachingJobService {
                             appOrderProInfo.setOrderStatus(CommonConstant.ORDER_STATUS_2);
                             appOrderProInfoService.updateById(appOrderProInfo);
                             //修改券使用记录状态
-                            appIsinService.update(Wrappers.lambdaUpdate(AppIsin.class).eq(AppIsin::getOrderProInfoId, appOrderProInfo.getId()).set(AppIsin::getIsinStatus, CommonConstant.ISIN_STATUS_1));
+                            appIsinService.update(Wrappers.lambdaUpdate(AppIsin.class).eq(AppIsin::getOrderProInfoId, appOrderProInfo.getId())
+                                    .set(AppIsin::getIsinStatus, CommonConstant.ISIN_STATUS_1)
+                                    .set(AppIsin::getUseImage,data.getPicUrl())
+                                    .set(AppIsin::getUseTime,DateUtils.str2Date(data.getGmtCreate(), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")))
+                            );
                             //修改订单状态
                             String orderId = appOrderProInfo.getOrderId();
                             List<AppOrderProInfo> proInfos = appOrderProInfoService.list(Wrappers.lambdaQuery(AppOrderProInfo.class).eq(AppOrderProInfo::getOrderId, orderId));