瀏覽代碼

feat(app): 完善课程验证及ISIN记录逻辑

- 新增 AppSiteMapper 和 AppIsinMapper 注入依赖- 在课程上传图片时增加对场地类型的判断
- 场地类型为学校时,更新 ISIN 记录状态并设置使用信息- 优化 CoursesVerificationRecordForm 中 id 字段描述为“使用人id”- 在订单服务中新增课程课时关联 ISIN 记录的创建逻辑
- AppIsin 实体类增加 coursePriceRuleId 字段用于关联课时规则
wzq 1 周之前
父節點
當前提交
d279925a23

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

@@ -1181,8 +1181,26 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
                     appIsin.setUseAddress(appSite.getName());
 
                     //判断当前课程是否是在学校上课
-
-
+                    if (appSite.getType() == 0){
+                        //查询当前课程的课时
+                        AppCourses appCourses = appCoursesMapper.selectById(appOrderProInfo.getProductId());
+                        List<AppCoursesPriceRules> appCoursesPriceRules = appCoursesPriceRulesMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId,
+                                appCourses.getId()));
+                        for (AppCoursesPriceRules appCoursesPriceRule : appCoursesPriceRules) {
+                            AppIsin appIsinInfo = new AppIsin();
+                            appIsinInfo
+                                    .setOrderId(appOrder.getId())
+                                    .setOrgCode(appOrder.getOrgCode())
+                                    .setOrderCode(appOrder.getOrderCode())
+                                    .setOrderProInfoId(appOrderProInfo.getId())
+                                    .setCoursePriceRuleId(appCoursesPriceRule.getId())
+                                    .setFamilyId(appOrderProInfo.getFamilyUserId())
+                                    .setFamilyUserName(appOrderProInfo.getUserName())
+                                    .setTicketNo(appOrderProInfo.getTicketNo())
+                                    .setIsinStatus(CommonConstant.ISIN_STATUS_0);
+                            appIsinMapper.insert(appIsinInfo);
+                        }
+                    }
                 }
                 appIsinMapper.insert(appIsin);
             }

+ 2 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppIsin.java

@@ -48,6 +48,8 @@ public class AppIsin implements Serializable {
     @Excel(name = "子订单商品ID", width = 15)
     @Schema(description = "子订单商品ID")
     private String orderProInfoId;
+    @Schema(description = "课时ID")
+    private String coursePriceRuleId;
 	/**用户ID*/
 	@Excel(name = "用户ID(关联家庭用户表)", width = 15)
     @Schema(description = "用户ID(关联家庭用户表)")

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/form/CoursesVerificationRecordForm.java

@@ -21,7 +21,7 @@ public class CoursesVerificationRecordForm implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
-     * id
+     * 使用人id
      */
     @Schema(description = "id")
     private String id;

+ 28 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppCoursesVerificationRecordServiceImpl.java

@@ -46,6 +46,10 @@ public class AppCoursesVerificationRecordServiceImpl extends ServiceImpl<AppCour
     private AppOrderProInfoMapper appOrderProInfoMapper;
     @Autowired
     private AppCoursesMapper appCoursesMapper;
+    @Resource
+    private AppSiteMapper appSiteMapper;
+    @Resource
+    private AppIsinMapper appIsinMapper;
 
     @Override
     public Boolean courseUploadImage(VerifyForm verifyForm) {
@@ -66,6 +70,30 @@ public class AppCoursesVerificationRecordServiceImpl extends ServiceImpl<AppCour
             }
         }
 
+        AppSite appSite = appSiteMapper.selectOne(Wrappers.lambdaQuery(AppSite.class).eq(AppSite::getId, appCourses.getAddressSiteId()));
+        if(ObjectUtil.isNotEmpty(appSite)){
+            if (Objects.equals(appSite.getType(), CommonConstant.STATUS_0_INT)){
+                for (CoursesVerificationRecordForm coursesVerificationRecordForm : verifyForm.getFormList()) {
+                    List<AppIsin> appIsins = appIsinMapper.selectList(Wrappers.<AppIsin>lambdaQuery()
+                            .eq(AppIsin::getCoursePriceRuleId, verifyForm.getCoursePriceRulesId())
+                            .eq(AppIsin::getFamilyId, coursesVerificationRecordForm.getId())
+                            .eq(AppIsin::getIsinStatus, CommonConstant.STATUS_NORMAL)
+                    );
+                    if (CollUtil.isNotEmpty(appIsins)) {
+                        appIsins.forEach(appIsin -> {
+                            appIsin.setIsinStatus(CommonConstant.STATUS_1_INT);
+                            appIsin.setUseAddress(appSite.getAddress());
+                            appIsin.setUseTime(DateUtils.getDate());
+                            appIsin.setUseImage(coursesVerificationRecordForm.getVerifyImage());
+                            appIsin.setVerifyUserId(sysUser.getId());
+                            appIsin.setVerifyUserName(sysUser.getRealname());
+                            appIsinMapper.updateById(appIsin);
+                        });
+                    }
+                }
+            }
+        }
+
         for (CoursesVerificationRecordForm coursesVerificationRecordForm : verifyForm.getFormList()) {
             List<AppCoursesVerificationRecord> verificationRecordList = baseMapper.selectList(Wrappers.<AppCoursesVerificationRecord>lambdaQuery()
                     .eq(AppCoursesVerificationRecord::getCoursesPriceRuleId, verifyForm.getCoursePriceRulesId())