fix: 霸王餐充值接口开发
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.constant;
|
package com.chaozhanggui.system.cashierservice.constant;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public interface TableConstant {
|
public interface TableConstant {
|
||||||
@@ -28,6 +29,39 @@ public interface TableConstant {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum UseType {
|
||||||
|
TAKEOUT("takeout"),
|
||||||
|
DINE_IN_AFTER("dine-in-after"),
|
||||||
|
DINE_IN_BEFORE("dine-in-before");
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
UseType(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equalsVals(String value) {
|
||||||
|
return this.value.equals(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShopInfo {
|
||||||
|
@Getter
|
||||||
|
public enum EatModel {
|
||||||
|
TAKEOUT("takeout"),
|
||||||
|
DINE_IN("dine-in");
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
EatModel(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equalsVals(String value) {
|
||||||
|
return this.value.equals(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.entity;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -214,4 +215,8 @@ public class TbOrderInfo implements Serializable {
|
|||||||
this.createdAt = System.currentTimeMillis();
|
this.createdAt = System.currentTimeMillis();
|
||||||
this.isAccepted = 1;
|
this.isAccepted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getEatModel() {
|
||||||
|
return TableConstant.OrderInfo.UseType.TAKEOUT.equalsVals(this.getUseType()) ? TableConstant.ShopInfo.EatModel.TAKEOUT.getValue() : TableConstant.ShopInfo.EatModel.DINE_IN.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验就餐模式是否满足
|
// 校验就餐模式是否满足
|
||||||
if (!freeDineConfig.getUseType().contains(orderInfo.getUseType())) {
|
if (!freeDineConfig.getUseType().contains(orderInfo.getEatModel())) {
|
||||||
throw new MsgException("当前店铺未开启此就餐模式霸王餐");
|
throw new MsgException("当前店铺未开启此就餐模式霸王餐");
|
||||||
}
|
}
|
||||||
BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes()));
|
BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes()));
|
||||||
|
|||||||
Reference in New Issue
Block a user