|
|
|
|
@ -50,30 +50,35 @@ public class ConfirmationCompletionAction implements Action {
|
|
|
|
|
doneWork(actionDto.getWorkId(), actionDto.getNegativeId()); |
|
|
|
|
// 最后更新状态
|
|
|
|
|
updateNegative(negativeId, completionData); |
|
|
|
|
|
|
|
|
|
addNegativeScorePolice(negativeId, completionData); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addNegativeScorePolice(String negativeId, ConfirmationCompletionData completionData) { |
|
|
|
|
String formula = "%s + (1 * %s) + (1 * %s)"; |
|
|
|
|
Negative negative = negativeService.getById(negativeId); |
|
|
|
|
List<NegativeScorePolice> scorePolices = completionData.getBlames().stream().map(blame -> { |
|
|
|
|
NegativeScorePolice negativeScorePolice = new NegativeScorePolice() |
|
|
|
|
.setNegativeId(negativeId) |
|
|
|
|
.setIdCode(blame.getBlameIdCode()) |
|
|
|
|
.setDiscoveryTime(negative.getDiscoveryTime()) |
|
|
|
|
.setIdCode(blame.getBlameIdCode()); |
|
|
|
|
String expression = String.format(formula, |
|
|
|
|
blame.getBaseScore(), |
|
|
|
|
NegativeLevelEnum.getScore(blame.getNegativeLevel()), |
|
|
|
|
blame.getFrequencyScore()); |
|
|
|
|
negativeScorePolice.setExpression(expression); |
|
|
|
|
double calculate = NumberUtil.calculate(expression); |
|
|
|
|
double score = NumberUtil.roundHalfEven(calculate, 2).doubleValue(); |
|
|
|
|
negativeScorePolice.setScore(score); |
|
|
|
|
negativeScorePolice.setCreateTime(LocalDateTime.now()); |
|
|
|
|
return negativeScorePolice; |
|
|
|
|
}).toList(); |
|
|
|
|
negativeScorePoliceService.saveBatch(scorePolices); |
|
|
|
|
// 属实
|
|
|
|
|
if (InspectCaseEnum.isItTure(negative.getCheckStatus())) { |
|
|
|
|
String formula = "%s + (1 * %s) + (1 * %s)"; |
|
|
|
|
List<NegativeScorePolice> scorePolices = completionData.getBlames().stream().map(blame -> { |
|
|
|
|
NegativeScorePolice negativeScorePolice = new NegativeScorePolice() |
|
|
|
|
.setNegativeId(negativeId) |
|
|
|
|
.setIdCode(blame.getBlameIdCode()) |
|
|
|
|
.setDiscoveryTime(negative.getDiscoveryTime()) |
|
|
|
|
.setIdCode(blame.getBlameIdCode()); |
|
|
|
|
String expression = String.format(formula, |
|
|
|
|
blame.getBaseScore(), |
|
|
|
|
NegativeLevelEnum.getScore(blame.getNegativeLevel()), |
|
|
|
|
blame.getFrequencyScore()); |
|
|
|
|
negativeScorePolice.setExpression(expression); |
|
|
|
|
double calculate = NumberUtil.calculate(expression); |
|
|
|
|
double score = NumberUtil.roundHalfEven(calculate, 2).doubleValue(); |
|
|
|
|
negativeScorePolice.setScore(score); |
|
|
|
|
negativeScorePolice.setCreateTime(LocalDateTime.now()); |
|
|
|
|
return negativeScorePolice; |
|
|
|
|
}).toList(); |
|
|
|
|
negativeScorePoliceService.saveBatch(scorePolices); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updateApprove(String negativeId, String comments, Integer workId) { |
|
|
|
|
|