| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.*; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | @Slf4j |
| | | public class DateUtils { |
| | |
| | | private static DateTimeFormatter format_yms = DateTimeFormatter.ofPattern("yyyyMM"); |
| | | private static DateTimeFormatter format_y = DateTimeFormatter.ofPattern("yyyy"); |
| | | |
| | | |
| | | public static String getNextDay(Date date,int day) { |
| | | LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | return yyyyMMdd_format.format(Date.from(localDate.plusDays(day).atStartOfDay(ZoneId.systemDefault()).toInstant())); |
| | | } |
| | | /** |
| | | * 将日期对象格式化成指定的字符串格式 |
| | | * |
| | |
| | | long min = diff / nm; |
| | | |
| | | return (int)hour; |
| | | } public static int getDay(Date stardate, Date enddate) { |
| | | long nd = 1000 * 24 * 60 * 60; |
| | | long nh = 1000 * 60 * 60; |
| | | long nm = 1000 * 60; |
| | | long diff = enddate.getTime() - stardate.getTime(); |
| | | |
| | | long day = diff / nd; |
| | | |
| | | long hour = diff / nh; |
| | | |
| | | long min = diff / nm; |
| | | |
| | | return (int)day; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 结束时间与当前时间计算相差的月数 |
| | | * |
| | |
| | | |
| | | |
| | | 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> |
| | |
| | | @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()); |
| | | } |
| | |
| | | } |
| | | 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"); |
| | |
| | | // 第三部分数据 |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | |
| | | 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 = "添加单位信息") |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.sangeshenbian.model.query.SuperviseQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO; |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; |
| | | import com.panzhihua.sangeshenbian.service.impl.SuperviseService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | 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 javax.validation.Valid; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/5/7 |
| | | */ |
| | | @Api(tags = {"小程序-诉求监督"}) |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("/applet/supervise") |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class SuperviseController extends BaseController { |
| | | private final SuperviseService superviseService; |
| | | @PostMapping("/processing-record-page") |
| | | @ApiOperation("诉求监督-处理记录") |
| | | public R<Page<ComplaintVO>> queryProcessingRecordPage(@RequestBody SuperviseQuery query) { |
| | | LoginUserInfoVO loginUserInfo = super.getLoginUserInfo(); |
| | | return R.ok(superviseService.queryProcessingRecordPage(query,loginUserInfo)); |
| | | } |
| | | @PostMapping("/reject-record-page") |
| | | @ApiOperation("诉求监督-问题驳回池") |
| | | public R<Page<AppComplaintRejectVO>> queryRejectRecordPage(@RequestBody SuperviseQuery query) { |
| | | LoginUserInfoVO loginUserInfo = super.getLoginUserInfo(); |
| | | return R.ok(superviseService.queryRejectRecordPage(query,loginUserInfo)); |
| | | } |
| | | } |
| | |
| | | import com.panzhihua.sangeshenbian.model.entity.Complaint; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO; |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintTodoVO; |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; |
| | | import com.panzhihua.sangeshenbian.warpper.MgtComplaintQuery; |
| | |
| | | * @return |
| | | */ |
| | | ComplaintVO getDetailBg(Long id); |
| | | |
| | | /** |
| | | * |
| | | * @param page |
| | | * @param keyword |
| | | * @param accountLevel |
| | | * @param targetId |
| | | * @return |
| | | */ |
| | | Page<ComplaintVO> queryProcessingRecordPage(Page<ComplaintVO> page,@Param("keyword")String keyword, |
| | | @Param("accountLevel") Integer accountLevel, @Param("targetId") Long targetId); |
| | | Page<AppComplaintRejectVO> queryRejectRecordPage(Page<ComplaintVO> page, @Param("keyword") String keyword, |
| | | @Param("accountLevel") Integer accountLevel, @Param("targetId") Long targetId); |
| | | } |
| | |
| | | import com.panzhihua.sangeshenbian.model.entity.ComplaintReject; |
| | | import com.panzhihua.sangeshenbian.model.query.ComplaintRejectQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintRejectVo; |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | |
| | | package com.panzhihua.sangeshenbian.model.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | @Data |
| | | @Builder |
| | | @ApiModel("用户身份层级") |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class UserIdentityDTO { |
| | | /** |
| | | * 身份标识 1:党员 2:管理员 |
| | |
| | | @TableField("apply_name") |
| | | private String applyName; |
| | | |
| | | @ApiModelProperty(value = "审核时间") |
| | | @TableField("audit_time") |
| | | private Date auditTime; |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | */ |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | 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> |
| | |
| | | @ApiModelProperty(value = "是否纪检组监督账号 1:是;0:否") |
| | | private Integer superviseFlag; |
| | | |
| | | @ApiModelProperty(value = "状态(1=正常,2=冻结,3=删除)") |
| | | private Integer status; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.model.query; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/5/7 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "诉求监督查询数据传输对象") |
| | | public class SuperviseQuery extends BasePage{ |
| | | @ApiModelProperty("关键字") |
| | | private String keyword; |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | @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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.model.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.panzhihua.sangeshenbian.model.entity.Complaint; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/5/7 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel("问题驳回视图对象") |
| | | public class AppComplaintRejectVO extends Complaint { |
| | | @ApiModelProperty("申请时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("申请人") |
| | | private String reporter; |
| | | |
| | | @ApiModelProperty("审批时间") |
| | | private Date auditTime; |
| | | |
| | | @ApiModelProperty("审批人") |
| | | private String auditorName; |
| | | |
| | | @ApiModelProperty("驳回理由") |
| | | private String rejectReason; |
| | | |
| | | @ApiModelProperty("驳回类型 1:延期被驳回 2:上报被驳回") |
| | | private Integer auditType; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "语音文件集合") |
| | | private List<String> voiceFileList; |
| | | |
| | | @ApiModelProperty(value = "添加办理进度数") |
| | | private Integer progressCount; |
| | | |
| | | @ApiModelProperty(value = "已下派次数") |
| | | private Integer assignmentCount; |
| | | |
| | | @ApiModelProperty(value = "已上报次数") |
| | | private Integer reportCount; |
| | | |
| | | } |
| | |
| | | private String id; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("子节点") |
| | | private List<RegionVO> children; |
| | | |
| | | @ApiModelProperty("层级") |
| | | private Integer tier; |
| | | } |
| | |
| | | */ |
| | | List<AnalyticStatisticsThreeVo> analyticStatisticsThree(@Valid AnalyticStatisticsQuery query, List<Complaint> complaints); |
| | | |
| | | /** |
| | | * 数据统计第四部分 |
| | | * @param complaints |
| | | * @return |
| | | */ |
| | | AnalyticStatisticsFourVo analyticStatisticsFour(List<Complaint> complaints); |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | complaintAuditRecord.setAuditorName(systemUser.getName()); |
| | | complaintAuditRecord.setAuditorPhone(systemUser.getPhone()); |
| | | complaintAuditRecord.setAuditTime(new Date()); |
| | | if (complaintReporAuditDTO.getAuditResult().equals(1)) { |
| | | complaintAuditRecord.setAuditStatus(1); |
| | | complaintAuditRecord.setAuditorId(loginUserInfoVO.getUserId()); |
| | |
| | | } |
| | | complaintAuditRecord.setAuditorName(systemUser.getName()); |
| | | complaintAuditRecord.setAuditorPhone(systemUser.getPhone()); |
| | | complaintAuditRecord.setAuditTime(new Date()); |
| | | //审核通过后,设置诉求延期 |
| | | if (complaintAuditRecord.getAuditType().equals(1) && complaintAuditRecord.getAuditStatus().equals(0) && dto.getAuditResult().equals(1)) { |
| | | Complaint complaint = getById(complaintAuditRecord.getComplaintId()); |
| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | // 获取当前身份 |
| | | if (userIdentityDTO == null){ |
| | | if (systemUser != null){ |
| | | handleSystemUserLevelId(phone, systemUser, 2, identityInformationVO); |
| | | }else if (partyMember != null && partyMember.getAuditStatus() == 1){ |
| | | identityInformationVO.setIdentity(1); |
| | | UserIdentityDTO build = UserIdentityDTO.builder().identity(1).build(); |
| | | redisUtils.set("identity:" + phone, build); |
| | | }else { |
| | | identityInformationVO.setIdentity(null); |
| | | } |
| | | handleSystemUserLevelId(phone, systemUser, 2, identityInformationVO, partyMember); |
| | | }else { |
| | | Integer identity = userIdentityDTO.getIdentity(); |
| | | identityInformationVO.setIdentity(identity); |
| | | if (identity == 1 && (partyMember == null || partyMember.getAuditStatus() != 1)){ |
| | | identityInformationVO.setIdentity(null); |
| | | redisUtils.remove("identity:" + phone); |
| | | }else if (identity == 2 && systemUser == null){ |
| | | identityInformationVO.setIdentity(null); |
| | | redisUtils.remove("identity:" + phone); |
| | | }else { |
| | | }else if (identity == 2){ |
| | | Integer levelId = userIdentityDTO.getLevelId(); |
| | | //验证账号所属层级 |
| | | SystemUserLevel userLevel = systemUserLevelService.getById(levelId); |
| | | if (Objects.isNull(userLevel)) { |
| | | handleSystemUserLevelId(phone, systemUser, identity, identityInformationVO); |
| | | handleSystemUserLevelId(phone, systemUser, identity, identityInformationVO,partyMember); |
| | | } else { |
| | | identityInformationVO.setLevelId(levelId); |
| | | identityInformationVO.setSuperviseFlag(userLevel.getSuperviseFlag()); |
| | |
| | | * @param identity |
| | | * @param identityInformationVO |
| | | */ |
| | | private void handleSystemUserLevelId(String phone, SystemUser systemUser, Integer identity, IdentityInformation identityInformationVO) { |
| | | SystemUserLevel userLevel; |
| | | //当前所属层级不存在,默认为第一个添加的层级 |
| | | Optional<SystemUserLevel> levelOptional = systemUserLevelService.getByLevelByUserId(systemUser.getId()); |
| | | if (levelOptional.isPresent()) { |
| | | userLevel = levelOptional.get(); |
| | | UserIdentityDTO build = UserIdentityDTO.builder().identity(identity).levelId(userLevel.getId()).build(); |
| | | private void handleSystemUserLevelId(String phone, SystemUser systemUser, Integer identity, |
| | | IdentityInformation identityInformationVO, PartyMember partyMember) { |
| | | // 情况1:系统用户存在 |
| | | if (Objects.nonNull(systemUser)) { |
| | | Optional<SystemUserLevel> levelOptional = systemUserLevelService.getByLevelByUserId(systemUser.getId()); |
| | | if (levelOptional.isPresent()) { |
| | | // 系统用户有关联的用户级别 |
| | | SystemUserLevel userLevel = levelOptional.get(); |
| | | |
| | | // 设置用户身份信息为系统用户身份 |
| | | identityInformationVO.setIdentity(identity); |
| | | identityInformationVO.setLevelId(userLevel.getId()); |
| | | identityInformationVO.setSuperviseFlag(userLevel.getSuperviseFlag()); |
| | | identityInformationVO.setSystemUserLevel(userLevel); |
| | | |
| | | // 存储到Redis |
| | | UserIdentityDTO build = UserIdentityDTO.builder() |
| | | .identity(identity) |
| | | .levelId(userLevel.getId()) |
| | | .build(); |
| | | redisUtils.set("identity:" + phone, build); |
| | | } else if (partyMember != null && partyMember.getAuditStatus() == 1) { |
| | | // 系统用户无关联级别,但是有党员身份且审核通过 |
| | | identityInformationVO.setIdentity(1); |
| | | |
| | | UserIdentityDTO build = UserIdentityDTO.builder() |
| | | .identity(1) |
| | | .build(); |
| | | redisUtils.set("identity:" + phone, build); |
| | | } else { |
| | | // 系统用户无关联级别,也没有党员身份,清除身份信息 |
| | | redisUtils.remove("identity:" + phone); |
| | | } |
| | | } else if (partyMember != null && partyMember.getAuditStatus() == 1) { |
| | | // 情况2:不是系统用户,但是党员身份且审核通过 |
| | | identityInformationVO.setIdentity(1); |
| | | |
| | | UserIdentityDTO build = UserIdentityDTO.builder() |
| | | .identity(1) |
| | | .build(); |
| | | redisUtils.set("identity:" + phone, build); |
| | | identityInformationVO.setIdentity(identity); |
| | | identityInformationVO.setLevelId(userLevel.getId()); |
| | | identityInformationVO.setSuperviseFlag(userLevel.getSuperviseFlag()); |
| | | identityInformationVO.setSystemUserLevel(userLevel); |
| | | } else { |
| | | //当前账号没有管理员账号所属层级,清空账号当前层级信息 |
| | | // 情况3:既不是系统用户也不是审核通过的党员,清除身份信息 |
| | | redisUtils.remove("identity:" + phone); |
| | | } |
| | | } |
| | |
| | | throw new ServiceException("您的账号已被冻结,请联系管理员"); |
| | | } |
| | | List<PermissionsVO> permissions = identityInformation.getPermissions(); |
| | | if (CollectionUtil.isEmpty(permissions)){ |
| | | if (CollectionUtil.isEmpty(permissions) || Objects.isNull(identityInformation.getIdentity())){ |
| | | throw new ServiceException("请先完成认证"); |
| | | } |
| | | |
| | | SystemUser systemUser = identityInformation.getSystemUser(); |
| | | if (systemUser == null && identityInformation.getIdentity() == 2) { |
| | | if (identityInformation.getIdentity() == 2 && Objects.isNull(systemUser)) { |
| | | throw new ServiceException("管理员信息不存在"); |
| | | } |
| | | SystemUserLevel systemUserLevel = identityInformation.getSystemUserLevel(); |
| | | if (systemUserLevel == null && identityInformation.getIdentity() == 2) { |
| | | if (identityInformation.getIdentity() == 2&&Objects.isNull(systemUserLevel)) { |
| | | throw new ServiceException("管理员所属层级不存在"); |
| | | } |
| | | PartyMember partyMember = identityInformation.getPartyMember(); |
| | | if (partyMember == null && identityInformation.getIdentity() == 1) { |
| | | if (identityInformation.getIdentity() == 1 && Objects.isNull(partyMember)) { |
| | | throw new ServiceException("党员信息不存在"); |
| | | } |
| | | return identityInformation; |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.sangeshenbian.dao.ComplaintMapper; |
| | | import com.panzhihua.sangeshenbian.dao.ComplaintRejectMapper; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel; |
| | | import com.panzhihua.sangeshenbian.model.query.SuperviseQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO; |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; |
| | | import com.panzhihua.sangeshenbian.service.IdentityInformationService; |
| | | import com.panzhihua.sangeshenbian.warpper.IdentityInformation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/5/7 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class SuperviseService { |
| | | private final IdentityInformationService identityInformationService; |
| | | private final ComplaintMapper complaintMapper; |
| | | |
| | | public Page<ComplaintVO> queryProcessingRecordPage(SuperviseQuery query, LoginUserInfoVO loginUserInfo) { |
| | | IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); |
| | | Integer identity = currentIdentityInformation.getIdentity(); |
| | | if (!identity.equals(2)) { |
| | | throw new ServiceException("当前账号无权限"); |
| | | } |
| | | Long targetId = null; |
| | | SystemUserLevel systemUserLevel = currentIdentityInformation.getSystemUserLevel(); |
| | | Integer accountLevel = systemUserLevel.getLevel(); |
| | | switch (accountLevel) { |
| | | case 1: |
| | | //市级 |
| | | targetId = 510400L; |
| | | break; |
| | | case 2: |
| | | //区县级 |
| | | targetId = Long.valueOf(systemUserLevel.getDistrictsCode()); |
| | | break; |
| | | case 3: |
| | | //街道 |
| | | targetId = Long.valueOf(systemUserLevel.getStreetId()); |
| | | break; |
| | | case 4: |
| | | //社区 |
| | | targetId = systemUserLevel.getCommunityId(); |
| | | break; |
| | | } |
| | | return complaintMapper.queryProcessingRecordPage(new Page<>(query.getPageNum(), query.getPageSize()), query.getKeyword(), accountLevel, targetId); |
| | | } |
| | | |
| | | public Page<AppComplaintRejectVO> queryRejectRecordPage(SuperviseQuery query, LoginUserInfoVO loginUserInfo) { |
| | | IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); |
| | | Integer identity = currentIdentityInformation.getIdentity(); |
| | | if (!identity.equals(2) || currentIdentityInformation.getSuperviseFlag().equals(0)) { |
| | | throw new ServiceException("当前账号无权限"); |
| | | } |
| | | Long targetId = null; |
| | | SystemUserLevel systemUserLevel = currentIdentityInformation.getSystemUserLevel(); |
| | | Integer accountLevel = systemUserLevel.getLevel(); |
| | | switch (accountLevel) { |
| | | case 1: |
| | | //市级 |
| | | targetId = 510400L; |
| | | break; |
| | | case 2: |
| | | //区县级 |
| | | targetId = Long.valueOf(systemUserLevel.getDistrictsCode()); |
| | | break; |
| | | case 3: |
| | | //街道 |
| | | targetId = Long.valueOf(systemUserLevel.getStreetId()); |
| | | break; |
| | | case 4: |
| | | //社区 |
| | | targetId = systemUserLevel.getCommunityId(); |
| | | break; |
| | | } |
| | | return complaintMapper.queryRejectRecordPage(new Page<>(query.getPageNum(), query.getPageSize()), query.getKeyword(), accountLevel, targetId); |
| | | } |
| | | } |
| | |
| | | @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(); |
| | | } |
| | | } |
| | |
| | | private Integer pageNum; |
| | | @ApiModelProperty(value = "每页数量", required = true) |
| | | private Integer pageSize; |
| | | @ApiModelProperty(value = "1当前组织架构 2当前及下级", required = true) |
| | | private Integer type; |
| | | } |
| | |
| | | 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 |
| | |
| | | private Integer accountLevel; |
| | | @ApiModelProperty("账号状态(1=使用中,2=已冻结)") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "账号层级(1=市级账号,2=区县账号,3=街道账号,4=社区账号)") |
| | | private List<SystemUserLevel> list; |
| | | } |
| | |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | /* 当诉求是当前用户处理的,显示正常状态 */ |
| | | WHEN (scar.superior_id = #{targetId} OR scar.create_by = #{query.userId}) THEN |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 and scar.audit_type = 2 THEN 6 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 and scar.audit_type = 1 THEN 9 |
| | | ELSE sc.status |
| | | END |
| | | /* 当诉求不是当前用户处理的,已办结(3)保持不变,其他状态都显示为正在办理(0) */ |
| | | ELSE |
| | | CASE |
| | | WHEN sc.status = 3 THEN 3 |
| | | ELSE 0 |
| | | END |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.superior_id, |
| | |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | and (sc.districts_code = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | and (sc.street_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | and (sc.community_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="5 == accountLevel"> |
| | | and (sc.party_member_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | and (sc.party_member_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="query.type!=null and query.type == 0"> |
| | | AND (scar.superior_id = #{targetId} or scar.create_by = #{query.userId}) |
| | | AND sc.status IN(0,1,2) and scar.audit_status = 0 |
| | | </if> |
| | | <if test="query.type!=null and query.type == 1"> |
| | | AND (sc.status IN(0,1,2) and scar.audit_status != 0 || sc.status IN(0,1,2) and scar.audit_status is null) |
| | | OR ( |
| | | scar.superior_id != #{targetId} AND scar.create_by != #{query.userId} |
| | | AND sc.status IN(0,1,2) and scar.audit_status = 0 |
| | | AND ( |
| | | /* 如果是当前用户处理的诉求,正常显示正在办理的诉求 */ |
| | | ((scar.superior_id = #{targetId} OR scar.create_by = #{query.userId}) AND sc.status IN(0,1,2)) |
| | | OR |
| | | /* 如果不是当前用户处理的诉求,只要不是已办结(3)或已评价(8)的都算作正在办理 */ |
| | | ((scar.superior_id != #{targetId} AND scar.create_by != #{query.userId} OR scar.superior_id IS NULL) AND sc.status NOT IN(3,8)) |
| | | ) |
| | | </if> |
| | | <if test="query.type!=null and query.type == 2"> |
| | |
| | | and t.city_code = 510400 |
| | | </if> |
| | | <if test="2 == loginUserInfo.accountLevel"> |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} || t.id in (select complaint_id from |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.districtsCode})) |
| | | </if> |
| | | <if test="3 == loginUserInfo.accountLevel"> |
| | | and (t.street_id = #{loginUserInfo.streetId} || t.id in (select complaint_id from |
| | | and (t.street_id = #{loginUserInfo.streetId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.streetId})) |
| | | </if> |
| | | <if test="4 == loginUserInfo.accountLevel"> |
| | | and (t.community_id = #{loginUserInfo.communityId} || t.id in (select complaint_id from |
| | | and (t.community_id = #{loginUserInfo.communityId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.communityId})) |
| | | </if> |
| | |
| | | and t.city_code = 510400 |
| | | </if> |
| | | <if test="2 == loginUserInfo.accountLevel"> |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} || t.id in (select complaint_id from |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.districtsCode})) |
| | | </if> |
| | | <if test="3 == loginUserInfo.accountLevel"> |
| | | and (t.street_id = #{loginUserInfo.streetId} || t.id in (select complaint_id from |
| | | and (t.street_id = #{loginUserInfo.streetId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.streetId})) |
| | | </if> |
| | | <if test="4 == loginUserInfo.accountLevel"> |
| | | and (t.community_id = #{loginUserInfo.communityId} || t.id in (select complaint_id from |
| | | and (t.community_id = #{loginUserInfo.communityId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.communityId})) |
| | | </if> |
| | |
| | | WHERE t.id = #{id} |
| | | GROUP BY t.id |
| | | </select> |
| | | <select id="queryProcessingRecordPage" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> |
| | | SELECT sc.id, |
| | | sc.serial_number, |
| | | sc.time, |
| | | sc.problem_type, |
| | | sc.name, |
| | | sc.contact_number, |
| | | sc.location, |
| | | sc.detailed_address, |
| | | sc.description_title, |
| | | sc.description_content, |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 |
| | | ELSE sc.status |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.superior_id, |
| | | sc.create_by, |
| | | sc.create_time, |
| | | sc.update_by, |
| | | sc.update_time, |
| | | sc.completion_description, |
| | | sc.completion_images, |
| | | sc.completion_videos, |
| | | sc.completion_other_description, |
| | | sc.completion_time, |
| | | sc.completion_user_id, |
| | | sc.completion_username, |
| | | sc.completion_user_phone, |
| | | sc.closing_time, |
| | | sc.over_time_days, |
| | | sc.latitude, |
| | | sc.longitude, |
| | | scar.audit_type, |
| | | scar.audit_status, |
| | | scar.reporter_level, |
| | | scar.comment, |
| | | scar.create_time AS reportTime, |
| | | scar.system_user_id, |
| | | scar.create_by as auditCreateBy, |
| | | scar.reporter, |
| | | scar.reporter_id, |
| | | scar.superior_id superiorId2, |
| | | scar.department_name, |
| | | scar.department_id, |
| | | (SELECT COUNT(*) FROM sgsb_complaint_progress WHERE complaint_id = sc.id) AS progress_count, |
| | | (SELECT COUNT(*) FROM sgsb_complaint_audit_record WHERE complaint_id = sc.id AND audit_type = 3 AND audit_status = 1) AS assignment_count, |
| | | (SELECT COUNT(*) FROM sgsb_complaint_audit_record WHERE complaint_id = sc.id AND audit_type = 2 AND audit_status = 1) AS report_count |
| | | FROM sgsb_complaint sc |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | <where> |
| | | <if test="1 == accountLevel"> |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="keyword!=null and keyword != ''"> |
| | | AND (sc.name like concat('%',#{keyword},'%') |
| | | or sc.id in (select complaint_id from sgsb_complaint_progress where create_by_name like concat('%',#{keyword},'%')) |
| | | or sc.report_user_name like concat('%',#{keyword},'%')) |
| | | </if> |
| | | </where> |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | <select id="queryRejectRecordPage" resultType="com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO"> |
| | | SELECT |
| | | scar.*, |
| | | sc.serial_number, |
| | | sc.latitude, |
| | | sc.longitude, |
| | | sc.location, |
| | | sc.detailed_address, |
| | | sc.problem_type, |
| | | sc.name, |
| | | sc.contact_number |
| | | FROM |
| | | sgsb_complaint_audit_record scar |
| | | LEFT JOIN sgsb_complaint sc ON scar.complaint_id = sc.id |
| | | <where> |
| | | scar.audit_type != 3 |
| | | AND scar.audit_status = 2 |
| | | <if test="1 == accountLevel"> |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} |
| | | </if> |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId}) |
| | | </if> |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId}) |
| | | </if> |
| | | <if test="keyword!=null and keyword != ''"> |
| | | AND (scar.reporter like concat('%',#{keyword},'%') or scar.auditor_name like concat('%',#{keyword},'%') |
| | | or sc.name like concat('%',#{keyword},'%')or sc.report_user_name like concat('%',#{keyword},'%')) |
| | | </if> |
| | | </where> |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | </mapper> |