|
|
|
|
@ -204,7 +204,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 +229,199 @@ 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>() |
|
|
|
|
.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.selectList(new LambdaQueryWrapper<NegativeBlame>() |
|
|
|
|
.select(NegativeBlame::getBlameIdCode, NegativeBlame::getThreeLevelDapart) |
|
|
|
|
.isNotNull(NegativeBlame::getBlameIdCode) |
|
|
|
|
.isNotNull(NegativeBlame::getThreeLevelDapart)); |
|
|
|
|
for (NegativeBlame negativeBlame : tmp) { |
|
|
|
|
if (departMap.get(negativeBlame.getThreeLevelDapart()) == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if(mapPerson.get(negativeBlame.getBlameIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapPeopleCount.get(negativeBlame.getThreeLevelDapart())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapPeopleCount.put(negativeBlame.getThreeLevelDapart(), 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>() |
|
|
|
|
.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.selectList(new LambdaQueryWrapper<NegativeBlame>() |
|
|
|
|
.select(NegativeBlame::getBlameIdCode, NegativeBlame::getThreeLevelDapart) |
|
|
|
|
.isNotNull(NegativeBlame::getBlameIdCode) |
|
|
|
|
.isNotNull(NegativeBlame::getThreeLevelDapart)); |
|
|
|
|
for (NegativeBlame negativeBlame : tmp) { |
|
|
|
|
if (departMap.get(negativeBlame.getThreeLevelDapart()) == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if(mapPerson.get(negativeBlame.getBlameIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Integer count = Optional.ofNullable(mapPeopleCount.get(negativeBlame.getThreeLevelDapart())).orElse(0); |
|
|
|
|
count++; |
|
|
|
|
mapPeopleCount.put(negativeBlame.getThreeLevelDapart(), 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>() |
|
|
|
|
.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.selectList(new LambdaQueryWrapper<NegativeBlame>() |
|
|
|
|
.select(NegativeBlame::getBlameIdCode, NegativeBlame::getThreeLevelDapart) |
|
|
|
|
.isNotNull(NegativeBlame::getBlameIdCode) |
|
|
|
|
.isNotNull(NegativeBlame::getThreeLevelDapart)); |
|
|
|
|
for (NegativeBlame negativeBlame : tmp) { |
|
|
|
|
StatisticsDepart depart = departMap.get(negativeBlame.getThreeLevelDapart()); |
|
|
|
|
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) { |
|
|
|
|
|