Merge branch 'feature/my-invitation' into preview

feature/my-invitation
yang 2025-01-13 16:19:13 +08:00
commit 2385b58bb0
5 changed files with 40 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;
@ -140,4 +141,16 @@ public class MemberController {
}
/**
*
*/
@GetMapping("calculatePayment")
public AjaxResult calculatePayment(@NotNull(message = "请选择会员") Long memberLevelId, @RequestParam(required = false) Long promotionId) {
MemberLevel memberLevel = memberLevelService.getById(memberLevelId);
Double unitPrice = memberLevel.getUnitPrice();
unitPrice = memberService.calculatePayment(unitPrice, promotionId);
return AjaxResult.success(unitPrice);
}
}

View File

@ -3,6 +3,7 @@ package com.mcwl.memberCenter.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.memberCenter.domain.Member;
import javax.validation.constraints.NotNull;
import java.util.List;
public interface MemberService extends IService<Member> {
@ -41,4 +42,6 @@ public interface MemberService extends IService<Member> {
* @param consumePoints
*/
void consumePoints(Double consumePoints);
Double calculatePayment(Double unitPrice, Long promotionId);
}

View File

@ -214,6 +214,24 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
}
@Override
public Double calculatePayment(Double unitPrice, Long promotionId) {
if (Objects.isNull(promotionId)) {
return unitPrice;
}
Promotion promotion = promotionMapper.selectById(promotionId);
if (Objects.isNull(promotion)) {
return unitPrice;
}
PromotionEnum activityType = promotion.getActivityType();
if (activityType == PromotionEnum.DISCOUNT) {
return unitPrice * promotion.getActivityValue();
}
return unitPrice;
}
private void saveMemberConsume(Double consumePoints, Long userId, double points) {
MemberConsume memberConsume = new MemberConsume();
memberConsume.setUserId(userId);

View File

@ -85,4 +85,9 @@ public class ModelImage extends BaseEntity {
*
*/
private Integer status;
/**
*
*/
private Integer isTop;
}

View File

@ -82,6 +82,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
BeanUtil.copyProperties(modelImageRes, modelImage);
modelImage.setUserId(SecurityUtils.getUserId());
modelImage.setCreateBy(SecurityUtils.getUsername());
modelImage.setCreateTime(new Date());
modelImage.setUpdateBy(SecurityUtils.getUsername());
modelImage.setUpdateTime(new Date());
modelImage.setStatus(3);