Joburgess 4 роки тому
батько
коміт
1ca6628a7f

+ 7 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -682,8 +682,9 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 			List<CourseScheduleStudentPaymentDto> notStartCourses = statusCoursesMap.get(CourseStatusEnum.OVER);
 			notStartCourses.sort(Comparator.comparing(CourseScheduleStudentPaymentDto::getCourseStartTime));
 			for (CourseScheduleStudentPaymentDto notStartCourse : notStartCourses) {
-				BigDecimal deductAmount = studentRegistrationService.updateUserSurplusCourseFee(notStartCourse.getUserId(), notStartCourse.getMusicGroupId(), notStartCourse.getExpectPrice().negate(), StringUtils.join("课程结束,扣除课程费用:", notStartCourse.getCourseScheduleId()), null);
-				notStartCourse.setActualPrice(deductAmount.abs());
+				BigDecimal actualPrice = Objects.isNull(notStartCourse.getActualPrice())?BigDecimal.ZERO:notStartCourse.getActualPrice();
+				BigDecimal deductAmount = studentRegistrationService.updateUserSurplusCourseFee(notStartCourse.getUserId(), notStartCourse.getMusicGroupId(), (notStartCourse.getExpectPrice().subtract(actualPrice)).negate(), StringUtils.join("课程结束,扣除课程费用:", notStartCourse.getCourseScheduleId()), null);
+				notStartCourse.setActualPrice(actualPrice.add(deductAmount.abs()));
 				needUpdates.add(notStartCourse);
 			}
 		}
@@ -691,4 +692,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 			courseScheduleStudentPaymentDao.batchUpdate(needUpdates);
 		}
 	}
+
+	public static void main(String[] args) {
+		System.out.println(new BigDecimal(12).subtract(BigDecimal.ZERO));
+	}
 }