etreschenkov 2023-05-29 19:20:42 +03:00
parent b3a5565dc0
commit e95e5bd677

View file

@ -125,7 +125,7 @@ public class InspectionObligations implements ISessionStage {
Registry counterRegistry = registryImdg.getSingleObjectBySQL(sqlCounterRegistryCondition);
if (counterRegistry == null) {
log.warn("Not found registry by params: {}; set not uncovered", sqlCounterRegistryCondition);
currentRegistry.setRegistryStatus("UNCV");
setUncover(currentRegistry);
alreadyUpdatedToUncover.add(currentRegistry.getId());
insecurityGroups.add(currentRegistry.getGroupId());
registryImdg.update(currentRegistry);
@ -134,7 +134,7 @@ public class InspectionObligations implements ISessionStage {
if (currentRegistry.getBalance().compareTo(counterRegistry.getBalance()) > 0) {
log.warn("groupId: {}: {}", currentRegistry.getGroupId(),
msgResolver.resolve(new EnumMessage(ClearingError.InsecurityObligation, currentRegistry.getCompanyId())));
currentRegistry.setRegistryStatus("UNCV");
setUncover(currentRegistry);
alreadyUpdatedToUncover.add(currentRegistry.getId());
insecurityGroups.add(currentRegistry.getGroupId());
registryImdg.update(currentRegistry);
@ -143,13 +143,14 @@ public class InspectionObligations implements ISessionStage {
currentRegistry.setRegistryStatus("OK");
registryImdg.update(currentRegistry);
}
//todo установить ok для
if (!insecurityGroups.isEmpty()) {
for (Long insecuritiesGroupId : insecurityGroups) {
for (Registry registry : registryByGroupIdAndCompanyId.get(insecuritiesGroupId)) {
if (!alreadyUpdatedToUncover.contains(registry)) {
if (!alreadyUpdatedToUncover.contains(registry.getId())) {
log.warn("set fail for registry.id: {}", registry.getId());
registry.setRegistryStatus("FAIL");
defineUncoverOrFail(registry);
registryImdg.update(registry);
}
}
@ -157,4 +158,20 @@ public class InspectionObligations implements ISessionStage {
}
return new StageResult(null, true);
}
private void defineUncoverOrFail(Registry registry) {
if (IEnumKey.getEnumByKey(RegistryDesignation.class, registry.getRegistryDesignation()) == RegistryDesignation.O) {
setUncover(registry);
} else {
setFail(registry);
}
}
private void setFail(Registry registry) {
registry.setRegistryStatus("FAIL");
}
private void setUncover(Registry registry) {
registry.setRegistryStatus("UNCV");
}
}