Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
ialbert
295e03c499 GatewayRequester amount 2023-09-20 18:59:00 +03:00

View file

@ -64,6 +64,7 @@ import java.util.function.Function;
import java.util.regex.Pattern;
import static ru.spcex.platform.enumeration.RegistryTradingParams.D__V;
import static ru.spcex.platform.enumeration.RegistryTradingParams.OM_T;
import static ru.spcex.platform.utils.number.BigDecimalUtil.safeBD;
@Service
@ -656,31 +657,31 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
return comment.replaceAll("\\s+", "");
}
private static String getContractFromSpecif(String specif) {
if (specif == null) {
private String getContractFromSpecif(String specif) {
if (TextUtil.isEmpty(specif)) {
return null;
}
int index = specif.indexOf("");
if (index == -1) {
return null;
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
ImdgPredicate prdct = pb.and(
pb.sql(RegistryCodeSqlBuilder.getInstance(OM_T).build()),
pb.equals("registryStatus", RegistryStatus.PROC.getKey()),
pb.notNull("contract"),
pb.not(pb.equals("contract", ""))
);
String contract = registryImdg.getCollectionObjectsByPredicate(prdct)
.stream()
.filter(r -> r.getValueDate() != null)
.filter(r -> r.getRefundDate() != null)
.filter(r -> r.getValueDate().isBefore(r.getRefundDate()))
.map(Registry::getContract)
.filter(specif::contains)
.findFirst()
.orElse(null);
if (contract == null) {
log.warn("couldn't find match for specif {}", specif);
}
StringBuilder buffer = new StringBuilder();
String afterN = specif.substring(index + 1);
int countSlashes = 0;
for(int i = 0; i < afterN.length(); i++) {
char c = afterN.charAt(i);
if (!Character.isWhitespace(c)) {
buffer.append(c);
if (c == '/') {
countSlashes++;
}
} else {
if (countSlashes == 3) {
break;
}
}
}
return buffer.toString();
return contract;
}
@FunctionalInterface