| | |
| | | package com.panzhihua.westcommittee.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; |
| | | import com.panzhihua.common.model.vos.west.SystemUserVo; |
| | | import com.panzhihua.westcommittee.model.entity.ComAct; |
| | | import com.panzhihua.westcommittee.model.entity.SystemUserLevel; |
| | | import com.panzhihua.westcommittee.model.query.ComplaintRejectQuery; |
| | | import com.panzhihua.westcommittee.model.vo.ComplaintRejectVo; |
| | | import com.panzhihua.westcommittee.service.IComActService; |
| | | import com.panzhihua.westcommittee.service.IComplaintRejectService; |
| | | import com.panzhihua.westcommittee.service.ISystemUserLevelService; |
| | | import com.panzhihua.westcommittee.service.ISystemUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | @Resource |
| | | private IComplaintRejectService complaintRejectService; |
| | | @Resource |
| | | private ISystemUserLevelService systemUserLevelService; |
| | | private IComActService comActService; |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取问题驳回统计列表", tags = {"三个身边后台-问题驳回统计"}) |
| | | @ApiOperation(value = "获取问题驳回统计列表", tags = {"西区纪委后台-问题驳回统计"}) |
| | | public R<IPage<ComplaintRejectVo>> list(ComplaintRejectQuery query){ |
| | | SystemUserVo loginUserInfoSanGeShenBian = getLoginUserInfoWest(); |
| | | Integer id = loginUserInfoSanGeShenBian.getId(); |
| | | List<SystemUserLevel> listBySystemUsers = systemUserLevelService.getListBySystemUserId(id); |
| | | SystemUserLevel systemUserLevel = listBySystemUsers.stream().filter(e -> e.getLevel() == 1).findFirst().orElse(null); |
| | | SystemUserVo loginUserInfo = getLoginUserInfoWest(); |
| | | |
| | | List<String> districtsCodes=new ArrayList<>(); |
| | | List<String> streetIds=new ArrayList<>(); |
| | | List<Long> communityIds=new ArrayList<>(); |
| | | // 看是否直接是市级账号 |
| | | if(systemUserLevel==null){ |
| | | // 不是市级 查看是否是区县账号 |
| | | List<SystemUserLevel> systemUserLevels2 = listBySystemUsers.stream().filter(e -> e.getLevel() == 2).collect(Collectors.toList()); |
| | | if(!systemUserLevels2.isEmpty()){ |
| | | // 区县账号 找出code |
| | | districtsCodes = systemUserLevels2.stream().map(SystemUserLevel::getDistrictsCode).collect(Collectors.toList()); |
| | | }else { |
| | | districtsCodes.add("-1"); |
| | | } |
| | | |
| | | List<SystemUserLevel> systemUserLevels3 = listBySystemUsers.stream().filter(e -> e.getLevel() == 3).collect(Collectors.toList()); |
| | | if(!systemUserLevels3.isEmpty()){ |
| | | // 街道账号 找出id 且不在上面的区县下的街道 |
| | | List<String> finalDistrictsCodes1 = districtsCodes; |
| | | streetIds = systemUserLevels3.stream().filter(e -> !finalDistrictsCodes1.contains(e.getDistrictsCode())).map(SystemUserLevel::getStreetId).collect(Collectors.toList()); |
| | | if(streetIds.isEmpty()){ |
| | | if(loginUserInfo.getAccountLevel()!=2){ |
| | | if(loginUserInfo.getAccountLevel()==3){ |
| | | if(loginUserInfo.getSystemRoleId()==1 || loginUserInfo.getSystemRoleId()==2){ |
| | | streetIds.add("-1"); |
| | | List<Long> ids = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getStreetId, loginUserInfo.getStreetId())).stream().map(ComAct::getCommunityId).collect(Collectors.toList()); |
| | | communityIds.addAll(ids); |
| | | } |
| | | }else { |
| | | streetIds.add("-1"); |
| | | } |
| | | if(loginUserInfo.getAccountLevel()==4){ |
| | | if(loginUserInfo.getSystemRoleId()==1 || loginUserInfo.getSystemRoleId()==2){ |
| | | streetIds.add("-1"); |
| | | communityIds.add(loginUserInfo.getCommunityId()); |
| | | } |
| | | } |
| | | |
| | | List<SystemUserLevel> systemUserLevels4 = listBySystemUsers.stream().filter(e -> e.getLevel() == 4).collect(Collectors.toList()); |
| | | if(!systemUserLevels4.isEmpty()){ |
| | | // community账号 找出id 且不在上面的街道下的社区 |
| | | List<String> finalStreetIds1 = streetIds; |
| | | List<String> finalDistrictsCodes2 = districtsCodes; |
| | | communityIds = systemUserLevels4.stream().filter(e -> !finalStreetIds1.contains(e.getStreetId()) && !finalDistrictsCodes2.contains(e.getDistrictsCode())).map(SystemUserLevel::getCommunityId).collect(Collectors.toList()); |
| | | }else { |
| | | communityIds.add(-1L); |
| | | } |
| | | List<String> finalDistrictsCodes = districtsCodes; |
| | | List<String> finalStreetIds = streetIds; |
| | | List<Long> finalCommunityIds = communityIds; |
| | | IPage<ComplaintRejectVo> list = complaintRejectService.getComplaintRejectListOther(query,finalDistrictsCodes,finalStreetIds,finalCommunityIds); |
| | | IPage<ComplaintRejectVo> list = complaintRejectService.getComplaintRejectListOther(query,finalDistrictsCodes,finalStreetIds,finalCommunityIds,loginUserInfo); |
| | | return R.ok(list); |
| | | }else { |
| | | IPage<ComplaintRejectVo> list = complaintRejectService.getComplaintRejectList(query); |
| | | IPage<ComplaintRejectVo> list = complaintRejectService.getComplaintRejectList(query,loginUserInfo); |
| | | return R.ok(list); |
| | | } |
| | | |