Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
831d828588
|
|
@ -97,6 +97,17 @@ public interface TableConstant {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum PayType {
|
||||||
|
CREDIT_BUYER("creditBuyer");
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
PayType(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum UseType {
|
public enum UseType {
|
||||||
TAKEOUT("takeout"),
|
TAKEOUT("takeout"),
|
||||||
|
|
|
||||||
|
|
@ -31,5 +31,6 @@ public class PayDTO {
|
||||||
private Integer pointsNum;
|
private Integer pointsNum;
|
||||||
private Integer staffId;
|
private Integer staffId;
|
||||||
private String loginName;
|
private String loginName;
|
||||||
|
private String creditBuyerId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,15 +171,15 @@ public class TbCreditBuyerOrderServiceImpl extends ServiceImpl<TbCreditBuyerOrde
|
||||||
// 账户余额
|
// 账户余额
|
||||||
BigDecimal accountBalance = creditBuyer.getAccountBalance();
|
BigDecimal accountBalance = creditBuyer.getAccountBalance();
|
||||||
// 如果有余额的话,从余额里面扣除,没有余额的话,从信用额度里面扣除,余额和信用额度都为0,则不允许挂账,余额+信用额度刚好够支付这笔订单的话需要同时减余额减信用额度
|
// 如果有余额的话,从余额里面扣除,没有余额的话,从信用额度里面扣除,余额和信用额度都为0,则不允许挂账,余额+信用额度刚好够支付这笔订单的话需要同时减余额减信用额度
|
||||||
if (NumberUtil.isGreaterOrEqual(accountBalance, orderInfo.getPayAmount())) {
|
if (NumberUtil.isGreaterOrEqual(accountBalance, orderInfo.getOrderAmount())) {
|
||||||
// 减余额
|
// 减余额
|
||||||
creditBuyer.setAccountBalance(NumberUtil.sub(accountBalance, orderInfo.getPayAmount()));
|
creditBuyer.setAccountBalance(NumberUtil.sub(accountBalance, orderInfo.getOrderAmount()));
|
||||||
tbCreditBuyerMapper.updateById(creditBuyer);
|
tbCreditBuyerMapper.updateById(creditBuyer);
|
||||||
// 记录还款记录
|
// 记录还款记录
|
||||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||||
record.setCreditBuyerId(creditBuyerId);
|
record.setCreditBuyerId(creditBuyerId);
|
||||||
record.setOrderId(orderId);
|
record.setOrderId(orderId);
|
||||||
record.setRepaymentAmount(orderInfo.getPayAmount());
|
record.setRepaymentAmount(orderInfo.getOrderAmount());
|
||||||
record.setPaymentMethod("余额支付");
|
record.setPaymentMethod("余额支付");
|
||||||
record.setPaymentTime(new Date());
|
record.setPaymentTime(new Date());
|
||||||
record.setRemark("挂账时余额充足,直接从余额扣除");
|
record.setRemark("挂账时余额充足,直接从余额扣除");
|
||||||
|
|
@ -188,7 +188,7 @@ public class TbCreditBuyerOrderServiceImpl extends ServiceImpl<TbCreditBuyerOrde
|
||||||
TbCreditBuyerOrder entity = new TbCreditBuyerOrder();
|
TbCreditBuyerOrder entity = new TbCreditBuyerOrder();
|
||||||
entity.setCreditBuyerId(creditBuyerId);
|
entity.setCreditBuyerId(creditBuyerId);
|
||||||
entity.setOrderId(orderId);
|
entity.setOrderId(orderId);
|
||||||
entity.setPaidAmount(orderInfo.getPayAmount());
|
entity.setPaidAmount(orderInfo.getOrderAmount());
|
||||||
entity.setStatus("paid");
|
entity.setStatus("paid");
|
||||||
entity.setLastPaymentTime(new Date());
|
entity.setLastPaymentTime(new Date());
|
||||||
entity.setLastPaymentMethod(record.getPaymentMethod());
|
entity.setLastPaymentMethod(record.getPaymentMethod());
|
||||||
|
|
@ -219,14 +219,14 @@ public class TbCreditBuyerOrderServiceImpl extends ServiceImpl<TbCreditBuyerOrde
|
||||||
entity.setLastPaymentMethod(record.getPaymentMethod());
|
entity.setLastPaymentMethod(record.getPaymentMethod());
|
||||||
entity.setRemark(record.getRemark());
|
entity.setRemark(record.getRemark());
|
||||||
//super.save(entity);
|
//super.save(entity);
|
||||||
orderInfo.setPayAmount(NumberUtil.sub(orderInfo.getPayAmount(), accountBalance));
|
orderInfo.setPayAmount(NumberUtil.sub(orderInfo.getOrderAmount(), accountBalance));
|
||||||
}
|
}
|
||||||
// 剩余挂账额度
|
// 剩余挂账额度
|
||||||
BigDecimal remainingAmount = creditBuyer.getRemainingAmount();
|
BigDecimal remainingAmount = creditBuyer.getRemainingAmount();
|
||||||
// 验证挂账金额是否大于剩余额度
|
// 验证挂账金额是否大于剩余额度
|
||||||
boolean greater = NumberUtil.isGreater(orderInfo.getPayAmount(), remainingAmount);
|
boolean greater = NumberUtil.isGreater(orderInfo.getOrderAmount(), remainingAmount);
|
||||||
if (greater) {
|
if (greater) {
|
||||||
throw new BadRequestException(StrUtil.format("{}:¥{}不能大于剩余挂账额度({})", "挂账金额", orderInfo.getPayAmount(), remainingAmount));
|
throw new BadRequestException(StrUtil.format("{}:¥{}不能大于剩余挂账额度({})", "挂账金额", orderInfo.getOrderAmount(), remainingAmount));
|
||||||
}
|
}
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = new TbCreditBuyerOrder();
|
entity = new TbCreditBuyerOrder();
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||||
private final TbShopUserMapper tbShopUserMapper;
|
private final TbShopUserMapper tbShopUserMapper;
|
||||||
private final ThirdPartyCouponService thirdPartyCouponService;
|
private final ThirdPartyCouponService thirdPartyCouponService;
|
||||||
private final TbThirdPartyCouponRecordService thirdPartyCouponRecordService;
|
private final TbThirdPartyCouponRecordService thirdPartyCouponRecordService;
|
||||||
|
private final TbCreditBuyerOrderService creditBuyerOrderService;
|
||||||
|
|
||||||
private TbOrderInfo getCurrentOrder(ShopEatTypeInfoDTO eatTypeInfoDTO) {
|
private TbOrderInfo getCurrentOrder(ShopEatTypeInfoDTO eatTypeInfoDTO) {
|
||||||
// 获取当前台桌最新订单,先付款模式不获取
|
// 获取当前台桌最新订单,先付款模式不获取
|
||||||
|
|
@ -2141,7 +2142,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||||
|
|
||||||
// 获取优惠券信息
|
// 获取优惠券信息
|
||||||
OrderCouponInfoDTO couponInfo = new OrderCouponInfoDTO();
|
OrderCouponInfoDTO couponInfo = new OrderCouponInfoDTO();
|
||||||
if (!payDTO.getUserCouponInfos().isEmpty()) {
|
if (payDTO.getUserCouponInfos() != null && !payDTO.getUserCouponInfos().isEmpty()) {
|
||||||
couponInfo = getCouponInfo(payDTO.getVipUserId(), payDTO.getShopId(), payDTO.getUserCouponInfos(),
|
couponInfo = getCouponInfo(payDTO.getVipUserId(), payDTO.getShopId(), payDTO.getUserCouponInfos(),
|
||||||
orderInfo.getOrderAmount(), productIdSet);
|
orderInfo.getOrderAmount(), productIdSet);
|
||||||
}
|
}
|
||||||
|
|
@ -2281,6 +2282,13 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||||
boolean isOnline = false;
|
boolean isOnline = false;
|
||||||
|
|
||||||
switch (payDTO.getPayType()) {
|
switch (payDTO.getPayType()) {
|
||||||
|
case "creditBuyer":
|
||||||
|
if (payDTO.getCreditBuyerId() == null) {
|
||||||
|
throw new BadRequestException("挂单人不为空");
|
||||||
|
}
|
||||||
|
creditBuyerOrderService.save(payDTO.getCreditBuyerId(), Long.valueOf(orderInfo.getId()));
|
||||||
|
orderInfo.setPayType(TableConstant.OrderInfo.PayType.CREDIT_BUYER.getValue());
|
||||||
|
break;
|
||||||
case "vipPay":
|
case "vipPay":
|
||||||
if (payDTO.getVipUserId() != null) {
|
if (payDTO.getVipUserId() != null) {
|
||||||
orderInfo.setUserId(String.valueOf(payDTO.getVipUserId()));
|
orderInfo.setUserId(String.valueOf(payDTO.getVipUserId()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue