|
|
|
|
@ -19,6 +19,7 @@ import com.biutag.supervision.pojo.model.DepartNegativeModel;
|
|
|
|
|
import com.biutag.supervision.pojo.param.DepartNegativeQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.vo.NegativeProfile; |
|
|
|
|
import com.biutag.supervision.service.*; |
|
|
|
|
import dm.jdbc.util.StringUtil; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springframework.format.annotation.DateTimeFormat; |
|
|
|
|
@ -151,41 +152,60 @@ public class ProfileDepartController {
|
|
|
|
|
profileDepart.setProblemTypeList(problemTypeList); |
|
|
|
|
// 个人问题排名
|
|
|
|
|
List<NegativeBlame> blames = blameService.list(new LambdaQueryWrapper<NegativeBlame>().in(NegativeBlame::getNegativeId, negativeIds).eq(NegativeBlame::getType, BlameType.personal.name())); |
|
|
|
|
Map<String, List<NegativeBlame>> policeGroup = blames.stream().collect(Collectors.groupingBy(NegativeBlame::getBlameEmpNo)); |
|
|
|
|
List<BarItem> policeBarList = policeGroup.keySet().stream().map(key -> { |
|
|
|
|
List<NegativeBlame> list1 = policeGroup.get(key); |
|
|
|
|
String blameName = list1.get(0).getBlameName(); |
|
|
|
|
return new BarItem(blameName, BigDecimal.valueOf(list1.size())); |
|
|
|
|
}).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList(); |
|
|
|
|
profileDepart.setPoliceBarList(policeBarList); |
|
|
|
|
// 问题涉及领导
|
|
|
|
|
Map<String, List<NegativeBlame>> policeLeadGroup = blames.stream().collect(Collectors.groupingBy(NegativeBlame::getLeadEmpNo)); |
|
|
|
|
List<BarItem> policeLeadBarList = policeLeadGroup.keySet().stream().map(key -> { |
|
|
|
|
List<NegativeBlame> list1 = policeLeadGroup.get(key); |
|
|
|
|
String name = list1.get(0).getLeadName(); |
|
|
|
|
return new BarItem(name, BigDecimal.valueOf(list1.size())); |
|
|
|
|
}).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList(); |
|
|
|
|
profileDepart.setPoliceLeadBarList(policeLeadBarList); |
|
|
|
|
|
|
|
|
|
// 突出问题排名
|
|
|
|
|
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 -> new BarItem(key, new BigDecimal(collect.get(key).size()))).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList(); |
|
|
|
|
profileDepart.setProblemTypeBarList(problemTypeBarList); |
|
|
|
|
blames= blames.stream().filter(s-> StringUtil.isNotEmpty(s.getBlameEmpNo())).toList(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(blames)){ |
|
|
|
|
Map<String, List<NegativeBlame>> policeGroup = blames.stream().collect(Collectors.groupingBy(NegativeBlame::getBlameEmpNo)); |
|
|
|
|
List<BarItem> policeBarList = policeGroup.keySet().stream().map(key -> { |
|
|
|
|
List<NegativeBlame> list1 = policeGroup.get(key); |
|
|
|
|
String blameName = list1.get(0).getBlameName(); |
|
|
|
|
return new BarItem(blameName, BigDecimal.valueOf(list1.size())); |
|
|
|
|
}).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList(); |
|
|
|
|
profileDepart.setPoliceBarList(policeBarList); |
|
|
|
|
// 问题涉及领导
|
|
|
|
|
Map<String, List<NegativeBlame>> policeLeadGroup = blames.stream().collect(Collectors.groupingBy(NegativeBlame::getLeadEmpNo)); |
|
|
|
|
List<BarItem> policeLeadBarList = policeLeadGroup.keySet().stream().map(key -> { |
|
|
|
|
List<NegativeBlame> list1 = policeLeadGroup.get(key); |
|
|
|
|
String name = list1.get(0).getLeadName(); |
|
|
|
|
return new BarItem(name, BigDecimal.valueOf(list1.size())); |
|
|
|
|
}).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList(); |
|
|
|
|
profileDepart.setPoliceLeadBarList(policeLeadBarList); |
|
|
|
|
}else{ |
|
|
|
|
profileDepart.setPoliceBarList(new ArrayList<>()); |
|
|
|
|
profileDepart.setPoliceLeadBarList(new ArrayList<>()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(negativeProblemRelations)){ |
|
|
|
|
// 突出问题排名
|
|
|
|
|
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 -> new BarItem(key, new BigDecimal(collect.get(key).size()))).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList(); |
|
|
|
|
profileDepart.setProblemTypeBarList(problemTypeBarList); |
|
|
|
|
}else{ |
|
|
|
|
profileDepart.setProblemTypeBarList(new ArrayList<>()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//List<Object> result = negativeScoreService.calculateDepartScore(beginTime, endTime, departId);
|
|
|
|
|
if(CollectionUtil.isNotEmpty(list)){ |
|
|
|
|
profileDepart.setScore(BigDecimal.valueOf(list.stream().mapToDouble(NegativeScoreDepart::getScore).sum())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
profileDepart.setScore(BigDecimal.valueOf(list.stream().mapToDouble(NegativeScoreDepart::getScore).sum())); |
|
|
|
|
// profileDepart.setExpression(result.get(1).toString());
|
|
|
|
|
// profileDepart.setRemarks(result.get(2).toString());
|
|
|
|
|
List<NegativeProfile> negativeProfiles = negatives.stream().map(item -> { |
|
|
|
|
NegativeProfile negativeProfile = new NegativeProfile(); |
|
|
|
|
BeanUtil.copyProperties(item, negativeProfile); |
|
|
|
|
String problemType = negativeProblemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(negativeProblemRelationService::getProblemType).orElse(""); |
|
|
|
|
negativeProfile.setProblemType(problemType); |
|
|
|
|
negativeProfile.setScore(list.stream().filter(s -> item.getId().equals(s.getNegativeId())).findFirst().map(NegativeScoreDepart::getScore).orElse(null)); |
|
|
|
|
return negativeProfile; |
|
|
|
|
}).toList(); |
|
|
|
|
profileDepart.setNegatives(negativeProfiles); |
|
|
|
|
if(CollectionUtil.isNotEmpty(negatives)){ |
|
|
|
|
List<NegativeProfile> negativeProfiles = negatives.stream().map(item -> { |
|
|
|
|
NegativeProfile negativeProfile = new NegativeProfile(); |
|
|
|
|
BeanUtil.copyProperties(item, negativeProfile); |
|
|
|
|
String problemType = negativeProblemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(negativeProblemRelationService::getProblemType).orElse(""); |
|
|
|
|
negativeProfile.setProblemType(problemType); |
|
|
|
|
negativeProfile.setScore(list.stream().filter(s -> item.getId().equals(s.getNegativeId())).findFirst().map(NegativeScoreDepart::getScore).orElse(null)); |
|
|
|
|
return negativeProfile; |
|
|
|
|
}).toList(); |
|
|
|
|
profileDepart.setNegatives(negativeProfiles); |
|
|
|
|
}else{ |
|
|
|
|
profileDepart.setNegatives(new ArrayList<>()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Result.success(profileDepart); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|