|
@@ -9,6 +9,7 @@ import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.CourseScheduleStudentPaymentQueryInfo;
|
|
|
import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
|
|
|
+import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
import com.ym.mec.biz.service.SysUserCashAccountService;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
@@ -61,6 +62,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
private StudentDao studentDao;
|
|
|
@Autowired
|
|
|
private SubjectDao subjectDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentRegistrationService studentRegistrationService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
|
|
@@ -405,9 +408,9 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
}
|
|
|
}
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
- for (String batchNo : allBatchNos) {
|
|
|
- updateForMusicGroupWithPaymentCalender(batchNo);
|
|
|
- }
|
|
|
+// for (String batchNo : allBatchNos) {
|
|
|
+// updateForMusicGroupWithPaymentCalender(batchNo);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -571,4 +574,38 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
}
|
|
|
return usersSimpleInfo;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updateCourseActualPrice() {
|
|
|
+ List<CourseScheduleStudentPaymentDto> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findNeedUpdateActualPriceStudentCourses();
|
|
|
+ if(CollectionUtils.isEmpty(courseScheduleStudentPayments)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<CourseScheduleStudentPayment> needUpdates = new ArrayList<>();
|
|
|
+ Map<CourseStatusEnum, List<CourseScheduleStudentPaymentDto>> statusCoursesMap = courseScheduleStudentPayments.stream().collect(Collectors.groupingBy(CourseScheduleStudentPaymentDto::getCourseStatus));
|
|
|
+ if(statusCoursesMap.containsKey(CourseStatusEnum.NOT_START)){
|
|
|
+ List<CourseScheduleStudentPaymentDto> notStartCourses = statusCoursesMap.get(CourseStatusEnum.NOT_START);
|
|
|
+ for (CourseScheduleStudentPaymentDto notStartCourse : notStartCourses) {
|
|
|
+ studentRegistrationService.updateUserSurplusCourseFee(notStartCourse.getUserId(), notStartCourse.getMusicGroupId(), notStartCourse.getActualPrice(), StringUtils.join("课程状态变更到未开始,退还缴费:", notStartCourse.getCourseScheduleId()), null);
|
|
|
+ notStartCourse.setActualPrice(BigDecimal.ZERO);
|
|
|
+ needUpdates.add(notStartCourse);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(statusCoursesMap.containsKey(CourseStatusEnum.OVER)){
|
|
|
+ List<CourseScheduleStudentPaymentDto> notStartCourses = statusCoursesMap.get(CourseStatusEnum.OVER);
|
|
|
+ for (CourseScheduleStudentPaymentDto notStartCourse : notStartCourses) {
|
|
|
+ boolean isUpdate = studentRegistrationService.updateUserSurplusCourseFee(notStartCourse.getUserId(), notStartCourse.getMusicGroupId(), notStartCourse.getExpectPrice().negate(), StringUtils.join("课程结束,扣除课程费用:", notStartCourse.getCourseScheduleId()), null);
|
|
|
+ if(!isUpdate){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ notStartCourse.setActualPrice(notStartCourse.getExpectPrice());
|
|
|
+ needUpdates.add(notStartCourse);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(needUpdates)){
|
|
|
+ courseScheduleStudentPaymentDao.batchUpdate(needUpdates);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|