浏览代码

Merge remote-tracking branch 'origin/saas' into saas

hgw 3 年之前
父节点
当前提交
ef13436ea5
共有 1 个文件被更改,包括 9 次插入5 次删除
  1. 9 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

+ 9 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -41,6 +41,7 @@ import java.math.BigDecimal;
 import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType.*;
@@ -4592,11 +4593,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         paymentCalenderDto.setMusicGroupId(musicGroup.getId());
         boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
-        BigDecimal originalPrice = BigDecimal.ZERO;
-        if(musicGroupPaymentCalenderStudentDetails != null && musicGroupPaymentCalenderStudentDetails.size() > 0){
-            originalPrice = musicGroupPaymentCalenderStudentDetails.stream().map(e -> e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+        //给原价赋值,前端没传过来
+        for (MusicGroupPaymentCalenderStudentDetail e : calenderStudentDetails) {
+            BigDecimal subtract = e.getMasterSubCoursePrice().subtract(e.getSubCourseAmount());
+            if(subtract.compareTo(BigDecimal.ZERO) < 0){
+                e.setCourseOriginalPrice(BigDecimal.ZERO);
+            }else {
+                e.setCourseOriginalPrice(subtract);
+            }
         }
-        paymentCalenderDto.setOriginalAmount(originalPrice);
         if (!containsAll) {
             paymentCalenderDto.setStatus(AUDITING);
         } else {
@@ -4613,7 +4618,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         paymentCalenderDto.setPaymentType(SPAN_GROUP_CLASS_ADJUST);
         //生成缴费项目
         paymentCalenderDto.setMasterTotalPrice(masterTotalPrice);
-//        paymentCalenderDto.setIsGiveMusicNetwork(false);
         paymentCalenderDto.setStudentIds(StringUtils.join(studentIds, ","));
         musicGroupPaymentCalenderService.create(paymentCalenderDto);
         //记录申请信息