From 449fd341e89d8b1990a054f1df2fa67010c3f40c Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期一, 18 七月 2022 13:26:35 +0800
Subject: [PATCH] 社区/村落列表接口更新

---
 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
index 89a5ad9..9518fa7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -13,6 +13,8 @@
 
 import javax.annotation.Resource;
 
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
@@ -41,6 +43,7 @@
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -3444,7 +3447,6 @@
         if (userProportions.size()>0){
             for (UserProportion userProportion : userProportions) {
                 if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){
-                    log.info("统计数据"+userProportion);
                     UserRateAnalysisVO vo=new UserRateAnalysisVO();
                     if (monthRange){
                         if (userProportion.getCommunityId().equals("11")){
@@ -3459,7 +3461,6 @@
                     }
                     vo.setName(typeToName(type,userProportion ));
                     vo.setCount(userProportion.getUser());
-                    log.info("统计后数据+"+vo);
                     userRateAnalysisVOList.add(vo);
                 }
             }
@@ -3603,6 +3604,38 @@
     }
 
     @Override
+    public R getCommunityList(Integer type) {
+        List<Integer> areaList = areaCodeList();
+        List<AreaVOS> areaVOList=new ArrayList<>();
+        for (Integer code : areaList) {
+            AreaVOS areaVO=new AreaVOS();
+            areaVO.setId(code);
+            areaVO.setName(areaCodeToName(code.longValue()));
+            List<StreetVO> streetVOS = userDao.selectStreetByAreaCode(code);
+            Iterator<StreetVO> iterator = streetVOS.listIterator();
+            while (iterator.hasNext()){
+                StreetVO vo = iterator.next();
+                List<CommunityVO> communityVOS = userDao.selectCommunityByStreetId(vo.getId(), type);
+                vo.setCommunityList(communityVOS);
+                if (communityVOS==null || communityVOS.size()==0){
+                    iterator.remove();
+                }
+            }
+            List<StreetVOS> list=new ArrayList<>();
+            for (StreetVO streetVO : streetVOS) {
+                StreetVOS vo=new StreetVOS();
+                vo.setId(streetVO.getId());
+                vo.setName(streetVO.getName());
+                vo.setChildList(streetVO.getCommunityList());
+                list.add(vo);
+            }
+            areaVO.setChildList(list);
+            areaVOList.add(areaVO);
+        }
+        return R.ok(areaVOList);
+    }
+
+    @Override
     public R getAreaAndStreet() {
         List<Integer> areaCodeList=areaCodeList();
         List<AreaVO> areaVOList=new ArrayList<>();

--
Gitblit v1.7.1