From 6891ae6f2d5313bcebff27e43f40e99c7ce715c8 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 07 五月 2025 17:32:46 +0800
Subject: [PATCH] 分析统计

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java                |  120 +++++++++++---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java                  |    2 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserListVo.java                |    5 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/RegionVO.java                       |    4 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserLevelServiceImpl.java |    2 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsRegionVo.java     |   21 ++
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java        |  223 +++++++++++++++++++++++++--
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUserLevel.java            |    8 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java       |   16 ++
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsDataVo.java       |   25 +++
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java                 |    5 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsFourVo.java       |    8 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintService.java               |    8 +
 13 files changed, 390 insertions(+), 57 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java
index 26587fc..a55aeb8 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java
@@ -2,25 +2,26 @@
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.panzhihua.common.controller.BaseController;
 import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.utlis.DateUtils;
-import com.panzhihua.sangeshenbian.model.entity.Complaint;
+import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo;
+import com.panzhihua.sangeshenbian.model.entity.*;
 import com.panzhihua.sangeshenbian.model.query.AnalyticStatisticsQuery;
-import com.panzhihua.sangeshenbian.model.vo.AnalyticStatisticsOneVo;
-import com.panzhihua.sangeshenbian.model.vo.AnalyticStatisticsThreeVo;
-import com.panzhihua.sangeshenbian.model.vo.AnalyticStatisticsTwoVo;
-import com.panzhihua.sangeshenbian.service.IComplaintService;
+import com.panzhihua.sangeshenbian.model.vo.*;
+import com.panzhihua.sangeshenbian.service.*;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -33,16 +34,37 @@
 @RestController
 @RequestMapping("/analytic-statistics")
 @Validated
-public class AnalyticStatisticsController {
+public class AnalyticStatisticsController extends BaseController {
 
     @Autowired
     private IComplaintService complaintService;
 
+    @Autowired
+    private ISystemUserLevelService systemUserLevelService;
+
+    @Resource
+    private IBcRegionService bcRegionService;
+
+    @Resource
+    private IComStreetService comStreetService;
+
+    @Resource
+    private IComActService comActService;
+
     @PostMapping("/data")
     @ApiOperation(value = "分析统计", tags = {"三个身边后台-分析统计"})
-    public R<?> data(@Valid @RequestBody AnalyticStatisticsQuery query){
-        // TODO 判断当前账号的层级  如果包含市级 可以查看所有  包含区县多个  包含镇多个 包含村多个
-        LambdaQueryWrapper<Complaint> wrapper = new LambdaQueryWrapper<Complaint>().eq(Complaint::getCityCode, query.getCityCode());
+    public R<AnalyticStatisticsDataVo> data(@Valid @RequestBody AnalyticStatisticsQuery query){
+        SystemUserVo loginUserInfoSanGeShenBian = getLoginUserInfoSanGeShenBian();
+        Integer id = loginUserInfoSanGeShenBian.getId();
+        List<SystemUserLevel> listBySystemUsers = systemUserLevelService.getListBySystemUserId(id);
+        if(listBySystemUsers.size()==0){
+            return R.ok(new AnalyticStatisticsDataVo());
+        }
+
+        LambdaQueryWrapper<Complaint> wrapper = new LambdaQueryWrapper<Complaint>();
+        if(query.getCityCode()!=null){
+            wrapper.eq(Complaint::getCityCode, query.getCityCode());
+        }
         if(query.getDistrictCode()!=null){
             wrapper.eq(Complaint::getDistrictsCode, query.getDistrictCode());
         }
@@ -51,6 +73,44 @@
         }
         if(query.getCommunityId()!=null){
             wrapper.eq(Complaint::getCommunityId, query.getCommunityId());
+        }
+        // 都为空 查他有的
+        if(query.getCityCode()==null && query.getDistrictCode()==null && query.getStreetId()==null && query.getCommunityId()==null){
+            // 看是否直接是市级账号
+            SystemUserLevel systemUserLevel = listBySystemUsers.stream().filter(e -> e.getLevel() == 1).findFirst().orElse(null);
+            if(systemUserLevel==null){
+                List<String> districtsCodes=new ArrayList<>();
+                List<String> streetIds=new ArrayList<>();
+                List<Long> communityIds=new ArrayList<>();
+                // 不是市级 查看是否是区县账号
+                List<SystemUserLevel> systemUserLevels2 = listBySystemUsers.stream().filter(e -> e.getLevel() == 2).collect(Collectors.toList());
+                if(systemUserLevels2.size()>0){
+                    districtsCodes = systemUserLevels2.stream().map(SystemUserLevel::getDistrictsCode).collect(Collectors.toList());
+                }else {
+                    districtsCodes.add("0");
+                }
+
+                List<SystemUserLevel> systemUserLevels3 = listBySystemUsers.stream().filter(e -> e.getLevel() == 3).collect(Collectors.toList());
+                if(systemUserLevels3.size()>0){
+                    streetIds = systemUserLevels3.stream().filter(e -> !systemUserLevels2.contains(e.getDistrictsCode())).map(SystemUserLevel::getStreetId).collect(Collectors.toList());
+                }else {
+                    streetIds.add("0");
+                }
+
+                List<SystemUserLevel> systemUserLevels4 = listBySystemUsers.stream().filter(e -> e.getLevel() == 4).collect(Collectors.toList());
+                if(systemUserLevels4.size()>0){
+                    communityIds = systemUserLevels4.stream().filter(e -> !systemUserLevels3.contains(e.getStreetId()) && !systemUserLevels2.contains(e.getDistrictsCode())).map(SystemUserLevel::getCommunityId).collect(Collectors.toList());
+                }else {
+                    communityIds.add(0L);
+                }
+                List<String> finalDistrictsCodes = districtsCodes;
+                List<String> finalStreetIds = streetIds;
+                List<Long> finalCommunityIds = communityIds;
+                wrapper.and(wrapper1 -> {
+                    wrapper1.in(Complaint::getDistrictsCode, finalDistrictsCodes).or().in(Complaint::getStreetId, finalStreetIds).or().in(Complaint::getCommunityId, finalCommunityIds);
+                });
+
+            }
         }
 
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -64,13 +124,140 @@
         // 第三部分数据
         List<AnalyticStatisticsThreeVo> analyticStatisticsThreeVos =complaintService.analyticStatisticsThree(query,complaints);
 
-        return R.ok(analyticStatisticsThreeVos);
+        // 第四部分数据
+        AnalyticStatisticsFourVo analyticStatisticsFourVos =complaintService.analyticStatisticsFour(complaints);
+
+
+        AnalyticStatisticsDataVo analyticStatisticsDataVo = new AnalyticStatisticsDataVo();
+        analyticStatisticsDataVo.setAnalyticStatisticsOneVo(analyticStatisticsOneVo);
+        analyticStatisticsDataVo.setAnalyticStatisticsTwoVos(analyticStatisticsTwoVos);
+        analyticStatisticsDataVo.setAnalyticStatisticsThreeVos(analyticStatisticsThreeVos);
+        analyticStatisticsDataVo.setAnalyticStatisticsFourVo(analyticStatisticsFourVos);
+
+        return R.ok(analyticStatisticsDataVo);
     }
 
 
-    public static void main(String[] args) {
-        String beforeDay = DateUtils.getBeforeDay(6);
-        System.out.println(beforeDay);
+
+
+    @GetMapping("/getRegion")
+    @ApiOperation(value = "分析统计--获取市-区县-街道-社区", tags = {"三个身边后台-分析统计--获取市-区县-街道-社区"})
+    public R<AnalyticStatisticsRegionVo> getRegion(){
+        SystemUserVo loginUserInfoSanGeShenBian = getLoginUserInfoSanGeShenBian();
+        Integer id = loginUserInfoSanGeShenBian.getId();
+        List<SystemUserLevel> listBySystemUsers = systemUserLevelService.getListBySystemUserId(id);
+        // 如果有市级权限  展示所有
+        SystemUserLevel systemUserLevel = listBySystemUsers.stream().filter(e -> e.getLevel() == 1).findFirst().orElse(null);
+
+        AnalyticStatisticsRegionVo analyticStatisticsRegionVo = new AnalyticStatisticsRegionVo();
+        if(systemUserLevel!=null){
+            // 查询所有的县 街道 社区
+            List<BcRegion> list = bcRegionService.list(new LambdaQueryWrapper<BcRegion>().eq(BcRegion::getParentId, 510400));
+
+            List<ComStreet> list1 = comStreetService.list(new LambdaQueryWrapper<ComStreet>().eq(ComStreet::getAreaCode, 510400));
+
+            List<ComAct> list2 = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getState,0).eq(ComAct::getAreaCode, 510400));
+            analyticStatisticsRegionVo.setBcRegions(list);
+            analyticStatisticsRegionVo.setComStreets(list1);
+            analyticStatisticsRegionVo.setComActs(list2);
+            return R.ok(analyticStatisticsRegionVo);
+        }
+
+        // 有区县级权限
+        List<SystemUserLevel> systemUserLevels = listBySystemUsers.stream().filter(e -> e.getLevel() == 2).collect(Collectors.toList());
+        // 拥有的区县code
+        List<String> collect = systemUserLevels.stream().map(SystemUserLevel::getDistrictsCode).collect(Collectors.toList());
+        if(collect.size()==0){
+            collect.add("0");
+        }
+        // 找出这个区县的
+        List<BcRegion> list = bcRegionService.list(new LambdaQueryWrapper<BcRegion>().eq(BcRegion::getParentId, 510400).in(BcRegion::getRegionCode, collect));
+
+        // 区县街道
+        List<ComStreet> list1 = comStreetService.list(new LambdaQueryWrapper<ComStreet>().in(ComStreet::getAreaCode, collect));
+
+        // 区县社区
+        List<ComAct> list2 = comActService.list(new LambdaQueryWrapper<ComAct>().in(ComAct::getAreaCode, collect).eq(ComAct::getState,0));
+
+
+        // 有街道权限 排除上个查询出来的
+        List<SystemUserLevel> systemUserLevels1 = listBySystemUsers.stream().filter(e -> e.getLevel() == 3 && !collect.contains(e.getDistrictsCode())).collect(Collectors.toList());
+        List<String> collect1 = systemUserLevels1.stream().map(SystemUserLevel::getStreetId).collect(Collectors.toList());
+        if(collect1.size()==0){
+            collect1.add("0");
+        }
+        // 区县街道
+        List<ComStreet> list3 = comStreetService.list(new LambdaQueryWrapper<ComStreet>().in(ComStreet::getStreetId, collect1));
+
+        // 区县社区
+        List<ComAct> list4 = comActService.list(new LambdaQueryWrapper<ComAct>().in(ComAct::getStreetId, collect1).eq(ComAct::getState,0));
+
+        list1.addAll(list3);
+        list2.addAll(list4);
+
+        // 有社区权限 排除上个查询出来的
+        List<SystemUserLevel> systemUserLevels2 = listBySystemUsers.stream().filter(e -> e.getLevel() == 4 && !collect.contains(e.getDistrictsCode()) && !collect1.contains(e.getStreetId())).collect(Collectors.toList());
+        List<Long> collect2 = systemUserLevels2.stream().map(SystemUserLevel::getCommunityId).collect(Collectors.toList());
+        if(collect2.size()==0){
+            collect2.add(0l);
+        }
+
+        // 区县社区
+        List<ComAct> list6 = comActService.list(new LambdaQueryWrapper<ComAct>().in(ComAct::getCommunityId, collect2).eq(ComAct::getState,0));
+        list2.addAll(list6);
+
+        analyticStatisticsRegionVo.setBcRegions(list);
+        analyticStatisticsRegionVo.setComStreets(list1);
+        analyticStatisticsRegionVo.setComActs(list2);
+
+        return R.ok(analyticStatisticsRegionVo);
+
+    }
+
+
+    @GetMapping("/getNextRegion")
+    @ApiOperation(value = "分析统计--获取下一级树", tags = {"三个身边后台-分析统计--获取市-区县-街道-社区"})
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "区 传regionCode  街道streetId", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "1区  2街道", required = true, dataType = "Integer")
+    })
+    public R<?> getNextRegion(@RequestParam String id, @RequestParam Integer type){
+        if(type==1){
+            List<ComStreet> list3 = comStreetService.list(new LambdaQueryWrapper<ComStreet>().eq(ComStreet::getAreaCode, id));
+            return R.ok(list3);
+        }
+        if(type==2){
+            List<ComAct> list3 = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getStreetId, id).eq(ComAct::getState,0));
+            return R.ok(list3);
+        }
+        return R.ok();
+    }
+
+    @GetMapping("/getLastRegion")
+    @ApiOperation(value = "分析统计--获取上级回显", tags = {"三个身边后台-分析统计--获取市-区县-街道-社区"})
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "街道streetId 社区 communityId", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "2街道 3社区", required = true, dataType = "Integer")
+    })
+    public R<AnalyticStatisticsRegionVo> getLastRegion(@RequestParam String id, @RequestParam Integer type){
+        AnalyticStatisticsRegionVo analyticStatisticsRegionVo = new AnalyticStatisticsRegionVo();
+        if(type==2){
+            ComStreet comStreet = comStreetService.getOne(new LambdaQueryWrapper<ComStreet>().eq(ComStreet::getStreetId, id));
+            // 找出这个区县的
+            List<BcRegion> list = bcRegionService.list(new LambdaQueryWrapper<BcRegion>().eq(BcRegion::getParentId, 510400).eq(BcRegion::getRegionCode, comStreet.getAreaCode()));
+            analyticStatisticsRegionVo.setBcRegions(list);
+            return R.ok(analyticStatisticsRegionVo);
+        }
+        if(type==3){
+            ComAct comAct = comActService.getOne(new LambdaQueryWrapper<ComAct>().eq(ComAct::getCommunityId, id));
+            // 找出这个区县的
+            List<BcRegion> list = bcRegionService.list(new LambdaQueryWrapper<BcRegion>().eq(BcRegion::getParentId, 510400).eq(BcRegion::getRegionCode, comAct.getAreaCode()));
+            analyticStatisticsRegionVo.setBcRegions(list);
+            List<ComStreet> list3 = comStreetService.list(new LambdaQueryWrapper<ComStreet>().eq(ComStreet::getStreetId, comAct.getStreetId()));
+            analyticStatisticsRegionVo.setComStreets(list3);
+            return R.ok(analyticStatisticsRegionVo);
+        }
+        return R.ok();
     }
 
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java
index b75396f..cd91124 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java
@@ -4,10 +4,9 @@
 import com.panzhihua.common.interfaces.OperLog;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.utlis.StringUtils;
-import com.panzhihua.sangeshenbian.model.entity.Department;
-import com.panzhihua.sangeshenbian.model.entity.SystemUser;
-import com.panzhihua.sangeshenbian.service.IDepartmentService;
-import com.panzhihua.sangeshenbian.service.ISystemUserService;
+import com.panzhihua.sangeshenbian.model.entity.*;
+import com.panzhihua.sangeshenbian.model.vo.RegionVO;
+import com.panzhihua.sangeshenbian.service.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -27,46 +26,105 @@
 @Api
 @RestController
 @RequestMapping("/department")
-public class DepartmentController {
+public class 	DepartmentController {
 	
 	@Resource
 	private IDepartmentService departmentService;
 	
 	@Resource
 	private ISystemUserService systemUserService;
+
+	@Resource
+	private IBcRegionService bcRegionService;
+
+	@Resource
+	private IComStreetService comStreetService;
+
+	@Resource
+	private IComActService comActService;
 	
 	
 	@GetMapping("/list")
-	@ApiOperation(value = "获取单位列表", tags = {"三个身边后台-用户管理"})
-	@OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取单位列表")
-	public R<List<Department>> list(String name){
-		List<Department> list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 4));
-		Set<Integer> collect3 = list4.stream().map(Department::getPid).collect(Collectors.toSet());
-		List<Department> list3 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 3)
-				.or().in(collect3.size() > 0, Department::getId, collect3));
-		Set<Integer> collect2 = list3.stream().map(Department::getPid).collect(Collectors.toSet());
-		List<Department> list2 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 2)
-				.or().in(collect2.size() > 0, Department::getId, collect2));
-		Set<Integer> collect1 = list2.stream().map(Department::getPid).collect(Collectors.toSet());
-		List<Department> list1 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 1)
-				.or().in(collect1.size() > 0, Department::getId, collect1));
-		for (Department department : list1) {
-			List<Department> departmentList2 = list2.stream().filter(s -> s.getPid().equals(department.getId())).collect(Collectors.toList());
-			for (Department department1 : departmentList2) {
-				List<Department> departmentList3 = list3.stream().filter(s -> s.getPid().equals(department1.getId())).collect(Collectors.toList());
-				for (Department department2 : departmentList3) {
-					List<Department> departmentList4 = list4.stream().filter(s -> s.getPid().equals(department2.getId())).collect(Collectors.toList());
-					department2.setChild(departmentList4);
+	@ApiOperation(value = "获取单位列表1", tags = {"三个身边后台-用户管理"})
+	@OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取单位列表1")
+	public R<List<RegionVO>> list(String name){
+		// 社区
+		List<ComAct> list2 = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getCityCode,510400).like(StringUtils.isNotEmpty(name), ComAct::getName, name));
+		Set<Long> collect2 = list2.stream().map(ComAct::getStreetId).collect(Collectors.toSet());
+
+        // 街道
+		List<ComStreet> list3 = comStreetService.list(new LambdaQueryWrapper<ComStreet>().eq(ComStreet::getCityCode,510400).like(StringUtils.isNotEmpty(name), ComStreet::getName, name)
+				.or().in(collect2.size() > 0, ComStreet::getStreetId, collect2));
+		Set<Integer> collect3 = list3.stream().map(ComStreet::getAreaCode).collect(Collectors.toSet());
+
+		// 区
+		List<BcRegion> list1 = bcRegionService.list(new LambdaQueryWrapper<BcRegion>().eq(BcRegion::getParentId,510400).like(StringUtils.isNotEmpty(name), BcRegion::getRegionName, name)
+				.or().in(collect3.size() > 0, BcRegion::getRegionCode, collect3));
+
+		List<RegionVO> dispatchVOList = new ArrayList<>();
+		for (BcRegion bcRegion : list1) {
+			RegionVO regionVO = new RegionVO();
+			regionVO.setTier(1);
+			regionVO.setId(bcRegion.getRegionCode());
+			regionVO.setName(bcRegion.getRegionName());
+			List<RegionVO> dispatchVOList1 = new ArrayList<>();
+			List<ComStreet> collect = list3.stream().filter(e -> e.getAreaCode().toString().equals(bcRegion.getRegionCode())).collect(Collectors.toList());
+			for (ComStreet street : collect) {
+				List<RegionVO> dispatchVOList2 = new ArrayList<>();
+				RegionVO regionVO1 = new RegionVO();
+				regionVO1.setTier(2);
+				regionVO1.setId(street.getStreetId());
+				regionVO1.setName(street.getName());
+				List<ComAct> collect1 = list2.stream().filter(e -> e.getStreetId().toString().equals(street.getStreetId())).collect(Collectors.toList());
+				for (ComAct comAct : collect1) {
+					RegionVO regionVO2 = new RegionVO();
+					regionVO2.setTier(3);
+					regionVO2.setId(comAct.getCommunityId().toString());
+					regionVO2.setName(comAct.getName());
+					dispatchVOList2.add(regionVO2);
 				}
-				department1.setChild(departmentList3);
+				regionVO1.setChildren(dispatchVOList2);
+				dispatchVOList1.add(regionVO1);
 			}
-			department.setChild(departmentList2);
+			regionVO.setChildren(dispatchVOList1);
+			dispatchVOList.add(regionVO);
 		}
-		return R.ok(list1);
+
+		return R.ok(dispatchVOList);
 	}
-	
-	
-	
+
+
+//	@GetMapping("/list")
+//	@ApiOperation(value = "获取单位列表", tags = {"三个身边后台-用户管理"})
+//	@OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取单位列表")
+//	public R<List<Department>> list(String name){
+//		List<Department> list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 4));
+//		Set<Integer> collect3 = list4.stream().map(Department::getPid).collect(Collectors.toSet());
+//		List<Department> list3 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 3)
+//				.or().in(collect3.size() > 0, Department::getId, collect3));
+//		Set<Integer> collect2 = list3.stream().map(Department::getPid).collect(Collectors.toSet());
+//		List<Department> list2 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 2)
+//				.or().in(collect2.size() > 0, Department::getId, collect2));
+//		Set<Integer> collect1 = list2.stream().map(Department::getPid).collect(Collectors.toSet());
+//		List<Department> list1 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 1)
+//				.or().in(collect1.size() > 0, Department::getId, collect1));
+//		for (Department department : list1) {
+//			List<Department> departmentList2 = list2.stream().filter(s -> s.getPid().equals(department.getId())).collect(Collectors.toList());
+//			for (Department department1 : departmentList2) {
+//				List<Department> departmentList3 = list3.stream().filter(s -> s.getPid().equals(department1.getId())).collect(Collectors.toList());
+//				for (Department department2 : departmentList3) {
+//					List<Department> departmentList4 = list4.stream().filter(s -> s.getPid().equals(department2.getId())).collect(Collectors.toList());
+//					department2.setChild(departmentList4);
+//				}
+//				department1.setChild(departmentList3);
+//			}
+//			department.setChild(departmentList2);
+//		}
+//		return R.ok(list1);
+//	}
+
+
+
 	@PostMapping("/add")
 	@ApiOperation(value = "添加单位信息", tags = {"三个身边后台-用户管理"})
 	@OperLog(operModul = "三个身边后台",operType = 1, businessType = "添加单位信息")
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java
index a1d1b83..9bc87b4 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java
@@ -5,7 +5,6 @@
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.StringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -141,4 +140,8 @@
 	 */
 	@TableField("create_time")
 	private LocalDateTime createTime;
+
+
+
+
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUserLevel.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUserLevel.java
index 7f98eac..61c9e84 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUserLevel.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUserLevel.java
@@ -1,14 +1,15 @@
 package com.panzhihua.sangeshenbian.model.entity;
 
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+
+import java.io.Serializable;
 
 /**
  * <p>
@@ -58,5 +59,8 @@
     @ApiModelProperty(value = "是否纪检组监督账号 1:是;0:否")
     private Integer superviseFlag;
 
+    @ApiModelProperty(value = "状态(1=正常,2=冻结,3=删除)")
+    private Integer status;
+
 
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsDataVo.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsDataVo.java
new file mode 100644
index 0000000..f56a72f
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsDataVo.java
@@ -0,0 +1,25 @@
+package com.panzhihua.sangeshenbian.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@ApiModel("数据统计数据Vo")
+public class AnalyticStatisticsDataVo {
+
+    @ApiModelProperty("数据统计第一部分Vo")
+    private AnalyticStatisticsOneVo analyticStatisticsOneVo;
+
+    @ApiModelProperty("数据统计第二部分Vo")
+    private List<AnalyticStatisticsTwoVo> analyticStatisticsTwoVos;
+
+    @ApiModelProperty("数据统计第三部分Vo")
+    private List<AnalyticStatisticsThreeVo> analyticStatisticsThreeVos;
+
+    @ApiModelProperty("数据统计第四部分Vo")
+    private AnalyticStatisticsFourVo analyticStatisticsFourVo;
+
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsFourVo.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsFourVo.java
index 652d57b..98a7af6 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsFourVo.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsFourVo.java
@@ -8,15 +8,15 @@
 @ApiModel("数据统计第四部分Vo")
 public class AnalyticStatisticsFourVo {
     @ApiModelProperty("非常满意")
-    private Double greatSatisfactionRate;
+    private Double greatSatisfactionRate=0.0;
 
     @ApiModelProperty("满意")
-    private Double satisfactionRate;
+    private Double satisfactionRate=0.0;
 
     @ApiModelProperty("一般")
-    private Double generalSatisfactionRate;
+    private Double generalSatisfactionRate=0.0;
 
     @ApiModelProperty("不满意")
-    private Double dissatisfactionRate;
+    private Double dissatisfactionRate=0.0;
 
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsRegionVo.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsRegionVo.java
new file mode 100644
index 0000000..2177bca
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AnalyticStatisticsRegionVo.java
@@ -0,0 +1,21 @@
+package com.panzhihua.sangeshenbian.model.vo;
+
+import com.panzhihua.sangeshenbian.model.entity.BcRegion;
+import com.panzhihua.sangeshenbian.model.entity.ComAct;
+import com.panzhihua.sangeshenbian.model.entity.ComStreet;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AnalyticStatisticsRegionVo {
+    @ApiModelProperty("区")
+    private List<BcRegion> bcRegions;
+
+    @ApiModelProperty("街道")
+    private  List<ComStreet> comStreets;
+
+    @ApiModelProperty("社区")
+    private List<ComAct> comActs;
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/RegionVO.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/RegionVO.java
index 0637a43..414fde4 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/RegionVO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/RegionVO.java
@@ -17,6 +17,10 @@
     private String id;
     @ApiModelProperty("名称")
     private String name;
+
     @ApiModelProperty("子节点")
     private List<RegionVO> children;
+
+    @ApiModelProperty("层级")
+    private Integer tier;
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintService.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintService.java
index 6fda0d8..657107c 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintService.java
@@ -202,4 +202,12 @@
      */
     List<AnalyticStatisticsThreeVo> analyticStatisticsThree(@Valid AnalyticStatisticsQuery query, List<Complaint> complaints);
 
+    /**
+     * 数据统计第四部分
+     * @param complaints
+     * @return
+     */
+    AnalyticStatisticsFourVo analyticStatisticsFour(List<Complaint> complaints);
+
+
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
index a091857..8a8c426 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -1629,6 +1629,22 @@
         return Collections.emptyList();
     }
 
+    @Override
+    public AnalyticStatisticsFourVo analyticStatisticsFour(List<Complaint> complaints) {
+        AnalyticStatisticsFourVo vo = new AnalyticStatisticsFourVo();
+        // 0:不满意 1:一般 2:满意 3:非常满意
+        long count = complaints.stream().filter(e -> e.getCommentRate() != null && e.getCommentRate() == 0).count();
+        long count1 = complaints.stream().filter(e -> e.getCommentRate() != null && e.getCommentRate() == 1).count();
+        long count2 = complaints.stream().filter(e -> e.getCommentRate() != null && e.getCommentRate() == 2).count();
+        long count3 = complaints.stream().filter(e -> e.getCommentRate() != null && e.getCommentRate() == 3).count();
+        vo.setDissatisfactionRate(BigDecimal.valueOf(count).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
+        vo.setGeneralSatisfactionRate(BigDecimal.valueOf(count1).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
+        vo.setSatisfactionRate(BigDecimal.valueOf(count2).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
+        vo.setGreatSatisfactionRate(BigDecimal.valueOf(count3).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
+
+        return vo;
+    }
+
 
 }
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserLevelServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserLevelServiceImpl.java
index 67f4b20..c433279 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserLevelServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserLevelServiceImpl.java
@@ -41,7 +41,7 @@
     @Override
     public List<SystemUserLevel> getListBySystemUserId(Integer systemUserId) {
         return this.lambdaQuery()
-                .eq(SystemUserLevel::getSystemUserId, systemUserId)
+                .eq(SystemUserLevel::getSystemUserId, systemUserId).eq(SystemUserLevel::getStatus,1)
                 .orderByAsc(SystemUserLevel::getId).list();
     }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java
index 1fc513b..1fae5eb 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java
@@ -25,4 +25,6 @@
 	private Integer pageNum;
 	@ApiModelProperty(value = "每页数量", required = true)
 	private Integer pageSize;
+	@ApiModelProperty(value = "1当前组织架构 2当前及下级", required = true)
+	private Integer type;
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserListVo.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserListVo.java
index 660d5c8..7264eff 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserListVo.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserListVo.java
@@ -1,8 +1,11 @@
 package com.panzhihua.sangeshenbian.warpper;
 
+import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import java.util.List;
 
 /**
  * @author zhibing.pu
@@ -27,4 +30,6 @@
 	private Integer accountLevel;
 	@ApiModelProperty("账号状态(1=使用中,2=已冻结)")
 	private Integer status;
+	@ApiModelProperty(value = "账号层级(1=市级账号,2=区县账号,3=街道账号,4=社区账号)")
+	private List<SystemUserLevel> list;
 }

--
Gitblit v1.7.1