From 09031fc86047fddb452198349dd3b77caf330f32 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Thu, 8 Aug 2024 16:31:29 +0800 Subject: [PATCH] 1 --- .../com/order/controller/OrderController.java | 2 ++ .../business/BsOrderStarbucksController.java | 2 +- .../com/hfkj/common/utils/StarbucksUtil.java | 2 +- .../hfkj/model/order/OrderStarbucksModel.java | 2 ++ .../hfkj/qianzhu/channel/StarbucksService.java | 17 ++++++++++------- .../service/order/OrderPaySuccessService.java | 13 +++++++++++-- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/order/src/main/java/com/order/controller/OrderController.java b/order/src/main/java/com/order/controller/OrderController.java index b52897f..e1b1536 100644 --- a/order/src/main/java/com/order/controller/OrderController.java +++ b/order/src/main/java/com/order/controller/OrderController.java @@ -57,6 +57,7 @@ public class OrderController { @ApiOperation(value = "创建订单") public ResponseData create(@RequestBody OrderModel body) { try { + System.out.println("body" + body.toString()); // 用户session UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); if (userSession == null) { @@ -86,6 +87,7 @@ public class OrderController { body.setUserName(userSession.getUser().getName()); body.setUserPhone(userSession.getUser().getPhone()); + return ResponseMsgUtil.success(orderService.create(body)); } catch (Exception e) { diff --git a/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java index 442eef1..51cadf0 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java @@ -89,7 +89,7 @@ public class BsOrderStarbucksController { starbucksModel.setStoreAddress(starbucks.get(0).getStoreAddress()); starbucksModel.setStoreName(starbucks.get(0).getStoreName()); starbucksModel.setUserPhone(starbucks.get(0).getUserPhone()); - + starbucksModel.setPayType(starbucks.get(0).getPayType()); starbucksModelList.add(starbucksModel); } diff --git a/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java b/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java index 31802fd..6d6c774 100644 --- a/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java @@ -55,7 +55,7 @@ public class StarbucksUtil { obj.put("cpu", "超大杯"); obj.put("notSelect", venti); obj.put("select", ventiSelect); - obj.put("volume", "473ml"); + obj.put("volume", "592ml"); obj.put("price", ventiPrice); break; default: diff --git a/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java b/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java index 56c49b0..e5c03e0 100644 --- a/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java +++ b/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java @@ -17,4 +17,6 @@ public class OrderStarbucksModel extends BsOrderChild{ private String storeName; private String userPhone; + + private Integer payType; } diff --git a/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java b/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java index adf7df0..cdca58f 100644 --- a/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java +++ b/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java @@ -103,14 +103,17 @@ public class StarbucksService { * @Author: Sum1Dream * @Date: 2024/8/1 下午2:21 */ - public static JSONObject starbucksOrdersPay(Map map) throws Exception { - - JSONObject object = QianZhuService.requestH5("starbucksOrders.pay" , map); + public static JSONObject starbucksOrdersPay(Map map) { + try { + JSONObject object = QianZhuService.requestH5("starbucksOrders.pay" , map); - if (object.getBoolean("success")) { - return object; - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!"); + if (object.getBoolean("success")) { + return object; + } else { + return null; + } + } catch (Exception e) { + return null; } } diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java index cb3026c..0260149 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java @@ -76,7 +76,7 @@ public class OrderPaySuccessService { } else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) { cinema(order, childOrder); } else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type4.getCode())) { - starbucks(childOrder); + starbucks(order , childOrder); } } catch (Exception e) { @@ -288,12 +288,21 @@ public class OrderPaySuccessService { } - public void starbucks(BsOrderChild childOrder) throws Exception { + public void starbucks(OrderModel order,BsOrderChild childOrder) { // 推送订单 // 查询星巴克订单 Map map = new HashMap<>(); map.put("orderNo", childOrder.getChannelOrderNo()); StarbucksService.starbucksOrdersPay(map); + + Map params = new HashMap<>(); + params.put("orderNo", childOrder.getOrderNo()); + List orderStarbucks = bsOrderStarbucksService.getList(params); + + for (BsOrderStarbucks bsOrderStarbucks : orderStarbucks) { + bsOrderStarbucks.setPayType(order.getPayType()); + bsOrderStarbucksService.update(bsOrderStarbucks); + } }