|
|
|
|
@ -155,17 +155,17 @@ public class NegativeScoreService {
|
|
|
|
|
if (sd == 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); |
|
|
|
|
// 个人问题数
|
|
|
|
|
long personSize = businessScorePolice.stream().filter(item -> police.getIdCode().equals(item.getIdCode())).count(); |
|
|
|
|
// 个人业务量
|
|
|
|
|
long personBusinessSize = businessPolices.stream().filter(item -> police.getName().equals(item.getPoliceName()) && police.getEmpNo().equals(item.getEmpNo())).count(); |
|
|
|
|
long personSize = businessScorePolice.stream().filter(item -> police.getOrgId().equals(item.getIdCode())).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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -226,10 +226,12 @@ public class NegativeScoreService {
|
|
|
|
|
List<NegativeScorePolice> scorePolices = negativeScorePoliceService.list(beginTime, endTime, depart.getStatisticsGroupId()); |
|
|
|
|
Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum(); |
|
|
|
|
List<String> expressionArr = new ArrayList<>(); |
|
|
|
|
StringBuilder remarks = new StringBuilder(); |
|
|
|
|
double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { |
|
|
|
|
List<NegativeScorePolice> businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); |
|
|
|
|
// 业务涉及人数
|
|
|
|
|
int policeSize = businessScorePolice.stream().map(NegativeScorePolice::getIdCode).collect(Collectors.toSet()).size(); |
|
|
|
|
remarks.append(String.format("业务设计人数 %s", policeSize)); |
|
|
|
|
// 业务问题数
|
|
|
|
|
int businessSize = businessScorePolice.size(); |
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
@ -257,11 +259,17 @@ public class NegativeScoreService {
|
|
|
|
|
Double score = businessScorePolice.stream().mapToDouble(NegativeScorePolice::getScore).sum(); |
|
|
|
|
double businessWeight = calculateBusinessWeight(totalScore, score); |
|
|
|
|
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); |
|
|
|
|
}).sum(); |
|
|
|
|
BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); |
|
|
|
|
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()); |
|
|
|
|
Double totalScore = scoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum(); |
|
|
|
|
List<String> expressionArr = new ArrayList<>(); |
|
|
|
|
StringBuilder remarks = new StringBuilder(); |
|
|
|
|
double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { |
|
|
|
|
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 businessWeight = calculateBusinessWeight(totalScore, score); |
|
|
|
|
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); |
|
|
|
|
}).sum(); |
|
|
|
|
BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); |
|
|
|
|
|