From 097b9534a78606e113d58111fa7da285bacf3919 Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期一, 09 十二月 2024 14:25:43 +0800
Subject: [PATCH] 1.

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java              |   10 ++++++++++
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml                  |    4 ++--
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java |   18 +++++++++++++++++-
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
index 63dc0de..2227c38 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
@@ -1,11 +1,16 @@
 package com.ruoyi.other.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.api.feignClient.UserAddressClient;
+import com.ruoyi.account.api.model.UserAddress;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.other.mapper.TechnicianMapper;
 import com.ruoyi.other.api.domain.Technician;
 import com.ruoyi.other.service.TechnicianService;
 import com.ruoyi.other.vo.TechnicianDetailVO;
 import com.ruoyi.other.vo.TechnicianVO;
+import com.ruoyi.system.api.model.LoginUser;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -23,6 +28,10 @@
 public class TechnicianServiceImpl extends ServiceImpl<TechnicianMapper, Technician> implements TechnicianService {
     @Resource
     private TechnicianMapper technicianMapper;
+    @Resource
+    private TokenService tokenService;
+    @Resource
+    private UserAddressClient userAddressClient;
 
     @Override
     public List<TechnicianVO> getTechnicianListByShopId(Long shopId) {
@@ -31,6 +40,13 @@
 
     @Override
     public TechnicianDetailVO technicianDetail(Long technicianId) {
-        return technicianMapper.selectTechnicianDetail(technicianId);
+        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
+        R<UserAddress> defaultUserAddressR = userAddressClient.getDefaultUserAddress(loginUserApplet.getUserid());
+        if (R.isError(defaultUserAddressR)){
+            throw new RuntimeException("获取默认地址失败");
+        }
+        TechnicianDetailVO technicianDetailVO = technicianMapper.selectTechnicianDetail(technicianId);
+        technicianDetailVO.setAddress(defaultUserAddressR.getData());
+        return technicianDetailVO;
     }
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java
index 63d3063..223c795 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java
@@ -1,5 +1,6 @@
 package com.ruoyi.other.vo;
 
+import com.ruoyi.account.api.model.UserAddress;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -49,4 +50,13 @@
     @ApiModelProperty(value = "技师详情图")
     private String infoPicture;
 
+    @ApiModelProperty(value = "预约状态(1=可预约,2=不可预约)")
+    private Integer subscribeStatus;
+
+    /**
+     * 默认地址
+     */
+    @ApiModelProperty(value = "默认地址")
+    private UserAddress address;
+
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
index 5e8ebde..e533c82 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
@@ -16,7 +16,6 @@
         WHERE
           tt.`status` = 2
           AND tt.del_flag = 0
-          AND tt.subscribe_status = 1
           AND tt.shop_id = #{shopId}
         GROUP BY
             tt.id,
@@ -27,6 +26,7 @@
     <select id="selectTechnicianDetail" resultType="com.ruoyi.other.vo.TechnicianDetailVO">
         SELECT
             tt.id,
+            tt.subscribe_status,
             tt.`name`,
             tt.introduction,
             tt.home_picture,
@@ -41,10 +41,10 @@
         WHERE
           tt.`status` = 2
           AND tt.del_flag = 0
-          AND tt.subscribe_status = 1
           AND tt.id = #{technicianId}
         GROUP BY
             tt.id,
+            tt.subscribe_status,
             tt.`name`,
             tt.introduction,
             tt.home_picture,

--
Gitblit v1.7.1