|
@@ -2,15 +2,7 @@ package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -118,6 +110,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentRegistration> getDAO() {
|
|
@@ -1284,4 +1278,33 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
List<CourseScheduleStudentPayment> classGroupNoStartCourse = courseScheduleStudentPaymentService.getClassGroupNoStartCourse(classGroupIds);
|
|
|
return classGroupNoStartCourse.stream().map(CourseScheduleStudentPayment::getExpectPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
+ public boolean updateUserSurplusCourseFee(Long studentRegistrationId, BigDecimal amount, String memo, Integer operatorId) {
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.lock(studentRegistrationId);
|
|
|
+ if(Objects.isNull(studentRegistration)){
|
|
|
+ throw new BizException("学员注册信息不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(BigDecimal.ZERO.compareTo(amount)==0){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(studentRegistration.getSurplusCourseFee().compareTo(amount)<0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ studentRegistration.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().add(amount));
|
|
|
+
|
|
|
+ StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
|
|
|
+ studentCourseFeeDetail.setStudentRegistrationId(studentRegistrationId);
|
|
|
+ studentCourseFeeDetail.setAmount(amount);
|
|
|
+ studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee());
|
|
|
+ studentCourseFeeDetail.setMemo(memo);
|
|
|
+ studentCourseFeeDetail.setOperator(operatorId);
|
|
|
+ studentCourseFeeDetailDao.insert(studentCourseFeeDetail);
|
|
|
+
|
|
|
+ studentRegistrationDao.update(studentRegistration);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|