|
|
|
|
@ -1,30 +1,48 @@
|
|
|
|
|
package com.biutag.supervision.service.subDatav; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.biutag.supervision.constants.enums.DepartGroupEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProblemSourcesEnum; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
|
import com.biutag.supervision.mapper.*; |
|
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
|
import com.biutag.supervision.pojo.dto.DepartAndSubDepartDto; |
|
|
|
|
import com.biutag.supervision.pojo.entity.SupDepart; |
|
|
|
|
import com.biutag.supervision.pojo.entity.SupExternalDepart; |
|
|
|
|
import com.biutag.supervision.pojo.dto.common.BarItem; |
|
|
|
|
import com.biutag.supervision.pojo.dto.common.PieItem; |
|
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
|
import com.biutag.supervision.pojo.entity.mailbox.Mail; |
|
|
|
|
import com.biutag.supervision.pojo.param.*; |
|
|
|
|
import com.biutag.supervision.pojo.param.negativeBlame.NegativeBlameQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.request.datav.DataVRequest; |
|
|
|
|
import com.biutag.supervision.pojo.request.subdatav.SubDataVRequest; |
|
|
|
|
import com.biutag.supervision.pojo.vo.GlobalOverViewVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.OrganizeProblemRankVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.*; |
|
|
|
|
import com.biutag.supervision.repository.dataAudit.DataAuditResourceService; |
|
|
|
|
import com.biutag.supervision.repository.dataCaseVerif.DataCaseVerifResourceService; |
|
|
|
|
import com.biutag.supervision.repository.dataPetitionComplaint.DataPetitionComplaintResourceService; |
|
|
|
|
import com.biutag.supervision.repository.mail.MailResourceService; |
|
|
|
|
import com.biutag.supervision.repository.negative.NegativeResourceService; |
|
|
|
|
import com.biutag.supervision.repository.negativeBlame.NegativeBlameResourceService; |
|
|
|
|
import com.biutag.supervision.repository.reportproject.ReportProjectResourceService; |
|
|
|
|
import com.biutag.supervision.repository.supExternalDepart.SupExternalDepartResourceService; |
|
|
|
|
import com.biutag.supervision.repository.supdepart.SupDepartResourceService; |
|
|
|
|
import com.biutag.supervision.service.NegativeBlameService; |
|
|
|
|
import com.biutag.supervision.service.*; |
|
|
|
|
import com.biutag.supervision.service.datav.DatavServiceImpl; |
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @ClassName SubDatavServiceImpl |
|
|
|
|
* @Description 区县大屏服务层 |
|
|
|
|
@ -35,14 +53,13 @@ import java.util.stream.Collectors;
|
|
|
|
|
public class SubDatavServiceImpl implements SubDatavService { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SupDepartResourceService supDepartResourceService; |
|
|
|
|
private ReportProjectResourceService reportProjectResourceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private NegativeResourceService negativeResourceService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private ReportProjectResourceService reportProjectResourceService; |
|
|
|
|
private SupDepartResourceService supDepartResourceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private NegativeBlameService negativeBlameService; |
|
|
|
|
@ -59,7 +76,63 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
@Resource |
|
|
|
|
private DataCaseVerifResourceService dataCaseVerifResourceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SupPoliceService supPoliceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private DataAuditResourceService dataAuditResourceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private NegativeService negativeService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private RpcApplyMapper rpcApplyMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private RpcComfortPacksMapper rpcComfortPacksMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private DataPetitionComplaintMapper dataPetitionComplaintMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private DataMailService dataMailService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private MailMapper mailMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private DataPetition12337Mapper dataPetition12337Mapper; |
|
|
|
|
@Resource |
|
|
|
|
private SupExternalDepartMapper supExternalDepartMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private DataPetition12337Service dataPetition12337Service; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SupDepartMapper supDepartMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private NegativeMapper negativeMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SuperviseReportService superviseReportService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private NegativeBlameResourceService negativeBlameResourceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private DataCaseVerifMapper dataCaseVerifMapper; |
|
|
|
|
|
|
|
|
|
private static final String NO_BLAME = "不予追责"; |
|
|
|
|
|
|
|
|
|
private static final BigDecimal WAN = new BigDecimal("10000"); |
|
|
|
|
|
|
|
|
|
private final String VALID_SIGN = "terminated"; |
|
|
|
|
private final String EX_SOURCE = "局长信箱"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// region 首页二级大屏
|
|
|
|
|
// 问题排名
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneOrganizationRank(SubDataVRequest request) { |
|
|
|
|
SupDepartQueryParam supDepartQueryParam = new SupDepartQueryParam(); |
|
|
|
|
@ -85,6 +158,7 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 二级首页总览数据
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneAllCount(SubDataVRequest request) { |
|
|
|
|
|
|
|
|
|
@ -167,7 +241,826 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
// region 视频督察二级
|
|
|
|
|
// 视频督察 二级问题数排名
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneVideoSuperviseProblemRank(SubDataVRequest request) { |
|
|
|
|
List<OrganizeProblemRankVo> policeVideoSuperviseProblemRankList = new ArrayList<>(); |
|
|
|
|
List<OrganizeProblemRankVo> teamVideoSuperviseProblemRankList = new ArrayList<>(); |
|
|
|
|
SupDepartQueryParam supDepartGroupParam = new SupDepartQueryParam(); |
|
|
|
|
supDepartGroupParam.setLevel("3"); |
|
|
|
|
supDepartGroupParam.setPid(request.getDepartId()); |
|
|
|
|
List<SupDepart> supDepartList = supDepartResourceService.query(supDepartGroupParam); |
|
|
|
|
// 派出所
|
|
|
|
|
List<SupDepart> pcsList = supDepartList.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getStatisticsGroupId())) |
|
|
|
|
.filter(one -> DepartGroupEnum.PCS.getId().equals(Integer.valueOf(one.getStatisticsGroupId()))) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
// 大队
|
|
|
|
|
List<SupDepart> dwList = supDepartList.stream() |
|
|
|
|
.filter(one -> { |
|
|
|
|
String groupId = one.getStatisticsGroupId(); |
|
|
|
|
return !StrUtil.isNotBlank(groupId) |
|
|
|
|
|| !DepartGroupEnum.PCS.getId().equals(Integer.valueOf(groupId)); |
|
|
|
|
}) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
for (SupDepart pcs : pcsList) { |
|
|
|
|
List<Negative> fxsjList = negativeMapper.getVideoSuperviseProblemRank(pcs.getId(), request.getBeginTime(), request.getEndTime()); |
|
|
|
|
// 总数
|
|
|
|
|
long total = fxsjList.size(); |
|
|
|
|
if (total == 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// 市局下发
|
|
|
|
|
long sjxf = fxsjList.stream().filter(one -> Integer.valueOf(0).equals(one.getCrtDepartLevel())).count(); |
|
|
|
|
// 县局下发
|
|
|
|
|
long xjxf = fxsjList.stream().filter(one -> Integer.valueOf(2).equals(one.getCrtDepartLevel())).count(); |
|
|
|
|
OrganizeProblemRankVo organizeProblemRankVo = new OrganizeProblemRankVo(); |
|
|
|
|
organizeProblemRankVo.setLabel(pcs.getShortName()); |
|
|
|
|
organizeProblemRankVo.setCityNumber(String.valueOf(sjxf)); |
|
|
|
|
organizeProblemRankVo.setCountyNumber(String.valueOf(xjxf)); |
|
|
|
|
organizeProblemRankVo.setValue(String.valueOf(total)); |
|
|
|
|
policeVideoSuperviseProblemRankList.add(organizeProblemRankVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (SupDepart dw : dwList) { |
|
|
|
|
List<Negative> fxsjList = negativeMapper.getVideoSuperviseProblemRank(dw.getId(), request.getBeginTime(), request.getEndTime()); |
|
|
|
|
// 总数
|
|
|
|
|
long total = fxsjList.size(); |
|
|
|
|
if (total == 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// 市局下发
|
|
|
|
|
long sjxf = fxsjList.stream().filter(one -> Integer.valueOf(0).equals(one.getCrtDepartLevel())).count(); |
|
|
|
|
// 县局下发
|
|
|
|
|
long xjxf = fxsjList.stream().filter(one -> Integer.valueOf(2).equals(one.getCrtDepartLevel())).count(); |
|
|
|
|
OrganizeProblemRankVo organizeProblemRankVo = new OrganizeProblemRankVo(); |
|
|
|
|
organizeProblemRankVo.setLabel(dw.getShortName()); |
|
|
|
|
organizeProblemRankVo.setCityNumber(String.valueOf(sjxf)); |
|
|
|
|
organizeProblemRankVo.setCountyNumber(String.valueOf(xjxf)); |
|
|
|
|
organizeProblemRankVo.setValue(String.valueOf(total)); |
|
|
|
|
teamVideoSuperviseProblemRankList.add(organizeProblemRankVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 排序
|
|
|
|
|
policeVideoSuperviseProblemRankList.sort( |
|
|
|
|
Comparator.comparingLong((OrganizeProblemRankVo vo) -> Long.parseLong(vo.getValue())) |
|
|
|
|
.reversed() |
|
|
|
|
); |
|
|
|
|
teamVideoSuperviseProblemRankList.sort( |
|
|
|
|
Comparator.comparingLong((OrganizeProblemRankVo vo) -> Long.parseLong(vo.getValue())) |
|
|
|
|
.reversed() |
|
|
|
|
); |
|
|
|
|
JSONObject data = new JSONObject(); |
|
|
|
|
data.fluentPut("policeVideoSuperviseProblemRankList", policeVideoSuperviseProblemRankList); |
|
|
|
|
data.fluentPut("teamVideoSuperviseProblemRankList", teamVideoSuperviseProblemRankList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 视频督察二级总览
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneAllVideoSuperviseCount(SubDataVRequest request) { |
|
|
|
|
List<Negative> negatives = negativeMapper.getNegativeListData(request.getDepartId(), request.getBeginTime(), request.getEndTime(), List.of(SPDC.getValue())); |
|
|
|
|
List<Negative> ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); |
|
|
|
|
List<Negative> completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); |
|
|
|
|
NegativeBlameQueryParam negativeBlameQueryParam = new NegativeBlameQueryParam(); |
|
|
|
|
negativeBlameQueryParam.setNegativeIds(ssList.stream().map(Negative::getId).toList()); |
|
|
|
|
List<NegativeBlame> negativeBlames = negativeBlameResourceService.query(negativeBlameQueryParam); |
|
|
|
|
|
|
|
|
|
// 3. 个人问责
|
|
|
|
|
List<NegativeBlame> personalBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.personal.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
// 4. 领导问责(按 negativeId + 领导姓名 + 领导处理结果 去重)
|
|
|
|
|
Set<String> seenLead = new HashSet<>(); |
|
|
|
|
List<NegativeBlame> leadBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.personal.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> seenLead.add( |
|
|
|
|
one.getNegativeId() + "_" + one.getLeadHandleResultName() + "_" + one.getLeadName() |
|
|
|
|
)) |
|
|
|
|
.toList(); |
|
|
|
|
// 5. 单位问责
|
|
|
|
|
List<NegativeBlame> unitBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.department.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
VideoSuperviseCountVo overview = new VideoSuperviseCountVo(); |
|
|
|
|
overview.setTotal(negatives.size()); |
|
|
|
|
overview.setCompletionProblem((long) completedList.size()); |
|
|
|
|
overview.setDiscoverProblem((long) ssList.size()); |
|
|
|
|
overview.setRelativeOrg((long) unitBlames.size()); |
|
|
|
|
overview.setRelativePer((long) (personalBlames.size() + leadBlames.size())); |
|
|
|
|
JSONObject data = new JSONObject().fluentPut("overview", overview); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 视频督察二级地图
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneVideoSuperviseMap(SubDataVRequest request) { |
|
|
|
|
|
|
|
|
|
List<VideoSuperviseMapIconVo> videoSuperviseMapIconVoList = new ArrayList<>(); |
|
|
|
|
String departId = request.getDepartId(); |
|
|
|
|
Date beginTime = request.getBeginTime(); |
|
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
|
|
|
|
|
|
List<String> proCode = List.of(SPDC.getValue()); |
|
|
|
|
|
|
|
|
|
// 查该区县局下属所有派出所
|
|
|
|
|
List<SupDepart> policeDeparts = supDepartMapper.selectPoliceDeparts(Integer.valueOf(departId)); |
|
|
|
|
for (SupDepart pcs : policeDeparts) { |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.getNegativeListData(pcs.getId(), request.getBeginTime(), request.getEndTime(), proCode); |
|
|
|
|
|
|
|
|
|
List<Negative> ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); |
|
|
|
|
List<Negative> completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); |
|
|
|
|
NegativeBlameQueryParam negativeBlameQueryParam = new NegativeBlameQueryParam(); |
|
|
|
|
negativeBlameQueryParam.setNegativeIds(ssList.stream().map(Negative::getId).toList()); |
|
|
|
|
List<NegativeBlame> negativeBlames = negativeBlameResourceService.query(negativeBlameQueryParam); |
|
|
|
|
|
|
|
|
|
// 3. 个人问责
|
|
|
|
|
List<NegativeBlame> personalBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.personal.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
// 4. 领导问责(按 negativeId + 领导姓名 + 领导处理结果 去重)
|
|
|
|
|
Set<String> seenLead = new HashSet<>(); |
|
|
|
|
List<NegativeBlame> leadBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> seenLead.add( |
|
|
|
|
one.getNegativeId() + "_" + one.getLeadHandleResultName() + "_" + one.getLeadName() |
|
|
|
|
)) |
|
|
|
|
.toList(); |
|
|
|
|
// 5. 单位问责
|
|
|
|
|
List<NegativeBlame> unitBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.department.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VideoSuperviseMapIconVo videoSuperviseMapIconVo = new VideoSuperviseMapIconVo(); |
|
|
|
|
videoSuperviseMapIconVo.setName(pcs.getShortName()); |
|
|
|
|
videoSuperviseMapIconVo.setDepartId(pcs.getId()); |
|
|
|
|
videoSuperviseMapIconVo.setDiscoverProblem(ssList.size()); |
|
|
|
|
videoSuperviseMapIconVo.setCompletionProblem(completedList.size()); |
|
|
|
|
videoSuperviseMapIconVo.setRelativeOrg(unitBlames.size()); |
|
|
|
|
videoSuperviseMapIconVo.setRelativePer(personalBlames.size() + leadBlames.size()); |
|
|
|
|
videoSuperviseMapIconVoList.add(videoSuperviseMapIconVo); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
videoSuperviseMapIconVoList.forEach(VideoSuperviseMapIconVo::initDefaultIfNull); |
|
|
|
|
JSONObject data = new JSONObject().fluentPut("videoSuperviseMapIconVoList", videoSuperviseMapIconVoList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
// region 案件核查二级
|
|
|
|
|
// 排名
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneCaseVerificationRank(SubDataVRequest request) { |
|
|
|
|
|
|
|
|
|
List<String> proCode = List.of(A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
|
List<SupDepart> level3ByPidSupDepartList = supDepartResourceService.getLevel3ByPidSupDepartList(request.getDepartId()); |
|
|
|
|
// 派出所
|
|
|
|
|
List<SupDepart> pcsList = level3ByPidSupDepartList.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getStatisticsGroupId())) |
|
|
|
|
.filter(one -> DepartGroupEnum.PCS.getId().equals(Integer.valueOf(one.getStatisticsGroupId()))) |
|
|
|
|
.toList(); |
|
|
|
|
// 大队
|
|
|
|
|
List<SupDepart> dwList = level3ByPidSupDepartList.stream() |
|
|
|
|
.filter(one -> { |
|
|
|
|
String groupId = one.getStatisticsGroupId(); |
|
|
|
|
return !StrUtil.isNotBlank(groupId) |
|
|
|
|
|| !DepartGroupEnum.PCS.getId().equals(Integer.valueOf(groupId)); |
|
|
|
|
}) |
|
|
|
|
.toList(); |
|
|
|
|
List<OrganizeProblemRankVo> fxsjRankList = new ArrayList<>(); |
|
|
|
|
List<OrganizeProblemRankVo> jsdwRankList = new ArrayList<>(); |
|
|
|
|
for (SupDepart pcs : pcsList) { |
|
|
|
|
List<Negative> negatives = negativeMapper.getNegativeListData(pcs.getId(), request.getBeginTime(), request.getEndTime(), proCode); |
|
|
|
|
if (CollectionUtil.isEmpty(negatives)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
OrganizeProblemRankVo organizeProblemRankVo = new OrganizeProblemRankVo(); |
|
|
|
|
organizeProblemRankVo.setLabel(pcs.getShortName()); |
|
|
|
|
organizeProblemRankVo.setValue(String.valueOf(negatives.size())); |
|
|
|
|
fxsjRankList.add(organizeProblemRankVo); |
|
|
|
|
} |
|
|
|
|
for (SupDepart dw : dwList) { |
|
|
|
|
List<Negative> negatives = negativeMapper.getNegativeListData(dw.getId(), request.getBeginTime(), request.getEndTime(), proCode); |
|
|
|
|
if (CollectionUtil.isEmpty(negatives)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
OrganizeProblemRankVo organizeProblemRankVo = new OrganizeProblemRankVo(); |
|
|
|
|
organizeProblemRankVo.setLabel(dw.getShortName()); |
|
|
|
|
organizeProblemRankVo.setValue(String.valueOf(negatives.size())); |
|
|
|
|
jsdwRankList.add(organizeProblemRankVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 排序
|
|
|
|
|
fxsjRankList.sort( |
|
|
|
|
Comparator.comparingLong((OrganizeProblemRankVo vo) -> Long.parseLong(vo.getValue())) |
|
|
|
|
.reversed() |
|
|
|
|
); |
|
|
|
|
jsdwRankList.sort( |
|
|
|
|
Comparator.comparingLong((OrganizeProblemRankVo vo) -> Long.parseLong(vo.getValue())) |
|
|
|
|
.reversed() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("fxsjRankList", fxsjRankList) |
|
|
|
|
.fluentPut("jsdwRankList", jsdwRankList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 总览
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneAllCaseVerificationCount(SubDataVRequest request) { |
|
|
|
|
// 交办
|
|
|
|
|
Set<String> ldjbCode = Set.of(SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
|
|
|
|
|
|
List<String> proCode = List.of(A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<DataCaseVerif> dataCaseVerifLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
dataCaseVerifLambdaQueryWrapper.between(DataCaseVerif::getCreateTime, request.getBeginTime(), request.getEndTime()); |
|
|
|
|
List<DataCaseVerif> dataCaseVerifs = dataCaseVerifMapper.getListData(request.getDepartId(), request.getBeginTime(), request.getEndTime()); |
|
|
|
|
List<Negative> negatives = negativeMapper.getNegativeListData(request.getDepartId(), request.getBeginTime(), request.getEndTime(), proCode); |
|
|
|
|
List<Negative> ssNegative = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); |
|
|
|
|
// 交办案件数
|
|
|
|
|
List<Negative> jbNegatvieList = negatives.stream().filter(one -> ldjbCode.contains(one.getProblemSourcesCode())).toList(); |
|
|
|
|
NegativeBlameQueryParam negativeBlameQueryParam = new NegativeBlameQueryParam(); |
|
|
|
|
negativeBlameQueryParam.setNegativeIds(ssNegative.stream().map(Negative::getId).toList()); |
|
|
|
|
List<NegativeBlame> negativeBlames = negativeBlameResourceService.query(negativeBlameQueryParam); |
|
|
|
|
|
|
|
|
|
// 3. 个人问责
|
|
|
|
|
List<NegativeBlame> personalBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.personal.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
// 4. 领导问责(按 negativeId + 领导姓名 + 领导处理结果 去重)
|
|
|
|
|
Set<String> seenLead = new HashSet<>(); |
|
|
|
|
List<NegativeBlame> leadBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> seenLead.add( |
|
|
|
|
one.getNegativeId() + "_" + one.getLeadHandleResultName() + "_" + one.getLeadName() |
|
|
|
|
)) |
|
|
|
|
.toList(); |
|
|
|
|
// 5. 单位问责
|
|
|
|
|
List<NegativeBlame> unitBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.department.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
Double verificationRate = 0.0; |
|
|
|
|
if (!dataCaseVerifs.isEmpty()) { |
|
|
|
|
double rawRate = (double) ssNegative.size() / (dataCaseVerifs.size() + jbNegatvieList.size()) * 100; |
|
|
|
|
verificationRate = Math.round(rawRate * 10) / 10.0; |
|
|
|
|
} |
|
|
|
|
CaseVerificationCountVo overview = new CaseVerificationCountVo(); |
|
|
|
|
overview.setTotal(dataCaseVerifs.size() + jbNegatvieList.size()); |
|
|
|
|
overview.setConfirmed(ssNegative.size()); |
|
|
|
|
overview.setDealCasePro((long) negatives.size()); |
|
|
|
|
overview.setPunishPre((long) (personalBlames.size() + leadBlames.size())); |
|
|
|
|
overview.setPunishOrg((long) unitBlames.size()); |
|
|
|
|
overview.setRate(verificationRate); |
|
|
|
|
JSONObject res = new JSONObject().fluentPut("overview", overview); |
|
|
|
|
return Result.success(res); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 地图
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneCaseVerificationMap(SubDataVRequest request) { |
|
|
|
|
|
|
|
|
|
// 交办
|
|
|
|
|
Set<String> ldjbCode = Set.of(SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
|
List<String> proCode = List.of(A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
|
// 查该区县局下属所有派出所
|
|
|
|
|
List<SupDepart> policeDeparts = supDepartMapper.selectPoliceDeparts(Integer.valueOf(request.getDepartId())); |
|
|
|
|
List<CaseVerificationMapVo> caseVerificationMapList = new ArrayList<>(); |
|
|
|
|
for (SupDepart pcs : policeDeparts) { |
|
|
|
|
// 案件核查
|
|
|
|
|
LambdaQueryWrapper<DataCaseVerif> dataCaseVerifLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
dataCaseVerifLambdaQueryWrapper.between(DataCaseVerif::getCreateTime, request.getBeginTime(), request.getEndTime()); |
|
|
|
|
dataCaseVerifLambdaQueryWrapper.eq(DataCaseVerif::getThirdDepartId, pcs.getId()); |
|
|
|
|
List<DataCaseVerif> dataCaseVerifs = dataCaseVerifMapper.selectList(dataCaseVerifLambdaQueryWrapper); |
|
|
|
|
|
|
|
|
|
// 所有查处数据
|
|
|
|
|
List<Negative> negatives = negativeMapper.getNegativeListData(pcs.getId(), request.getBeginTime(), request.getEndTime(), proCode); |
|
|
|
|
// 交办案件数
|
|
|
|
|
List<Negative> jbNegatvieList = negatives.stream().filter(one -> ldjbCode.contains(one.getProblemSourcesCode())).toList(); |
|
|
|
|
// 问责情况
|
|
|
|
|
List<Negative> ssNegative = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); |
|
|
|
|
NegativeBlameQueryParam negativeBlameQueryParam = new NegativeBlameQueryParam(); |
|
|
|
|
negativeBlameQueryParam.setNegativeIds(ssNegative.stream().map(Negative::getId).toList()); |
|
|
|
|
List<NegativeBlame> negativeBlames = negativeBlameResourceService.query(negativeBlameQueryParam); |
|
|
|
|
|
|
|
|
|
// 3. 个人问责
|
|
|
|
|
List<NegativeBlame> personalBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.personal.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
// 4. 领导问责(按 negativeId + 领导姓名 + 领导处理结果 去重)
|
|
|
|
|
Set<String> seenLead = new HashSet<>(); |
|
|
|
|
List<NegativeBlame> leadBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> seenLead.add( |
|
|
|
|
one.getNegativeId() + "_" + one.getLeadHandleResultName() + "_" + one.getLeadName() |
|
|
|
|
)) |
|
|
|
|
.toList(); |
|
|
|
|
// 5. 单位问责
|
|
|
|
|
List<NegativeBlame> unitBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.department.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
int totalCaseCount = dataCaseVerifs.size() + jbNegatvieList.size(); |
|
|
|
|
double verificationRate = 0.0; |
|
|
|
|
if (totalCaseCount > 0) { |
|
|
|
|
double rawRate = (double) ssNegative.size() / totalCaseCount * 100; |
|
|
|
|
verificationRate = Math.round(rawRate * 10) / 10.0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CaseVerificationMapVo caseVerificationMapVo = new CaseVerificationMapVo(); |
|
|
|
|
caseVerificationMapVo.setName(pcs.getShortName()); |
|
|
|
|
caseVerificationMapVo.setDepartId(pcs.getId()); |
|
|
|
|
caseVerificationMapVo.setTotal(dataCaseVerifs.size() + jbNegatvieList.size()); |
|
|
|
|
caseVerificationMapVo.setConfirmed(ssNegative.size()); |
|
|
|
|
caseVerificationMapVo.setDealCasePro(negatives.size()); |
|
|
|
|
caseVerificationMapVo.setPunishPre(personalBlames.size() + leadBlames.size()); |
|
|
|
|
caseVerificationMapVo.setPunishOrg(unitBlames.size()); |
|
|
|
|
caseVerificationMapVo.setRate(verificationRate); |
|
|
|
|
caseVerificationMapList.add(caseVerificationMapVo); |
|
|
|
|
} |
|
|
|
|
caseVerificationMapList.forEach(CaseVerificationMapVo::initDefaultIfNull); |
|
|
|
|
JSONObject res = new JSONObject().fluentPut("caseVerificationMapList", caseVerificationMapList); |
|
|
|
|
return Result.success(res); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 案件来源占比 & 问责处理情况
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneCaseSourceRateAndDealSituation(SubDataVRequest request) { |
|
|
|
|
List<EchartsVo> caseSourceRateList = new ArrayList<>(); |
|
|
|
|
List<EchartsVo> dealSituationPieList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
// 总
|
|
|
|
|
List<String> proCode = List.of(A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
|
// 交办
|
|
|
|
|
Set<String> ldjbCode = Set.of(SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
|
// 案件核查 || 12389
|
|
|
|
|
List<DataCaseVerif> dataCaseVerifs = dataCaseVerifMapper.getListData(request.getDepartId(), request.getBeginTime(), request.getEndTime()); |
|
|
|
|
// 交办
|
|
|
|
|
List<Negative> negatives = negativeMapper.getNegativeListData(request.getDepartId(), request.getBeginTime(), request.getEndTime(), proCode); |
|
|
|
|
|
|
|
|
|
// 案件来源占比
|
|
|
|
|
// 1、找到案件核查案件数
|
|
|
|
|
caseSourceRateList.add(new EchartsVo("12389投诉", dataCaseVerifs.size())); |
|
|
|
|
// 2、找交办案件数
|
|
|
|
|
Map<String, List<Negative>> groupedByProblemSource = negatives.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getProblemSourcesCode())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getProblemSources())) |
|
|
|
|
.filter(one -> ldjbCode.contains(one.getProblemSourcesCode())) |
|
|
|
|
.collect(Collectors.groupingBy(Negative::getProblemSources)); |
|
|
|
|
for (Map.Entry<String, List<Negative>> entry : groupedByProblemSource.entrySet()) { |
|
|
|
|
EchartsVo echartsVo = new EchartsVo(); |
|
|
|
|
echartsVo.setName(entry.getKey()); |
|
|
|
|
echartsVo.setValue(entry.getValue().size()); |
|
|
|
|
caseSourceRateList.add(echartsVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 问责处理情况
|
|
|
|
|
List<Negative> ssNegative = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); |
|
|
|
|
NegativeBlameQueryParam negativeBlameQueryParam = new NegativeBlameQueryParam(); |
|
|
|
|
negativeBlameQueryParam.setNegativeIds(ssNegative.stream().map(Negative::getId).toList()); |
|
|
|
|
List<NegativeBlame> negativeBlames = negativeBlameResourceService.query(negativeBlameQueryParam); |
|
|
|
|
Map<String, List<NegativeBlame>> blames = negativeBlames.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !"不予追责".equals(one.getHandleResultName())) |
|
|
|
|
.collect(Collectors.groupingBy(NegativeBlame::getHandleResultName)); |
|
|
|
|
for (Map.Entry<String, List<NegativeBlame>> entry : blames.entrySet()) { |
|
|
|
|
EchartsVo echartsVo = new EchartsVo(); |
|
|
|
|
echartsVo.setName(entry.getKey()); |
|
|
|
|
echartsVo.setValue(entry.getValue().size()); |
|
|
|
|
dealSituationPieList.add(echartsVo); |
|
|
|
|
} |
|
|
|
|
// 过滤0
|
|
|
|
|
caseSourceRateList = filterZero(caseSourceRateList); |
|
|
|
|
dealSituationPieList = filterZero(dealSituationPieList); |
|
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("caseSourceRateList", caseSourceRateList) |
|
|
|
|
.fluentPut("dealSituationPieList", dealSituationPieList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
// region 信访投诉二级
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneFirstAndRepeatMail(SubDataVRequest request) { |
|
|
|
|
Date beginTime = request.getBeginTime(); |
|
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
|
// 派出所
|
|
|
|
|
List<OrganizeProblemRankVo> fxsjFirstRankList = dataPetitionComplaintMapper.getSubMailRank(beginTime, endTime, 10, RepeatEnum.FIRST_MAIL.getId(), request.getDepartId()); |
|
|
|
|
List<OrganizeProblemRankVo> fxsjRepeatRankList = dataPetitionComplaintMapper.getSubMailRank(beginTime, endTime, 10, RepeatEnum.REPEAT_MAIL.getId(), request.getDepartId()); |
|
|
|
|
// 大队
|
|
|
|
|
List<OrganizeProblemRankVo> bwzdFirstRankList = dataPetitionComplaintMapper.getSubMailRank(beginTime, endTime, null, RepeatEnum.FIRST_MAIL.getId(), request.getDepartId()); |
|
|
|
|
List<OrganizeProblemRankVo> bwzdRepeatRankList = dataPetitionComplaintMapper.getSubMailRank(beginTime, endTime, null, RepeatEnum.REPEAT_MAIL.getId(), request.getDepartId()); |
|
|
|
|
// 汇总(派出所)
|
|
|
|
|
MailFirstAndRepeatOverviewVo fxsjOverview = new MailFirstAndRepeatOverviewVo(); |
|
|
|
|
fxsjOverview.setFirstMail(fxsjFirstRankList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
fxsjOverview.setRepeatMail(fxsjRepeatRankList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
fxsjOverview.setLeaderMail(0); |
|
|
|
|
// 汇总(大队)
|
|
|
|
|
MailFirstAndRepeatOverviewVo bwzdOverview = new MailFirstAndRepeatOverviewVo(); |
|
|
|
|
bwzdOverview.setFirstMail(bwzdFirstRankList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
bwzdOverview.setRepeatMail(bwzdRepeatRankList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
bwzdOverview.setLeaderMail(0); |
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("fxsjOverview", fxsjOverview) |
|
|
|
|
.fluentPut("bwzdOverview", bwzdOverview) |
|
|
|
|
.fluentPut("fxsjFirstRankList", fxsjFirstRankList) |
|
|
|
|
.fluentPut("fxsjRepeatRankList", fxsjRepeatRankList) |
|
|
|
|
.fluentPut("bwzdFirstRankList", bwzdFirstRankList) |
|
|
|
|
.fluentPut("bwzdRepeatRankList", bwzdRepeatRankList); |
|
|
|
|
// return getSubOneFirstAndRepeatMail();
|
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 信访数据大屏中央数据统计 && 信访投诉占比
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneAllMailCount(SubDataVRequest request) { |
|
|
|
|
MailOverviewVo overview = new MailOverviewVo(); |
|
|
|
|
Date beginTime = request.getBeginTime(); |
|
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
|
String departId = request.getDepartId(); |
|
|
|
|
// 国家信访
|
|
|
|
|
Long countryTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, GJXFPT.getValue(), departId); |
|
|
|
|
// 公安信访
|
|
|
|
|
Long policeTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, GABXF.getValue(), departId); |
|
|
|
|
// 12337
|
|
|
|
|
Long numTotal = dataPetition12337Service.count(new LambdaQueryWrapper<DataPetition12337>().between(DataPetition12337::getDiscoverTime, beginTime, endTime).eq(DataPetition12337::getSecondDepartId, departId)); |
|
|
|
|
// 局长信箱
|
|
|
|
|
QueryWrapper<Mail> subOneMailQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
String exDepartId = supExternalDepartMapper.getExIdByInId(departId.toString(), "局长信箱"); |
|
|
|
|
subOneMailQueryWrapper.ne("mail_state", VALID_SIGN); |
|
|
|
|
subOneMailQueryWrapper.eq("second_dept_id", exDepartId); |
|
|
|
|
subOneMailQueryWrapper.between("create_time", beginTime, endTime); |
|
|
|
|
Long commissionerTotal = mailMapper.selectCount(subOneMailQueryWrapper); |
|
|
|
|
// 总数
|
|
|
|
|
Long total = countryTotal + policeTotal + numTotal; |
|
|
|
|
//国家信访
|
|
|
|
|
overview.setCountryMail(countryTotal); |
|
|
|
|
//公安部信访
|
|
|
|
|
overview.setPoliceMail(policeTotal); |
|
|
|
|
//局长信箱
|
|
|
|
|
overview.setManageMail(commissionerTotal); |
|
|
|
|
//12337信访
|
|
|
|
|
overview.setNumberMail(numTotal); |
|
|
|
|
overview.setTotalMail(total); |
|
|
|
|
// overview.setCountryMail(120L); // 国家信访
|
|
|
|
|
// overview.setPoliceMail(45L); // 公安部信访
|
|
|
|
|
// overview.setNumberMail(30L); // 12337
|
|
|
|
|
// overview.setManageMail(20L); // 局长信箱
|
|
|
|
|
// overview.setTotalMail(120L + 45L + 30L);
|
|
|
|
|
JSONObject data = new JSONObject().fluentPut("overview", overview); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 信访地图
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneMailMapIcon(SubDataVRequest request) { |
|
|
|
|
List<MailMapIconVo> res = new ArrayList<>(); |
|
|
|
|
String departId = request.getDepartId(); |
|
|
|
|
Date beginTime = request.getBeginTime(); |
|
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
|
// 查该区县局下属所有派出所
|
|
|
|
|
List<SupDepart> policeDeparts = supDepartMapper.selectPoliceDeparts(Integer.valueOf(departId)); |
|
|
|
|
for (SupDepart supDepart : policeDeparts) { |
|
|
|
|
MailMapIconVo mapIconVo = new MailMapIconVo(); |
|
|
|
|
mapIconVo.setName(supDepart.getShortName()); |
|
|
|
|
mapIconVo.setDepartId(supDepart.getId()); |
|
|
|
|
res.add(mapIconVo); |
|
|
|
|
} |
|
|
|
|
// 查询国家信访和公安部信访数据
|
|
|
|
|
for (MailMapIconVo re : res) { |
|
|
|
|
String policeDepartId = re.getDepartId(); |
|
|
|
|
// 国家
|
|
|
|
|
Long countryTotal = dataPetitionComplaintMapper.selectPoliceMailBySourceCode(beginTime, endTime, GJXFPT.getValue(), policeDepartId); |
|
|
|
|
// 公安
|
|
|
|
|
Long policeTotal = dataPetitionComplaintMapper.selectPoliceMailBySourceCode(beginTime, endTime, GABXF.getValue(), policeDepartId); |
|
|
|
|
// 12337 数据
|
|
|
|
|
LambdaQueryWrapper<DataPetition12337> dataPetition12337LambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
dataPetition12337LambdaQueryWrapper.between(DataPetition12337::getDiscoverTime, beginTime, endTime); |
|
|
|
|
dataPetition12337LambdaQueryWrapper.eq(DataPetition12337::getThirdDepartId, re.getDepartId()); |
|
|
|
|
Long numTotal = dataPetition12337Service.count(dataPetition12337LambdaQueryWrapper); |
|
|
|
|
// 局长信箱
|
|
|
|
|
String exDepartId = supExternalDepartMapper.getExIdByInId(policeDepartId, EX_SOURCE); |
|
|
|
|
Long manageMail = 0L; |
|
|
|
|
if (exDepartId != null) { |
|
|
|
|
QueryWrapper<Mail> qw = new QueryWrapper<>(); |
|
|
|
|
qw.ne("mail_state", VALID_SIGN); |
|
|
|
|
qw.eq("three_dept_id", exDepartId); |
|
|
|
|
qw.between("create_time", beginTime, endTime); |
|
|
|
|
manageMail = mailMapper.selectCount(qw); |
|
|
|
|
} |
|
|
|
|
long country = countryTotal == null ? 0L : countryTotal; |
|
|
|
|
long police = policeTotal == null ? 0L : policeTotal; |
|
|
|
|
long num = numTotal == null ? 0L : numTotal; |
|
|
|
|
long manage = manageMail == null ? 0L : manageMail; |
|
|
|
|
Long total = country + police + num; |
|
|
|
|
re.setCountryTotal(String.valueOf(country)); |
|
|
|
|
re.setPoliceTotal(String.valueOf(police)); |
|
|
|
|
re.setCommissionerTotal(String.valueOf(manage)); |
|
|
|
|
re.setNumTotal(String.valueOf(num)); |
|
|
|
|
re.setTotal(total.toString()); |
|
|
|
|
} |
|
|
|
|
JSONObject data = new JSONObject().fluentPut("mailMapIconList", res); |
|
|
|
|
// return getSubOneMailMapIcon();
|
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 集访
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneEntanglementAndMassMail(SubDataVRequest request) { |
|
|
|
|
Date beginTime = request.getBeginTime(); |
|
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
|
String departId = request.getDepartId(); |
|
|
|
|
// 分县市局
|
|
|
|
|
List<OrganizeProblemRankVo> fxsjMassMailList = dataPetitionComplaintMapper.getSubOneMassMailRank(beginTime, endTime, 10, departId); |
|
|
|
|
List<OrganizeProblemRankVo> fxsjLeaderReviewMailList = dataPetitionComplaintMapper.getSubOneMailLeaderRank(beginTime, endTime, 10, departId); |
|
|
|
|
// 局属单位
|
|
|
|
|
List<OrganizeProblemRankVo> bwzdMassMailList = dataPetitionComplaintMapper.getSubOneMassMailRank(beginTime, endTime, null, departId); |
|
|
|
|
List<OrganizeProblemRankVo> bwzdLeaderReviewMailList = dataPetitionComplaintMapper.getMailLeaderRank(beginTime, endTime, 4); |
|
|
|
|
// 汇总(分县市局)
|
|
|
|
|
MailEntanglementMassOverviewVo fxsjOverview = new MailEntanglementMassOverviewVo(); |
|
|
|
|
fxsjOverview.setEntanglement(0); |
|
|
|
|
fxsjOverview.setMass(fxsjMassMailList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
fxsjOverview.setLeaderReview(fxsjLeaderReviewMailList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
// 汇总(局属单位)
|
|
|
|
|
MailEntanglementMassOverviewVo bwzdOverview = new MailEntanglementMassOverviewVo(); |
|
|
|
|
bwzdOverview.setEntanglement(0); |
|
|
|
|
bwzdOverview.setMass(bwzdMassMailList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
bwzdOverview.setLeaderReview(bwzdLeaderReviewMailList.stream().mapToInt(OrganizeProblemRankVo::getValueAsInt).sum()); |
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("fxsjOverview", fxsjOverview) |
|
|
|
|
.fluentPut("bwzdOverview", bwzdOverview) |
|
|
|
|
.fluentPut("fxsjMassMailList", fxsjMassMailList) |
|
|
|
|
.fluentPut("bwzdMassMailList", bwzdMassMailList) |
|
|
|
|
.fluentPut("fxsjLeaderReviewMailList", fxsjLeaderReviewMailList) |
|
|
|
|
.fluentPut("bwzdLeaderReviewMailList", bwzdLeaderReviewMailList); |
|
|
|
|
// return mockSubOneEntanglementAndMassMail();
|
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
// region 维权抚慰二级
|
|
|
|
|
// 二级大屏 维权案件情况
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubRightsBarList(SubDataVRequest request) { |
|
|
|
|
// 维权案件情况 - 派出所
|
|
|
|
|
List<BarItem> pcsList = rpcApplyMapper.selectSubPcsProtectRightsBarList(request.getBeginTime(), request.getEndTime(), Integer.valueOf(request.getDepartId()), 10); |
|
|
|
|
// 维权案件情况 - 大队
|
|
|
|
|
List<BarItem> dbList = rpcApplyMapper.selectSubDdProtectRightsBarList(request.getBeginTime(), request.getEndTime(), Integer.valueOf(request.getDepartId()), 10); |
|
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("fxsjRightsRankList", pcsList) |
|
|
|
|
.fluentPut("jsdwRightsRankList", dbList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 金额情况
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubComfortMoneyBarList(SubDataVRequest request) { |
|
|
|
|
List<BarItem> fxsjComfortMoneyRank = rpcApplyMapper.getSubPcComfortMoneyBarList(request.getBeginTime(), request.getEndTime(), request.getDepartId(), 10); |
|
|
|
|
List<BarItem> jsdwComfortMoneyRank = rpcApplyMapper.getSubDdComfortMoneyBarList(request.getBeginTime(), request.getEndTime(), request.getDepartId(), 10); |
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("fxsjComfortMoneyRank", fxsjComfortMoneyRank) |
|
|
|
|
.fluentPut("jsdwComfortMoneyRank", jsdwComfortMoneyRank); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 维权抚慰 二级大屏 案件类别占比
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubCaseType(SubDataVRequest request) { |
|
|
|
|
List<EchartsVo> crownCaseBar = rpcApplyMapper.selectSubCaseData(request.getBeginTime(), request.getEndTime(), "1", Integer.valueOf(request.getDepartId())); |
|
|
|
|
//案件类别 - 行政
|
|
|
|
|
List<EchartsVo> administrativeCase = rpcApplyMapper.selectSubCaseData(request.getBeginTime(), request.getEndTime(), "2", Integer.valueOf(request.getDepartId())); |
|
|
|
|
JSONObject data = new JSONObject().fluentPut("crownCaseBar", crownCaseBar).fluentPut("administrativeCase", administrativeCase); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 维权抚慰 二级大屏 案件类别占比
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneALlComfortCount(SubDataVRequest request) { |
|
|
|
|
ComfortCountVO comfortOverview = new ComfortCountVO(); |
|
|
|
|
Date beginTime = request.getBeginTime(); |
|
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
|
String departId = request.getDepartId(); |
|
|
|
|
comfortOverview.setComfortCaseTotal(Long.valueOf(rpcApplyMapper.selectMapRightsNumber(beginTime, endTime, departId))); |
|
|
|
|
comfortOverview.setHurtTotal(Long.valueOf(rpcApplyMapper.selectMapVictimNumber(beginTime, endTime, departId))); |
|
|
|
|
comfortOverview.setComfortTotal(rpcApplyMapper.selectMapComfortPersonNumber(beginTime, endTime, departId)); |
|
|
|
|
List<String> tortNames = rpcApplyMapper.selectMaptHitPersonNumber(beginTime, endTime, departId); |
|
|
|
|
long initialListSize = tortNames.size(); |
|
|
|
|
long hitPersonNumber = tortNames.stream() |
|
|
|
|
.filter(s -> s.contains(",")).toList().size(); |
|
|
|
|
// 筛选出包含逗号的名称
|
|
|
|
|
long nums = tortNames.stream() |
|
|
|
|
.filter(s -> s.contains(",")) |
|
|
|
|
.mapToLong(s -> s.split(",").length) // 拆分每个名称并计算拆分后的数组长度
|
|
|
|
|
.sum();// 计算所有拆分后数组长度的总和
|
|
|
|
|
if (tortNames.stream().noneMatch(s -> s.contains(","))) { |
|
|
|
|
comfortOverview.setHitTotal(initialListSize); |
|
|
|
|
} else { |
|
|
|
|
comfortOverview.setHitTotal(initialListSize + nums - hitPersonNumber); |
|
|
|
|
} |
|
|
|
|
comfortOverview.setComfortMoney(rpcApplyMapper.selectMapComfortMoney(beginTime, endTime, departId)); |
|
|
|
|
JSONObject data = new JSONObject().fluentPut("comfortOverview", comfortOverview); |
|
|
|
|
return Result.success(data); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubHitState(SubDataVRequest request) { |
|
|
|
|
List<PieItem> pieItems = rpcApplyMapper.getSubHitState(request.getBeginTime(), request.getEndTime(), request.getDepartId()); |
|
|
|
|
JSONObject data = new JSONObject().fluentPut("PunishmentSituation", pieItems); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubComfortState(SubDataVRequest request) { |
|
|
|
|
List<PieItem> comfortSituationList = rpcApplyMapper.getSubComfortState(request.getBeginTime(), request.getEndTime(), request.getDepartId()); |
|
|
|
|
JSONObject data = new JSONObject().fluentPut("comfortSituationList", comfortSituationList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubPoliceHurtSituationAndHurtType(SubDataVRequest request) { |
|
|
|
|
List<EchartsVo> policeHurtSituationList = rpcApplyMapper.getSubPoliceHurtSituationAndHurtType(request.getBeginTime(), request.getEndTime(), request.getDepartId()); // 人数情况
|
|
|
|
|
JSONObject data = new JSONObject().fluentPut("policeHurtSituationList", policeHurtSituationList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<JSONObject> getSubOneCaseAriseSituationRate(SubDataVRequest request) { |
|
|
|
|
List<EchartsVo> incidentLinkList = rpcApplyMapper.getSubIncidentLinkList(request.getBeginTime(), request.getEndTime(), request.getDepartId()); |
|
|
|
|
List<EchartsVo> incidentPoliceList = rpcApplyMapper.getSubIncidentPoliceList(request.getBeginTime(), request.getEndTime(), request.getDepartId()); |
|
|
|
|
List<EchartsVo> incidentOrgList = rpcApplyMapper.getSubIncidentOrgList(request.getBeginTime(), request.getEndTime(), request.getDepartId()); |
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("incidentLinkList", incidentLinkList) |
|
|
|
|
.fluentPut("incidentPoliceTypeList", incidentPoliceList) |
|
|
|
|
.fluentPut("incidentOrgList", incidentOrgList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
// region 辅助方法
|
|
|
|
|
private List<EchartsVo> filterZero(List<EchartsVo> list) { |
|
|
|
|
return list.stream() |
|
|
|
|
.filter(e -> e.getValue() != null && e.getValue() > 0) |
|
|
|
|
.toList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public record BlameResult( |
|
|
|
|
List<NegativeBlame> personalBlames, |
|
|
|
|
List<NegativeBlame> leadBlames |
|
|
|
|
) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public DatavServiceImpl.BlameResult buildBlameResult(List<Negative> negativeListData) { |
|
|
|
|
if (CollUtil.isEmpty(negativeListData)) { |
|
|
|
|
return new DatavServiceImpl.BlameResult(List.of(), List.of()); |
|
|
|
|
} |
|
|
|
|
// 1. 筛选有效 negative
|
|
|
|
|
List<Negative> validNegatives = negativeListData.stream() |
|
|
|
|
.filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) |
|
|
|
|
|| CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())) |
|
|
|
|
.toList(); |
|
|
|
|
if (CollUtil.isEmpty(validNegatives)) { |
|
|
|
|
return new DatavServiceImpl.BlameResult(List.of(), List.of()); |
|
|
|
|
} |
|
|
|
|
// 2. 查询问责数据
|
|
|
|
|
NegativeBlameQueryParam param = new NegativeBlameQueryParam(); |
|
|
|
|
param.setNegativeIds(validNegatives.stream() |
|
|
|
|
.map(Negative::getId) |
|
|
|
|
.toList()); |
|
|
|
|
List<NegativeBlame> negativeBlames = negativeBlameResourceService.query(param); |
|
|
|
|
if (CollUtil.isEmpty(negativeBlames)) { |
|
|
|
|
return new DatavServiceImpl.BlameResult(List.of(), List.of()); |
|
|
|
|
} |
|
|
|
|
// 3. 个人问责
|
|
|
|
|
List<NegativeBlame> personalBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> BlameType.personal.name().equals(one.getType())) |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) |
|
|
|
|
.filter(one -> !NO_BLAME.equals(one.getHandleResultName())) |
|
|
|
|
.toList(); |
|
|
|
|
// 4. 领导问责(去重)
|
|
|
|
|
Set<String> seenLead = new HashSet<>(); |
|
|
|
|
List<NegativeBlame> leadBlames = negativeBlames.stream() |
|
|
|
|
.filter(one -> StrUtil.isNotBlank(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> !NO_BLAME.equals(one.getLeadHandleResultName())) |
|
|
|
|
.filter(one -> seenLead.add( |
|
|
|
|
one.getNegativeId() + "_" + one.getLeadHandleResultName() + "_" + one.getLeadName() |
|
|
|
|
)) |
|
|
|
|
.toList(); |
|
|
|
|
return new DatavServiceImpl.BlameResult(personalBlames, leadBlames); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private LocalDateTime toLocalDateTime(Date date) { |
|
|
|
|
if (date == null) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
return date.toInstant() |
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
.toLocalDateTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private long calculateRate(long numerator, long denominator) { |
|
|
|
|
if (denominator == 0) { |
|
|
|
|
return 0L; |
|
|
|
|
} |
|
|
|
|
return (numerator * 100 + denominator / 2) / denominator; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<AuditNegativeVo> buildAuditNegativeVoList(List<SupDepart> departs, DataVRequest request) { |
|
|
|
|
List<AuditNegativeVo> result = new ArrayList<>(); |
|
|
|
|
for (SupDepart depart : departs) { |
|
|
|
|
List<Negative> negativeListData = negativeMapper.getNegativeListData( |
|
|
|
|
depart.getId(), |
|
|
|
|
request.getBeginTime(), |
|
|
|
|
request.getEndTime(), |
|
|
|
|
List.of(request.getAuditType()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
long numerator = negativeListData.stream() |
|
|
|
|
.filter(one -> "1".equals(one.getIsRectifyCode())) |
|
|
|
|
.count(); |
|
|
|
|
long denominator = negativeListData.size(); |
|
|
|
|
AuditNegativeVo vo = new AuditNegativeVo(); |
|
|
|
|
vo.setLabel(depart.getShortName()); |
|
|
|
|
vo.setNumerator(numerator); |
|
|
|
|
vo.setDenominator(denominator); |
|
|
|
|
vo.setValue(calculateRate(numerator, denominator)); |
|
|
|
|
result.add(vo); |
|
|
|
|
} |
|
|
|
|
return result.stream() |
|
|
|
|
// 过滤没有问题数据的
|
|
|
|
|
.filter(vo -> vo.getDenominator() > 0) |
|
|
|
|
// 按整改率降序
|
|
|
|
|
.sorted(Comparator.comparing(AuditNegativeVo::getValue).reversed()) |
|
|
|
|
.toList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private <T> BigDecimal sumAmount(List<T> list, Function<T, BigDecimal> mapper, BigDecimal divisor) { |
|
|
|
|
BigDecimal sum = list.stream() |
|
|
|
|
.map(mapper) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
if (divisor == null || BigDecimal.ONE.compareTo(divisor) == 0) { |
|
|
|
|
return sum; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return sum.divide(divisor, 2, RoundingMode.HALF_UP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private <T> BigDecimal sumAmountInWan(List<T> list, Function<T, BigDecimal> mapper) { |
|
|
|
|
return list.stream() |
|
|
|
|
.map(mapper) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add) |
|
|
|
|
.divide(WAN, 2, RoundingMode.HALF_UP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|