|
|
|
@ -50,6 +50,7 @@ public class ProfileDepartController { |
|
|
|
private final NegativeScoreService negativeScoreService; |
|
|
|
private final NegativeScoreService negativeScoreService; |
|
|
|
|
|
|
|
|
|
|
|
private final NegativeScoreDepartService negativeScoreDepartService; |
|
|
|
private final NegativeScoreDepartService negativeScoreDepartService; |
|
|
|
|
|
|
|
private final NegativeProblemRelationService negativeProblemRelationService; |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping |
|
|
|
@GetMapping |
|
|
|
public Result<Page<DepartNegativeModel>> list(DepartNegativeQueryParam param) { |
|
|
|
public Result<Page<DepartNegativeModel>> list(DepartNegativeQueryParam param) { |
|
|
|
@ -87,9 +88,12 @@ public class ProfileDepartController { |
|
|
|
.between(NegativeScoreDepart::getDiscoveryTime, beginTime, endTime)); |
|
|
|
.between(NegativeScoreDepart::getDiscoveryTime, beginTime, endTime)); |
|
|
|
|
|
|
|
|
|
|
|
List<String> negativeIds = list.stream().map(NegativeScoreDepart::getNegativeId).toList(); |
|
|
|
List<String> negativeIds = list.stream().map(NegativeScoreDepart::getNegativeId).toList(); |
|
|
|
int negativePoliceSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.police.getValue())); |
|
|
|
if (negativeIds.isEmpty()) { |
|
|
|
|
|
|
|
return Result.success(profileDepart); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int negativePoliceSize = profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.police.getValue())); |
|
|
|
profileDepart.getDepartInfo().setNegativePoliceSize(negativePoliceSize); |
|
|
|
profileDepart.getDepartInfo().setNegativePoliceSize(negativePoliceSize); |
|
|
|
int negativeAuxSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.aux.getValue(), PersonTypeEnum.xj.getValue())); |
|
|
|
int negativeAuxSize = profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.aux.getValue(), PersonTypeEnum.xj.getValue())); |
|
|
|
profileDepart.getDepartInfo().setNegativeAuxSize(negativeAuxSize); |
|
|
|
profileDepart.getDepartInfo().setNegativeAuxSize(negativeAuxSize); |
|
|
|
|
|
|
|
|
|
|
|
profileDepart.getNegativeInfo().setSize(list.size()); |
|
|
|
profileDepart.getNegativeInfo().setSize(list.size()); |
|
|
|
@ -132,18 +136,24 @@ public class ProfileDepartController { |
|
|
|
List<BarItem> policeBarList = profileDepartMapper.selectPoliceNegativeCount(departId, beginTime, endTime); |
|
|
|
List<BarItem> policeBarList = profileDepartMapper.selectPoliceNegativeCount(departId, beginTime, endTime); |
|
|
|
profileDepart.setPoliceBarList(policeBarList); |
|
|
|
profileDepart.setPoliceBarList(policeBarList); |
|
|
|
|
|
|
|
|
|
|
|
// 风险问题构成 雷达图
|
|
|
|
List<BarItem> problemTypeList = profileDepartMapper.selectProblemType(departId, beginTime, endTime); |
|
|
|
List<BarItem> problemTypeBarList = profileDepartMapper.selectProblemType(departId, beginTime, endTime); |
|
|
|
int max = problemTypeList.stream().mapToInt(BarItem::getValue).max().getAsInt(); |
|
|
|
int max = problemTypeBarList.stream().mapToInt(BarItem::getValue).max().getAsInt(); |
|
|
|
List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = problemTypeList.stream().map(item -> { |
|
|
|
List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = problemTypeBarList.stream().map(item -> { |
|
|
|
|
|
|
|
ProfileDepart.RadarIndicatorItem radarIndicatorItem = new ProfileDepart.RadarIndicatorItem(); |
|
|
|
ProfileDepart.RadarIndicatorItem radarIndicatorItem = new ProfileDepart.RadarIndicatorItem(); |
|
|
|
radarIndicatorItem.setMax(max); |
|
|
|
radarIndicatorItem.setMax(max); |
|
|
|
radarIndicatorItem.setName(item.getLabel()); |
|
|
|
radarIndicatorItem.setName(item.getLabel()); |
|
|
|
return radarIndicatorItem; |
|
|
|
return radarIndicatorItem; |
|
|
|
}).toList(); |
|
|
|
}).toList(); |
|
|
|
|
|
|
|
|
|
|
|
profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator); |
|
|
|
profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 突出问题排名
|
|
|
|
|
|
|
|
List<NegativeProblemRelation> negativeProblemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper<NegativeProblemRelation>().in(NegativeProblemRelation::getNegativeId, negativeIds)); |
|
|
|
|
|
|
|
Map<String, List<NegativeProblemRelation>> collect = negativeProblemRelations.stream().collect(Collectors.groupingBy(item -> item.getOneLevelContent() + " / " + item.getTwoLevelContent() + " / " + item.getThreeLevelContent())); |
|
|
|
|
|
|
|
List<BarItem> problemTypeBarList = collect.keySet().stream().map(key -> { |
|
|
|
|
|
|
|
return new BarItem(key, collect.get(key).size()); |
|
|
|
|
|
|
|
}).toList(); |
|
|
|
|
|
|
|
profileDepart.setProblemTypeBarList(problemTypeBarList); |
|
|
|
|
|
|
|
|
|
|
|
List<Object> result = negativeScoreService.calculateDepartScore(beginTime, endTime, departId); |
|
|
|
List<Object> result = negativeScoreService.calculateDepartScore(beginTime, endTime, departId); |
|
|
|
profileDepart.setScore((BigDecimal) result.get(0)); |
|
|
|
profileDepart.setScore((BigDecimal) result.get(0)); |
|
|
|
profileDepart.setExpression(result.get(1).toString()); |
|
|
|
profileDepart.setExpression(result.get(1).toString()); |
|
|
|
|