Browse Source

fix: 完善问题赋分

main
wxc 1 year ago
parent
commit
a71a20ce41
  1. 7
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java
  2. 2
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java
  3. 7
      src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java
  4. 2
      src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java
  5. 29
      src/main/java/com/biutag/supervision/service/NegativeScoreService.java

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

@ -154,14 +154,13 @@ public class ProfileDepartController {
radarIndicatorItem.setName(item.getLabel()); radarIndicatorItem.setName(item.getLabel());
return radarIndicatorItem; return radarIndicatorItem;
}).toList(); }).toList();
List<Integer> problemTypeRadarData = problemTypeBarList.stream().map(BarItem::getValue).toList();
profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator); profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator);
profileDepart.setProblemTypeRadarData(problemTypeRadarData);
// 突出问题排名
profileDepart.setProblemTypeBarList(profileDepartMapper.selectThirdProblemType(departId, beginTime, endTime));
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());
profileDepart.setRemarks(result.get(2).toString());
return Result.success(profileDepart); return Result.success(profileDepart);
} }

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

@ -154,6 +154,8 @@ public class ProfilePoliceController {
List<Object> result = negativeScoreService.calculatePoliceScore(beginTime, endTime, idCode); List<Object> result = negativeScoreService.calculatePoliceScore(beginTime, endTime, idCode);
profilePolice.setScore((BigDecimal) result.get(0)); profilePolice.setScore((BigDecimal) result.get(0));
profilePolice.setExpression(result.get(1).toString()); profilePolice.setExpression(result.get(1).toString());
return Result.success(profilePolice); return Result.success(profilePolice);
} }

7
src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java

@ -22,6 +22,8 @@ public class ProfileDepart {
private String expression; private String expression;
private String remarks;
private DepartInfo departInfo = new DepartInfo(); private DepartInfo departInfo = new DepartInfo();
private NegativeInfo negativeInfo = new NegativeInfo(); private NegativeInfo negativeInfo = new NegativeInfo();
private List<PieItem> problemSourcesList = new ArrayList<>(); private List<PieItem> problemSourcesList = new ArrayList<>();
@ -29,8 +31,9 @@ public class ProfileDepart {
private List<BarItem> policeBarList = new ArrayList<>(); private List<BarItem> policeBarList = new ArrayList<>();
// 雷达图 // 雷达图
private List<RadarIndicatorItem> problemTypeRadarIndicator = new ArrayList<>(); private List<RadarIndicatorItem> problemTypeRadarIndicator = new ArrayList<>();
private List<Integer> problemTypeRadarData = new ArrayList<>(); private List<Integer> scoreRadarData = new ArrayList<>();
private List<BarItem> problemTypeBarList = new ArrayList<>(); private List<BarItem> scoreTypeBarList = new ArrayList<>();
private List<BarItem> weightTypeBarList = new ArrayList<>();
@Setter @Setter
@Getter @Getter

2
src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java

@ -21,6 +21,8 @@ public class ProfilePolice {
private String expression; private String expression;
private String remarks;
private SupPolice policeInfo = new SupPolice(); private SupPolice policeInfo = new SupPolice();
private NegativeInfo negativeInfo = new NegativeInfo(); private NegativeInfo negativeInfo = new NegativeInfo();
private List<PieItem> problemSourcesList = new ArrayList<>(); private List<PieItem> problemSourcesList = new ArrayList<>();

29
src/main/java/com/biutag/supervision/service/NegativeScoreService.java

@ -155,17 +155,17 @@ public class NegativeScoreService {
if (sd == 0) { if (sd == 0) {
return 0; return 0;
} }
List<BusinessPolice> businessPolices = businessPoliceService.list(beginTime, endTime, businessTypeCode); List<BusinessDepart> businessDeparts = businessDepartService.list(beginTime, endTime, businessTypeCode);
// 总业务量 // 总业务量
int totalBusinessSize = businessPolices.stream().mapToInt(BusinessPolice::getNumber).sum(); int totalBusinessSize = businessDeparts.stream().mapToInt(BusinessDepart::getNumber).sum();
// 平均问题发生率 // 平均问题发生率
double avgRate = totalBusinessSize == 0? 0: NumberUtil.div(businessScorePolice.size(), totalBusinessSize); double avgRate = totalBusinessSize == 0? 0: NumberUtil.div(businessScorePolice.size(), totalBusinessSize);
// 个人问题数 // 个人问题数
long personSize = businessScorePolice.stream().filter(item -> police.getIdCode().equals(item.getIdCode())).count(); long personSize = businessScorePolice.stream().filter(item -> police.getOrgId().equals(item.getIdCode())).count();
// 个人业务量 // 单位业务量
long personBusinessSize = businessPolices.stream().filter(item -> police.getName().equals(item.getPoliceName()) && police.getEmpNo().equals(item.getEmpNo())).count(); long departBusinessSize = businessDeparts.stream().filter(item -> police.getOrgId().equals(item.getDepartId())).count();
// 个人问题发生率 // 个人问题发生率
double personRate = personBusinessSize == 0? 0: NumberUtil.div(personSize, personBusinessSize); double personRate = departBusinessSize == 0? 0: NumberUtil.div(personSize, departBusinessSize);
return NumberUtil.div(personRate - avgRate, sd); return NumberUtil.div(personRate - avgRate, sd);
} }
@ -226,10 +226,12 @@ public class NegativeScoreService {
List<NegativeScorePolice> scorePolices = negativeScorePoliceService.list(beginTime, endTime, depart.getStatisticsGroupId()); List<NegativeScorePolice> scorePolices = negativeScorePoliceService.list(beginTime, endTime, depart.getStatisticsGroupId());
Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum(); Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum();
List<String> expressionArr = new ArrayList<>(); List<String> expressionArr = new ArrayList<>();
StringBuilder remarks = new StringBuilder();
double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> {
List<NegativeScorePolice> businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); List<NegativeScorePolice> businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList();
// 业务涉及人数 // 业务涉及人数
int policeSize = businessScorePolice.stream().map(NegativeScorePolice::getIdCode).collect(Collectors.toSet()).size(); int policeSize = businessScorePolice.stream().map(NegativeScorePolice::getIdCode).collect(Collectors.toSet()).size();
remarks.append(String.format("业务设计人数 %s", policeSize));
// 业务问题数 // 业务问题数
int businessSize = businessScorePolice.size(); int businessSize = businessScorePolice.size();
//--------------------------------------------------------- //---------------------------------------------------------
@ -257,11 +259,17 @@ public class NegativeScoreService {
Double score = businessScorePolice.stream().mapToDouble(NegativeScorePolice::getScore).sum(); Double score = businessScorePolice.stream().mapToDouble(NegativeScorePolice::getScore).sum();
double businessWeight = calculateBusinessWeight(totalScore, score); double businessWeight = calculateBusinessWeight(totalScore, score);
expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight)); expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight));
remarks.append(String.format("%s:", businessTypeEnum.getLabel())).append("\n");
remarks.append(String.format("业务涉及人数 %s", policeSize)).append("\n");
remarks.append(String.format("业务问题数 %s", businessSize)).append("\n");
remarks.append(String.format("平均问题数 %s", avgNumber)).append("\n");
remarks.append(String.format("业务标准差 %s", sd)).append("\n");
remarks.append(String.format("业务差异值 %s", diff)).append("\n");
return NumberUtil.mul(businessScore, businessWeight); return NumberUtil.mul(businessScore, businessWeight);
}).sum(); }).sum();
BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2);
String expression = String.join(" + ", expressionArr); String expression = String.join(" + ", expressionArr);
return List.of(score, expression); return List.of(score, expression, remarks);
} }
/** /**
@ -277,6 +285,7 @@ public class NegativeScoreService {
List<NegativeScoreDepart> scoreDeparts = negativeScoreDepartService.list(beginTime, endTime, depart.getStatisticsGroupId()); List<NegativeScoreDepart> scoreDeparts = negativeScoreDepartService.list(beginTime, endTime, depart.getStatisticsGroupId());
Double totalScore = scoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum(); Double totalScore = scoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum();
List<String> expressionArr = new ArrayList<>(); List<String> expressionArr = new ArrayList<>();
StringBuilder remarks = new StringBuilder();
double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> {
List<NegativeScoreDepart> businessScoreDeparts = scoreDeparts.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); List<NegativeScoreDepart> businessScoreDeparts = scoreDeparts.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList();
// 业务涉及人数 // 业务涉及人数
@ -303,6 +312,12 @@ public class NegativeScoreService {
Double score = businessScoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum(); Double score = businessScoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum();
double businessWeight = calculateBusinessWeight(totalScore, score); double businessWeight = calculateBusinessWeight(totalScore, score);
expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight)); expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight));
remarks.append(String.format("%s:", businessTypeEnum.getLabel())).append("\n");
remarks.append(String.format("业务涉及人数 %s", departSize)).append("\n");
remarks.append(String.format("当前部门问题数 %s", personalSize)).append("\n");
remarks.append(String.format("平均问题数 %s", avgNumber)).append("\n");
remarks.append(String.format("业务标准差 %s", sd)).append("\n");
remarks.append(String.format("业务差异值 %s", diff)).append("\n");
return NumberUtil.mul(businessScore, businessWeight); return NumberUtil.mul(businessScore, businessWeight);
}).sum(); }).sum();
BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2);

Loading…
Cancel
Save