Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

master
袁野 11 months ago
parent 39b5450654
commit f7fbf15176
  1. 105
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java

@ -1168,38 +1168,6 @@ 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, "未知的油卡");
}
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(createOrderChildModel.getGoodsPrice());
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setSaleCount(createOrderChildModel.getSaleCount());
childOrder.setGiveawayType(false);
childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber());
childOrder.setTotalPrice(childOrder.getGoodsPrice());
childOrder.setTotalActualPrice(childOrder.getGoodsPrice());
childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice()));
childOrder.setPraiseStatus(0);
childOrder.setCreateTime(new Date());
return childOrder;
}
@Override
public HighChildOrder group(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception {
@ -1254,78 +1222,7 @@ 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) {
@ -1372,7 +1269,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
}
@Override
public HighChildOrder petroCoupon(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception {
public HighChildOrder petroCoupon(HighOrder order, CreateOrderChildModel createOrderChildModel) {
ApiCoupon apiCoupon = apiCouponService.findCoupon(createOrderChildModel.getCouponCode());

Loading…
Cancel
Save