Browse Source

fix: 完善单位问题画像、个人问题画像

main
wxc 1 year ago
parent
commit
d931f4f9f9
  1. 2
      src/main/java/com/biutag/supervision/constants/enums/BusinessTypeEnum.java
  2. 9
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java
  3. 19
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java
  4. 13
      src/main/java/com/biutag/supervision/job/DepartJob.java
  5. 2
      src/main/resources/mapper/ProfilePoliceMapper.xml

2
src/main/java/com/biutag/supervision/constants/enums/BusinessTypeEnum.java

@ -34,6 +34,6 @@ public enum BusinessTypeEnum {
return businessTypeEnum;
}
}
throw new RuntimeException("无此业务类型");
return null;
}
}

9
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java

@ -43,6 +43,7 @@ public class ProfileDepartController {
private final SupDepartService departService;
private final SupPoliceService policeService;
private final NegativeService negativeService;
private final NegativeBlameService negativeBlameService;
private final BusinessDepartService businessDepartService;
@GetMapping
@ -74,10 +75,11 @@ public class ProfileDepartController {
profileDepart.getDepartInfo().setMainRole(polices.stream().filter(item -> "正职".equals(item.getPosition())).findFirst().map(SupPolice::getName).orElse(null));
profileDepart.getDepartInfo().setDeputyRole(polices.stream().filter(item -> "副职".equals(item.getPosition())).map(SupPolice::getName).toList());
// 民警数量
profileDepart.getDepartInfo().setPoliceSize(polices.stream().filter(item -> PersonTypeEnum.police.getValue().equals(item.getPersonStatus())).count());
profileDepart.getDepartInfo().setPoliceSize(polices.stream().filter(item -> PersonTypeEnum.police.getValue().equals(item.getPersonType())).count());
// 协警辅警数量
profileDepart.getDepartInfo().setAuxSize(polices.stream().filter(item -> PersonTypeEnum.aux.getValue().equals(item.getPersonStatus()) || PersonTypeEnum.xj.getValue().equals(item.getPersonStatus())).count());
profileDepart.getDepartInfo().setAuxSize(polices.stream().filter(item -> PersonTypeEnum.aux.getValue().equals(item.getPersonType()) || PersonTypeEnum.xj.getValue().equals(item.getPersonType())).count());
List<Negative> list = negativeService.list(new LambdaQueryWrapper<Negative>().eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())));
profileDepart.getNegativeInfo().setSize(list.size());
@ -109,7 +111,8 @@ public class ProfileDepartController {
profileDepart.setProblemSourcesList(problemSourcesList);
// 业务类型占比
Map<String, List<Negative>> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode));
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(BusinessTypeEnum.get(key).getLabel(), businessTypeGroup.get(key).size())).toList();
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key),
businessTypeGroup.get(key).size())).toList();
profileDepart.setBusinessTypeList(businessTypeList);
// 个人问题排名
List<BarItem> policeBarList = profileDepartMapper.selectPoliceTop10(departId, beginTime, endTime);

19
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java

@ -13,13 +13,15 @@ import com.biutag.supervision.pojo.domain.ProfileDepart;
import com.biutag.supervision.pojo.domain.ProfilePolice;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.BusinessDepart;
import com.biutag.supervision.pojo.entity.BusinessPolice;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.model.PoliceNegativeModel;
import com.biutag.supervision.pojo.param.DepartPoliceQueryParam;
import com.biutag.supervision.service.*;
import com.biutag.supervision.service.BusinessPoliceService;
import com.biutag.supervision.service.NegativeBlameService;
import com.biutag.supervision.service.NegativeService;
import com.biutag.supervision.service.SupPoliceService;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
@ -77,7 +79,8 @@ public class ProfilePoliceController {
int jcjBusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_110.getValue())
.eq(BusinessPolice::getPoliceIdCode, idCode))
.eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo())
.eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName()))
.stream().mapToInt(BusinessPolice::getNumber).sum();
Set<String> negativeIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>().eq(NegativeBlame::getBlameIdCode, idCode)).stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet());
@ -89,7 +92,8 @@ public class ProfilePoliceController {
int zfbaBusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.ZFBA.getValue())
.eq(BusinessPolice::getPoliceIdCode, idCode))
.eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo())
.eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName()))
.stream().mapToInt(BusinessPolice::getNumber).sum();
int zfbaSize = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
@ -100,16 +104,17 @@ public class ProfilePoliceController {
List<Negative> list = negativeIds.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue())
.in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())));
// 问题来源占比
Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), problemSourcesGroup.get(key).size())).toList();
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key),
problemSourcesGroup.get(key).size())).toList();
profilePolice.setProblemSourcesList(problemSourcesList);
// 业务类型占比
Map<String, List<Negative>> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode));
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(BusinessTypeEnum.get(key).getLabel(), businessTypeGroup.get(key).size())).toList();
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key)
, businessTypeGroup.get(key).size())).toList();
profilePolice.setBusinessTypeList(businessTypeList);
// 风险问题构成 雷达图
List<BarItem> problemTypeBarList = profilePoliceMapper.selectProblemType(idCode, beginTime, endTime);

13
src/main/java/com/biutag/supervision/job/DepartJob.java

@ -0,0 +1,13 @@
package com.biutag.supervision.job;
import org.springframework.stereotype.Component;
/**
* @author wxc
* @date 2024/11/4
*/
@Component
public class DepartJob {
}

2
src/main/resources/mapper/ProfilePoliceMapper.xml

@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
sup_police p
LEFT JOIN sup_depart d ON p.org_id = d.id
LEFT JOIN sup_depart d1 ON d.pid = d1.id and d1.level = 2
LEFT JOIN sup_depart d1 ON d.pid = d1.id and d1.level >= 2
LEFT JOIN negative_blame nb ON p.id_code = nb.blameIdCode
LEFT JOIN negative n ON nb.negativeId = n.id
AND n.checkStatus IN ( '1', '2' )

Loading…
Cancel
Save