| | |
| | | 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; |
| | |
| | | @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 = "添加单位信息") |