From a655e8333623c49768aeb39c367ca43e0c742eea Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 8 Nov 2023 11:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4diam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighUserCardController.java | 2 +- .../com/web/controller/OrderController.java | 6 ++-- .../service/OrderCreateHandleService.java | 7 ++++ .../impl/OrderCreateHandleServiceImpl.java | 35 +++++++++++++++++++ .../impl/OrderPaySuccessServiceImpl.java | 6 +--- .../order/service/impl/OrderServiceImpl.java | 6 ++++ .../service/impl/HighOilCardServiceImpl.java | 2 ++ .../service/impl/HighUserCardServiceImpl.java | 2 +- 8 files changed, 56 insertions(+), 10 deletions(-) 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 dd7b7062..3c2c7844 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,4 +119,11 @@ public interface OrderCreateHandleService { */ HighChildOrder levelUp(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception; + /** + * 加油卡 + * @param order + * @param createOrderChildModel + * @return + */ + HighChildOrder oilCard(HighOrder order , CreateOrderChildModel createOrderChildModel); } 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 239651ba..dd667b48 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 @@ -153,6 +153,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Resource private HighOilCardOrderService highOilCardOrderService; + @Resource + private HighOilCardService oilCardService; + @Override public List couponHandle(HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception { if (createOrderChild.getSaleCount() != 1) { @@ -1137,4 +1140,36 @@ 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; + } } 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 05d94106..56053e6f 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 @@ -620,12 +620,10 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { } -<<<<<<< HEAD - private void oilCardHandle(String cardNo, HighOrder order) { oilCardService.recharge(cardNo, order.getOrderNo()); } -======= + private void levelUp(HighOrder order) { HighUserLevel userLevel = new HighUserLevel(); @@ -646,6 +644,4 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { } } - ->>>>>>> 7fcdfd2e6935a820db8abb66831c9c85be5d9aae } 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 183ccf12..00718698 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 { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知业务类型"); } 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);