From 348e010644a859a74837b0ae5bf8fbaebc4bccb4 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 16 Nov 2023 16:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/web/controller/OrderController.java | 140 +++++++++++++----- .../com/hai/order/service/OrderService.java | 7 +- .../order/service/impl/OrderServiceImpl.java | 17 +++ 3 files changed, 130 insertions(+), 34 deletions(-) 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 7ce68487..f7a406af 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -279,65 +279,139 @@ public class OrderController { @RequestMapping(value="/getDetailByOrderNo",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号查询详情") - public ResponseData getDetailByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { + public ResponseData getDetailByOrderNo(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo) { try { - HighOrder highOrder = orderService.getOrderDetailByNo(orderNo); - if (highOrder.getProductType() == 12) { + if (StringUtils.isBlank(orderNo) && StringUtils.isBlank(paySerialNo)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, ""); + } + HighOrder highOrder = null; + if (StringUtils.isBlank(orderNo)) { + highOrder = orderService.getOrderDetailByNo(orderNo); + if (highOrder.getProductType() == 12) { + + // todo 临时代码 - // todo 临时代码 + for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { - for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { + GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(childOrder.getId()); + if (logistics != null) { + childOrder.setExt6(logistics.getLogisticsStatusDesc()); + childOrder.setExt4(logistics.getNumber()); + } - GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(childOrder.getId()); - if (logistics != null) { - childOrder.setExt6(logistics.getLogisticsStatusDesc()); - childOrder.setExt4(logistics.getNumber()); } - } + GoodsOrder order = goodsOrderExtService.findGoodsOrder(highOrder.getOrderNo()); + GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(order.getDeliveryAddressId()); - GoodsOrder order = goodsOrderExtService.findGoodsOrder(highOrder.getOrderNo()); - GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(order.getDeliveryAddressId()); + GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); + BeanUtils.copyProperties(highOrder , goodsOrderModel); + goodsOrderModel.setGoodsOrder(order); + goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress); - GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); - BeanUtils.copyProperties(highOrder , goodsOrderModel); - goodsOrderModel.setGoodsOrder(order); - goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress); + return ResponseMsgUtil.success(goodsOrderModel); - return ResponseMsgUtil.success(goodsOrderModel); + } else if (highOrder.getProductType() == 17) { - } else if (highOrder.getProductType() == 17) { + GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); + BeanUtils.copyProperties(highOrder , goodsOrderModel); - GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); - BeanUtils.copyProperties(highOrder , goodsOrderModel); + HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo()); - HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo()); + JSONObject object = groupService.getGroupContent(highGroupOrder.getGroupId()); - JSONObject object = groupService.getGroupContent(highGroupOrder.getGroupId()); + if (object.getString("return_code").equals("000000")) { + goodsOrderModel.setGroupData(object.getJSONObject("return_data")); + } - if (object.getString("return_code").equals("000000")) { - goodsOrderModel.setGroupData(object.getJSONObject("return_data")); - } + JSONObject objectStore = groupService.getStoreMsg(highGroupOrder.getStoreId()); + + if (objectStore.getString("return_code").equals("000000")) { + goodsOrderModel.setStoreData(objectStore.getJSONObject("return_data")); + } + + + Map map = new HashMap<>(); + map.put("orderId" , highOrder.getId()); + + HighGroupCode highGroupCode = groupCodeService.findGroupCode(map); + goodsOrderModel.setHighGroupCode(highGroupCode); + return ResponseMsgUtil.success(goodsOrderModel); + } + + + + + + } + + if (StringUtils.isBlank(paySerialNo)) { + highOrder = orderService.getOrderDetailBySerialNo(paySerialNo); + if (highOrder.getProductType() == 12) { + + // todo 临时代码 + + for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { - JSONObject objectStore = groupService.getStoreMsg(highGroupOrder.getStoreId()); + GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(childOrder.getId()); + if (logistics != null) { + childOrder.setExt6(logistics.getLogisticsStatusDesc()); + childOrder.setExt4(logistics.getNumber()); + } - if (objectStore.getString("return_code").equals("000000")) { - goodsOrderModel.setStoreData(objectStore.getJSONObject("return_data")); + } + + + GoodsOrder order = goodsOrderExtService.findGoodsOrder(highOrder.getOrderNo()); + GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(order.getDeliveryAddressId()); + + GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); + BeanUtils.copyProperties(highOrder , goodsOrderModel); + goodsOrderModel.setGoodsOrder(order); + goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress); + + + + return ResponseMsgUtil.success(goodsOrderModel); + + } else if (highOrder.getProductType() == 17) { + + GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); + BeanUtils.copyProperties(highOrder , goodsOrderModel); + + HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo()); + + JSONObject object = groupService.getGroupContent(highGroupOrder.getGroupId()); + + if (object.getString("return_code").equals("000000")) { + goodsOrderModel.setGroupData(object.getJSONObject("return_data")); + } + + JSONObject objectStore = groupService.getStoreMsg(highGroupOrder.getStoreId()); + + if (objectStore.getString("return_code").equals("000000")) { + goodsOrderModel.setStoreData(objectStore.getJSONObject("return_data")); + } + + + Map map = new HashMap<>(); + map.put("orderId" , highOrder.getId()); + + HighGroupCode highGroupCode = groupCodeService.findGroupCode(map); + goodsOrderModel.setHighGroupCode(highGroupCode); + return ResponseMsgUtil.success(goodsOrderModel); } - Map map = new HashMap<>(); - map.put("orderId" , highOrder.getId()); - HighGroupCode highGroupCode = groupCodeService.findGroupCode(map); - goodsOrderModel.setHighGroupCode(highGroupCode); - return ResponseMsgUtil.success(goodsOrderModel); + } diff --git a/hai-service/src/main/java/com/hai/order/service/OrderService.java b/hai-service/src/main/java/com/hai/order/service/OrderService.java index ead3252c..72c1791c 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderService.java @@ -73,7 +73,12 @@ public interface OrderService { */ HighOrder getOrderDetailByNo(String orderNo); - + /** + * 根据订单号查询交易订单号详情 + * @param paySerialNo 订单号 + * @return + */ + HighOrder getOrderDetailBySerialNo(String paySerialNo); /** * @Author Sum1Dream 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 1cbb586c..fbea33ff 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 @@ -831,6 +831,23 @@ public class OrderServiceImpl implements OrderService { return order; } + @Override + public HighOrder getOrderDetailBySerialNo(String paySerialNo) { + HighOrderExample orderExample = new HighOrderExample(); + orderExample.createCriteria().andPaySerialNoEqualTo(paySerialNo); + List orderList = orderMapper.selectByExample(orderExample); + if (orderList.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + HighOrder order = orderList.get(0); + + // 子订单 + HighChildOrderExample childOrderExample = new HighChildOrderExample(); + childOrderExample.createCriteria().andOrderIdEqualTo(order.getId()); + order.setHighChildOrderList(childOrderMapper.selectByExample(childOrderExample)); + return order; + } + @Override public HighOrder getOrderDetail(String orderNo) { HighOrderExample orderExample = new HighOrderExample();