Browse Source

增加计算实际销售金额

周箭河 5 years ago
parent
commit
f10ee53b71

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -237,7 +237,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         }
         for (MusicGroupGoodsAndDiscountDto musicGroupGoodsAndDiscountDto : goodsList) {
             musicGroupGoodsAndDiscountDto.setDiscountRate(subjectDiscount.getGoodsDiscountRate());
-            musicGroupGoodsAndDiscountDto.setGroupPurchasePrice(musicGroupGoodsAndDiscountDto.getGroupPurchasePrice().multiply(subjectDiscount.getGoodsDiscountRate()).setScale(2, BigDecimal.ROUND_HALF_UP));
+            musicGroupGoodsAndDiscountDto.setGroupPurchasePrice(musicGroupGoodsAndDiscountDto.getGroupPurchasePrice().multiply(subjectDiscount.getGoodsDiscountRate()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP));
         }
         return goodsList;
     }

+ 18 - 6
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,10 +1,10 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
@@ -33,6 +33,10 @@ public class StudentRegistrationController extends BaseController {
     private StudentRegistrationService studentRegistrationService;
     @Autowired
     private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+    @Autowired
+    private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
 
     @ApiOperation(value = "乐团添加学员")
     @PostMapping("/insertStudent")
@@ -153,11 +157,19 @@ public class StudentRegistrationController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/getSubjectGoodsAndInfo')")
     @ApiImplicitParams({@ApiImplicitParam(name = "subjectId", value = "声部信息", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
-    public HttpResponseResult<MusicGroupSubjectGoodsAndInfoDto> getSubjectGoodsAndInfo(Integer subjectId, String musicGroupId) {
-        if (subjectId == null || StringUtils.isEmpty(musicGroupId)) {
+    public HttpResponseResult<MusicGroupSubjectGoodsAndInfoDto> getSubjectGoodsAndInfo(Integer subjectId, String musicGroupId, Long calenderId) {
+        if (subjectId == null || StringUtils.isEmpty(musicGroupId) || calenderId == null) {
             return failed("参数校验异常");
         }
-        return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
+        MusicGroupSubjectGoodsAndInfoDto subjectGoodsAndInfo = musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId);
+
+        MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.get(calenderId);
+        if (musicGroupRegCalender != null && musicGroupRegCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
+            List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupRegCalender.getId());
+            musicGroupRegCalender.setMusicGroupPaymentCalenderCourseSettingsList(courseSettings);
+            subjectGoodsAndInfo.setMusicGroupPaymentCalender(musicGroupRegCalender);
+        }
+        return succeed(subjectGoodsAndInfo);
     }
 
     @ApiOperation(value = "获取班级课程的价值")