diff --git a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java index 96b0f37..77db162 100644 --- a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java +++ b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java @@ -1,5 +1,6 @@ package com.biutag.supervision.controller.subdatav; +import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.biutag.supervision.mapper.NegativeMapper; import com.biutag.supervision.pojo.Result; @@ -7,7 +8,6 @@ import com.biutag.supervision.pojo.entity.News; import com.biutag.supervision.pojo.request.subdatav.SubDataVRequest; import com.biutag.supervision.pojo.vo.EchartsVo; import com.biutag.supervision.service.NewsService; -import com.biutag.supervision.service.SubOneSupervisionNotifyService; import com.biutag.supervision.service.subDatav.SubDatavService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -32,7 +32,6 @@ import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.*; @Tag(name = "现场专项二级大屏", description = "现场专项二级大屏") public class SubOneSupervisionNotifyController { - private final SubOneSupervisionNotifyService subOneSupervisionNotifyService; private final NewsService newsService; private final SubDatavService subDatavService; private final NegativeMapper negativeMapper; @@ -48,7 +47,7 @@ public class SubOneSupervisionNotifyController { public Result getSubOneProblemTypeRate(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - List wtlxList = subOneSupervisionNotifyService.getSubOneProblemTypeRatio(departId, beginTime, endTime); + List wtlxList = negativeMapper.getSubOneProblemTypeRatio(departId, beginTime, endTime); JSONObject data = new JSONObject().fluentPut("wtlxList", wtlxList); return Result.success(data); } @@ -86,6 +85,7 @@ public class SubOneSupervisionNotifyController { public Result> getSubOneWorkDynamics(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + endTime = DateUtil.endOfDay(endTime); List newsList = newsService.getWorkDynamics(beginTime, endTime, DCGZDT, departId.toString()); return Result.success(newsList); } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java index ba4e5a4..b96ae83 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -100,13 +100,16 @@ public interface NegativeMapper extends BaseMapper { - @Select("SELECT npr.oneLevelContent as name, count(*) value FROM negative ng, negative_problem_relation npr " + - "WHERE ng.id = npr.negativeId " + - "AND ng.problemSourcesCode in (13,14, 15) " + - "and ng.check_status_code in (1, 2, 3) " + - "AND ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + - "AND oneLevelContent is NOT NULL " + - "GROUP BY oneLevelContent ") + @Select("SELECT " + + "npr.oneLevelContent as `name`, " + + "count(*) as `value` " + + "FROM negative ng " + + "LEFT JOIN negative_problem_relation npr on ng.id = npr.negativeId " + + "WHERE ng.problemSourcesCode IN (13, 14, 15) " + + "AND ng.check_status_code IN (1, 2, 3) " + + "AND ng.crtTime >= #{beginTime} AND ng.crtTime < #{endTime} " + + "AND npr.oneLevelContent is not NULL " + + "GROUP BY npr.oneLevelContent; ") List getProblemTypeRatio(Date beginTime, Date endTime); @@ -489,16 +492,20 @@ public interface NegativeMapper extends BaseMapper { "order by rate desc;") List getSubOneTeamChangedRateRank(Integer departId, Date beginTime, Date endTime); - @Select("SELECT npr.oneLevelContent as name, " + - "count(*) value " + - "FROM negative ng " + - "INNER JOIN negative_problem_relation npr ON ng.id = npr.negativeId " + - "INNER JOIN sup_depart sd ON ng.involveDepartId=sd.id AND sd.pid=#{departId} " + - "WHERE ng.problemSourcesCode in (13, 15) " + - "and ng.checkStatus<>3 " + - "AND ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + - "AND oneLevelContent is NOT NULL " + - "GROUP BY oneLevelContent ") + @Select("SELECT " + + "npr.oneLevelContent as `name`, " + + "count(*) as `value` " + + "FROM negative ng " + + "LEFT JOIN negative_problem_relation npr on ng.id = npr.negativeId " + + "LEFT JOIN sup_depart sd on ng.involveDepartId = sd.id " + + "LEFT JOIN sup_depart sdd on sd.pid = sdd.id " + + "LEFT JOIN sup_depart sddd on sdd.pid = sddd.id " + + "WHERE ng.problemSourcesCode IN (13, 14, 15) " + + "AND ng.check_status_code IN (1, 2, 3) " + + "AND ng.crtTime >= #{beginTime} AND ng.crtTime < #{endTime} " + + "AND npr.oneLevelContent is not NULL " + + "AND (sd.id = #{departId} or sdd.id= #{departId} or sddd.id = #{departId} ) " + + "GROUP BY npr.oneLevelContent; ") List getSubOneProblemTypeRatio(Integer departId, Date beginTime, Date endTime); @Select("SELECT " + diff --git a/src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java b/src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java index 832f1b1..779c7bc 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java @@ -1,5 +1,6 @@ package com.biutag.supervision.pojo.vo; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; @@ -19,5 +20,8 @@ public class SuperviseMapIconVo implements Serializable { private String relationOrg; private String personNum; private String completedRate; + + @Schema(description = "通报期数") + private String reportNumber; } diff --git a/src/main/java/com/biutag/supervision/service/SubOneSupervisionNotifyService.java b/src/main/java/com/biutag/supervision/service/SubOneSupervisionNotifyService.java deleted file mode 100644 index 9b3156a..0000000 --- a/src/main/java/com/biutag/supervision/service/SubOneSupervisionNotifyService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.biutag.supervision.service; - -import com.biutag.supervision.mapper.NegativeMapper; -import com.biutag.supervision.pojo.vo.EchartsVo; -import com.biutag.supervision.pojo.vo.RankVo; -import com.biutag.supervision.pojo.vo.SupervisionNotifyOverView; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; - -/** - * @Auther: sh - * @Date: 2024/12/17 16:27 - * @Description: 现场督察二级大屏服务 - */ -@RequiredArgsConstructor -@Service -public class SubOneSupervisionNotifyService { - - private final NegativeMapper negativeMapper; - -// public DayTimeSuperviseVo getChangedRankOverView(Integer groupId, Integer departId, Date beginTime, Date endTime) { -// DayTimeSuperviseVo res; -// if (groupId != null && groupId == 10) { -// res = negativeMapper.getPoliceChangedRankOverView(departId, beginTime, endTime); -// } else { -// res = negativeMapper.getTeamChangedRankOverView(departId, beginTime, endTime); -// } -// return res; -// } - - public List getSubOneChangedRateRank(Integer groupId, Integer departId, Date beginTime, Date endTime) { - List res; - if (groupId != null && groupId == 10) { - res = negativeMapper.getSubOnePoliceChangedRateRank(departId, beginTime, endTime); - } else { - res = negativeMapper.getSubOneTeamChangedRateRank(departId, beginTime, endTime); - } - return res; - } - - public List getSubOneProblemTypeRatio(Integer departId, Date beginTime, Date endTime) { - List res = negativeMapper.getSubOneProblemTypeRatio(departId, beginTime, endTime); - return res; - } - - public SupervisionNotifyOverView getAllSubOneSupervisionNotifyCount(Integer departId, Date beginTime, Date endTime) { - SupervisionNotifyOverView res = negativeMapper.getAllSubOneSupervisionNotifyCount(departId, beginTime, endTime); - return res; - } - - public List getSubOneSupervisionTrend(Integer departId, String year) { - List res = negativeMapper.getSubOneSupervisionTrend(departId, year); - return res; - } - - -} - diff --git a/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java b/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java index 1421b9e..eb32aec 100644 --- a/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java @@ -37,6 +37,7 @@ import com.biutag.supervision.service.*; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -131,6 +132,9 @@ public class DatavServiceImpl implements DatavService { @Resource private DataCaseVerifMapper dataCaseVerifMapper; + @Resource + private SupDepartService supDepartService; + private static final String NO_BLAME = "不予追责"; private static final BigDecimal WAN = new BigDecimal("10000"); @@ -709,53 +713,36 @@ public class DatavServiceImpl implements DatavService { List fxsjDw = supDepartResourceService.query(supDepartQueryParam); List proCode = List.of(XCDC.getValue(), LMGZ.getValue(), ZXDC.getValue()); + SupDepartGroupParam supDepartGroupParam = new SupDepartGroupParam(); + supDepartGroupParam.setGroupId(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId()); + supDepartGroupParam.setParentLevel(2); + supDepartGroupParam.setChildLevel(3); + Map departAndSubDepart = supDepartResourceService.getDepartAndSubDepart(supDepartGroupParam); + for (SupDepart fxsj : fxsjDw) { SuperviseMapIconVo superviseMapIconVo = new SuperviseMapIconVo(); List negatives = negativeMapper.getNegativeListData(fxsj.getId(), request.getBeginTime(), request.getEndTime(), proCode); List completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); List processingList = negatives.stream().filter(item -> ProcessingStatusEnum.processing.name().equals(item.getProcessingStatus())).toList(); - // 暂不用通报期数 -// LambdaQueryWrapper superviseReportLambdaQueryWrapper = new LambdaQueryWrapper<>(); -// superviseReportLambdaQueryWrapper.between(SuperviseReport::getCrtTime, request.getBeginTime(), request.getEndTime()); -// superviseReportLambdaQueryWrapper.eq(SuperviseReport::getType, "1"); -// List superviseReportList = superviseReportService.list(superviseReportLambdaQueryWrapper); - List negativeIds = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).map(Negative::getId).toList(); - - - NegativeBlameQueryParam negativeBlameQueryParam = new NegativeBlameQueryParam(); - negativeBlameQueryParam.setNegativeIds(negativeIds); - List negativeBlames = negativeBlameResourceService.query(negativeBlameQueryParam); - - // 3. 个人问责 - List 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 seenLead = new HashSet<>(); - List 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 unitBlames = negativeBlames.stream() - .filter(one -> BlameType.department.name().equals(one.getType())) - .filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) - .filter(one -> !"不予追责".equals(one.getHandleResultName())) - .toList(); + // 通报期数 + LambdaQueryWrapper superviseReportLambdaQueryWrapper = new LambdaQueryWrapper<>(); + superviseReportLambdaQueryWrapper.between(SuperviseReport::getCrtTime, request.getBeginTime(), request.getEndTime()); + superviseReportLambdaQueryWrapper.eq(SuperviseReport::getType, "1"); + Set allDepartIds = Optional.ofNullable(departAndSubDepart.get(fxsj.getId())) + .map(DepartAndSubDepartDto::getAllDepartIds) + .orElse(Collections.emptySet()); + superviseReportLambdaQueryWrapper.in(CollectionUtil.isNotEmpty(allDepartIds), SuperviseReport::getCrtDepartId, allDepartIds); + List superviseReportList = superviseReportService.list(superviseReportLambdaQueryWrapper); + BlameResult blameResult = this.buildBlameResult(negatives); superviseMapIconVo.setDepartId(fxsj.getId()); superviseMapIconVo.setName(fxsj.getShortName()); superviseMapIconVo.setTotalPro(negatives.size()); superviseMapIconVo.setProcessingNumber(processingList.size()); superviseMapIconVo.setCompletedNumber(completedList.size()); - superviseMapIconVo.setRelationOrg(String.valueOf(unitBlames.size())); - superviseMapIconVo.setPersonNum(String.valueOf(personalBlames.size() + leadBlames.size())); + superviseMapIconVo.setRelationOrg(String.valueOf(blameResult.unitBlames().size())); + superviseMapIconVo.setPersonNum(String.valueOf(blameResult.personalBlames().size() + blameResult.leadBlames().size())); + superviseMapIconVo.setReportNumber(String.valueOf(superviseReportList.size())); superviseTempMapVoList.add(superviseMapIconVo); } JSONObject data = new JSONObject().fluentPut("superviseTempMapVoList", superviseTempMapVoList); @@ -1326,7 +1313,7 @@ public class DatavServiceImpl implements DatavService { BigDecimal qtsjje = this.sumAmount(dataAuditList, DataAudit::getAuditAmount, new BigDecimal(1)); // 其他审计审减问题金额 BigDecimal qtsjwtje = this.sumAmount(dataAuditList, DataAudit::getIssueAmount, new BigDecimal(1)); - overview.setProjectNumber(BigDecimal.valueOf(reportProjects.size()+ dataAuditList.size())); + overview.setProjectNumber(BigDecimal.valueOf(reportProjects.size() + dataAuditList.size())); overview.setAuditAmount(zftzje.add(qtsjje)); overview.setAuditSjAmount(zftzsjje.add(qtsjwtje)); overview.setNegativeNumber(negativeListData.size()); @@ -1382,7 +1369,7 @@ public class DatavServiceImpl implements DatavService { // 其他审计审减问题金额 BigDecimal qtsjwtje = this.sumAmount(dataAuditList, DataAudit::getIssueAmount, new BigDecimal(1)); - auditSuperviseMapIconVo.setProjectNumber(reportProjects.size()+ dataAuditList.size()); + auditSuperviseMapIconVo.setProjectNumber(reportProjects.size() + dataAuditList.size()); auditSuperviseMapIconVo.setAuditAmount(zftzje.add(qtsjje)); auditSuperviseMapIconVo.setAuditSjAmount(zftzsjje.add(qtsjwtje)); auditSuperviseMapIconVo.setNegativeNumber(negativeListData.size()); @@ -1511,7 +1498,6 @@ public class DatavServiceImpl implements DatavService { // endregion - // region 辅助方法 private List filterZero(List list) { return list.stream() @@ -1522,13 +1508,14 @@ public class DatavServiceImpl implements DatavService { public record BlameResult( List personalBlames, - List leadBlames + List leadBlames, + List unitBlames ) { } public BlameResult buildBlameResult(List negativeListData) { if (CollUtil.isEmpty(negativeListData)) { - return new BlameResult(List.of(), List.of()); + return new BlameResult(List.of(), List.of(), List.of()); } // 1. 筛选有效 negative List validNegatives = negativeListData.stream() @@ -1536,7 +1523,7 @@ public class DatavServiceImpl implements DatavService { || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())) .toList(); if (CollUtil.isEmpty(validNegatives)) { - return new BlameResult(List.of(), List.of()); + return new BlameResult(List.of(), List.of(), List.of()); } // 2. 查询问责数据 NegativeBlameQueryParam param = new NegativeBlameQueryParam(); @@ -1545,7 +1532,7 @@ public class DatavServiceImpl implements DatavService { .toList()); List negativeBlames = negativeBlameResourceService.query(param); if (CollUtil.isEmpty(negativeBlames)) { - return new BlameResult(List.of(), List.of()); + return new BlameResult(List.of(), List.of(), List.of()); } // 3. 个人问责 List personalBlames = negativeBlames.stream() @@ -1562,7 +1549,13 @@ public class DatavServiceImpl implements DatavService { one.getNegativeId() + "_" + one.getLeadHandleResultName() + "_" + one.getLeadName() )) .toList(); - return new BlameResult(personalBlames, leadBlames); + // 5. 单位问责 + List unitBlames = negativeBlames.stream() + .filter(one -> BlameType.department.name().equals(one.getType())) + .filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) + .filter(one -> !"不予追责".equals(one.getHandleResultName())) + .toList(); + return new BlameResult(personalBlames, leadBlames, unitBlames); } private LocalDateTime toLocalDateTime(Date date) { @@ -1649,9 +1642,6 @@ public class DatavServiceImpl implements DatavService { // endregion - - - public Result getSubOneMailMapIcon() { // ✅ 注意:这里的 name 必须和地图 geojson 区域名一致(一般是“xx街道/园区”) diff --git a/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java b/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java index be2eed7..9e65230 100644 --- a/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java @@ -1,4 +1,4 @@ -package com.biutag.supervision.service.subDatav; +package com.biutag.supervision.service.subDatav; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; @@ -19,8 +19,6 @@ 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.*; -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; @@ -28,7 +26,10 @@ import com.biutag.supervision.repository.negativeBlame.NegativeBlameResourceServ 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.*; +import com.biutag.supervision.service.DataMailService; +import com.biutag.supervision.service.DataPetition12337Service; +import com.biutag.supervision.service.NegativeBlameService; +import com.biutag.supervision.service.SuperviseReportService; import com.biutag.supervision.service.datav.DatavServiceImpl; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; @@ -107,6 +108,9 @@ public class SubDatavServiceImpl implements SubDatavService { @Resource private DataCaseVerifMapper dataCaseVerifMapper; + @Resource + private SuperviseReportService superviseReportService; + private static final String NO_BLAME = "不予追责"; private static final BigDecimal WAN = new BigDecimal("10000"); @@ -557,35 +561,24 @@ public class SubDatavServiceImpl implements SubDatavService { if (negatives.isEmpty()) { continue; } - List completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); List processingList = negatives.stream().filter(item -> ProcessingStatusEnum.processing.name().equals(item.getProcessingStatus())).toList(); - List negativeIds = negatives.stream() - .filter(item -> InspectCaseEnum.isItTure(item.getCheckStatus())) - .map(Negative::getId) - .toList(); - - long personNumber = negativeIds.isEmpty() ? 0 : negativeBlameService.count(new LambdaQueryWrapper() - .in(NegativeBlame::getNegativeId, negativeIds) - .eq(NegativeBlame::getType, "personal") - .ne(NegativeBlame::getHandleResultName, "涓嶄簣杩借矗") - .isNotNull(NegativeBlame::getHandleResultName) - .ne(NegativeBlame::getHandleResultName, "")); - long departNumber = negativeIds.isEmpty() ? 0 : negativeBlameService.count(new LambdaQueryWrapper() - .in(NegativeBlame::getNegativeId, negativeIds) - .eq(NegativeBlame::getType, "department") - .ne(NegativeBlame::getHandleResultName, "涓嶄簣杩借矗") - .isNotNull(NegativeBlame::getHandleResultName) - .ne(NegativeBlame::getHandleResultName, "")); - + // 通报期数 + LambdaQueryWrapper superviseReportLambdaQueryWrapper = new LambdaQueryWrapper<>(); + superviseReportLambdaQueryWrapper.between(SuperviseReport::getCrtTime, request.getBeginTime(), request.getEndTime()); + superviseReportLambdaQueryWrapper.eq(SuperviseReport::getType, "1"); + superviseReportLambdaQueryWrapper.eq(SuperviseReport::getCrtDepartId, request.getDepartId()); + List superviseReportList = superviseReportService.list(superviseReportLambdaQueryWrapper); + DatavServiceImpl.BlameResult blameResult = this.buildBlameResult(negatives); SuperviseMapIconVo superviseMapIconVo = new SuperviseMapIconVo(); superviseMapIconVo.setName(supDepart.getShortName()); superviseMapIconVo.setDepartId(supDepart.getId()); superviseMapIconVo.setTotalPro(negatives.size()); superviseMapIconVo.setCompletedNumber(completedList.size()); superviseMapIconVo.setProcessingNumber(processingList.size()); - superviseMapIconVo.setPersonNum(String.valueOf(personNumber)); - superviseMapIconVo.setRelationOrg(String.valueOf(departNumber)); + superviseMapIconVo.setPersonNum(String.valueOf(blameResult.personalBlames().size() + blameResult.leadBlames().size())); + superviseMapIconVo.setRelationOrg(String.valueOf(blameResult.unitBlames().size())); + superviseMapIconVo.setReportNumber(String.valueOf(superviseReportList.size())); superviseTempMapVoList.add(superviseMapIconVo); } @@ -596,77 +589,30 @@ public class SubDatavServiceImpl implements SubDatavService { @Override public Result getAllSubOneSupervisionNotifyCount(SubDataVRequest request) { SupervisionNotifyOverView overView = new SupervisionNotifyOverView(); - List policeDeparts = supDepartMapper.selectPoliceDeparts(Integer.valueOf(request.getDepartId())); List proCode = List.of(XCDC.getValue(), LMGZ.getValue(), ZXDC.getValue()); - - long problemNumber = 0L; - long processingNumber = 0L; - long completedNumber = 0L; - long reportNumber = 0L; - long departNumber = 0L; - long personNumber = 0L; - - for (SupDepart supDepart : policeDeparts) { - List negatives = negativeMapper.getNegativeListData(supDepart.getId(), request.getBeginTime(), request.getEndTime(), proCode); - if (CollectionUtil.isEmpty(negatives)) { - continue; - } - - List completedList = negatives.stream() - .filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())) - .toList(); - List processingList = negatives.stream() - .filter(item -> ProcessingStatusEnum.processing.name().equals(item.getProcessingStatus())) - .toList(); - List negativeIds = negatives.stream() - .filter(item -> CheckStatusEnum.TRUE_SET.contains(item.getCheckStatusCode()) - || CheckStatusEnum.PART_TRUE_SET.contains(item.getCheckStatusCode())) - .map(Negative::getId) - .toList(); - - List negativeBlames = Collections.emptyList(); - if (!negativeIds.isEmpty()) { - NegativeBlameQueryParam negativeBlameQueryParam = new NegativeBlameQueryParam(); - negativeBlameQueryParam.setNegativeIds(negativeIds); - negativeBlames = negativeBlameResourceService.query(negativeBlameQueryParam); - } - - List personalBlames = negativeBlames.stream() - .filter(one -> BlameType.personal.name().equals(one.getType())) - .filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) - .filter(one -> !"不予追责".equals(one.getHandleResultName())) - .toList(); - - Set seenLead = new HashSet<>(); - List 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(); - - List unitBlames = negativeBlames.stream() - .filter(one -> BlameType.department.name().equals(one.getType())) - .filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) - .filter(one -> !"不予追责".equals(one.getHandleResultName())) - .toList(); - - problemNumber += negatives.size(); - processingNumber += processingList.size(); - completedNumber += completedList.size(); - reportNumber += 0L; - departNumber += unitBlames.size(); - personNumber += personalBlames.size() + leadBlames.size(); - } - - overView.setProblemNumber(Math.toIntExact(problemNumber)); - overView.setProcessingNumber(processingNumber); - overView.setCompletedNumber(completedNumber); - overView.setReportNumber(reportNumber); - overView.setDepartNumber(departNumber); - overView.setPersonNumber(personNumber); + List negatives = negativeMapper.getNegativeListData(request.getDepartId(), request.getBeginTime(), request.getEndTime(), proCode); + List completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); + List processingList = negatives.stream().filter(item -> ProcessingStatusEnum.processing.name().equals(item.getProcessingStatus())).toList(); + SupDepartGroupParam supDepartGroupParam = new SupDepartGroupParam(); + supDepartGroupParam.setGroupId(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId()); + supDepartGroupParam.setParentLevel(2); + supDepartGroupParam.setChildLevel(3); + Map departAndSubDepart = supDepartResourceService.getDepartAndSubDepart(supDepartGroupParam); + Set allDepartIds = Optional.ofNullable(departAndSubDepart.get(request.getDepartId())) + .map(DepartAndSubDepartDto::getAllDepartIds) + .orElse(Collections.emptySet()); + LambdaQueryWrapper superviseReportLambdaQueryWrapper = new LambdaQueryWrapper<>(); + superviseReportLambdaQueryWrapper.between(SuperviseReport::getCrtTime, request.getBeginTime(), request.getEndTime()); + superviseReportLambdaQueryWrapper.eq(SuperviseReport::getType, "1"); + superviseReportLambdaQueryWrapper.in(CollectionUtil.isNotEmpty(allDepartIds), SuperviseReport::getCrtDepartId, allDepartIds); + List superviseReportList = superviseReportService.list(superviseReportLambdaQueryWrapper); + DatavServiceImpl.BlameResult blameResult = this.buildBlameResult(negatives); + overView.setProblemNumber(negatives.size()); + overView.setProcessingNumber((long) processingList.size()); + overView.setCompletedNumber((long) completedList.size()); + overView.setReportNumber((long) superviseReportList.size()); + overView.setDepartNumber((long) blameResult.unitBlames().size()); + overView.setPersonNumber((long) (blameResult.leadBlames().size() + blameResult.personalBlames().size())); return Result.success(new JSONObject().fluentPut("overview", overView)); } @@ -1318,7 +1264,7 @@ public class SubDatavServiceImpl implements SubDatavService { public DatavServiceImpl.BlameResult buildBlameResult(List negativeListData) { if (CollUtil.isEmpty(negativeListData)) { - return new DatavServiceImpl.BlameResult(List.of(), List.of()); + return new DatavServiceImpl.BlameResult(List.of(), List.of(), List.of()); } // 1. 筛选有效 negative List validNegatives = negativeListData.stream() @@ -1326,7 +1272,7 @@ public class SubDatavServiceImpl implements SubDatavService { || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())) .toList(); if (CollUtil.isEmpty(validNegatives)) { - return new DatavServiceImpl.BlameResult(List.of(), List.of()); + return new DatavServiceImpl.BlameResult(List.of(), List.of(), List.of()); } // 2. 查询问责数据 NegativeBlameQueryParam param = new NegativeBlameQueryParam(); @@ -1335,7 +1281,7 @@ public class SubDatavServiceImpl implements SubDatavService { .toList()); List negativeBlames = negativeBlameResourceService.query(param); if (CollUtil.isEmpty(negativeBlames)) { - return new DatavServiceImpl.BlameResult(List.of(), List.of()); + return new DatavServiceImpl.BlameResult(List.of(), List.of(), List.of()); } // 3. 个人问责 List personalBlames = negativeBlames.stream() @@ -1352,7 +1298,13 @@ public class SubDatavServiceImpl implements SubDatavService { one.getNegativeId() + "_" + one.getLeadHandleResultName() + "_" + one.getLeadName() )) .toList(); - return new DatavServiceImpl.BlameResult(personalBlames, leadBlames); + // 5. 单位问责 + List unitBlames = negativeBlames.stream() + .filter(one -> BlameType.department.name().equals(one.getType())) + .filter(one -> StrUtil.isNotBlank(one.getHandleResultName())) + .filter(one -> !"不予追责".equals(one.getHandleResultName())) + .toList(); + return new DatavServiceImpl.BlameResult(personalBlames, leadBlames, unitBlames); } private LocalDateTime toLocalDateTime(Date date) {