yxk-20260728
改善提案 改善效果得分拆分为安全、质量、效率、成本四个,权重平均分
This commit is contained in:
+11
-2
@@ -20,8 +20,17 @@ public class ImprovementDeptScoreBpmDTO {
|
|||||||
@Schema(description = "当前流程任务ID")
|
@Schema(description = "当前流程任务ID")
|
||||||
private String taskId;
|
private String taskId;
|
||||||
|
|
||||||
@Schema(description = "改善效果得分,0-100")
|
@Schema(description = "安全得分,0-100")
|
||||||
private BigDecimal effectScore;
|
private BigDecimal safetyScore;
|
||||||
|
|
||||||
|
@Schema(description = "质量得分,0-100")
|
||||||
|
private BigDecimal qualityScore;
|
||||||
|
|
||||||
|
@Schema(description = "效率得分,0-100")
|
||||||
|
private BigDecimal efficiencyScore;
|
||||||
|
|
||||||
|
@Schema(description = "成本得分,0-100")
|
||||||
|
private BigDecimal costScore;
|
||||||
|
|
||||||
@Schema(description = "可推广度得分,0-100")
|
@Schema(description = "可推广度得分,0-100")
|
||||||
private BigDecimal promotionScore;
|
private BigDecimal promotionScore;
|
||||||
|
|||||||
+16
@@ -50,6 +50,22 @@ public class ImprovementDeptScore implements Serializable {
|
|||||||
@Excel(name = "评分状态:pending/completed", width = 15)
|
@Excel(name = "评分状态:pending/completed", width = 15)
|
||||||
@Schema(description = "评分状态:pending/completed")
|
@Schema(description = "评分状态:pending/completed")
|
||||||
private String scoreStatus;
|
private String scoreStatus;
|
||||||
|
/**安全得分*/
|
||||||
|
@Excel(name = "安全得分", width = 15)
|
||||||
|
@Schema(description = "安全得分")
|
||||||
|
private java.math.BigDecimal safetyScore;
|
||||||
|
/**质量得分*/
|
||||||
|
@Excel(name = "质量得分", width = 15)
|
||||||
|
@Schema(description = "质量得分")
|
||||||
|
private java.math.BigDecimal qualityScore;
|
||||||
|
/**效率得分*/
|
||||||
|
@Excel(name = "效率得分", width = 15)
|
||||||
|
@Schema(description = "效率得分")
|
||||||
|
private java.math.BigDecimal efficiencyScore;
|
||||||
|
/**成本得分*/
|
||||||
|
@Excel(name = "成本得分", width = 15)
|
||||||
|
@Schema(description = "成本得分")
|
||||||
|
private java.math.BigDecimal costScore;
|
||||||
/**改善效果得分*/
|
/**改善效果得分*/
|
||||||
@Excel(name = "改善效果得分", width = 15)
|
@Excel(name = "改善效果得分", width = 15)
|
||||||
@Schema(description = "改善效果得分")
|
@Schema(description = "改善效果得分")
|
||||||
|
|||||||
+35
-10
@@ -231,14 +231,16 @@ public class ImprovementProposalServiceImpl extends ServiceImpl<ImprovementPropo
|
|||||||
throw new IllegalStateException("评分已锁定,请重新提交流程办理");
|
throw new IllegalStateException("评分已锁定,请重新提交流程办理");
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal totalScore = calculateTotalScore(scoreAction);
|
// 改善效果由四个子项在服务端计算,避免前端篡改汇总得分或加权总分。
|
||||||
|
BigDecimal effectScore = calculateEffectScore(scoreAction);
|
||||||
|
BigDecimal totalScore = calculateTotalScore(scoreAction, effectScore);
|
||||||
if (existingScore == null) {
|
if (existingScore == null) {
|
||||||
ImprovementDeptScore newScore = new ImprovementDeptScore();
|
ImprovementDeptScore newScore = new ImprovementDeptScore();
|
||||||
newScore.setMainId(lockedProposal.getId());
|
newScore.setMainId(lockedProposal.getId());
|
||||||
newScore.setProcessTaskId(scoreAction.getTaskId());
|
newScore.setProcessTaskId(scoreAction.getTaskId());
|
||||||
newScore.setScorerId(loginUser.getId());
|
newScore.setScorerId(loginUser.getId());
|
||||||
newScore.setScorerName(loginUser.getRealname());
|
newScore.setScorerName(loginUser.getRealname());
|
||||||
fillDeptScoreDraft(newScore, scoreAction, totalScore);
|
fillDeptScoreDraft(newScore, scoreAction, effectScore, totalScore);
|
||||||
improvementDeptScoreMapper.insert(newScore);
|
improvementDeptScoreMapper.insert(newScore);
|
||||||
} else {
|
} else {
|
||||||
// 草稿保存只能更新 pending 记录,避免流程已提交后通过接口修改最终评分。
|
// 草稿保存只能更新 pending 记录,避免流程已提交后通过接口修改最终评分。
|
||||||
@@ -246,7 +248,11 @@ public class ImprovementProposalServiceImpl extends ServiceImpl<ImprovementPropo
|
|||||||
.eq(ImprovementDeptScore::getId, existingScore.getId())
|
.eq(ImprovementDeptScore::getId, existingScore.getId())
|
||||||
.eq(ImprovementDeptScore::getScoreStatus, "pending")
|
.eq(ImprovementDeptScore::getScoreStatus, "pending")
|
||||||
.set(ImprovementDeptScore::getProcessTaskId, scoreAction.getTaskId())
|
.set(ImprovementDeptScore::getProcessTaskId, scoreAction.getTaskId())
|
||||||
.set(ImprovementDeptScore::getEffectScore, scoreAction.getEffectScore())
|
.set(ImprovementDeptScore::getSafetyScore, scoreAction.getSafetyScore())
|
||||||
|
.set(ImprovementDeptScore::getQualityScore, scoreAction.getQualityScore())
|
||||||
|
.set(ImprovementDeptScore::getEfficiencyScore, scoreAction.getEfficiencyScore())
|
||||||
|
.set(ImprovementDeptScore::getCostScore, scoreAction.getCostScore())
|
||||||
|
.set(ImprovementDeptScore::getEffectScore, effectScore)
|
||||||
.set(ImprovementDeptScore::getPromotionScore, scoreAction.getPromotionScore())
|
.set(ImprovementDeptScore::getPromotionScore, scoreAction.getPromotionScore())
|
||||||
.set(ImprovementDeptScore::getOriginalityScore, scoreAction.getOriginalityScore())
|
.set(ImprovementDeptScore::getOriginalityScore, scoreAction.getOriginalityScore())
|
||||||
.set(ImprovementDeptScore::getEffortScore, scoreAction.getEffortScore())
|
.set(ImprovementDeptScore::getEffortScore, scoreAction.getEffortScore())
|
||||||
@@ -374,7 +380,10 @@ public class ImprovementProposalServiceImpl extends ServiceImpl<ImprovementPropo
|
|||||||
if (scoreAction == null) {
|
if (scoreAction == null) {
|
||||||
throw new IllegalStateException("评分参数不能为空");
|
throw new IllegalStateException("评分参数不能为空");
|
||||||
}
|
}
|
||||||
validateScoreValue(scoreAction.getEffectScore(), "改善效果");
|
validateScoreValue(scoreAction.getSafetyScore(), "安全");
|
||||||
|
validateScoreValue(scoreAction.getQualityScore(), "质量");
|
||||||
|
validateScoreValue(scoreAction.getEfficiencyScore(), "效率");
|
||||||
|
validateScoreValue(scoreAction.getCostScore(), "成本");
|
||||||
validateScoreValue(scoreAction.getPromotionScore(), "可推广度");
|
validateScoreValue(scoreAction.getPromotionScore(), "可推广度");
|
||||||
validateScoreValue(scoreAction.getOriginalityScore(), "独创性");
|
validateScoreValue(scoreAction.getOriginalityScore(), "独创性");
|
||||||
validateScoreValue(scoreAction.getEffortScore(), "努力度");
|
validateScoreValue(scoreAction.getEffortScore(), "努力度");
|
||||||
@@ -386,16 +395,28 @@ public class ImprovementProposalServiceImpl extends ServiceImpl<ImprovementPropo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal calculateTotalScore(ImprovementDeptScoreBpmDTO scoreAction) {
|
private BigDecimal calculateEffectScore(ImprovementDeptScoreBpmDTO scoreAction) {
|
||||||
return scoreAction.getEffectScore().multiply(new BigDecimal("0.50"))
|
return calculateEffectScore(scoreAction.getSafetyScore(), scoreAction.getQualityScore(), scoreAction.getEfficiencyScore(), scoreAction.getCostScore());
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal calculateEffectScore(BigDecimal safetyScore, BigDecimal qualityScore, BigDecimal efficiencyScore, BigDecimal costScore) {
|
||||||
|
return safetyScore.add(qualityScore).add(efficiencyScore).add(costScore).divide(BigDecimal.valueOf(4), 2, RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal calculateTotalScore(ImprovementDeptScoreBpmDTO scoreAction, BigDecimal effectScore) {
|
||||||
|
return effectScore.multiply(new BigDecimal("0.50"))
|
||||||
.add(scoreAction.getPromotionScore().multiply(new BigDecimal("0.20")))
|
.add(scoreAction.getPromotionScore().multiply(new BigDecimal("0.20")))
|
||||||
.add(scoreAction.getOriginalityScore().multiply(new BigDecimal("0.20")))
|
.add(scoreAction.getOriginalityScore().multiply(new BigDecimal("0.20")))
|
||||||
.add(scoreAction.getEffortScore().multiply(new BigDecimal("0.10")))
|
.add(scoreAction.getEffortScore().multiply(new BigDecimal("0.10")))
|
||||||
.setScale(2, RoundingMode.HALF_UP);
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillDeptScoreDraft(ImprovementDeptScore target, ImprovementDeptScoreBpmDTO source, BigDecimal totalScore) {
|
private void fillDeptScoreDraft(ImprovementDeptScore target, ImprovementDeptScoreBpmDTO source, BigDecimal effectScore, BigDecimal totalScore) {
|
||||||
target.setEffectScore(source.getEffectScore());
|
target.setSafetyScore(source.getSafetyScore());
|
||||||
|
target.setQualityScore(source.getQualityScore());
|
||||||
|
target.setEfficiencyScore(source.getEfficiencyScore());
|
||||||
|
target.setCostScore(source.getCostScore());
|
||||||
|
target.setEffectScore(effectScore);
|
||||||
target.setPromotionScore(source.getPromotionScore());
|
target.setPromotionScore(source.getPromotionScore());
|
||||||
target.setOriginalityScore(source.getOriginalityScore());
|
target.setOriginalityScore(source.getOriginalityScore());
|
||||||
target.setEffortScore(source.getEffortScore());
|
target.setEffortScore(source.getEffortScore());
|
||||||
@@ -406,11 +427,15 @@ public class ImprovementProposalServiceImpl extends ServiceImpl<ImprovementPropo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validateSavedScore(ImprovementDeptScore score) {
|
private void validateSavedScore(ImprovementDeptScore score) {
|
||||||
validateScoreValue(score.getEffectScore(), "改善效果");
|
validateScoreValue(score.getSafetyScore(), "安全");
|
||||||
|
validateScoreValue(score.getQualityScore(), "质量");
|
||||||
|
validateScoreValue(score.getEfficiencyScore(), "效率");
|
||||||
|
validateScoreValue(score.getCostScore(), "成本");
|
||||||
validateScoreValue(score.getPromotionScore(), "可推广度");
|
validateScoreValue(score.getPromotionScore(), "可推广度");
|
||||||
validateScoreValue(score.getOriginalityScore(), "独创性");
|
validateScoreValue(score.getOriginalityScore(), "独创性");
|
||||||
validateScoreValue(score.getEffortScore(), "努力度");
|
validateScoreValue(score.getEffortScore(), "努力度");
|
||||||
if (score.getTotalScore() == null) {
|
BigDecimal calculatedEffectScore = calculateEffectScore(score.getSafetyScore(), score.getQualityScore(), score.getEfficiencyScore(), score.getCostScore());
|
||||||
|
if (score.getEffectScore() == null || score.getEffectScore().compareTo(calculatedEffectScore) != 0 || score.getTotalScore() == null) {
|
||||||
throw new IllegalStateException("请先保存完整个人评分");
|
throw new IllegalStateException("请先保存完整个人评分");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user