Joburgess преди 5 години
родител
ревизия
f3952ca519
променени са 1 файла, в които са добавени 13 реда и са изтрити 6 реда
  1. 13 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

+ 13 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -400,15 +400,22 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 			//学员总缴费金额
 			BigDecimal totalActualAmount = musicGroupPaymentCalenderDetails.stream().map(e -> Objects.isNull(e.getActualAmount())?BigDecimal.ZERO:e.getActualAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
 
-			for (CourseScheduleStudentPayment courseScheduleStudentPayment : studentStudentPaymentMapEntry.getValue()) {
-				if(totalActualAmount.compareTo(courseScheduleStudentPayment.getExpectPrice())>=0){
-					courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
-					totalActualAmount=totalActualAmount.subtract(courseScheduleStudentPayment.getExpectPrice());
+			for(int i=0;i<studentStudentPaymentMapEntry.getValue().size();i++){
+				if(totalActualAmount.compareTo(studentStudentPaymentMapEntry.getValue().get(i).getExpectPrice())>=0){
+					studentStudentPaymentMapEntry.getValue().get(i).setActualPrice(studentStudentPaymentMapEntry.getValue().get(i).getExpectPrice());
+					totalActualAmount=totalActualAmount.subtract(studentStudentPaymentMapEntry.getValue().get(i).getExpectPrice());
 				}else{
-					courseScheduleStudentPayment.setActualPrice(totalActualAmount);
+					studentStudentPaymentMapEntry.getValue().get(i).setActualPrice(totalActualAmount);
 					totalActualAmount=BigDecimal.ZERO;
 				}
-				updateStudentPayments.add(courseScheduleStudentPayment);
+				updateStudentPayments.add(studentStudentPaymentMapEntry.getValue().get(i));
+				if(i==studentStudentPaymentMapEntry.getValue().size()-1){
+					studentStudentPaymentMapEntry.getValue().get(0).setActualPrice(studentStudentPaymentMapEntry.getValue().get(0).getExpectPrice().add(totalActualAmount));
+				}
+			}
+
+			for (CourseScheduleStudentPayment courseScheduleStudentPayment : studentStudentPaymentMapEntry.getValue()) {
+
 			}
 		}