Browse Source

fiex:人员抽检修复

master
pengwei 1 month ago
parent
commit
65d016b839
  1. 80
      src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfileDepartController.java

80
src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfileDepartController.java

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

Loading…
Cancel
Save