From 1690d4d06b0c20b3606e50e0844ef67e07947a0d Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期二, 10 十二月 2024 14:05:59 +0800
Subject: [PATCH] 1.

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java          |    3 +--
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java                        |    1 -
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java               |   22 ++++++++--------------
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java            |    6 +++++-
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java |    8 +++++++-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java    |    7 +++++++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java                     |    3 ++-
 7 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java
index 3fc2995..1cdb2b2 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.other.api.domain.Technician;
+import com.ruoyi.other.api.domain.TechnicianSubscribe;
 import com.ruoyi.other.api.feignClient.TechnicianClient;
 import org.springframework.cloud.openfeign.FallbackFactory;
 
@@ -15,9 +16,14 @@
             }
 
             @Override
-            public R<Void> updateStatus(Integer status, Integer subscribeId) {
+            public R<Void> updateStatus(Integer status, Long subscribeId) {
                 return R.fail("跟新技师预约状态失败:" + cause.getMessage());
             }
+
+            @Override
+            public R<TechnicianSubscribe> getSubscribeByOrderId(Long orderId) {
+                return R.fail("根据订单id获取预约信息失败:" + cause.getMessage());
+            }
         };
     }
 }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
index bcec36a..5a9ad6a 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
@@ -3,6 +3,7 @@
 import com.ruoyi.common.core.constant.ServiceNameConstants;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.other.api.domain.Technician;
+import com.ruoyi.other.api.domain.TechnicianSubscribe;
 import com.ruoyi.other.api.factory.TechnicianClientFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,5 +17,8 @@
     R<Technician> shopdetail(@RequestParam("id") Integer techId);
 
     @PutMapping("/technician-subscribe/updateStatus")
-    R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Integer subscribeId);
+    R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Long subscribeId);
+
+    @GetMapping("/technician-subscribe/getSubscribeByOrderId")
+    R<TechnicianSubscribe> getSubscribeByOrderId(@RequestParam("orderId") Long orderId);
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
index 6250043..d710205 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -24,5 +24,4 @@
 
     void writeOff(String code,Integer shopId);
 
-    void commission(Long orderId);
 }
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..31860a6 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
@@ -210,14 +210,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 +235,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) {
-
     }
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
index 6e9eb75..b4fab11 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
@@ -75,8 +75,7 @@
         List<GoodsCategory> indexlist = goodsCategoryService.lambdaQuery()
                 .orderByDesc(GoodsCategory::getCreateTime)
                 .last("limit 8")
-                .list()
-                ;
+                .list();
         return R.ok(indexlist);
     }
     @GetMapping("/list")
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
index 44975f1..5c09cf5 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -104,6 +104,13 @@
         return R.ok(technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status));
     }
 
+    @GetMapping("/getSubscribeByOrderId")
+    @ApiOperation(value = "根据订单id获取预约信息", notes = "根据订单id获取预约信息", tags = {"后台-技师预约管理-根据订单id获取预约信息"})
+    public R<TechnicianSubscribe> getSubscribeByOrderId(@ApiParam(value = "订单id") @RequestParam Long orderId) {
+        return R.ok(technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>()
+                .eq(TechnicianSubscribe::getOrderId, orderId)));
+    }
+
 
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
index 1ca3e83..9143f45 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
@@ -4,6 +4,7 @@
 import com.ruoyi.other.api.domain.Technician;
 import com.ruoyi.other.vo.TechnicianDetailVO;
 import com.ruoyi.other.vo.TechnicianVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,7 +18,7 @@
  */
 public interface TechnicianMapper extends BaseMapper<Technician> {
 
-    List<TechnicianVO> selectTechnicianListByShopId(Long shopId, String name);
+    List<TechnicianVO> selectTechnicianListByShopId(@Param("shopId") Long shopId,@Param("name") String name);
 
     TechnicianDetailVO selectTechnicianDetail(Long technicianId);
 

--
Gitblit v1.7.1