Browse Source

灵敏感知相关接口

main
kami 1 year ago
parent
commit
c1a76721b4
  1. 8
      src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java
  2. 2
      src/main/java/com/biutag/supervision/pojo/vo/BlamePerson.java
  3. 49
      src/main/java/com/biutag/supervision/service/ProblemSourceService.java
  4. 4
      src/main/java/com/biutag/supervision/service/RiskStatisticsService.java

8
src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java

@ -28,17 +28,17 @@ public interface NegativeBlameMapper extends BaseMapper<NegativeBlame> {
@Select(" SELECT blameIdCode, blameName, count(1) as number FROM `negative_blame` " +
" where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode = '1' " +
" where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode = '1' and crt_time > '2024-01-01 00:00:00' " +
" GROUP BY blameIdCode order by number desc limit 10")
List<BlamePerson> statisticsBlame();
@Select(" SELECT blameIdCode, blameName, count(1) as number FROM `negative_blame` " +
" where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode != '1' " +
" where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode != '1' and crt_time > '2024-01-01 00:00:00' " +
" GROUP BY blameIdCode order by number desc limit 10")
List<BlamePerson> statisticsBlame2();
@Select(" SELECT leadIdCode as blameIdCode, leadName as blameName, count(1) as number FROM `negative_blame` " +
" where leadIdCode is not null and LENGTH(leadIdCode) > 0 " +
@Select(" SELECT leadIdCode, leadName as blameName, count(distinct blameIdCode) as number FROM `negative_blame` " +
" where leadIdCode is not null and LENGTH(leadIdCode) > 0 and crt_time > '2024-01-01 00:00:00'" +
" GROUP BY leadIdCode order by number desc limit 10")
List<BlamePerson> statisticsBlame3();
}

2
src/main/java/com/biutag/supervision/pojo/vo/BlamePerson.java

@ -24,6 +24,8 @@ public class BlamePerson implements Serializable {
String blameIdCode;
String leadIdCode;
String blameName;
Integer number;

49
src/main/java/com/biutag/supervision/service/ProblemSourceService.java

@ -49,10 +49,12 @@ 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)
.ge(NegativeBlame::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))
.isNotNull(NegativeBlame::getBlameIdCode));
Long count = list.stream().map(NegativeBlame::getBlameIdCode).distinct().count();
build.peopleCount(count.intValue());
@ -63,40 +65,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;
@ -113,6 +81,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) {
@ -151,6 +120,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) {
@ -191,6 +161,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) {
@ -242,6 +213,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<>();
@ -259,6 +231,7 @@ public class ProblemSourceService {
List<NegativeBlame> tmp = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>()
.select(NegativeBlame::getBlameIdCode, NegativeBlame::getThreeLevelDapart)
.ge(NegativeBlame::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))
.isNotNull(NegativeBlame::getBlameIdCode)
.isNotNull(NegativeBlame::getThreeLevelDapart));
for (NegativeBlame negativeBlame : tmp) {
@ -289,6 +262,7 @@ public class ProblemSourceService {
}
return vo;
}
// 派出所
public List<RiskStatisticsVo> statisticsGroupRate2() {
StatisticsGroup group = statisticsGroupMapper.selectOne(new LambdaQueryWrapper<StatisticsGroup>()
@ -301,6 +275,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) {
@ -317,6 +292,7 @@ public class ProblemSourceService {
List<NegativeBlame> tmp = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>()
.select(NegativeBlame::getBlameIdCode, NegativeBlame::getThreeLevelDapart)
.ge(NegativeBlame::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))
.isNotNull(NegativeBlame::getBlameIdCode)
.isNotNull(NegativeBlame::getThreeLevelDapart));
for (NegativeBlame negativeBlame : tmp) {
@ -364,6 +340,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) {
@ -385,6 +362,7 @@ public class ProblemSourceService {
List<NegativeBlame> tmp = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>()
.select(NegativeBlame::getBlameIdCode, NegativeBlame::getThreeLevelDapart)
.ge(NegativeBlame::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))
.isNotNull(NegativeBlame::getBlameIdCode)
.isNotNull(NegativeBlame::getThreeLevelDapart));
for (NegativeBlame negativeBlame : tmp) {
@ -421,7 +399,6 @@ public class ProblemSourceService {
}
List<RiskStatisticsVo> trans(List<BlamePerson> list) {
List<RiskStatisticsVo> vo = new ArrayList<>();
for (BlamePerson blamePerson : list) {

4
src/main/java/com/biutag/supervision/service/RiskStatisticsService.java

@ -10,6 +10,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -108,6 +109,7 @@ public class RiskStatisticsService {
public List<RiskStatisticsVo> personStatistics() {
List<NegativeBlame> blames = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>()
.select(NegativeBlame::getBlameName, NegativeBlame::getBlameIdCode)
.ge(NegativeBlame::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))
.isNotNull(NegativeBlame::getBlameIdCode)
.eq(NegativeBlame::getIvPersonTypeCode, "1"));
Map<String, NegativeBlame> blameMap = blames.stream().collect(Collectors.toMap(NegativeBlame::getBlameIdCode, Function.identity(), (oldValue, newValue) -> newValue));
@ -130,6 +132,7 @@ public class RiskStatisticsService {
public List<RiskStatisticsVo> personStatistics2() {
List<NegativeBlame> blames = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>()
.select(NegativeBlame::getBlameName, NegativeBlame::getBlameIdCode)
.ge(NegativeBlame::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))
.isNotNull(NegativeBlame::getBlameIdCode)
.ne(NegativeBlame::getIvPersonTypeCode, "1"));
Map<String, NegativeBlame> blameMap = blames.stream().collect(Collectors.toMap(NegativeBlame::getBlameIdCode, Function.identity(), (oldValue, newValue) -> newValue));
@ -152,6 +155,7 @@ public class RiskStatisticsService {
public List<RiskStatisticsVo> leaderStatistics() {
List<NegativeBlame> blames = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>()
.select(NegativeBlame::getLeadIdCode, NegativeBlame::getLeadName)
.ge(NegativeBlame::getCrtTime, LocalDateTime.of(2024, 1, 1, 0, 0, 0))
.isNotNull(NegativeBlame::getLeadIdCode)
.ne(NegativeBlame::getIvPersonTypeCode, "1"));
Map<String, NegativeBlame> blameMap = blames.stream().collect(Collectors.toMap(NegativeBlame::getLeadIdCode, Function.identity(), (oldValue, newValue) -> newValue));

Loading…
Cancel
Save