From f774a91be6fbafa31865c591013ecba4e9f939f1 Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期二, 10 十二月 2024 15:47:52 +0800
Subject: [PATCH] 1.

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
index 7724e42..9a67c80 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -142,6 +142,12 @@
             }
             technician = shopdetail.getData();
         }
+        R<TechnicianSubscribe> subscribeR = technicianClient.getSubscribeByOrderId(orderId);
+        if (!R.isSuccess(subscribeR)){
+            throw new ServiceException("获取预约信息失败");
+        }
+        TechnicianSubscribe subscribe = subscribeR.getData();
+
         Shop shop = shopR.getData();
         orderDetailVO.setId(order.getId());
         orderDetailVO.setOrderStatus(order.getOrderStatus());
@@ -166,6 +172,7 @@
         orderDetailVO.setLatitude(shop.getLatitude());
         orderDetailVO.setShopId(shop.getId());
         orderDetailVO.setTechnicianName(technician.getName());
+        orderDetailVO.setTechnicianSubscribeId(String.valueOf(subscribe.getId()));
         return orderDetailVO;
     }
 
@@ -201,7 +208,7 @@
     public void writeOff(String code,Integer shopId) {
         LoginUser loginUserApplet = tokenService.getLoginUserApplet();
         Order order = orderMapper.selectOne(new LambdaQueryWrapper<Order>()
-                .eq(Order::getOrderNumber, code));
+                .eq(Order::getId, code));
         boolean check = check(order, shopId, loginUserApplet.getUserid());
         if (!check){
             throw new ServiceException("订单不存在");
@@ -210,14 +217,15 @@
         orderMapper.updateById(order);
         Integer orderType = order.getOrderType();
         if (orderType.equals(OrderType.SERVICE.getCode())){
-            R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId());
-            if (shopdetail.getCode() != R.SUCCESS){
-                throw new ServiceException("获取技师信息失败");
+            R<TechnicianSubscribe> subscribeR = technicianClient.getSubscribeByOrderId(order.getId());
+            if (R.isError(subscribeR)){
+                throw new ServiceException("获取预约信息失败");
             }
-            Technician technician = shopdetail.getData();
-            R<Void> r = technicianClient.updateStatus(2, technician.getId());
-            if (r.getCode() != R.SUCCESS){
-                throw new ServiceException("修改技师状态失败");
+            TechnicianSubscribe subscribe = subscribeR.getData();
+            subscribe.setStatus(2);
+            R<Void> r = technicianClient.updateStatus(subscribe.getStatus(), subscribe.getId());
+            if (R.isError(r)){
+                throw new ServiceException("更新预约状态失败");
             }
         }
 
@@ -234,12 +242,5 @@
         JSONObject jsonObject = JSONObject.parseObject(content);
         Long days = jsonObject.getLong("days");
         commissionService.addToCommissionDelayQueue(order.getId(), LocalDateTime.now().plusDays(days));
-    }
-
-
-
-    @Override
-    public void commission(Long orderId) {
-
     }
 }

--
Gitblit v1.7.1