|
|
|
@ -1,14 +1,9 @@ |
|
|
|
package com.biutag.supervision.service; |
|
|
|
package com.biutag.supervision.service; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.biutag.supervision.mapper.BusinessDepartMapper; |
|
|
|
import com.biutag.supervision.mapper.*; |
|
|
|
import com.biutag.supervision.mapper.NegativeBlameMapper; |
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
import com.biutag.supervision.mapper.NegativeMapper; |
|
|
|
import com.biutag.supervision.pojo.vo.BlamePerson; |
|
|
|
import com.biutag.supervision.mapper.SupDepartMapper; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.BusinessDepart; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.Negative; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.NegativeBlame; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.SupDepart; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.vo.ProblemSourceStatisticsVo; |
|
|
|
import com.biutag.supervision.pojo.vo.ProblemSourceStatisticsVo; |
|
|
|
import com.biutag.supervision.pojo.vo.ProblemSourceVo; |
|
|
|
import com.biutag.supervision.pojo.vo.ProblemSourceVo; |
|
|
|
import com.biutag.supervision.util.CompletableUtils.CompletableFutureUtil; |
|
|
|
import com.biutag.supervision.util.CompletableUtils.CompletableFutureUtil; |
|
|
|
@ -27,6 +22,7 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 灵敏感知大屏 |
|
|
|
* 灵敏感知大屏 |
|
|
|
|
|
|
|
* |
|
|
|
* @author kami on 2024-11-16 15:04:16 |
|
|
|
* @author kami on 2024-11-16 15:04:16 |
|
|
|
* @version 0.0.1 |
|
|
|
* @version 0.0.1 |
|
|
|
* @since 1.8 |
|
|
|
* @since 1.8 |
|
|
|
@ -44,14 +40,15 @@ public class ProblemSourceService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 数量统计 |
|
|
|
* 数量统计 |
|
|
|
|
|
|
|
* |
|
|
|
* @return 统计结构 |
|
|
|
* @return 统计结构 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public ProblemSourceStatisticsVo totalStatistics() { |
|
|
|
public ProblemSourceStatisticsVo totalStatistics() { |
|
|
|
ProblemSourceStatisticsVo.ProblemSourceStatisticsVoBuilder build = ProblemSourceStatisticsVo.builder(); |
|
|
|
ProblemSourceStatisticsVo.ProblemSourceStatisticsVoBuilder build = ProblemSourceStatisticsVo.builder(); |
|
|
|
CompletableFuture.allOf( |
|
|
|
CompletableFuture.allOf( |
|
|
|
CompletableFutureUtil.runSyncObject(() -> build.aTotal(businessDepartMapper.problemSum(List.of(1,2), "2024-01-01 00:00:00"))), |
|
|
|
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.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))).intValue())) |
|
|
|
).join(); |
|
|
|
).join(); |
|
|
|
List<NegativeBlame> list = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>().select(NegativeBlame::getBlameIdCode)); |
|
|
|
List<NegativeBlame> list = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>().select(NegativeBlame::getBlameIdCode)); |
|
|
|
Long count = list.stream().map(NegativeBlame::getBlameIdCode).distinct().count(); |
|
|
|
Long count = list.stream().map(NegativeBlame::getBlameIdCode).distinct().count(); |
|
|
|
@ -64,7 +61,6 @@ public class ProblemSourceService { |
|
|
|
private final SupDepartMapper supDepartMapper; |
|
|
|
private final SupDepartMapper supDepartMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
|
|
|
|
* @param type 类型 1- 风险值 2- 问题数 3-问题发生率 |
|
|
|
* @param type 类型 1- 风险值 2- 问题数 3-问题发生率 |
|
|
|
* @param businessType |
|
|
|
* @param businessType |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -74,29 +70,146 @@ public class ProblemSourceService { |
|
|
|
Map<String, SupDepart> departMap = departs.stream().collect(Collectors.toMap(SupDepart::getId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
Map<String, SupDepart> departMap = departs.stream().collect(Collectors.toMap(SupDepart::getId, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>() |
|
|
|
.in(Negative::getCheckStatus, List.of(1,2))); |
|
|
|
.in(Negative::getCheckStatus, List.of(1, 2))); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
Map<String, Integer> mapLevel3 = new HashMap<>(); |
|
|
|
Map<String, Integer> mapLevel2 = new HashMap<>(); |
|
|
|
Map<String, Integer> mapLevel2 = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
for (Negative negative : negatives) { |
|
|
|
SupDepart depart = departMap.get(negative.getInvolveDepartId()); |
|
|
|
SupDepart depart = departMap.get(negative.getInvolveDepartId()); |
|
|
|
if(depart == null) { |
|
|
|
if (depart == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
if(depart.getLevel() == 3) { |
|
|
|
if (depart.getLevel() == 3) { |
|
|
|
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
mapLevel3.put(negative.getInvolveDepartId(), count); |
|
|
|
mapLevel3.put(negative.getInvolveDepartId(), count); |
|
|
|
depart = departMap.get(depart.getPid()); |
|
|
|
depart = departMap.get(depart.getPid()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(depart.getLevel() == 2) { |
|
|
|
if (depart.getLevel() == 2) { |
|
|
|
Integer count = Optional.ofNullable(mapLevel2.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
Integer count = Optional.ofNullable(mapLevel2.get(negative.getInvolveDepartId())).orElse(0); |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
mapLevel2.put(negative.getInvolveDepartId(), count); |
|
|
|
mapLevel2.put(negative.getInvolveDepartId(), count); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final StatisticsGroupMapper statisticsGroupMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final StatisticsDepartMapper departMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void statisticsGroupRank() { |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) { |
|
|
|
|
|
|
|
log.info("机构:{} | {}", departMap.get(entry.getKey()).getName(), entry.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 派出所 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void statisticsGroupRank2() { |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) { |
|
|
|
|
|
|
|
log.info("机构:{} | {}", departMap.get(entry.getKey()).getName(), entry.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 分县
|
|
|
|
|
|
|
|
public void statisticsGroupRank3() { |
|
|
|
|
|
|
|
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(negative.getInvolveDepartId(), count); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) { |
|
|
|
|
|
|
|
log.info("机构:{} | {}", areaMap.get(entry.getKey()).getName(), entry.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 民警、辅警 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void personStatistics() { |
|
|
|
|
|
|
|
List<BlamePerson> list = blameMapper.statisticsBlame(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BlamePerson> list2 = blameMapper.statisticsBlame2(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BlamePerson> list3 = blameMapper.statisticsBlame3(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (BlamePerson blamePerson : list) { |
|
|
|
|
|
|
|
log.info("民警:{} | {}", blamePerson.getBlameName(), blamePerson.getNumber()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (BlamePerson blamePerson : list2) { |
|
|
|
|
|
|
|
log.info("辅警:{} | {}", blamePerson.getBlameName(), blamePerson.getNumber()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (BlamePerson blamePerson : list3) { |
|
|
|
|
|
|
|
log.info("领导:{} | {}", blamePerson.getBlameName(), blamePerson.getNumber()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|