|
|
|
|
@ -41,6 +41,7 @@ import java.time.ZoneId;
|
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.*; |
|
|
|
|
|
|
|
|
|
@ -434,7 +435,6 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
|
|
|
|
|
List<RankVo> fxsjChangedRankList = new ArrayList<>(); |
|
|
|
|
List<RankVo> jsdwChangedRankList = new ArrayList<>(); |
|
|
|
|
List<RankVo> allRankList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (SupDepart pcs : policeDeparts) { |
|
|
|
|
List<Negative> negativeList = negativeMapper.getChangedRank(pcs.getId(), request.getBeginTime(), request.getEndTime()); |
|
|
|
|
@ -442,17 +442,16 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
if (totalPro == 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
long completed = negativeList.stream() |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.filter(one -> ProcessingStatusEnum.completed.name().equals(one.getProcessingStatus())) |
|
|
|
|
.count(); |
|
|
|
|
// 办结数
|
|
|
|
|
long completed = negativeList.stream().filter(Objects::nonNull).filter(one -> ProcessingStatusEnum.completed.name().equals(one.getProcessingStatus())).count(); |
|
|
|
|
// 市局下发
|
|
|
|
|
long sjxf = negativeList.stream().filter(Objects::nonNull).filter(one -> Integer.valueOf(0).equals(one.getCrtDepartLevel())).count(); |
|
|
|
|
// 县局下发
|
|
|
|
|
long xjxf = negativeList.stream().filter(Objects::nonNull).filter(one -> Integer.valueOf(2).equals(one.getCrtDepartLevel())).count(); |
|
|
|
|
String rate = BigDecimal.valueOf(completed) |
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(totalPro), 1, RoundingMode.HALF_UP) |
|
|
|
|
.toString(); |
|
|
|
|
|
|
|
|
|
RankVo rankVo = new RankVo(); |
|
|
|
|
rankVo.setLabel(pcs.getShortName()); |
|
|
|
|
rankVo.setDepartId(pcs.getId()); |
|
|
|
|
@ -463,7 +462,6 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
rankVo.setValue(rate); |
|
|
|
|
rankVo.setRate(rate); |
|
|
|
|
fxsjChangedRankList.add(rankVo); |
|
|
|
|
allRankList.add(rankVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (SupDepart dw : teamDeparts) { |
|
|
|
|
@ -482,7 +480,6 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(totalPro), 1, RoundingMode.HALF_UP) |
|
|
|
|
.toString(); |
|
|
|
|
|
|
|
|
|
RankVo rankVo = new RankVo(); |
|
|
|
|
rankVo.setLabel(dw.getShortName()); |
|
|
|
|
rankVo.setDepartId(dw.getId()); |
|
|
|
|
@ -493,57 +490,31 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
rankVo.setValue(rate); |
|
|
|
|
rankVo.setRate(rate); |
|
|
|
|
jsdwChangedRankList.add(rankVo); |
|
|
|
|
allRankList.add(rankVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fxsjChangedRankList.sort(Comparator.comparingLong((RankVo vo) -> Long.parseLong(vo.getDenominator())).reversed()); |
|
|
|
|
jsdwChangedRankList.sort(Comparator.comparingLong((RankVo vo) -> Long.parseLong(vo.getDenominator())).reversed()); |
|
|
|
|
|
|
|
|
|
long policeTotal = fxsjChangedRankList.stream().mapToLong(vo -> Long.parseLong(vo.getDenominator())).sum(); |
|
|
|
|
long policeCompleted = fxsjChangedRankList.stream().mapToLong(vo -> Long.parseLong(vo.getNumerator())).sum(); |
|
|
|
|
long policeProcessing = policeTotal - policeCompleted; |
|
|
|
|
double policeRate = policeTotal == 0 ? 0.0 : BigDecimal.valueOf(policeCompleted) |
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(policeTotal), 1, RoundingMode.HALF_UP) |
|
|
|
|
.doubleValue(); |
|
|
|
|
long teamTotal = jsdwChangedRankList.stream().mapToLong(vo -> Long.parseLong(vo.getDenominator())).sum(); |
|
|
|
|
long teamCompleted = jsdwChangedRankList.stream().mapToLong(vo -> Long.parseLong(vo.getNumerator())).sum(); |
|
|
|
|
long teamProcessing = teamTotal - teamCompleted; |
|
|
|
|
double teamRate = teamTotal == 0 ? 0.0 : BigDecimal.valueOf(teamCompleted) |
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(teamTotal), 1, RoundingMode.HALF_UP) |
|
|
|
|
.doubleValue(); |
|
|
|
|
long total = Stream.concat(fxsjChangedRankList.stream(), jsdwChangedRankList.stream()) |
|
|
|
|
.mapToLong(vo -> Long.parseLong(vo.getDenominator())) |
|
|
|
|
.sum(); |
|
|
|
|
|
|
|
|
|
long total = policeTotal + teamTotal; |
|
|
|
|
long completed = policeCompleted + teamCompleted; |
|
|
|
|
long processing = policeProcessing + teamProcessing; |
|
|
|
|
long completed = Stream.concat(fxsjChangedRankList.stream(), jsdwChangedRankList.stream()) |
|
|
|
|
.mapToLong(vo -> Long.parseLong(vo.getNumerator())) |
|
|
|
|
.sum(); |
|
|
|
|
|
|
|
|
|
long processing = total - completed; |
|
|
|
|
double rate = total == 0 ? 0.0 : BigDecimal.valueOf(completed) |
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(total), 1, RoundingMode.HALF_UP) |
|
|
|
|
.doubleValue(); |
|
|
|
|
|
|
|
|
|
DayTimeSuperviseVo fxsjRankOverview = new DayTimeSuperviseVo(); |
|
|
|
|
fxsjRankOverview.setProTotal((int) policeTotal); |
|
|
|
|
fxsjRankOverview.setProcessingNumber(policeProcessing); |
|
|
|
|
fxsjRankOverview.setCompletedNumber(policeCompleted); |
|
|
|
|
fxsjRankOverview.setCompletedRate(policeRate); |
|
|
|
|
|
|
|
|
|
DayTimeSuperviseVo jsdwRankOverview = new DayTimeSuperviseVo(); |
|
|
|
|
jsdwRankOverview.setProTotal((int) teamTotal); |
|
|
|
|
jsdwRankOverview.setProcessingNumber(teamProcessing); |
|
|
|
|
jsdwRankOverview.setCompletedNumber(teamCompleted); |
|
|
|
|
jsdwRankOverview.setCompletedRate(teamRate); |
|
|
|
|
|
|
|
|
|
DayTimeSuperviseVo overview = new DayTimeSuperviseVo(); |
|
|
|
|
overview.setProTotal((int) total); |
|
|
|
|
overview.setProcessingNumber(processing); |
|
|
|
|
overview.setCompletedNumber(completed); |
|
|
|
|
overview.setCompletedRate(rate); |
|
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("overview", overview) |
|
|
|
|
.fluentPut("fxsjRankOverview", fxsjRankOverview) |
|
|
|
|
.fluentPut("jsdwRankOverview", jsdwRankOverview) |
|
|
|
|
.fluentPut("fxsjChangedRankList", fxsjChangedRankList) |
|
|
|
|
.fluentPut("jsdwChangedRankList", jsdwChangedRankList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
@ -663,72 +634,28 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
|
|
|
|
|
fxsjYellowBetRankList.sort(Comparator.comparingInt((OrganizeProblemRankVo vo) -> Integer.parseInt(vo.getValue())).reversed()); |
|
|
|
|
jsdwYellowBetRankList.sort(Comparator.comparingInt((OrganizeProblemRankVo vo) -> Integer.parseInt(vo.getValue())).reversed()); |
|
|
|
|
|
|
|
|
|
List<Negative> totalNegativeList = new ArrayList<>(totalNegativeMap.values()); |
|
|
|
|
long policeTotal = fxsjYellowBetRankList.stream().mapToLong(vo -> Long.parseLong(vo.getValue())).sum(); |
|
|
|
|
long policeCompleted = 0L; |
|
|
|
|
long policeProcessing = 0L; |
|
|
|
|
long teamTotal = jsdwYellowBetRankList.stream().mapToLong(vo -> Long.parseLong(vo.getValue())).sum(); |
|
|
|
|
long teamCompleted = 0L; |
|
|
|
|
long teamProcessing = 0L; |
|
|
|
|
for (SupDepart supDepart : policeDeparts) { |
|
|
|
|
List<Negative> negativeList = negativeMapper.getYellowBetNegativeList(supDepart.getId(), request.getBeginTime(), request.getEndTime(), request.getSpecialSupervision()); |
|
|
|
|
policeCompleted += negativeList.stream() |
|
|
|
|
.filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())) |
|
|
|
|
.count(); |
|
|
|
|
policeProcessing += negativeList.stream() |
|
|
|
|
.filter(item -> ProcessingStatusEnum.processing.name().equals(item.getProcessingStatus())) |
|
|
|
|
.count(); |
|
|
|
|
} |
|
|
|
|
for (SupDepart supDepart : teamDeparts) { |
|
|
|
|
List<Negative> negativeList = negativeMapper.getYellowBetNegativeList(supDepart.getId(), request.getBeginTime(), request.getEndTime(), request.getSpecialSupervision()); |
|
|
|
|
teamCompleted += negativeList.stream() |
|
|
|
|
.filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())) |
|
|
|
|
.count(); |
|
|
|
|
teamProcessing += negativeList.stream() |
|
|
|
|
.filter(item -> ProcessingStatusEnum.processing.name().equals(item.getProcessingStatus())) |
|
|
|
|
.count(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DayTimeSuperviseVo fxsjYellowBetOverview = new DayTimeSuperviseVo(); |
|
|
|
|
fxsjYellowBetOverview.setProTotal((int) policeTotal); |
|
|
|
|
fxsjYellowBetOverview.setProcessingNumber(policeProcessing); |
|
|
|
|
fxsjYellowBetOverview.setCompletedNumber(policeCompleted); |
|
|
|
|
fxsjYellowBetOverview.setCompletedRate(policeTotal == 0 |
|
|
|
|
? 0D |
|
|
|
|
: BigDecimal.valueOf(policeCompleted).multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(policeTotal), 2, RoundingMode.HALF_UP).doubleValue()); |
|
|
|
|
|
|
|
|
|
DayTimeSuperviseVo jsdwYellowBetOverview = new DayTimeSuperviseVo(); |
|
|
|
|
jsdwYellowBetOverview.setProTotal((int) teamTotal); |
|
|
|
|
jsdwYellowBetOverview.setProcessingNumber(teamProcessing); |
|
|
|
|
jsdwYellowBetOverview.setCompletedNumber(teamCompleted); |
|
|
|
|
jsdwYellowBetOverview.setCompletedRate(teamTotal == 0 |
|
|
|
|
? 0D |
|
|
|
|
: BigDecimal.valueOf(teamCompleted).multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(teamTotal), 2, RoundingMode.HALF_UP).doubleValue()); |
|
|
|
|
|
|
|
|
|
long processingCount = totalNegativeList.stream() |
|
|
|
|
.filter(item -> ProcessingStatusEnum.processing.name().equals(item.getProcessingStatus())) |
|
|
|
|
.count(); |
|
|
|
|
|
|
|
|
|
long completedCount = totalNegativeList.stream() |
|
|
|
|
.filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())) |
|
|
|
|
.count(); |
|
|
|
|
|
|
|
|
|
DayTimeSuperviseVo overview = new DayTimeSuperviseVo(); |
|
|
|
|
overview.setProTotal(totalNegativeList.size()); |
|
|
|
|
overview.setProcessingNumber(processingCount); |
|
|
|
|
overview.setCompletedNumber(completedCount); |
|
|
|
|
DayTimeSuperviseVo overView = new DayTimeSuperviseVo(); |
|
|
|
|
overView.setProTotal(totalNegativeList.size()); |
|
|
|
|
overView.setProcessingNumber(processingCount); |
|
|
|
|
overView.setCompletedNumber(completedCount); |
|
|
|
|
double completedRate = totalNegativeList.isEmpty() |
|
|
|
|
? 0D |
|
|
|
|
: BigDecimal.valueOf(completedCount) |
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(totalNegativeList.size()), 2, RoundingMode.HALF_UP) |
|
|
|
|
.doubleValue(); |
|
|
|
|
overview.setCompletedRate(completedRate); |
|
|
|
|
overView.setCompletedRate(completedRate); |
|
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("overview",overview) |
|
|
|
|
.fluentPut("fxsjYellowBetOverview", fxsjYellowBetOverview) |
|
|
|
|
.fluentPut("jsdwYellowBetOverview", jsdwYellowBetOverview) |
|
|
|
|
.fluentPut("overview",overView) |
|
|
|
|
.fluentPut("fxsjYellowBetRankList", fxsjYellowBetRankList) |
|
|
|
|
.fluentPut("jsdwYellowBetRankList", jsdwYellowBetRankList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
@ -1374,6 +1301,67 @@ public class SubDatavServiceImpl implements SubDatavService {
|
|
|
|
|
.divide(WAN, 2, RoundingMode.HALF_UP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Result<JSONObject> mockData() { |
|
|
|
|
List<RankVo> fxsj = new ArrayList<>(); |
|
|
|
|
List<RankVo> jsdw = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
fxsj.add(build("城东派出所", "pcs_001", 15, 20, 8, 12)); |
|
|
|
|
fxsj.add(build("城西派出所", "pcs_002", 10, 18, 6, 12)); |
|
|
|
|
fxsj.add(build("开发区派出所", "pcs_003", 20, 30, 10, 20)); |
|
|
|
|
|
|
|
|
|
jsdw.add(build("刑侦大队", "team_001", 12, 15, 7, 8)); |
|
|
|
|
jsdw.add(build("治安大队", "team_002", 8, 12, 5, 7)); |
|
|
|
|
jsdw.add(build("网安大队", "team_003", 10, 25, 12, 13)); |
|
|
|
|
|
|
|
|
|
long total = Stream.concat(fxsj.stream(), jsdw.stream()) |
|
|
|
|
.mapToLong(vo -> Long.parseLong(vo.getDenominator())) |
|
|
|
|
.sum(); |
|
|
|
|
|
|
|
|
|
long completed = Stream.concat(fxsj.stream(), jsdw.stream()) |
|
|
|
|
.mapToLong(vo -> Long.parseLong(vo.getNumerator())) |
|
|
|
|
.sum(); |
|
|
|
|
|
|
|
|
|
long processing = total - completed; |
|
|
|
|
|
|
|
|
|
double rate = total == 0 ? 0.0 : |
|
|
|
|
BigDecimal.valueOf(completed) |
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(total), 1, RoundingMode.HALF_UP) |
|
|
|
|
.doubleValue(); |
|
|
|
|
|
|
|
|
|
DayTimeSuperviseVo overview = new DayTimeSuperviseVo(); |
|
|
|
|
overview.setProTotal((int) total); |
|
|
|
|
overview.setProcessingNumber(processing); |
|
|
|
|
overview.setCompletedNumber(completed); |
|
|
|
|
overview.setCompletedRate(rate); |
|
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("overview", overview) |
|
|
|
|
.fluentPut("fxsjChangedRankList", fxsj) |
|
|
|
|
.fluentPut("jsdwChangedRankList", jsdw); |
|
|
|
|
|
|
|
|
|
return Result.success(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private RankVo build(String name, String id, int completed, int total, int city, int county) { |
|
|
|
|
RankVo vo = new RankVo(); |
|
|
|
|
vo.setLabel(name); |
|
|
|
|
vo.setDepartId(id); |
|
|
|
|
vo.setNumerator(String.valueOf(completed)); |
|
|
|
|
vo.setDenominator(String.valueOf(total)); |
|
|
|
|
vo.setCityNumber(String.valueOf(city)); |
|
|
|
|
vo.setCountyNumber(String.valueOf(county)); |
|
|
|
|
|
|
|
|
|
String rate = BigDecimal.valueOf(completed) |
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
.divide(BigDecimal.valueOf(total), 1, RoundingMode.HALF_UP) |
|
|
|
|
.toString(); |
|
|
|
|
|
|
|
|
|
vo.setRate(rate); |
|
|
|
|
vo.setValue(rate); |
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|