|
|
|
|
@ -1,10 +1,8 @@
|
|
|
|
|
package com.biutag.supervision.service.complaintCollection; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.lang.Assert; |
|
|
|
|
import cn.hutool.core.lang.Opt; |
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
@ -17,13 +15,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.biutag.supervision.common.UserContextHolder; |
|
|
|
|
import com.biutag.supervision.constants.AppConstants; |
|
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
|
import com.biutag.supervision.constants.enums.BusinessTypeEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProblemSourcesEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
|
|
|
|
import com.biutag.supervision.mapper.ComplaintCollectionMapper; |
|
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
|
import com.biutag.supervision.pojo.domain.Blame; |
|
|
|
|
import com.biutag.supervision.pojo.dto.NegativeDto; |
|
|
|
|
import com.biutag.supervision.pojo.dto.complaintCollection.*; |
|
|
|
|
import com.biutag.supervision.pojo.dto.flow.VerifyData; |
|
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.*; |
|
|
|
|
import com.biutag.supervision.pojo.enums.negative.NegativeSourceTypeEnum; |
|
|
|
|
@ -41,10 +40,8 @@ import com.biutag.supervision.pojo.param.complaintCollectionCheckFile.ComplaintC
|
|
|
|
|
import com.biutag.supervision.pojo.param.complaintCollectionFile.ComplaintCollectionFileQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.request.complaintCollection.*; |
|
|
|
|
import com.biutag.supervision.pojo.transfer.ComplaintCollectionTransfer; |
|
|
|
|
import com.biutag.supervision.pojo.vo.FileVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.complaintCollection.ComplaintCollectionDetailVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.complaintCollection.ComplaintCollectionMailRepeattVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.complaintCollection.ComplaintCollectionWatchDetailVO; |
|
|
|
|
import com.biutag.supervision.repository.complaintCollection.ComplaintCollectionResourceService; |
|
|
|
|
import com.biutag.supervision.repository.complaintCollectionBlame.ComplaintCollectionBlameResourceService; |
|
|
|
|
import com.biutag.supervision.repository.complaintCollectionCheckFile.ComplaintCollectionCheckFileResourceService; |
|
|
|
|
@ -59,7 +56,6 @@ import com.biutag.supervision.util.SfssUtil;
|
|
|
|
|
import com.biutag.supervision.util.TimeUtil; |
|
|
|
|
import jakarta.servlet.ServletOutputStream; |
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
import jakarta.validation.ValidationException; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -71,7 +67,6 @@ import java.net.URLEncoder;
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
@ -270,40 +265,47 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && (user.getRoleCodes().isEmpty() || user.getAuthSources().isEmpty() || user.getAuthDepartIds().isEmpty())) { |
|
|
|
|
return new Page<ComplaintCollectionPageDTO>().setTotal(0).setRecords(new ArrayList<>()); |
|
|
|
|
} |
|
|
|
|
// 鉴权 如果不是超级管理员
|
|
|
|
|
// 办理单位:需要鉴权
|
|
|
|
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType())) { |
|
|
|
|
// 获取用户有权访问的所有下级机构ID
|
|
|
|
|
List<String> allNodeIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
|
|
|
|
Set<String> visibleSecondIds = new HashSet<>(allNodeIds); |
|
|
|
|
// 如果前端传了二级机构,校验是否在用户权限范围内
|
|
|
|
|
if (StrUtil.isNotBlank(request.getSecondDepartId())) { |
|
|
|
|
// 获取前端选择的二级机构及其所有下级
|
|
|
|
|
List<String> reqAllIds = departService.getAllNodeIds(List.of(request.getSecondDepartId())); |
|
|
|
|
Set<String> visibleIds = new HashSet<>(allNodeIds); |
|
|
|
|
// 如果前端传了办理单位,校验是否在用户权限范围内
|
|
|
|
|
if (StrUtil.isNotBlank(request.getHandleDepartId())) { |
|
|
|
|
// 获取前端选择的办理单位及其所有下级
|
|
|
|
|
List<String> reqAllIds = departService.getAllNodeIds(List.of(request.getHandleDepartId())); |
|
|
|
|
// 取交集:用户权限 ∩ 前端选择
|
|
|
|
|
visibleSecondIds.retainAll(new HashSet<>(reqAllIds)); |
|
|
|
|
visibleIds.retainAll(new HashSet<>(reqAllIds)); |
|
|
|
|
// 如果没有交集,说明用户没有访问该机构的权限
|
|
|
|
|
if (CollectionUtil.isEmpty(visibleSecondIds)) { |
|
|
|
|
if (CollectionUtil.isEmpty(visibleIds)) { |
|
|
|
|
return new Page<ComplaintCollectionPageDTO>().setTotal(0).setRecords(new ArrayList<>()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
param.setSecondDepartIds(visibleSecondIds); |
|
|
|
|
param.setHandleDepartIds(visibleIds); |
|
|
|
|
}else { |
|
|
|
|
// 超级管理员:如果前端传了二级机构,只按该机构筛选
|
|
|
|
|
if (StrUtil.isNotBlank(request.getSecondDepartId())) { |
|
|
|
|
List<String> reqAllIds = departService.getAllNodeIds(List.of(request.getSecondDepartId())); |
|
|
|
|
// 超级管理员:如果前端传了办理单位,只按该机构筛选
|
|
|
|
|
if (StrUtil.isNotBlank(request.getHandleDepartId())) { |
|
|
|
|
List<String> reqAllIds = departService.getAllNodeIds(List.of(request.getHandleDepartId())); |
|
|
|
|
if (CollectionUtil.isNotEmpty(reqAllIds)) { |
|
|
|
|
param.setSecondDepartIds(new HashSet<>(reqAllIds)); |
|
|
|
|
param.setHandleDepartIds(new HashSet<>(reqAllIds)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 办理单位:获取所有子节点ID
|
|
|
|
|
if (StrUtil.isNotBlank(request.getHandleDepartId())) { |
|
|
|
|
List<String> allDepartIds = departService.getAllNodeIds(List.of(request.getHandleDepartId())); |
|
|
|
|
// 涉及单位:获取所有子节点ID(不需要鉴权)
|
|
|
|
|
if (StrUtil.isNotBlank(request.getInvolveDepartId())) { |
|
|
|
|
List<String> allDepartIds = departService.getAllNodeIds(List.of(request.getInvolveDepartId())); |
|
|
|
|
if (CollectionUtil.isNotEmpty(allDepartIds)) { |
|
|
|
|
param.setHandleDepartIds(new HashSet<>(allDepartIds)); |
|
|
|
|
param.setInvolveDepartIds(new HashSet<>(allDepartIds)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// doto 自办信件的只有市局管理员 12377管理员可以看
|
|
|
|
|
// // 办理单位:获取所有子节点ID
|
|
|
|
|
// if (StrUtil.isNotBlank(request.getHandleDepartId())) {
|
|
|
|
|
// List<String> allDepartIds = departService.getAllNodeIds(List.of(request.getHandleDepartId()));
|
|
|
|
|
// if (CollectionUtil.isNotEmpty(allDepartIds)) {
|
|
|
|
|
// param.setHandleDepartIds(new HashSet<>(allDepartIds));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
Page<ComplaintCollection> page = new Page<>(param.getCurrent(), param.getSize()); |
|
|
|
|
IPage<ComplaintCollectionPageDTO> pageResult = complaintCollectionMapper.selectPageWithNegative(page, param); |
|
|
|
|
List<ComplaintCollectionPageDTO> list = pageResult.getRecords(); |
|
|
|
|
|