|
|
|
|
@ -61,6 +61,8 @@ public class NegativeScoreService {
|
|
|
|
|
try { |
|
|
|
|
String formula = "%s + (%s * %s) + (%s * %s)"; |
|
|
|
|
List<NegativeScoreDepart> scoreDeparts = new ArrayList<>(); |
|
|
|
|
record PoliceScoreKey(String negativeId, String idCode) {} |
|
|
|
|
Map<PoliceScoreKey, NegativeScorePolice> scorePolices = new LinkedHashMap<>(); |
|
|
|
|
negativeScorePoliceService.remove(new LambdaQueryWrapper<NegativeScorePolice>().isNotNull(NegativeScorePolice::getNegativeId)); |
|
|
|
|
negativeScoreDepartService.remove(new LambdaQueryWrapper<NegativeScoreDepart>().isNotNull(NegativeScoreDepart::getNegativeId)); |
|
|
|
|
Set<String> negativeIds = negativeBlames.stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet()); |
|
|
|
|
@ -103,7 +105,11 @@ public class NegativeScoreService {
|
|
|
|
|
negativeScorePolice.setScore(score) |
|
|
|
|
.setExpression(expression); |
|
|
|
|
|
|
|
|
|
negativeScorePoliceService.save(negativeScorePolice); |
|
|
|
|
PoliceScoreKey scoreKey = new PoliceScoreKey(blame.getNegativeId(), blame.getBlameIdCode()); |
|
|
|
|
NegativeScorePolice existingScore = scorePolices.get(scoreKey); |
|
|
|
|
if (Objects.isNull(existingScore) || existingScore.getScore() < score) { |
|
|
|
|
scorePolices.put(scoreKey, negativeScorePolice); |
|
|
|
|
} |
|
|
|
|
NegativeScoreDepart scoreDepart = scoreDeparts.stream().filter(item -> item.getNegativeId().equals(negative.getId())).findFirst().orElse(null); |
|
|
|
|
if (Objects.isNull(scoreDepart)) { |
|
|
|
|
scoreDepart = new NegativeScoreDepart(); |
|
|
|
|
@ -112,8 +118,12 @@ public class NegativeScoreService {
|
|
|
|
|
scoreDeparts.add(scoreDepart); |
|
|
|
|
} else if (scoreDepart.getScore() < score) { |
|
|
|
|
scoreDepart.setScore(score); |
|
|
|
|
scoreDepart.setExpression(expression); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if (!scorePolices.isEmpty()) { |
|
|
|
|
negativeScorePoliceService.saveBatch(scorePolices.values()); |
|
|
|
|
} |
|
|
|
|
if (!scoreDeparts.isEmpty()) { |
|
|
|
|
negativeScoreDepartService.saveBatch(scoreDeparts); |
|
|
|
|
} |
|
|
|
|
@ -125,6 +135,7 @@ public class NegativeScoreService {
|
|
|
|
|
System.out.println("calculateScore-------------------------------------------------End"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final BusinessDepartService businessDepartService; |
|
|
|
|
|
|
|
|
|
private final SupPoliceService policeService; |
|
|
|
|
|