|
|
|
@ -165,9 +165,11 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { |
|
|
|
|
@Resource |
|
|
|
|
private GroupCodeService groupCodeService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private ApiCouponService apiCouponService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<HighChildOrder> couponHandle(HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception { |
|
|
|
|
if (createOrderChild.getSaleCount() != 1) { |
|
|
|
@ -1252,6 +1254,79 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { |
|
|
|
|
return childOrder; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HighChildOrder oilCard(HighOrder order, CreateOrderChildModel createOrderChildModel) { |
|
|
|
|
// 查询油卡
|
|
|
|
|
HighOilCard card = oilCardService.getOilCardByCardNo(createOrderChildModel.getGoodsId().toString()); |
|
|
|
|
if (card == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油卡"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 充值金额
|
|
|
|
|
BigDecimal rechargeAmount = createOrderChildModel.getGoodsPrice(); |
|
|
|
|
// 赠送金额
|
|
|
|
|
BigDecimal givePrice = new BigDecimal("0"); |
|
|
|
|
|
|
|
|
|
SecConfig rechargeRatio = secConfigService.findByCodeType("OIL_CARD_RECHARGE_RATIO"); |
|
|
|
|
if (rechargeRatio != null && StringUtils.isNotBlank(rechargeRatio.getCodeValue())) { |
|
|
|
|
BigDecimal ratio = new BigDecimal(rechargeRatio.getCodeValue()).divide(new BigDecimal("100")); |
|
|
|
|
givePrice = rechargeAmount.multiply(ratio).setScale(2, RoundingMode.DOWN); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HighChildOrder childOrder = new HighChildOrder(); |
|
|
|
|
childOrder.setOrderNo(order.getOrderNo()); |
|
|
|
|
childOrder.setMemId(order.getMemId()); |
|
|
|
|
childOrder.setMemName(order.getMemName()); |
|
|
|
|
childOrder.setMemPhone(order.getMemPhone()); |
|
|
|
|
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); |
|
|
|
|
childOrder.setGoodsType(OrderChildGoodsType.TYPE15.getNumber()); |
|
|
|
|
childOrder.setGoodsId(card.getId()); |
|
|
|
|
childOrder.setGoodsName("油卡充值"); |
|
|
|
|
childOrder.setGoodsSpecName(card.getCardNo()); |
|
|
|
|
childOrder.setGoodsPrice(rechargeAmount.add(givePrice)); |
|
|
|
|
childOrder.setGoodsActualPrice(createOrderChildModel.getGoodsPrice()); |
|
|
|
|
childOrder.setSaleCount(createOrderChildModel.getSaleCount()); |
|
|
|
|
childOrder.setGiveawayType(false); |
|
|
|
|
childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); |
|
|
|
|
childOrder.setTotalPrice(childOrder.getGoodsPrice()); |
|
|
|
|
childOrder.setTotalActualPrice(createOrderChildModel.getGoodsPrice()); |
|
|
|
|
childOrder.setTotalDeductionPrice(createOrderChildModel.getGoodsPrice().subtract(childOrder.getTotalActualPrice())); |
|
|
|
|
childOrder.setPraiseStatus(0); |
|
|
|
|
childOrder.setCreateTime(new Date()); |
|
|
|
|
childOrder.setExt1(givePrice.toString()); |
|
|
|
|
return childOrder; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HighChildOrder petroCoupon(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception { |
|
|
|
|
|
|
|
|
|
ApiCoupon apiCoupon = apiCouponService.findCoupon(createOrderChildModel.getCouponCode()); |
|
|
|
|
|
|
|
|
|
// 生成交易子订单
|
|
|
|
|
HighChildOrder childOrder = new HighChildOrder(); |
|
|
|
|
childOrder.setOrderNo(order.getOrderNo()); |
|
|
|
|
childOrder.setMemId(order.getMemId()); |
|
|
|
|
childOrder.setMemName(order.getMemName()); |
|
|
|
|
childOrder.setMemPhone(order.getMemPhone()); |
|
|
|
|
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); |
|
|
|
|
childOrder.setGoodsType(OrderChildGoodsType.TYPE12.getNumber()); |
|
|
|
|
childOrder.setGoodsId(apiCoupon.getId()); |
|
|
|
|
childOrder.setGoodsName(apiCoupon.getName()); |
|
|
|
|
childOrder.setGoodsSpecName(apiCoupon.getCode()); |
|
|
|
|
childOrder.setGoodsPrice(new BigDecimal(apiCoupon.getPrice())); |
|
|
|
|
childOrder.setGoodsActualPrice(createOrderChildModel.getPrice()); |
|
|
|
|
childOrder.setSaleCount(createOrderChildModel.getSaleCount()); |
|
|
|
|
childOrder.setGiveawayType(false); |
|
|
|
|
childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); |
|
|
|
|
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); |
|
|
|
|
childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); |
|
|
|
|
childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); |
|
|
|
|
childOrder.setPraiseStatus(0); |
|
|
|
|
childOrder.setCreateTime(new Date()); |
|
|
|
|
|
|
|
|
|
return childOrder; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HighChildOrder oilCard(HighOrder order, CreateOrderChildModel createOrderChildModel) { |
|
|
|
|
// 查询油卡
|
|
|
|
|