diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java index b5ca0b0a..5fbf0bb2 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java @@ -372,7 +372,7 @@ public class HighUserCardController { } - @RequestMapping(value = "/applyOilCard", method = RequestMethod.GET) + @RequestMapping(value = "/applyOilCard", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "申请个人加油卡") public ResponseData applyOilCard(HttpServletRequest request) { diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index 9dc089a3..13f3e355 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -149,10 +149,10 @@ public class OrderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请选择收货地址!"); } - } else if (childModel.getGoodsType().equals(OrderChildGoodsType.TYPE14.getNumber())) { - if (childModel.getGoodsSpecName() == null) { + } else if (childModel.getGoodsType().equals(OrderChildGoodsType.TYPE15.getNumber())) { + if (childModel.getGoodsPrice() == null) { log.error("OrderController -> create() error!",""); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入卡号"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请选择规格!"); } } diff --git a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java index 27f98a28..818cf828 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java @@ -119,6 +119,13 @@ public interface OrderCreateHandleService { */ HighChildOrder levelUp(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception; + /** + * 加油卡 + * @param order + * @param createOrderChildModel + * @return + */ + HighChildOrder oilCard(HighOrder order , CreateOrderChildModel createOrderChildModel); /** * @Author Sum1Dream * @Name group diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 5fdeaf51..4c860f47 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -158,6 +158,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Resource private HighOilCardOrderService highOilCardOrderService; + @Resource + private HighOilCardService oilCardService; + @Resource private GroupCodeService groupCodeService; @@ -1146,6 +1149,38 @@ 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 { diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index c4383b19..ab2eb168 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -630,6 +630,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { private void oilCardHandle(String cardNo, HighOrder order) { oilCardService.recharge(cardNo, order.getOrderNo()); } + private void levelUp(HighOrder order) { HighUserLevel userLevel = new HighUserLevel(); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 8ab08980..294dae47 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -363,6 +363,12 @@ public class OrderServiceImpl implements OrderService { order.setProductType(OrderProductType.PRODUCT_TYPE15.getNumber()); order.setSecUserId(childOrder.getId()); order.setTitle("升级会员"); + } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE15.getNumber())) { + + HighChildOrder childOrder = orderCreateHandleService.oilCard(order , child); + childOrderList.add(childOrder); + order.setProductType(OrderProductType.PRODUCT_TYPE16.getNumber()); + order.setTitle("油卡充值"); } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE17.getNumber())) { HighChildOrder childOrder = orderCreateHandleService.group(order , child); childOrderList.add(childOrder); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOilCardServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOilCardServiceImpl.java index ac4ebe84..dbe1eca2 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOilCardServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOilCardServiceImpl.java @@ -107,6 +107,8 @@ public class HighOilCardServiceImpl implements HighOilCardService { oilCard.setBindStatus(OilCardBindStatusEnum.status1.getStatus()); oilCard.setBindTime(new Date()); oilCard.setGetType(OilCardGetTypeEnum.type2.getCode()); + oilCard.setContactName(user.getName()); + oilCard.setContactPhone(user.getPhone()); editData(oilCard); // 绑定用户 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java index 03e09859..89462977 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java @@ -65,7 +65,7 @@ public class HighUserCardServiceImpl implements HighUserCardService { } @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation= Propagation.REQUIRED) public void bindCard(Integer type, String cardNo,Long userId) { HighUserCard userCard = new HighUserCard(); userCard.setType(type);