|
@@ -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);
|