|
|
|
|
@ -49,11 +49,10 @@ public class ProblemSourceService {
|
|
|
|
|
CompletableFuture.allOf( |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> build.aTotal(businessDepartMapper.problemSum(List.of(1, 2), "2024-01-01 00:00:00"))), |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> build.caseTotal(businessDepartMapper.problemSum(List.of(4, 5, 6), "2024-01-01 00:00:00"))), |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> build.negativeTotal(negativeMapper.selectCount(new LambdaQueryWrapper<Negative>().in(Negative::getCheckStatus, List.of(1, 2))).intValue())) |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> build.negativeTotal(negativeMapper.selectCount(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2)).ge(Negative::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))).intValue())) |
|
|
|
|
).join(); |
|
|
|
|
List<NegativeBlame> list = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>() |
|
|
|
|
.select(NegativeBlame::getBlameIdCode) |
|
|
|
|
.isNotNull(NegativeBlame::getBlameIdCode)); |
|
|
|
|
List<NegativeBlame> list = blameMapper.selectBlameList(); |
|
|
|
|
Long count = list.stream().map(NegativeBlame::getBlameIdCode).distinct().count(); |
|
|
|
|
build.peopleCount(count.intValue()); |
|
|
|
|
ProblemSourceStatisticsVo vo = build.build(); |
|
|
|
|
@ -63,40 +62,6 @@ public class ProblemSourceService {
|
|
|
|
|
|
|
|
|
|
private final SupDepartMapper supDepartMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param type 类型 1- 风险值 2- 问题数 3-问题发生率 |
|
|
|
|
* @param businessType |
|
|
|
|
*/ |
|
|
|
|
public void rankStatistics(Integer type, Integer businessType) { |
|
|
|
|
List<SupDepart> departs = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>() |
|
|
|
|
.select(SupDepart::getId, SupDepart::getPid, SupDepart::getName, SupDepart::getLevel)); |
|
|
|
|
Map<String, SupDepart> departMap = departs.stream().collect(Collectors.toMap(SupDepart::getId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
|
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
|
Map<String, Integer> mapLevel2 = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
SupDepart depart = departMap.get(negative.getInvolveDepartId()); |
|
|
|
|
if (depart == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (depart.getLevel() == 3) { |
|
|
|
|
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapLevel3.put(negative.getInvolveDepartId(), count); |
|
|
|
|
depart = departMap.get(depart.getPid()); |
|
|
|
|
} |
|
|
|
|
if (depart.getLevel() == 2) { |
|
|
|
|
Integer count = Optional.ofNullable(mapLevel2.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapLevel2.put(negative.getInvolveDepartId(), count); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private final StatisticsGroupMapper statisticsGroupMapper; |
|
|
|
|
|
|
|
|
|
private final StatisticsDepartMapper departMapper; |
|
|
|
|
@ -104,7 +69,7 @@ public class ProblemSourceService {
|
|
|
|
|
public List<RiskStatisticsVo> statisticsGroupRank() { |
|
|
|
|
StatisticsGroup group = statisticsGroupMapper |
|
|
|
|
.selectOne(new LambdaQueryWrapper<StatisticsGroup>() |
|
|
|
|
.eq(StatisticsGroup::getName, "交警大队").last("limit 1")); |
|
|
|
|
.eq(StatisticsGroup::getName, "交警大队").last("limit 1")); |
|
|
|
|
|
|
|
|
|
List<StatisticsDepart> list = departMapper.selectList(new LambdaQueryWrapper<StatisticsDepart>() |
|
|
|
|
.eq(StatisticsDepart::getLevel, 3) |
|
|
|
|
@ -113,6 +78,7 @@ public class ProblemSourceService {
|
|
|
|
|
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.ge(Negative::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0)) |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
@ -131,8 +97,8 @@ public class ProblemSourceService {
|
|
|
|
|
vo.add(v); |
|
|
|
|
} |
|
|
|
|
vo.sort(Comparator.comparing(RiskStatisticsVo::getValue, Comparator.reverseOrder())); |
|
|
|
|
if(vo.size() > 10) { |
|
|
|
|
return vo.subList(0,10); |
|
|
|
|
if (vo.size() > 10) { |
|
|
|
|
return vo.subList(0, 10); |
|
|
|
|
} |
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
@ -151,6 +117,7 @@ public class ProblemSourceService {
|
|
|
|
|
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.ge(Negative::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0)) |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
@ -169,8 +136,8 @@ public class ProblemSourceService {
|
|
|
|
|
vo.add(v); |
|
|
|
|
} |
|
|
|
|
vo.sort(Comparator.comparing(RiskStatisticsVo::getValue, Comparator.reverseOrder())); |
|
|
|
|
if(vo.size() > 10) { |
|
|
|
|
return vo.subList(0,10); |
|
|
|
|
if (vo.size() > 10) { |
|
|
|
|
return vo.subList(0, 10); |
|
|
|
|
} |
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
@ -191,6 +158,7 @@ public class ProblemSourceService {
|
|
|
|
|
Map<String, SupDepart> areaMap = departs.stream().collect(Collectors.toMap(SupDepart::getId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.ge(Negative::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0)) |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
@ -204,7 +172,7 @@ public class ProblemSourceService {
|
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapLevel3.get(area.getId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapLevel3.put(negative.getInvolveDepartId(), count); |
|
|
|
|
mapLevel3.put(area.getId(), count); |
|
|
|
|
} |
|
|
|
|
List<RiskStatisticsVo> vo = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) { |
|
|
|
|
@ -229,6 +197,193 @@ public class ProblemSourceService {
|
|
|
|
|
return trans(blameMapper.statisticsBlame3()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 交警人均率
|
|
|
|
|
public List<RiskStatisticsVo> statisticsGroupRate() { |
|
|
|
|
StatisticsGroup group = statisticsGroupMapper |
|
|
|
|
.selectOne(new LambdaQueryWrapper<StatisticsGroup>() |
|
|
|
|
.eq(StatisticsGroup::getName, "交警大队").last("limit 1")); |
|
|
|
|
|
|
|
|
|
List<StatisticsDepart> list = departMapper.selectList(new LambdaQueryWrapper<StatisticsDepart>() |
|
|
|
|
.eq(StatisticsDepart::getLevel, 3) |
|
|
|
|
.eq(StatisticsDepart::getGroupId, group.getGroupId())); |
|
|
|
|
|
|
|
|
|
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.ge(Negative::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0)) |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
// *********问题数**********
|
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
if (departMap.get(negative.getInvolveDepartId()) == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapLevel3.put(negative.getInvolveDepartId(), count); |
|
|
|
|
} |
|
|
|
|
// *********问题人数**********
|
|
|
|
|
Map<String, Integer> mapPeopleCount = new HashMap<>(); |
|
|
|
|
Map<String, String> mapPerson = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
List<NegativeBlame> tmp = blameMapper.selectBlameList(); |
|
|
|
|
for (NegativeBlame negativeBlame : tmp) { |
|
|
|
|
if (departMap.get(negativeBlame.getBlameDepartId()) == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (mapPerson.get(negativeBlame.getBlameIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapPeopleCount.get(negativeBlame.getBlameDepartId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapPeopleCount.put(negativeBlame.getBlameDepartId(), count); |
|
|
|
|
} |
|
|
|
|
mapPerson = null; |
|
|
|
|
// 统计
|
|
|
|
|
List<RiskStatisticsVo> vo = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) { |
|
|
|
|
Integer humanCount = mapPeopleCount.get(entry.getKey()); |
|
|
|
|
if (humanCount == null) continue; |
|
|
|
|
RiskStatisticsVo v = new RiskStatisticsVo(); |
|
|
|
|
v.setName(departMap.get(entry.getKey()).getName().replaceFirst("湖南省长沙市公安局", "").replaceFirst("湖南省长沙市", "").replaceFirst("湖南省", "")); |
|
|
|
|
v.setScore(new BigDecimal(entry.getValue().toString()).divide(new BigDecimal(humanCount.toString()), 2, RoundingMode.UP).doubleValue()); |
|
|
|
|
vo.add(v); |
|
|
|
|
} |
|
|
|
|
vo.sort(Comparator.comparing(RiskStatisticsVo::getScore, Comparator.reverseOrder())); |
|
|
|
|
if (vo.size() > 10) { |
|
|
|
|
return vo.subList(0, 10); |
|
|
|
|
} |
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 派出所
|
|
|
|
|
public List<RiskStatisticsVo> statisticsGroupRate2() { |
|
|
|
|
StatisticsGroup group = statisticsGroupMapper.selectOne(new LambdaQueryWrapper<StatisticsGroup>() |
|
|
|
|
.eq(StatisticsGroup::getName, "派出所").last("limit 1")); |
|
|
|
|
|
|
|
|
|
List<StatisticsDepart> list = departMapper.selectList(new LambdaQueryWrapper<StatisticsDepart>() |
|
|
|
|
.eq(StatisticsDepart::getLevel, 3) |
|
|
|
|
.eq(StatisticsDepart::getGroupId, group.getGroupId())); |
|
|
|
|
|
|
|
|
|
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.ge(Negative::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0)) |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
if (departMap.get(negative.getInvolveDepartId()) == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapLevel3.put(negative.getInvolveDepartId(), count); |
|
|
|
|
} |
|
|
|
|
// *********问题人数**********
|
|
|
|
|
Map<String, Integer> mapPeopleCount = new HashMap<>(); |
|
|
|
|
Map<String, String> mapPerson = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
List<NegativeBlame> tmp = blameMapper.selectBlameList(); |
|
|
|
|
for (NegativeBlame negativeBlame : tmp) { |
|
|
|
|
if (departMap.get(negativeBlame.getBlameDepartId()) == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (mapPerson.get(negativeBlame.getBlameIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapPeopleCount.get(negativeBlame.getBlameDepartId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapPeopleCount.put(negativeBlame.getBlameDepartId(), count); |
|
|
|
|
} |
|
|
|
|
mapPerson = null; |
|
|
|
|
// 统计
|
|
|
|
|
List<RiskStatisticsVo> vo = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) { |
|
|
|
|
Integer humanCount = mapPeopleCount.get(entry.getKey()); |
|
|
|
|
if (humanCount == null) continue; |
|
|
|
|
RiskStatisticsVo v = new RiskStatisticsVo(); |
|
|
|
|
v.setName(departMap.get(entry.getKey()).getName().replaceFirst("湖南省长沙市公安局", "").replaceFirst("湖南省长沙市", "").replaceFirst("湖南省", "")); |
|
|
|
|
v.setScore(new BigDecimal(entry.getValue().toString()).divide(new BigDecimal(humanCount.toString()), 2, RoundingMode.UP).doubleValue()); |
|
|
|
|
vo.add(v); |
|
|
|
|
} |
|
|
|
|
vo.sort(Comparator.comparing(RiskStatisticsVo::getScore, Comparator.reverseOrder())); |
|
|
|
|
if (vo.size() > 10) { |
|
|
|
|
return vo.subList(0, 10); |
|
|
|
|
} |
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 分县
|
|
|
|
|
public List<RiskStatisticsVo> statisticsGroupRate3() { |
|
|
|
|
StatisticsGroup group = statisticsGroupMapper.selectOne(new LambdaQueryWrapper<StatisticsGroup>() |
|
|
|
|
.eq(StatisticsGroup::getName, "派出所").last("limit 1")); |
|
|
|
|
|
|
|
|
|
List<StatisticsDepart> list = departMapper.selectList(new LambdaQueryWrapper<StatisticsDepart>() |
|
|
|
|
.eq(StatisticsDepart::getLevel, 3) |
|
|
|
|
.eq(StatisticsDepart::getGroupId, group.getGroupId())); |
|
|
|
|
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<SupDepart> departs = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>() |
|
|
|
|
.eq(SupDepart::getLevel, 2) |
|
|
|
|
.select(SupDepart::getId, SupDepart::getPid, SupDepart::getName, SupDepart::getLevel)); |
|
|
|
|
Map<String, SupDepart> areaMap = departs.stream().collect(Collectors.toMap(SupDepart::getId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.ge(Negative::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0)) |
|
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
StatisticsDepart depart = departMap.get(negative.getInvolveDepartId()); |
|
|
|
|
if (depart == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SupDepart area = areaMap.get(depart.getPid()); |
|
|
|
|
if (area == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapLevel3.get(area.getId())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapLevel3.put(area.getId(), count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, Integer> mapPeopleCount = new HashMap<>(); |
|
|
|
|
Map<String, String> mapPerson = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
List<NegativeBlame> tmp = blameMapper.selectBlameList(); |
|
|
|
|
for (NegativeBlame negativeBlame : tmp) { |
|
|
|
|
StatisticsDepart depart = departMap.get(negativeBlame.getBlameDepartId()); |
|
|
|
|
if (depart == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SupDepart area = areaMap.get(depart.getPid()); |
|
|
|
|
if (area == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (mapPerson.get(negativeBlame.getBlameIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapPeopleCount.get(depart.getPid())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapPeopleCount.put(depart.getPid(), count); |
|
|
|
|
} |
|
|
|
|
mapPerson = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 统计
|
|
|
|
|
List<RiskStatisticsVo> vo = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) { |
|
|
|
|
Integer humanCount = mapPeopleCount.get(entry.getKey()); |
|
|
|
|
if (humanCount == null) continue; |
|
|
|
|
RiskStatisticsVo v = new RiskStatisticsVo(); |
|
|
|
|
v.setName(areaMap.get(entry.getKey()).getName().replaceFirst("湖南省长沙市公安局", "").replaceFirst("湖南省长沙市", "").replaceFirst("湖南省", "")); |
|
|
|
|
v.setScore(new BigDecimal(entry.getValue().toString()).divide(new BigDecimal(humanCount.toString()), 2, RoundingMode.UP).doubleValue()); |
|
|
|
|
vo.add(v); |
|
|
|
|
} |
|
|
|
|
vo.sort(Comparator.comparing(RiskStatisticsVo::getScore, Comparator.reverseOrder())); |
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<RiskStatisticsVo> trans(List<BlamePerson> list) { |
|
|
|
|
List<RiskStatisticsVo> vo = new ArrayList<>(); |
|
|
|
|
for (BlamePerson blamePerson : list) { |
|
|
|
|
|