From 2bbe4eac73a88e806442e79f460ae8940c2f5228 Mon Sep 17 00:00:00 2001
From: luofl <1442745593@qq.com>
Date: 星期四, 27 二月 2025 11:33:25 +0800
Subject: [PATCH] 修改物流信息导入模板

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java |   49 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
index df64f87..7c2bf6d 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -291,6 +291,16 @@
             }
         }
 
+        if (user.getShopName() == null){
+            user.setShopName("");
+        }
+        if (user.getShopCover() == null){
+            user.setShopCover("");
+        }
+        if (user.getShopAddress() == null){
+            user.setShopAddress("");
+        }
+
         //指导老师
         allSuperiors.stream()
                 .filter(superiors -> superiors.getVipId() != null && superiors.getVipId() > 3)
@@ -300,12 +310,23 @@
                     user.setTeacherPhone(superiors.getPhone());
                 });
 
+        if (user.getTeacher() == null){
+            user.setTeacher("");
+        }
+        if (user.getTeacherPhone() == null){
+            user.setTeacherPhone("");
+        }
+
+
 
 
         //获取绑定上级
         if (user.getInviteUserId() != null) {
             AppUser byId = appUserService.getById(user.getInviteUserId());
             user.setTopUser(byId);
+        }else {
+            AppUser topUser = new AppUser();
+            user.setTopUser(topUser);
         }
         //获取绑定下级列表
         List<AppUser> list = appUserService.lambdaQuery()
@@ -481,21 +502,13 @@
                 .ifPresent(superiors -> {
                     user.setTeacher(superiors.getName());
                 });
-        //当前绑定门店的店铺信息(服务商)
-        for (AppUser allSuperior : allSuperiors) {
-            List<Shop> shopList = shopClient.getShopByUserId(allSuperior.getId()).getData();
-            if (!CollectionUtils.isEmpty(shopList)){
-                user.setShopName(shopList.get(0).getName());
-                break;
-            }
+        
+        Shop shop1 = shopClient.getServiceProvider(userId).getData();
+        if(null != shop1){
+            user.setShopName(shop1.getName());
+            user.setShopId(shop1.getId());
         }
-//        if (user.getShopId() != null) {
-//            R<Shop> storeById = shopClient.getShopById(user.getShopId());
-//            if (storeById.getData() != null) {
-//                Shop shop = storeById.getData();
-//                user.setShopName(shop.getName());
-//            }
-//        }
+
         ArrayList<Long> userIds = new ArrayList<>();
         userIds.add(userId);
         // 获取当前用户的所有下级
@@ -891,11 +904,9 @@
         Long userid = tokenService.getLoginUser().getUserid();
         SysUser sysUser = sysUserClient.getSysUser(userid).getData();
         AppUser byId = appUserService.getById(id);
-        if (byId.getShopId() != null) {
-            R<Shop> shopById = shopClient.getShopById(Integer.parseInt(String.valueOf(byId.getShopId())));
-            if (shopById.getData() != null) {
-                byId.setShopName(shopById.getData().getName());
-            }
+        Shop shop1 = shopClient.getServiceProvider(id).getData();
+        if(null != shop1){
+            byId.setShopName(shop1.getName());
         }
         R<List<Shop>> shopByUserId = shopClient.getShopByUserId(id);
         if (shopByUserId.getData() != null) {

--
Gitblit v1.7.1