fix: 充值霸王餐查询修改
This commit is contained in:
@@ -385,7 +385,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取店铺霸王餐配置
|
// 获取店铺霸王餐配置
|
||||||
TbFreeDineConfig freeDineConfig = freeDineConfigService.getById(orderInfo.getShopId());
|
TbFreeDineConfig freeDineConfig = freeDineConfigService.getByShopId(orderInfo.getShopId());
|
||||||
if (freeDineConfig == null || freeDineConfig.getEnable() == null || freeDineConfig.getEnable() == 0) {
|
if (freeDineConfig == null || freeDineConfig.getEnable() == null || freeDineConfig.getEnable() == 0) {
|
||||||
throw new MsgException("店铺未开启霸王餐配置");
|
throw new MsgException("店铺未开启霸王餐配置");
|
||||||
}
|
}
|
||||||
@@ -403,6 +403,11 @@ public class PayService {
|
|||||||
if (payDTO.getUsePoints() && freeDineConfig.getWithPoints() == 0) {
|
if (payDTO.getUsePoints() && freeDineConfig.getWithPoints() == 0) {
|
||||||
throw new MsgException("当前店铺未开启与积分同享");
|
throw new MsgException("当前店铺未开启与积分同享");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 校验就餐模式是否满足
|
||||||
|
if (!freeDineConfig.getUseType().contains(orderInfo.getUseType())) {
|
||||||
|
throw new MsgException("当前店铺未开启此就餐模式霸王餐");
|
||||||
|
}
|
||||||
BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes()));
|
BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes()));
|
||||||
|
|
||||||
if (!payDTO.getCouponIds().isEmpty()) {
|
if (!payDTO.getCouponIds().isEmpty()) {
|
||||||
|
|||||||
@@ -10,4 +10,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
*/
|
*/
|
||||||
public interface TbFreeDineConfigService extends IService<TbFreeDineConfig> {
|
public interface TbFreeDineConfigService extends IService<TbFreeDineConfig> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺id查询
|
||||||
|
* @param shopId 店铺id
|
||||||
|
* @return 霸王餐配置
|
||||||
|
*/
|
||||||
|
TbFreeDineConfig getByShopId(String shopId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbFreeDineConfig;
|
import com.chaozhanggui.system.cashierservice.entity.TbFreeDineConfig;
|
||||||
import com.chaozhanggui.system.cashierservice.service.TbFreeDineConfigService;
|
import com.chaozhanggui.system.cashierservice.service.TbFreeDineConfigService;
|
||||||
@@ -17,6 +18,11 @@ import org.springframework.stereotype.Service;
|
|||||||
public class TbFreeDineConfigServiceImpl extends ServiceImpl<TbFreeDineConfigMapper, TbFreeDineConfig>
|
public class TbFreeDineConfigServiceImpl extends ServiceImpl<TbFreeDineConfigMapper, TbFreeDineConfig>
|
||||||
implements TbFreeDineConfigService{
|
implements TbFreeDineConfigService{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TbFreeDineConfig getByShopId(String shopId) {
|
||||||
|
return getOne(new LambdaQueryWrapper<TbFreeDineConfig>()
|
||||||
|
.eq(TbFreeDineConfig::getShopId, shopId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user