|
|
|
@ -0,0 +1,450 @@ |
|
|
|
|
|
|
|
package com.biutag.supervision.service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
|
|
|
|
import com.biutag.supervision.mapper.DataPoliceMeetingMysqlMapper; |
|
|
|
|
|
|
|
import com.biutag.supervision.mapper.NegativeMapper; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.DataPoliceMeeting; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.Negative; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.vo.*; |
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
|
|
|
@Service |
|
|
|
|
|
|
|
public class AnalysisJudgmentService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final FileService fileService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DataPoliceMeetingMysqlMapper dataPoliceMeetingMysqlMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final NegativeMapper negativeMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final SupDepartService departService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
|
|
|
public void policeEvaluationExportExcel(Integer departId, Date beginTime, Date endTime) { |
|
|
|
|
|
|
|
List<String> departIds = departService.getAllNodeIds(String.valueOf(departId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 计算去年的开始时间和结束时间
|
|
|
|
|
|
|
|
LocalDate beginLocalDate = beginTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
|
|
|
|
|
|
|
LocalDate endLocalDate = endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
|
|
|
|
|
|
|
LocalDate lastYearBeginLocalDate = beginLocalDate.minusYears(1); |
|
|
|
|
|
|
|
LocalDate lastYearEndLocalDate = endLocalDate.minusYears(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date lastYearBeginTime = Date.from(lastYearBeginLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
|
|
|
|
|
|
|
Date lastYearEndTime = Date.from(lastYearEndLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DataPoliceMeeting> dataPoliceMeetingList = dataPoliceMeetingMysqlMapper.selectPoliceEvaluationList(departIds, beginTime, endTime); |
|
|
|
|
|
|
|
if (dataPoliceMeetingList.isEmpty()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<DataPoliceMeeting> lastDataPoliceMeetingList = dataPoliceMeetingMysqlMapper.selectPoliceEvaluationList(departIds, lastYearBeginTime, lastYearEndTime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> sampleIdList = dataPoliceMeetingList.stream().map(DataPoliceMeeting::getSampleId).toList(); |
|
|
|
|
|
|
|
List<Negative> negativeList = negativeMapper.selectListBySampleId(sampleIdList); |
|
|
|
|
|
|
|
List<AnalysisJudgmentPoliceEvaluation> data = new ArrayList<>(); |
|
|
|
|
|
|
|
List<String> businessNameCollect = dataPoliceMeetingList.stream().map(DataPoliceMeeting::getBusinessName).distinct().toList(); |
|
|
|
|
|
|
|
int i = 1; |
|
|
|
|
|
|
|
for (String businessName : businessNameCollect) { |
|
|
|
|
|
|
|
AnalysisJudgmentPoliceEvaluation analysisJudgmentPoliceEvaluation = new AnalysisJudgmentPoliceEvaluation(); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setId(String.valueOf(i++)); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setBusinessName(businessName); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessName().equals(businessName)).toList(); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setEffectiveResponse(filterList.size()); |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setSatisfied((int) dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessName().equals(businessName) && dataPoliceMeeting.getResultName().equals("满意")).count()); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setBasicallySatisfied((int) dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessName().equals(businessName) && dataPoliceMeeting.getResultName().equals("基本满意")).count()); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setDissatisfied((int) dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessName().equals(businessName) && dataPoliceMeeting.getResultName().equals("不满意")).count()); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setSatisfactionRate(String.format("%.1f%%", (analysisJudgmentPoliceEvaluation.getSatisfied() + analysisJudgmentPoliceEvaluation.getBasicallySatisfied()) / (double) analysisJudgmentPoliceEvaluation.getEffectiveResponse() * 100)); |
|
|
|
|
|
|
|
int lastCount = (int) lastDataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessName().equals(businessName)).count(); |
|
|
|
|
|
|
|
if (lastCount == 0) { |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setLastSatisfactionRate("0"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setLastSatisfactionRate(String.format("%.1f%%", (lastDataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessName().equals(businessName) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double)lastCount * 100))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setLastSatisfactionCompare(analysisJudgmentPoliceEvaluation.getEffectiveResponse() - lastCount); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
if (negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRealNumbers(0); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRealRate("0%"); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRectificationNumbers(0); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRectificationRate("0%"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRealNumbers((int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count()); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRealRate(String.format("%.1f%%", analysisJudgmentPoliceEvaluation.getUnsatisfiedRealNumbers() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRectificationNumbers((int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count()); |
|
|
|
|
|
|
|
analysisJudgmentPoliceEvaluation.setUnsatisfiedRectificationRate(String.format("%.1f%%", analysisJudgmentPoliceEvaluation.getUnsatisfiedRectificationNumbers() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
data.add(analysisJudgmentPoliceEvaluation); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
ExcelWriter excelWriter = EasyExcel.write(os).build(); |
|
|
|
|
|
|
|
WriteSheet sheet1 = EasyExcel.writerSheet(0, "警务评议总体情况") |
|
|
|
|
|
|
|
.head(AnalysisJudgmentPoliceEvaluation.class).build(); |
|
|
|
|
|
|
|
excelWriter.write(data, sheet1); |
|
|
|
|
|
|
|
excelWriter.finish(); |
|
|
|
|
|
|
|
String filePath = fileService.upload(new ByteArrayInputStream(os.toByteArray()), os.size(), ".xlsx"); |
|
|
|
|
|
|
|
System.out.println(filePath); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
|
|
|
public void sixBranchExportExcel(Integer departId, Date beginTime, Date endTime) { |
|
|
|
|
|
|
|
List<String> departIds = departService.getAllNodeIds(String.valueOf(departId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DataPoliceMeeting> dataPoliceMeetingList = dataPoliceMeetingMysqlMapper.selectPoliceEvaluationList(departIds, beginTime, endTime); |
|
|
|
|
|
|
|
if (dataPoliceMeetingList.isEmpty()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 天心分局
|
|
|
|
|
|
|
|
List<String> tianXinDepartIds = departService.getAllNodeIds("3041"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> tianXinList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> tianXinDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 高新分局
|
|
|
|
|
|
|
|
List<String> gaoXinDepartIds = departService.getAllNodeIds("4437"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> gaoXinList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> gaoXinDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 芙蓉分局
|
|
|
|
|
|
|
|
List<String> fuRongDepartIds = departService.getAllNodeIds("2898"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> fuRongList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> fuRongDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 岳麓分局
|
|
|
|
|
|
|
|
List<String> yueLuDepartIds = departService.getAllNodeIds("3178"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> yueLuList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> yueLuDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 开福分局
|
|
|
|
|
|
|
|
List<String> kaiFuDepartIds = departService.getAllNodeIds("3337"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> kaiFuList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> kaiFuDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 雨花分局
|
|
|
|
|
|
|
|
List<String> yuHuaDepartIds = departService.getAllNodeIds("3490"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> yuHuaList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> yuHuaDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> sampleIdList = dataPoliceMeetingList.stream().map(DataPoliceMeeting::getSampleId).toList(); |
|
|
|
|
|
|
|
List<Negative> negativeList = negativeMapper.selectListBySampleId(sampleIdList); |
|
|
|
|
|
|
|
List<AnalysisJudgmentSixBranch> data = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
generateSixBranchLine(tianXinList, "天心分局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateSixBranchLine(gaoXinList, "高新分局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateSixBranchLine(fuRongList, "芙蓉分局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateSixBranchLine(yueLuList, "岳麓分局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateSixBranchLine(kaiFuList, "开福分局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateSixBranchLine(yuHuaList, "雨花分局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
data.sort(Comparator.comparingDouble((AnalysisJudgmentSixBranch branch) -> Double.parseDouble(branch.getScore())).reversed()); |
|
|
|
|
|
|
|
for (AnalysisJudgmentSixBranch datum : data) { |
|
|
|
|
|
|
|
datum.setId(String.valueOf(data.indexOf(datum) + 1)); |
|
|
|
|
|
|
|
datum.setRank(data.indexOf(datum) + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
ExcelWriter excelWriter = EasyExcel.write(os).build(); |
|
|
|
|
|
|
|
WriteSheet sheet1 = EasyExcel.writerSheet(0, "六分局排名情况") |
|
|
|
|
|
|
|
.head(AnalysisJudgmentSixBranch.class).build(); |
|
|
|
|
|
|
|
excelWriter.write(data, sheet1); |
|
|
|
|
|
|
|
excelWriter.finish(); |
|
|
|
|
|
|
|
String filePath = fileService.upload(new ByteArrayInputStream(os.toByteArray()), os.size(), ".xlsx"); |
|
|
|
|
|
|
|
System.out.println(filePath); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void generateSixBranchLine(List<DataPoliceMeeting> list, String businessName, List<DataPoliceMeeting> dataPoliceMeetingList, List<Negative> negativeList, List<AnalysisJudgmentSixBranch> data) { |
|
|
|
|
|
|
|
List<Integer> businessIdCollect = list.stream().map(DataPoliceMeeting::getBusinessId).distinct().toList(); |
|
|
|
|
|
|
|
AnalysisJudgmentSixBranch sixBranch = new AnalysisJudgmentSixBranch(); |
|
|
|
|
|
|
|
sixBranch.setBusinessName(businessName); |
|
|
|
|
|
|
|
for (Integer businessId : businessIdCollect) { |
|
|
|
|
|
|
|
// 110
|
|
|
|
|
|
|
|
if (businessId == 12) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
sixBranch.setSatisfactionRate110(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedTimelinessRate110(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRealRate110(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRectificationRate110(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 13) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
sixBranch.setSatisfactionRateVictim(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedTimelinessRateVictim(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRealRateVictim(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRectificationRateVictim(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 19) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
sixBranch.setSatisfactionRateIdCard(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedTimelinessRateIdCard(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRealRateIdCard(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRectificationRateIdCard(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 20) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
sixBranch.setSatisfactionRateHuKou(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedTimelinessRateHuKou(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRealRateHuKou(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
sixBranch.setUnsatisfiedRectificationRateHuKou(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
double rate110 = getRateByString(sixBranch.getSatisfactionRate110()); |
|
|
|
|
|
|
|
double rateVictim = getRateByString(sixBranch.getSatisfactionRateVictim()); |
|
|
|
|
|
|
|
double rateIdCard = getRateByString(sixBranch.getSatisfactionRateIdCard()); |
|
|
|
|
|
|
|
double rateHuKou = getRateByString(sixBranch.getSatisfactionRateHuKou()); |
|
|
|
|
|
|
|
double score = (rate110 * 100 * 20 / 65 |
|
|
|
|
|
|
|
+ rateVictim * 100 * 25 / 65 |
|
|
|
|
|
|
|
+ rateIdCard * 100 * 10 / 65 |
|
|
|
|
|
|
|
+ rateHuKou * 100 * 10 / 65); |
|
|
|
|
|
|
|
sixBranch.setScore(String.format("%.1f", score)); |
|
|
|
|
|
|
|
data.add(sixBranch); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
|
|
|
public void fourBureauExportExcel(Integer departId, Date beginTime, Date endTime) { |
|
|
|
|
|
|
|
List<String> departIds = departService.getAllNodeIds(String.valueOf(departId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DataPoliceMeeting> dataPoliceMeetingList = dataPoliceMeetingMysqlMapper.selectPoliceEvaluationList(departIds, beginTime, endTime); |
|
|
|
|
|
|
|
if (dataPoliceMeetingList.isEmpty()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 宁乡市局
|
|
|
|
|
|
|
|
List<String> ningXiangDepartIds = departService.getAllNodeIds("3994"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> ningXiangList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> ningXiangDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 望城分局
|
|
|
|
|
|
|
|
List<String> wangChengDepartIds = departService.getAllNodeIds("3799"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> wangChengList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> wangChengDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 浏阳市局
|
|
|
|
|
|
|
|
List<String> liuYangDepartIds = departService.getAllNodeIds("4170"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> liuYangList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> liuYangDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
// 长沙县局
|
|
|
|
|
|
|
|
List<String> xingShaDepartIds = departService.getAllNodeIds("3651"); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> xingShaList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> xingShaDepartIds.contains(dataPoliceMeeting.getInvolveDepartId())).toList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> sampleIdList = dataPoliceMeetingList.stream().map(DataPoliceMeeting::getSampleId).toList(); |
|
|
|
|
|
|
|
List<Negative> negativeList = negativeMapper.selectListBySampleId(sampleIdList); |
|
|
|
|
|
|
|
List<AnalysisJudgmentFourBureau> data = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
generateFourBureauLine(ningXiangList, "宁乡市局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateFourBureauLine(wangChengList, "望城分局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateFourBureauLine(liuYangList, "浏阳市局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
generateFourBureauLine(xingShaList, "长沙县局", dataPoliceMeetingList, negativeList, data); |
|
|
|
|
|
|
|
data.sort(Comparator.comparingDouble((AnalysisJudgmentFourBureau branch) -> Double.parseDouble(branch.getScore())).reversed()); |
|
|
|
|
|
|
|
for (AnalysisJudgmentFourBureau datum : data) { |
|
|
|
|
|
|
|
datum.setId(String.valueOf(data.indexOf(datum) + 1)); |
|
|
|
|
|
|
|
datum.setRank(data.indexOf(datum) + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
ExcelWriter excelWriter = EasyExcel.write(os).build(); |
|
|
|
|
|
|
|
WriteSheet sheet1 = EasyExcel.writerSheet(0, "四县市局排名情况") |
|
|
|
|
|
|
|
.head(AnalysisJudgmentFourBureau.class).build(); |
|
|
|
|
|
|
|
excelWriter.write(data, sheet1); |
|
|
|
|
|
|
|
excelWriter.finish(); |
|
|
|
|
|
|
|
String filePath = fileService.upload(new ByteArrayInputStream(os.toByteArray()), os.size(), ".xlsx"); |
|
|
|
|
|
|
|
System.out.println(filePath); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void generateFourBureauLine(List<DataPoliceMeeting> list, String businessName, List<DataPoliceMeeting> dataPoliceMeetingList, List<Negative> negativeList, List<AnalysisJudgmentFourBureau> data) { |
|
|
|
|
|
|
|
List<Integer> businessIdCollect = list.stream().map(DataPoliceMeeting::getBusinessId).distinct().toList(); |
|
|
|
|
|
|
|
AnalysisJudgmentFourBureau fourBureau = new AnalysisJudgmentFourBureau(); |
|
|
|
|
|
|
|
fourBureau.setBusinessName(businessName); |
|
|
|
|
|
|
|
for (Integer businessId : businessIdCollect) { |
|
|
|
|
|
|
|
if (businessId == 12) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
fourBureau.setSatisfactionRate110(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedTimelinessRate110(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRealRate110(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRectificationRate110(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 13) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
fourBureau.setSatisfactionRateVictim(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedTimelinessRateVictim(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRealRateVictim(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRectificationRateVictim(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 18) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
fourBureau.setSatisfactionRate122(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedTimelinessRate122(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRealRate122(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRectificationRate122(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 11) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
fourBureau.setSatisfactionRateDrivingTest(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedTimelinessRateDrivingTest(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRealRateDrivingTest(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRectificationRateDrivingTest(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 14) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
fourBureau.setSatisfactionRateCarRegistration(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedTimelinessRateCarRegistration(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRealRateCarRegistration(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRectificationRateCarRegistration(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 19) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
fourBureau.setSatisfactionRateIdCard(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedTimelinessRateIdCard(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRealRateIdCard(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRectificationRateIdCard(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (businessId == 20) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId)).toList(); |
|
|
|
|
|
|
|
if (filterList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<Integer> filterSampleIdList = filterList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> filterSampleIdList.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
fourBureau.setSatisfactionRateHuKou(String.format("%.1f%%", (filterList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getBusinessId().equals(businessId) && !dataPoliceMeeting.getResultName().equals("不满意")).count() / (double) filterList.size() * 100))); |
|
|
|
|
|
|
|
if (!negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedTimelinessRateHuKou(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() == null || negative.getHandleTimeout() == 0).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRealRateHuKou(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
fourBureau.setUnsatisfiedRectificationRateHuKou(String.format("%.1f%%", (int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
double rate110 = getRateByString(fourBureau.getSatisfactionRate110()); |
|
|
|
|
|
|
|
double rateVictim = getRateByString(fourBureau.getSatisfactionRateVictim()); |
|
|
|
|
|
|
|
double rate122 = getRateByString(fourBureau.getSatisfactionRate122()); |
|
|
|
|
|
|
|
double rateDrivingTest = getRateByString(fourBureau.getSatisfactionRateDrivingTest()); |
|
|
|
|
|
|
|
double rateCarRegistration = getRateByString(fourBureau.getSatisfactionRateCarRegistration()); |
|
|
|
|
|
|
|
double rateIdCard = getRateByString(fourBureau.getSatisfactionRateIdCard()); |
|
|
|
|
|
|
|
double rateHuKou = getRateByString(fourBureau.getSatisfactionRateHuKou()); |
|
|
|
|
|
|
|
double score = (rate110 * 100 * 20 / 100 |
|
|
|
|
|
|
|
+ rateVictim * 100 * 25 / 100 |
|
|
|
|
|
|
|
+ rate122 * 100 * 15 / 100 |
|
|
|
|
|
|
|
+ rateDrivingTest * 100 * 10 / 100 |
|
|
|
|
|
|
|
+ rateCarRegistration * 100 * 10 / 100 |
|
|
|
|
|
|
|
+ rateIdCard * 100 * 10 / 100 |
|
|
|
|
|
|
|
+ rateHuKou * 100 * 10 / 100); |
|
|
|
|
|
|
|
fourBureau.setScore(String.format("%.1f", score)); |
|
|
|
|
|
|
|
data.add(fourBureau); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
|
|
|
public void projectAnalysisExportExcel(Integer project, Integer departId, Integer level, Date beginTime, Date endTime) { |
|
|
|
|
|
|
|
List<DepartTree> allDepartNode = departService.getAllNode(List.of(String.valueOf(departId))); |
|
|
|
|
|
|
|
List<DepartTree> departNodeList; |
|
|
|
|
|
|
|
if (level == 2) { |
|
|
|
|
|
|
|
departNodeList = allDepartNode.stream().filter(departTree -> departTree.getLevel() == 2).toList(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
departNodeList = allDepartNode.stream().filter(departTree -> departTree.getStatisticsGroupId() != null && departTree.getStatisticsGroupId().equals(String.valueOf(level))).toList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> departIds = departService.getAllNodeIds(departNodeList.stream().map(DepartTree::getId).toList()); |
|
|
|
|
|
|
|
List<DataPoliceMeeting> dataPoliceMeetingList = dataPoliceMeetingMysqlMapper.selectProjectAnalysisList(project, departIds, beginTime, endTime); |
|
|
|
|
|
|
|
if (dataPoliceMeetingList.isEmpty()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> sampleIdList = dataPoliceMeetingList.stream().map(DataPoliceMeeting::getSampleId).toList(); |
|
|
|
|
|
|
|
List<Negative> negativeList = negativeMapper.selectListBySampleId(sampleIdList); |
|
|
|
|
|
|
|
List<AnalysisJudgmentProjectAnalysis> data = new ArrayList<>(); |
|
|
|
|
|
|
|
int i = 1; |
|
|
|
|
|
|
|
for (DepartTree departNode : departNodeList) { |
|
|
|
|
|
|
|
List<DataPoliceMeeting> filterDataPoliceMeetingList = dataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getInvolveDepartId().equals(departNode.getId())).toList(); |
|
|
|
|
|
|
|
AnalysisJudgmentProjectAnalysis analysisJudgmentProjectAnalysis = new AnalysisJudgmentProjectAnalysis(); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setId(String.valueOf(i++)); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setBusinessName(departNode.getName()); |
|
|
|
|
|
|
|
if (filterDataPoliceMeetingList.isEmpty()) { |
|
|
|
|
|
|
|
data.add(analysisJudgmentProjectAnalysis); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setEffectiveResponse(filterDataPoliceMeetingList.size()); |
|
|
|
|
|
|
|
Set<Integer> sampleIdSet = filterDataPoliceMeetingList.stream().map(DataPoliceMeeting::getSampleId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setSatisfied((int) filterDataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getResultName().equals("满意")).count()); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setBasicallySatisfied((int) filterDataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getResultName().equals("基本满意")).count()); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setDissatisfied((int) filterDataPoliceMeetingList.stream().filter(dataPoliceMeeting -> dataPoliceMeeting.getResultName().equals("不满意")).count()); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setSatisfactionRate(String.format("%.1f%%", (analysisJudgmentProjectAnalysis.getSatisfied() + analysisJudgmentProjectAnalysis.getBasicallySatisfied()) / (double) analysisJudgmentProjectAnalysis.getEffectiveResponse() * 100)); |
|
|
|
|
|
|
|
List<Negative> negativeFilterList = negativeList.stream().filter(negative -> sampleIdSet.contains(negative.getSampleId())).toList(); |
|
|
|
|
|
|
|
if (negativeFilterList.isEmpty()) { |
|
|
|
|
|
|
|
data.add(analysisJudgmentProjectAnalysis); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setUnsatisfiedTimeoutNumbers((int) negativeFilterList.stream().filter(negative -> negative.getHandleTimeout() != null && negative.getHandleTimeout() > 0).count()); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setUnsatisfiedTimeoutRate(String.format("%.1f%%", analysisJudgmentProjectAnalysis.getUnsatisfiedTimeoutNumbers() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setUnsatisfiedRealNumbers((int) negativeFilterList.stream().filter(negative -> !negative.getCheckStatusName().equals("不属实")).count()); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setUnsatisfiedRealRate(String.format("%.1f%%", analysisJudgmentProjectAnalysis.getUnsatisfiedRealNumbers() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setUnsatisfiedRectificationNumbers((int) negativeFilterList.stream().filter(negative -> negative.getIsRectifyName().equals("已整改")).count()); |
|
|
|
|
|
|
|
analysisJudgmentProjectAnalysis.setUnsatisfiedRectificationRate(String.format("%.1f%%", analysisJudgmentProjectAnalysis.getUnsatisfiedRectificationNumbers() / (double) negativeFilterList.size() * 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
data.add(analysisJudgmentProjectAnalysis); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
ExcelWriter excelWriter = EasyExcel.write(os).build(); |
|
|
|
|
|
|
|
WriteSheet sheet1 = EasyExcel.writerSheet(0, "警务评议项目分析") |
|
|
|
|
|
|
|
.head(AnalysisJudgmentProjectAnalysis.class).build(); |
|
|
|
|
|
|
|
excelWriter.write(data, sheet1); |
|
|
|
|
|
|
|
excelWriter.finish(); |
|
|
|
|
|
|
|
String filePath = fileService.upload(new ByteArrayInputStream(os.toByteArray()), os.size(), ".xlsx"); |
|
|
|
|
|
|
|
System.out.println(filePath); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static double getRateByString(String string) { |
|
|
|
|
|
|
|
if (string == null) { |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Double.parseDouble(string.replace("%", "")) / 100; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |