|
|
|
@ -12,6 +12,7 @@ import com.biutag.supervision.util.ScoreRule; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
@ -44,6 +45,7 @@ public class NegativeScoreService { |
|
|
|
|
|
|
|
|
|
|
|
private AtomicBoolean flag = new AtomicBoolean(false); |
|
|
|
private AtomicBoolean flag = new AtomicBoolean(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateNegativeScore() { |
|
|
|
public void updateNegativeScore() { |
|
|
|
if (flag.get()) { |
|
|
|
if (flag.get()) { |
|
|
|
throw new RuntimeException("风险指数正在计算中"); |
|
|
|
throw new RuntimeException("风险指数正在计算中"); |
|
|
|
@ -59,8 +61,8 @@ public class NegativeScoreService { |
|
|
|
try { |
|
|
|
try { |
|
|
|
String formula = "%s + (%s * %s) + (%s * %s)"; |
|
|
|
String formula = "%s + (%s * %s) + (%s * %s)"; |
|
|
|
List<NegativeScoreDepart> scoreDeparts = new ArrayList<>(); |
|
|
|
List<NegativeScoreDepart> scoreDeparts = new ArrayList<>(); |
|
|
|
negativeScorePoliceService.remove(new LambdaQueryWrapper<>()); |
|
|
|
negativeScorePoliceService.remove(new LambdaQueryWrapper<NegativeScorePolice>().isNotNull(NegativeScorePolice::getNegativeId)); |
|
|
|
negativeScoreDepartService.remove(new LambdaQueryWrapper<>()); |
|
|
|
negativeScoreDepartService.remove(new LambdaQueryWrapper<NegativeScoreDepart>().isNotNull(NegativeScoreDepart::getNegativeId)); |
|
|
|
Set<String> negativeIds = negativeBlames.stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet()); |
|
|
|
Set<String> negativeIds = negativeBlames.stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet()); |
|
|
|
List<NegativeProblemRelation> problemsAll = problemRelationService.list(negativeIds); |
|
|
|
List<NegativeProblemRelation> problemsAll = problemRelationService.list(negativeIds); |
|
|
|
List<Negative> negatives = negativeService.listByIds(negativeIds); |
|
|
|
List<Negative> negatives = negativeService.listByIds(negativeIds); |
|
|
|
|