From 43f0578e80af82ecae6c61b51bd0539c6b960603 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期二, 16 八月 2022 19:08:32 +0800
Subject: [PATCH] 服务范围优化

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java
index 6c1f5b2..802ba20 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java
@@ -1,17 +1,21 @@
 package com.panzhihua.service_community.api;
 
 
+import cn.hutool.core.util.ArrayUtil;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.dtos.property.CommonPage;
 import com.panzhihua.service_community.dao.ComAreaTownCommunityDao;
 import com.panzhihua.common.model.vos.community.acid.ComAreaCounty;
 import com.panzhihua.service_community.entity.ComAreaTownCommunity;
 import com.panzhihua.service_community.service.ComAreaTownCommunityService;
+import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -89,13 +93,21 @@
     }
 
     @GetMapping("/areaTownCommunity")
-    public R test(@RequestParam("name")String name){
+    public R test(@RequestParam("name")String name,@RequestParam("userId")Long userId){
+        Long[] idArray={4L,17959L,16522L,16196L,16214L,17949L,89234L};
         if("panzhihua".equals(name)){
             List<ComAreaCounty> list=comAreaTownCommunityDao.selectArea();
             list.forEach(lis->{
                 List<ComAreaCounty> townList=comAreaTownCommunityDao.selectTown(lis.getValue());
                 townList.forEach(tow->{
-                    tow.setChildren(comAreaTownCommunityDao.selectCommunity(tow.getValue()));
+                    List<ComAreaCounty> list1=new ArrayList<>();
+                    if(ArrayUtil.contains(idArray,userId)){
+                        list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"学园社区");
+                    }
+                    else {
+                        list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"");
+                    }
+                    tow.setChildren(list1);
                 });
                 lis.setChildren(townList);
             });
@@ -105,13 +117,26 @@
             List<ComAreaCounty> townList=comAreaTownCommunityDao.selectTown(name);
             if(!CollectionUtils.isEmpty(townList)){
                 townList.forEach(tow->{
-                    tow.setChildren(comAreaTownCommunityDao.selectCommunity(tow.getValue()));
+                    List<ComAreaCounty> list1=new ArrayList<>();
+                    if(ArrayUtil.contains(idArray,userId)){
+                        list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"学园社区");
+                    }
+                    else {
+                        list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"");
+                    }
+                    tow.setChildren(list1);
                 });
                 return R.ok(townList);
             }
             else {
-                List<ComAreaCounty> list=comAreaTownCommunityDao.selectCommunity(name);
-                return R.ok(list);
+                List<ComAreaCounty> list1=new ArrayList<>();
+                if(ArrayUtil.contains(idArray,userId)){
+                    list1=comAreaTownCommunityDao.selectCommunity(name,"学园社区");
+                }
+                else {
+                    list1=comAreaTownCommunityDao.selectCommunity(name,"");
+                }
+                return R.ok(list1);
             }
         }
 

--
Gitblit v1.7.1