积分校验
This commit is contained in:
parent
03c757f38f
commit
88c47d1261
|
|
@ -252,22 +252,27 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
Long shopId = orderInfo.getShopId();
|
||||
AssertUtil.isNull(shopId, "生成支付订单失败,订单信息异常");
|
||||
PointsBasicSetting pointSetting = pointsBasicService.getById(shopId);
|
||||
if (param.getPointsNum() > 0 && !pointSetting.getEnableDeduction().equals(1)) {
|
||||
throw new ValidateException("生成支付订单失败,该店铺未开启积分抵扣");
|
||||
}
|
||||
orderInfo.setSeatNum(param.getSeatNum());
|
||||
if (shopInfo.getIsTableFee() != 1 && shopInfo.getTableFee().compareTo(BigDecimal.ZERO) != 0) {
|
||||
orderInfo.setSeatAmount(new BigDecimal(param.getSeatNum()).multiply(shopInfo.getTableFee()));
|
||||
} else {
|
||||
orderInfo.setSeatAmount(BigDecimal.ZERO);
|
||||
}
|
||||
PointsBasicSetting pointSetting = pointsBasicService.getById(shopId);
|
||||
if (param.getPointsNum() > 0) {
|
||||
if (pointSetting == null || !pointSetting.getEnableDeduction().equals(1)) {
|
||||
throw new ValidateException("生成支付订单失败,该店铺未开启积分抵扣");
|
||||
}
|
||||
if (param.getUserId() == null) {
|
||||
throw new ValidateException("生成支付订单失败,请选择用户后再使用积分抵扣");
|
||||
}
|
||||
}
|
||||
ShopUser shopUser = null;
|
||||
if (param.getUserId() != null) {
|
||||
UserInfo userInfo = userInfoService.getById(param.getUserId());
|
||||
AssertUtil.isNull(userInfo, "生成支付订单失败,用户信息不存在");
|
||||
shopUser = shopUserService.getShopUserInfo(shopId, param.getUserId());
|
||||
if (!shopUser.getIsVip().equals(1) && pointSetting.getDeductionGroup().contains("vip")) {
|
||||
if (param.getPointsNum() > 0 && !shopUser.getIsVip().equals(1) && pointSetting.getDeductionGroup().contains("vip")) {
|
||||
throw new ValidateException("生成支付订单失败,该店铺仅会员可使用积分抵扣");
|
||||
}
|
||||
orderInfo.setUserId(userInfo.getId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue