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