瀏覽代碼

修改云教室记录相关功能

hgw 3 年之前
父節點
當前提交
ff9a88c824

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantCloudCourseRecord.java

@@ -28,6 +28,10 @@ public class TenantCloudCourseRecord implements Serializable {
     @ApiModelProperty(value = "机构id")
     private Integer tenantId;
 
+    @TableField("group_id_")
+    @ApiModelProperty(value = "课程组id")
+    private Integer groupId;
+
     @TableField("course_id_")
     @ApiModelProperty(value = "course_schedule表的id_")
     private Integer courseId;
@@ -40,6 +44,10 @@ public class TenantCloudCourseRecord implements Serializable {
     @ApiModelProperty(value = "金额")
     private BigDecimal amount;
 
+    @TableField("record_type_")
+    @ApiModelProperty(value = "扣费记录类型 0课程 1课程组")
+    private Integer recordType;
+
     @TableField("created_by_")
     @ApiModelProperty(value = "创建人")
     private Integer createdBy;
@@ -66,6 +74,14 @@ public class TenantCloudCourseRecord implements Serializable {
         this.tenantId = tenantId;
     }
 
+    public Integer getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Integer groupId) {
+        this.groupId = groupId;
+    }
+
     public Integer getCourseId() {
         return courseId;
     }
@@ -90,6 +106,14 @@ public class TenantCloudCourseRecord implements Serializable {
         this.amount = amount;
     }
 
+    public Integer getRecordType() {
+        return recordType;
+    }
+
+    public void setRecordType(Integer recordType) {
+        this.recordType = recordType;
+    }
+
     public Integer getCreatedBy() {
         return createdBy;
     }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TenantAssetsInfoService.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.TenantAssetsInfo;
+import com.ym.mec.biz.dal.entity.VipGroup;
 
 import java.util.List;
 
@@ -19,5 +20,7 @@ public interface TenantAssetsInfoService extends IService<TenantAssetsInfo> {
     void courseRecoverAmount(Integer courseId);
 
     void courseDeductAmount(Integer courseId);
+
+    void groupFrozenAmount(VipGroup vipGroup, List<CourseSchedule> dto);
 }
 

+ 27 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantAssetsInfoServiceImpl.java

@@ -48,14 +48,18 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
     private TenantCloudCourseRecordService tenantCloudCourseRecordService;
 
     /**
+     * 课程
      * 扣除冻结的金额
      *
      * @param courseId 课程id
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void courseDeductAmount(Integer courseId){
+    public void courseDeductAmount(Integer courseId) {
         TenantCloudCourseRecord lastRecord = checkLastRecord(courseId);
+        if (Objects.isNull(lastRecord)) {
+            return;
+        }
         //写入流水
         lastRecord.setDeductState(1);
         tenantCloudCourseRecordService.save(lastRecord);
@@ -65,6 +69,7 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
     }
 
     /**
+     * 课程
      * 恢复/取消 冻结的金额
      *
      * @param courseId 课程id
@@ -73,6 +78,9 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
     @Transactional(rollbackFor = Exception.class)
     public void courseRecoverAmount(Integer courseId) {
         TenantCloudCourseRecord lastRecord = checkLastRecord(courseId);
+        if (Objects.isNull(lastRecord)) {
+            return;
+        }
         //写入流水
         lastRecord.setDeductState(2);
         tenantCloudCourseRecordService.save(lastRecord);
@@ -84,8 +92,11 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
 
     private TenantCloudCourseRecord checkLastRecord(Integer courseId) {
         TenantCloudCourseRecord lastRecord = tenantCloudCourseRecordService.queryLastRecord(courseId);
+        if (Objects.isNull(lastRecord)) {
+            return null;
+        }
         //判断是否是冻结的状态
-        if (Objects.nonNull(lastRecord) && lastRecord.getDeductState() != 0) {
+        if (lastRecord.getDeductState() != 0) {
             //只有冻结的才能取消冻结 或者 扣费
             throw new BizException("该课程非线上课!");
         }
@@ -95,7 +106,19 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
     }
 
     /**
-     * 排课扣费计算
+     * 课程组金额冻结
+     *
+     * @param vipGroup 课程组信息
+     * @param dto      课程组中的课程
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void groupFrozenAmount(VipGroup vipGroup, List<CourseSchedule> dto) {
+
+    }
+
+    /**
+     * 冻结课程的总价格
      * 1.线上排课计算出的总价格不能超过账户余额(注意多人同时操作账户余额多扣问题)
      * 2.若符合规则冻结部分账户
      */
@@ -147,6 +170,7 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
             record.setAmount(coursePrice);
             record.setTenantId(tenantId);
             record.setDeductState(0);
+            record.setRecordType(0);
             record.setCreatedBy(getUserId());
             record.setCreatedTime(new Date());
             tenantCloudCourseRecordService.save(record);

+ 3 - 1
mec-biz/src/main/resources/config/mybatis/TenantCloudCourseRecordMapper.xml

@@ -5,16 +5,18 @@
     <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantCloudCourseRecord">
         <id column="id_" jdbcType="INTEGER" property="id"/>
         <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
+        <result column="group_id_" jdbcType="INTEGER" property="groupId"/>
         <result column="course_id_" jdbcType="INTEGER" property="courseId"/>
         <result column="deduct_state_" jdbcType="INTEGER" property="deductState"/>
         <result column="amount_" jdbcType="VARCHAR" property="amount"/>
+        <result column="record_type_" jdbcType="INTEGER" property="recordType"/>
         <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
         <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
     </resultMap>
 
     <sql id="Base_Column_List">
         id_
-        , tenant_id_, course_id_, deduct_state_, amount_, created_by_, created_time_
+        , tenant_id_, group_id_,course_id_, deduct_state_, amount_, record_type_,created_by_, created_time_
     </sql>
 
     <select id="queryPage" parameterType="map" resultType="com.ym.mec.biz.dal.vo.TenantCloudCourseRecordVo">