zouxuan před 6 dny
rodič
revize
633c53ded8

+ 10 - 3
mec-application/src/main/java/com/ym/mec/student/controller/ActivityController.java

@@ -15,12 +15,11 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -52,6 +51,8 @@ public class ActivityController extends BaseController {
     private MusicGroupPlanMakingService musicGroupPlanMakingService;
     @Autowired
     private SubjectService subjectService;
+    @Autowired
+    private MemberRankSettingService memberRankSettingService;
 
     @ApiOperation("活动购买")
     @PostMapping(value = "/buy")
@@ -194,11 +195,17 @@ public class ActivityController extends BaseController {
         Map<String, String> categoryMap = vipGroupCategoryDao.findConditionCategorys().stream().collect(Collectors.toMap(e-> e.getId().toString(), ConditionDto::getName));
         vipGroupActivity.setVipGroupCategoryNames(categoryMap.get(vipGroupActivity.getVipGroupCategoryIdList()));
         vipGroupActivity.setGiveCategoryName(categoryMap.get(vipGroupActivity.getGiveCategoryId()));
+        if (vipGroupActivity.getGiveMemberRankId() != null) {
+            MemberRankSetting rankSetting = memberRankSettingService.get(vipGroupActivity.getGiveMemberRankId());
+            if(rankSetting != null){
+                vipGroupActivity.setGiveMemberRankName(rankSetting.getName());
+            }
+        }
         //如果是固定金额
         if(vipGroupActivity.getFixedCourseNumFlag()){
             vipGroupActivity.setDisplayPrice(vipGroupActivity.getMarketPrice());
         }else {
-            vipGroupActivity.setDisplayPrice(vipGroupActivity.getSinglePrice().multiply(vipGroupActivity.getDiscount()).divide(new BigDecimal(100), 0, ROUND_UP));
+            vipGroupActivity.setDisplayPrice(vipGroupActivity.getSinglePrice().multiply(vipGroupActivity.getDiscount()).divide(new BigDecimal(100), 0, RoundingMode.UP));
         }
         vipGroupActivityService.setActivityType(vipGroupActivity);
         return succeed(vipGroupActivity);

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/VipGroupActivity.java

@@ -70,6 +70,9 @@ public class VipGroupActivity{
 	@ApiModelProperty(value = "赠课类型")
 	private String giveCourseType;
 
+	@ApiModelProperty(value = "赠课名称")
+	private String giveMemberRankName;
+
 	@ApiModelProperty(value = "课类型")
 	private String courseType;