|
@@ -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);
|