提交
This commit is contained in:
parent
67a013a596
commit
499597d357
|
@ -123,10 +123,7 @@ public class TransactionBillConverterImpl implements TransactionBillConverter {
|
||||||
bo.setPlatform(deptService.selectDeptById(Constants.ROOT_DEPT));
|
bo.setPlatform(deptService.selectDeptById(Constants.ROOT_DEPT));
|
||||||
bo.setAgent(userService.selectSmUserByUserId(device.getAgentId()));
|
bo.setAgent(userService.selectSmUserByUserId(device.getAgentId()));
|
||||||
bo.setVip(vipService.selectVipById(dto.getVipId()));
|
bo.setVip(vipService.selectVipById(dto.getVipId()));
|
||||||
|
bo.setPrice(RechargeUtils.calcRechargePrePayPrice(bo.getVip(), bo.getSuit()));
|
||||||
if (bo.getVip() != null && bo.getSuit() != null) {
|
|
||||||
bo.setPrice(RechargeUtils.calcRechargePrePayPrice(bo.getVip(), bo.getSuit()));
|
|
||||||
}
|
|
||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,9 @@ public class VipServiceImpl implements VipService
|
||||||
@Override
|
@Override
|
||||||
public VipVO selectVipById(Long id)
|
public VipVO selectVipById(Long id)
|
||||||
{
|
{
|
||||||
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return vipMapper.selectVipById(id);
|
return vipMapper.selectVipById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,7 @@ package com.ruoyi.ss.vipLevel.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import javax.validation.constraints.DecimalMax;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.constraints.DecimalMin;
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.constants.DictTypeConstants;
|
import com.ruoyi.common.constants.DictTypeConstants;
|
||||||
|
@ -32,35 +28,39 @@ public class VipLevel extends BaseEntity
|
||||||
|
|
||||||
@Excel(name = "价格")
|
@Excel(name = "价格")
|
||||||
@ApiModelProperty("价格")
|
@ApiModelProperty("价格")
|
||||||
|
@DecimalMin(value = "0.01", message = "价格不允许小于0.01元")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
@Excel(name = "时长(天)")
|
@Excel(name = "时长(天)")
|
||||||
@ApiModelProperty("时长(天)")
|
@ApiModelProperty("时长(天)")
|
||||||
|
@Min(value = 1, message = "时长不允许小于1天")
|
||||||
private Integer time;
|
private Integer time;
|
||||||
|
|
||||||
@Excel(name = "描述")
|
@Excel(name = "描述")
|
||||||
@ApiModelProperty("描述")
|
@ApiModelProperty("描述")
|
||||||
|
@Size(max = 200, message = "描述不允许超过200个字符")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Excel(name = "限制类型", readConverterExp = "1=不限制,2=自然周,3=30天")
|
@Excel(name = "限制类型", readConverterExp = "1=不限制,2=自然周,3=30天")
|
||||||
@ApiModelProperty("限制类型")
|
@ApiModelProperty("限制类型")
|
||||||
@NotBlank(message = "限制类型不允许为空", groups = {ValidGroup.Create.class})
|
@NotBlank(message = "限制类型不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||||
@DictValid(type = DictTypeConstants.VIP_LEVEL_LIMIT_TYPE, message = "非法的限制类型")
|
@DictValid(type = DictTypeConstants.VIP_LEVEL_LIMIT_TYPE, message = "非法的限制类型")
|
||||||
private String limitType;
|
private String limitType;
|
||||||
|
|
||||||
@Excel(name = "限制次数")
|
@Excel(name = "限制次数")
|
||||||
@ApiModelProperty("限制次数")
|
@ApiModelProperty("限制次数")
|
||||||
|
@Min(value = 0, message = "限制次数不允许小于0")
|
||||||
private Integer limitCount;
|
private Integer limitCount;
|
||||||
|
|
||||||
@Excel(name = "状态", dictType = DictTypeConstants.VIP_LEVEL_STATUS)
|
@Excel(name = "状态", dictType = DictTypeConstants.VIP_LEVEL_STATUS)
|
||||||
@ApiModelProperty("状态")
|
@ApiModelProperty("状态")
|
||||||
@NotBlank(message = "状态不允许为空", groups = {ValidGroup.Create.class})
|
@NotBlank(message = "状态不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||||
@DictValid(type = DictTypeConstants.VIP_LEVEL_STATUS, message = "非法的状态")
|
@DictValid(type = DictTypeConstants.VIP_LEVEL_STATUS, message = "非法的状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@Excel(name = "定价名称")
|
@Excel(name = "名称")
|
||||||
@ApiModelProperty("定价名称")
|
@ApiModelProperty("名称")
|
||||||
@NotBlank(message = "定价名称不允许为空", groups = {ValidGroup.Create.class})
|
@NotBlank(message = "会员名称不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Excel(name = "原价")
|
@Excel(name = "原价")
|
||||||
|
@ -70,7 +70,7 @@ public class VipLevel extends BaseEntity
|
||||||
@Excel(name = "限制总次数")
|
@Excel(name = "限制总次数")
|
||||||
@ApiModelProperty("限制总次数")
|
@ApiModelProperty("限制总次数")
|
||||||
@Min(value = 0, message = "限制总次数不允许小于0")
|
@Min(value = 0, message = "限制总次数不允许小于0")
|
||||||
@NotNull(message = "限制总次数不允许为空", groups = {ValidGroup.Create.class})
|
@NotNull(message = "限制总次数不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||||
private Integer limitTotal;
|
private Integer limitTotal;
|
||||||
|
|
||||||
@Excel(name = "商户ID")
|
@Excel(name = "商户ID")
|
||||||
|
@ -80,13 +80,13 @@ public class VipLevel extends BaseEntity
|
||||||
|
|
||||||
@Excel(name = "折扣")
|
@Excel(name = "折扣")
|
||||||
@ApiModelProperty("折扣")
|
@ApiModelProperty("折扣")
|
||||||
@NotNull(message = "折扣不允许为空", groups = {ValidGroup.Create.class})
|
@NotNull(message = "折扣不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||||
@DecimalMin(value = "0.1", message = "折扣不允许小于0.1折")
|
@DecimalMin(value = "0.1", message = "折扣不允许小于0.1折")
|
||||||
@DecimalMax(value = "10", message = "折扣不允许大于10折")
|
@DecimalMax(value = "10", message = "折扣不允许大于10折")
|
||||||
private BigDecimal discount;
|
private BigDecimal discount;
|
||||||
|
|
||||||
@Excel(name = "可用店铺ID")
|
@Excel(name = "可用店铺ID")
|
||||||
@ApiModelProperty("可用店铺ID")
|
@ApiModelProperty("可用店铺ID")
|
||||||
@NotNull(message = "可用店铺ID不允许为空", groups = {ValidGroup.Create.class})
|
@NotNull(message = "可用店铺不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.ruoyi.ss.vipLevel.service.impl;
|
package com.ruoyi.ss.vipLevel.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.ss.store.domain.StoreVo;
|
||||||
|
import com.ruoyi.ss.store.service.StoreService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
|
@ -10,15 +13,23 @@ import com.ruoyi.ss.vipLevel.service.VipLevelValidator;
|
||||||
@Service
|
@Service
|
||||||
public class VipLevelValidatorImpl implements VipLevelValidator {
|
public class VipLevelValidatorImpl implements VipLevelValidator {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreService storeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterValid(VipLevelVO vo) {
|
public void afterValid(VipLevelVO vo) {
|
||||||
ServiceUtil.assertion(vo == null, "VIP等级定价不存在");
|
ServiceUtil.assertion(vo == null, "VIP等级定价不存在");
|
||||||
|
|
||||||
// 判断限制次数是否必填
|
// 判断限制次数是否必填
|
||||||
if (!VipLevelLimitType.NONE.getType().equals(vo.getLimitType())) {
|
if (!VipLevelLimitType.NONE.getType().equals(vo.getLimitType())) {
|
||||||
ServiceUtil.assertion(vo.getLimitCount() == null, "限制次数不能为空");
|
ServiceUtil.assertion(vo.getLimitCount() == null, "限制次数不能为空");
|
||||||
ServiceUtil.assertion(vo.getLimitCount() <= 0, "限制次数不能小于等于0");
|
ServiceUtil.assertion(vo.getLimitCount() <= 0, "限制次数不能小于等于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断店铺是否生效的店铺
|
||||||
|
StoreVo store = storeService.selectSmStoreById(vo.getStoreId());
|
||||||
|
ServiceUtil.assertion(store == null, "ID为%s的店铺不存在", vo.getStoreId());
|
||||||
|
ServiceUtil.assertion(store.getEnabled() == null || !store.getEnabled(), "店铺【%s】暂未生效,请等待审核通过后重试", store.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ public class AppTransactionBillController extends BaseController
|
||||||
|
|
||||||
@ApiOperation("下单前获取订单预存金额")
|
@ApiOperation("下单前获取订单预存金额")
|
||||||
@GetMapping("/recharge/prePayPrice")
|
@GetMapping("/recharge/prePayPrice")
|
||||||
public AjaxResult prePayPrice(@RequestParam @ApiParam("会员ID") Long vipId,
|
public AjaxResult prePayPrice(@RequestParam(required = false) @ApiParam("会员ID") Long vipId,
|
||||||
@RequestParam @ApiParam("套餐ID") Long suitId) {
|
@RequestParam @ApiParam("套餐ID") Long suitId) {
|
||||||
return success(transactionBillService.calcRechargePrePayPrice(vipId, suitId));
|
return success(transactionBillService.calcRechargePrePayPrice(vipId, suitId));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user