Compare commits
No commits in common. "2385b58bb0eced703d70c55e4d7b66b93b97af13" and "c8bc8356448efdee5dd9c9e819a7aecac06b436c" have entirely different histories.
2385b58bb0
...
c8bc835644
|
@ -19,7 +19,6 @@ 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;
|
||||||
|
|
||||||
|
@ -141,16 +140,4 @@ 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,7 +3,6 @@ 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> {
|
||||||
|
@ -42,6 +41,4 @@ 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,24 +214,6 @@ 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,9 +85,4 @@ public class ModelImage extends BaseEntity {
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否置顶
|
|
||||||
*/
|
|
||||||
private Integer isTop;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,6 @@ 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