|
@@ -1,12 +1,14 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupGiveCourseSortDto;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.dal.enums.TeachModeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.VipGroupActivityTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
|
|
|
import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
|
|
|
+import com.ym.mec.biz.service.SysUserCashAccountService;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -33,6 +35,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
private CourseScheduleDao courseScheduleDao;
|
|
|
@Autowired
|
|
|
private ClassGroupStudentMapperDao classGroupStudentMapperDao;
|
|
|
+ @Autowired
|
|
|
+ private SysUserCashAccountService sysUserCashAccountService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
|
|
@@ -191,6 +195,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
if(Objects.isNull(courseScheduleStudentPayment.getExpectPrice())){
|
|
|
courseScheduleStudentPayment.setExpectPrice(zeroPrice);
|
|
|
}
|
|
|
+ sysUserCashAccountService.appendCourseBalance(classGroupStudent.getUserId(), courseScheduleStudentPayment.getExpectPrice().negate());
|
|
|
courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
}else{
|
|
|
CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment(
|
|
@@ -214,4 +219,17 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
public int batchInsert(List<CourseScheduleStudentPayment> courseScheduleStudentPayments) {
|
|
|
return courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateVipGiveCourse(Long vipGroupId) {
|
|
|
+ List<VipGroupGiveCourseSortDto> vipGroupSortCourseByGroup = courseScheduleStudentPaymentDao.findVipGroupSortCourseByGroup(vipGroupId.toString());
|
|
|
+ Map<BigDecimal, Long> expectPriceCountMap = vipGroupSortCourseByGroup.stream()
|
|
|
+ .collect(Collectors.groupingBy(VipGroupGiveCourseSortDto::getExpectPrice, Collectors.counting()));
|
|
|
+ BigDecimal zero = new BigDecimal(0);
|
|
|
+ int zeroPriceNum = expectPriceCountMap.get(zero).intValue();
|
|
|
+ if(zeroPriceNum<=0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|