From 5c6b1469792343d30781074c18880259498109b4 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 09 一月 2025 18:11:37 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
index 931bc30..237be21 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -15,6 +15,8 @@
 import com.ruoyi.other.service.TechnicianService;
 import com.ruoyi.other.vo.TechnicianDetailVO;
 import com.ruoyi.other.vo.TechnicianVO;
+import com.ruoyi.system.api.domain.SysUser;
+import com.ruoyi.system.api.feignClient.SysUserClient;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -41,6 +43,10 @@
     private TechnicianScoreService technicianScoreService;
     @Resource
     private TokenService tokenService;
+    @Resource
+    private SysUserClient sysUserClient;
+
+
 
 //        @PostMapping("/shop/list")
 //	@ApiOperation(value = "获取门店的技师列表", tags = {"小程序-门店详情-技师预约"})
@@ -127,10 +133,11 @@
     @PostMapping("/manage/addorupdate")
     @ApiOperation(value = "添加编辑", tags = {"门店-技师列表"})
     public R<Page<Technician>> add(@RequestBody Technician technician) {
-        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
+        Long userid = tokenService.getLoginUser().getUserid();
+        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
         if (technician.getId()==null) {
             technician.setSubscribeStatus(2);
-            List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).list();
+            List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).eq(Technician::getShopId, sysUser.getObjectId()).list();
             if (!list.isEmpty()) {
                 return R.fail("当前号码已经添加");
             }
@@ -141,7 +148,7 @@
         }else {
             Technician byId = technicianService.getById(technician.getId());
             if (byId.getPhone()!=technician.getPhone()){
-                List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).list();
+                List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).eq(Technician::getShopId, sysUser.getObjectId()).list();
                 if (!list.isEmpty()) {
                     return R.fail("当前号码已经添加");
                 }
@@ -151,7 +158,7 @@
                 }
             }
         }
-        technician.setShopId(objectId);
+        technician.setShopId(sysUser.getObjectId());
         R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone());
         if (appUserByPhone1.getData()!=null){
             technician.setAppUserId(appUserByPhone1.getData().getId());

--
Gitblit v1.7.1