|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.biutag.supervision.service.datav; |
|
|
|
package com.biutag.supervision.service.datav; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
@ -35,12 +36,15 @@ import com.biutag.supervision.repository.supdepart.SupDepartResourceService; |
|
|
|
import com.biutag.supervision.service.*; |
|
|
|
import com.biutag.supervision.service.*; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.math.RoundingMode; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
@ -127,6 +131,10 @@ public class DatavServiceImpl implements DatavService { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private DataCaseVerifMapper dataCaseVerifMapper; |
|
|
|
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 VALID_SIGN = "terminated"; |
|
|
|
private final String EX_SOURCE = "局长信箱"; |
|
|
|
private final String EX_SOURCE = "局长信箱"; |
|
|
|
|
|
|
|
|
|
|
|
@ -557,11 +565,7 @@ public class DatavServiceImpl implements DatavService { |
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
Date endTime = request.getEndTime(); |
|
|
|
List<Negative> negatives = negativeService.list(new LambdaQueryWrapper<Negative>().between(Negative::getCrtTime, beginTime, DateUtil.endOfDay(endTime)) |
|
|
|
List<Negative> negatives = negativeService.list(new LambdaQueryWrapper<Negative>().between(Negative::getCrtTime, beginTime, DateUtil.endOfDay(endTime)) |
|
|
|
.in(Negative::getProblemSourcesCode, List.of(ProblemSourcesEnum.ZFTZSJ.getValue(), ProblemSourcesEnum.ZFSACFSS.getValue(), ProblemSourcesEnum.JJZRSJ.getValue(), ProblemSourcesEnum.ZXSJ.getValue()))); |
|
|
|
.in(Negative::getProblemSourcesCode, List.of(ProblemSourcesEnum.ZFTZSJ.getValue(), ProblemSourcesEnum.ZFSACFSS.getValue(), ProblemSourcesEnum.JJZRSJ.getValue(), ProblemSourcesEnum.ZXSJ.getValue()))); |
|
|
|
long accountableNumber = 0; |
|
|
|
BlameResult blameResult = buildBlameResult(negatives); |
|
|
|
if (CollectionUtil.isNotEmpty(negatives)) { |
|
|
|
|
|
|
|
accountableNumber = negativeBlameService.count(new LambdaQueryWrapper<NegativeBlame>().in(NegativeBlame::getNegativeId, negatives.stream().map(Negative::getId).collect(Collectors.toSet())) |
|
|
|
|
|
|
|
.ne(NegativeBlame::getHandleResultName, "不予追责")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 政府投资数据
|
|
|
|
// 政府投资数据
|
|
|
|
ReportProjectQueryParam reportProjectQueryParam = new ReportProjectQueryParam(); |
|
|
|
ReportProjectQueryParam reportProjectQueryParam = new ReportProjectQueryParam(); |
|
|
|
reportProjectQueryParam.setArchivingStart(beginTime); |
|
|
|
reportProjectQueryParam.setArchivingStart(beginTime); |
|
|
|
@ -595,7 +599,7 @@ public class DatavServiceImpl implements DatavService { |
|
|
|
overview.setAuditSjAmount(zftzsjje); |
|
|
|
overview.setAuditSjAmount(zftzsjje); |
|
|
|
overview.setAuditWtAmount(fxwtje); |
|
|
|
overview.setAuditWtAmount(fxwtje); |
|
|
|
overview.setNegativeNumber(negatives.size()); |
|
|
|
overview.setNegativeNumber(negatives.size()); |
|
|
|
overview.setAccountableNumber(accountableNumber); |
|
|
|
overview.setAccountableNumber((long) (blameResult.personalBlames().size() + blameResult.leadBlames().size())); |
|
|
|
return Result.success(overview); |
|
|
|
return Result.success(overview); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2072,7 +2076,7 @@ public class DatavServiceImpl implements DatavService { |
|
|
|
List<EchartsVo> dealSituationPieList = new ArrayList<>(); |
|
|
|
List<EchartsVo> dealSituationPieList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
// 总
|
|
|
|
// 总
|
|
|
|
List<String> proCode = List.of(A12389.getValue(),SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
List<String> proCode = List.of(A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
// 交办
|
|
|
|
// 交办
|
|
|
|
Set<String> ldjbCode = Set.of(SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
Set<String> ldjbCode = Set.of(SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); |
|
|
|
// 案件核查 || 12389
|
|
|
|
// 案件核查 || 12389
|
|
|
|
@ -2121,6 +2125,65 @@ public class DatavServiceImpl implements DatavService { |
|
|
|
return Result.success(data); |
|
|
|
return Result.success(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Result<JSONObject> getAuditNegativeVo(DataVRequest request) { |
|
|
|
|
|
|
|
// 排名
|
|
|
|
|
|
|
|
SupDepartQueryParam supDepartQueryParam = new SupDepartQueryParam(); |
|
|
|
|
|
|
|
supDepartQueryParam.setStatisticsGroupId(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId()); |
|
|
|
|
|
|
|
List<SupDepart> fxsjDw = supDepartResourceService.query(supDepartQueryParam); |
|
|
|
|
|
|
|
SupDepartQueryParam jsdwQueryParam = new SupDepartQueryParam(); |
|
|
|
|
|
|
|
jsdwQueryParam.setStatisticsGroupId(DepartGroupEnum.BUREAU_AFFILIATED.getId()); |
|
|
|
|
|
|
|
List<SupDepart> jsdwDw = supDepartResourceService.query(jsdwQueryParam); |
|
|
|
|
|
|
|
List<AuditNegativeVo> fxData = buildAuditNegativeVoList(fxsjDw, request); |
|
|
|
|
|
|
|
List<AuditNegativeVo> jsData = buildAuditNegativeVoList(jsdwDw, request); |
|
|
|
|
|
|
|
// 总览
|
|
|
|
|
|
|
|
AuditOverview auditOverview = new AuditOverview(); |
|
|
|
|
|
|
|
if (ZFTZSJ.getValue().equals(request.getAuditType())) { |
|
|
|
|
|
|
|
ReportProjectQueryParam reportProjectQueryParam = new ReportProjectQueryParam(); |
|
|
|
|
|
|
|
reportProjectQueryParam.setPublicationDateStart(request.getBeginTime()); |
|
|
|
|
|
|
|
reportProjectQueryParam.setPublicationDateEnd(request.getEndTime()); |
|
|
|
|
|
|
|
List<ReportProject> reportProjects = reportProjectResourceService.query(reportProjectQueryParam); |
|
|
|
|
|
|
|
NegativeQueryParam negativeQueryParam = new NegativeQueryParam(); |
|
|
|
|
|
|
|
negativeQueryParam.setCrtTime(List.of(request.getBeginTime(), request.getEndTime())); |
|
|
|
|
|
|
|
negativeQueryParam.setProblemSourcesCode(List.of(ZFTZSJ.getValue())); |
|
|
|
|
|
|
|
List<Negative> negativeListData = negativeResourceService.query(negativeQueryParam); |
|
|
|
|
|
|
|
BlameResult blameResult = this.buildBlameResult(negativeListData); |
|
|
|
|
|
|
|
BigDecimal zftzje = this.sumAmountInWan(reportProjects, ReportProject::getReportMoney); |
|
|
|
|
|
|
|
BigDecimal zftzsjje = this.sumAmountInWan(reportProjects, ReportProject::getArchivingReduceMoney); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auditOverview.setProjectNumber(BigDecimal.valueOf(reportProjects.size())); |
|
|
|
|
|
|
|
auditOverview.setAuditAmount(zftzje); |
|
|
|
|
|
|
|
auditOverview.setAuditSjAmount(zftzsjje); |
|
|
|
|
|
|
|
auditOverview.setNegativeNumber(negativeListData.size()); |
|
|
|
|
|
|
|
auditOverview.setAccountableNumber((long) (blameResult.personalBlames().size() + blameResult.leadBlames().size())); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
DataAuditQueryParam dataAuditQueryParam = new DataAuditQueryParam(); |
|
|
|
|
|
|
|
dataAuditQueryParam.setAuditTimeStart(toLocalDateTime(request.getBeginTime())); |
|
|
|
|
|
|
|
dataAuditQueryParam.setAuditTimeEnd(toLocalDateTime(request.getEndTime())); |
|
|
|
|
|
|
|
dataAuditQueryParam.setAuditType(request.getAuditType()); |
|
|
|
|
|
|
|
List<DataAudit> dataAuditList = dataAuditResourceService.query(dataAuditQueryParam); |
|
|
|
|
|
|
|
NegativeQueryParam negativeQueryParam = new NegativeQueryParam(); |
|
|
|
|
|
|
|
negativeQueryParam.setCrtTime(List.of(request.getBeginTime(), request.getEndTime())); |
|
|
|
|
|
|
|
negativeQueryParam.setProblemSourcesCode(List.of(request.getAuditType())); |
|
|
|
|
|
|
|
List<Negative> negativeListData = negativeResourceService.query(negativeQueryParam); |
|
|
|
|
|
|
|
BlameResult blameResult = this.buildBlameResult(negativeListData); |
|
|
|
|
|
|
|
BigDecimal je = this.sumAmount(dataAuditList, DataAudit::getAuditAmount, new BigDecimal(1)); |
|
|
|
|
|
|
|
BigDecimal zsjje = this.sumAmount(dataAuditList, DataAudit::getIssueAmount, new BigDecimal(1)); |
|
|
|
|
|
|
|
auditOverview.setProjectNumber(BigDecimal.valueOf(dataAuditList.size())); |
|
|
|
|
|
|
|
auditOverview.setAuditAmount(je); |
|
|
|
|
|
|
|
auditOverview.setAuditSjAmount(zsjje); |
|
|
|
|
|
|
|
auditOverview.setNegativeNumber(negativeListData.size()); |
|
|
|
|
|
|
|
auditOverview.setAccountableNumber((long) (blameResult.personalBlames().size() + blameResult.leadBlames().size())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
JSONObject object = new JSONObject(); |
|
|
|
|
|
|
|
object.fluentPut("fxData", fxData); |
|
|
|
|
|
|
|
object.fluentPut("jsData", jsData); |
|
|
|
|
|
|
|
object.fluentPut("leftOverview", auditOverview); |
|
|
|
|
|
|
|
return Result.success(object); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<EchartsVo> filterZero(List<EchartsVo> list) { |
|
|
|
private List<EchartsVo> filterZero(List<EchartsVo> list) { |
|
|
|
return list.stream() |
|
|
|
return list.stream() |
|
|
|
.filter(e -> e.getValue() != null && e.getValue() > 0) |
|
|
|
.filter(e -> e.getValue() != null && e.getValue() > 0) |
|
|
|
@ -2128,6 +2191,118 @@ public class DatavServiceImpl implements DatavService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public record BlameResult( |
|
|
|
|
|
|
|
List<NegativeBlame> personalBlames, |
|
|
|
|
|
|
|
List<NegativeBlame> leadBlames |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BlameResult buildBlameResult(List<Negative> negativeListData) { |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(negativeListData)) { |
|
|
|
|
|
|
|
return new 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 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 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 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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Result<JSONObject> getSubOneMailMapIcon() { |
|
|
|
public Result<JSONObject> getSubOneMailMapIcon() { |
|
|
|
|
|
|
|
|
|
|
|
// ✅ 注意:这里的 name 必须和地图 geojson 区域名一致(一般是“xx街道/园区”)
|
|
|
|
// ✅ 注意:这里的 name 必须和地图 geojson 区域名一致(一般是“xx街道/园区”)
|
|
|
|
|