Merge branch 'preview' of https://gitea.qinmian.online/CY/mcwl-ai into preview
commit
1cdfb48ae3
|
@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.memberCenter.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mcwl.memberCenter.domain.Member;
|
import com.mcwl.memberCenter.domain.Member;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface MemberService extends IService<Member> {
|
public interface MemberService extends IService<Member> {
|
||||||
|
@ -41,4 +42,6 @@ public interface MemberService extends IService<Member> {
|
||||||
* @param consumePoints 消费积分
|
* @param consumePoints 消费积分
|
||||||
*/
|
*/
|
||||||
void consumePoints(Double consumePoints);
|
void consumePoints(Double consumePoints);
|
||||||
|
|
||||||
|
Double calculatePayment(Double unitPrice, Long promotionId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
private void saveMemberConsume(Double consumePoints, Long userId, double points) {
|
||||||
MemberConsume memberConsume = new MemberConsume();
|
MemberConsume memberConsume = new MemberConsume();
|
||||||
memberConsume.setUserId(userId);
|
memberConsume.setUserId(userId);
|
||||||
|
|
|
@ -85,4 +85,9 @@ public class ModelImage extends BaseEntity {
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否置顶
|
||||||
|
*/
|
||||||
|
private Integer isTop;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
BeanUtil.copyProperties(modelImageRes, modelImage);
|
BeanUtil.copyProperties(modelImageRes, modelImage);
|
||||||
modelImage.setUserId(SecurityUtils.getUserId());
|
modelImage.setUserId(SecurityUtils.getUserId());
|
||||||
modelImage.setCreateBy(SecurityUtils.getUsername());
|
modelImage.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
modelImage.setCreateTime(new Date());
|
||||||
modelImage.setUpdateBy(SecurityUtils.getUsername());
|
modelImage.setUpdateBy(SecurityUtils.getUsername());
|
||||||
modelImage.setUpdateTime(new Date());
|
modelImage.setUpdateTime(new Date());
|
||||||
modelImage.setStatus(3);
|
modelImage.setStatus(3);
|
||||||
|
|
Loading…
Reference in New Issue