Merge branch 'ReturnDepositSessionFix' into dev
This commit is contained in:
commit
68a7aec74c
6 changed files with 30 additions and 29 deletions
|
|
@ -114,7 +114,7 @@ public class Sdf06Executor {
|
|||
errorSdf07.setGenerationId(sdf07GroupId);
|
||||
sdf07Imdg.insert(errorSdf07);
|
||||
});
|
||||
sendToExporter(groupId);
|
||||
sendToExporter(sdf07GroupId);
|
||||
return;
|
||||
}
|
||||
Collection<AssetOperationRequest> requests = new ArrayList<>();
|
||||
|
|
@ -169,7 +169,7 @@ public class Sdf06Executor {
|
|||
assetOperationListRequest.setAssetOperationRequests(requests);
|
||||
kafkaSender.sendRequestToQueue(Consts.ASSET_OPERATION, assetOperationListRequest);
|
||||
} else if (sdf07WasCreated) {
|
||||
sendToExporter(groupId);
|
||||
sendToExporter(sdf07GroupId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ import ru.clearing.classes.statics.data.statement.Statement;
|
|||
import ru.spcex.clearing.error.ClearingError;
|
||||
import ru.spcex.clearing.error.ClearingErrorInternal;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdfRequestPart;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.importexport.SwtExporterRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.service.model.Result;
|
||||
import ru.spcex.clearing.service.validation.ValidationStored;
|
||||
|
|
@ -87,11 +89,15 @@ public class Sdf08Executor extends AbstractExecutor<SDf08> {
|
|||
|
||||
@Override
|
||||
public boolean isNeedToSendCommand() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCommand(KafkaSender kafkaSender, Result result) {
|
||||
SwtExporterRequest swtReq = new SwtExporterRequest();
|
||||
swtReq.setType(SdfTable.SDF_09.getKey());
|
||||
swtReq.setGroupId(result.getGenerationId());
|
||||
kafkaSender.sendRequestToQueue(Consts.SWT_EXPORTER, swtReq);
|
||||
}
|
||||
|
||||
Company searchCompany(String depoCode) {
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
||||
import ru.clearing.classes.statics.data.misc.Session;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf06;
|
||||
import ru.spcex.clearing.error.ClearingError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.enumeration.AccountType;
|
||||
import ru.spcex.platform.enumeration.CompanySymbol;
|
||||
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
|
|
@ -35,27 +33,13 @@ public enum Sdf06NewValidationRule implements IValidationRule<ImdgValidationCont
|
|||
@Override
|
||||
public Optional<EnumMessage> validate(ImdgValidationContext<SDf06> context) {
|
||||
SDf06 sdf06 = context.getValidatedObject();
|
||||
Imdg<CompanySymbols> companySymbolsImdg = context.obtainMap(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class);
|
||||
Imdg<Company> companyImdg = context.obtainMap(IMDGDistributedNames.Map_Company, Company.class);
|
||||
|
||||
CompanySymbols companySymbols = null;
|
||||
if (sdf06.getInn() != null) { //TextUtil.isEmpty
|
||||
companySymbols = companySymbolsImdg.getFirstObjectByFieldValues(Map.of(
|
||||
"companySymbol", CompanySymbol.INN.getKey(),
|
||||
"companySymbolValue", sdf06.getInn()));
|
||||
} else if (sdf06.getBic() != null) {
|
||||
companySymbols = companySymbolsImdg.getFirstObjectByFieldValues(Map.of(
|
||||
"companySymbol", CompanySymbol.BIC.getKey(),
|
||||
"companySymbolValue", sdf06.getBic()));
|
||||
if (TextUtil.isEmpty(sdf06.getDeal())) {
|
||||
return of(ClearingError.CompanyNotFoundB, sdf06.getDeal());
|
||||
}
|
||||
if (companySymbols == null) {
|
||||
return of(ClearingError.CompanyNotFoundB, "inn=" + sdf06.getInn() + "/bic=" + sdf06.getBic());
|
||||
}
|
||||
Company company = companyImdg.getSingleObjectByID(companySymbols.getCompanyId());
|
||||
Company company = companyImdg.getFirstObjectBySQL("tradingCode = '" + sdf06.getDeal() + "'");
|
||||
if (company == null) {
|
||||
return of(ClearingError.CompanyNotFoundB, "inn=" + sdf06.getInn()
|
||||
+ "/bic=" + sdf06.getBic()
|
||||
+ "/companyId=" + companySymbols.getCompanyId());
|
||||
return of(ClearingError.CompanyNotFoundB, sdf06.getDeal());
|
||||
}
|
||||
context.storeObject(ValidationStored.Sdf06Company, company);
|
||||
return empty();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
protected abstract SWTHeaderData getHeader(T record);
|
||||
|
||||
|
||||
public void process() {
|
||||
public void process(Long groupId) {
|
||||
LocalDateTime exportAt = LocalDateTime.now();
|
||||
|
||||
String fileName = formatFileName(typeForFileName(), sectionForFileName(), exportAt);
|
||||
|
|
@ -70,7 +70,7 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
byte[] data;
|
||||
{
|
||||
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
|
||||
Collection<T> records = selectItems();
|
||||
Collection<T> records = selectItems(groupId);
|
||||
log.debug("Prepared {} record from {} to file {}",
|
||||
records.size(), sdfImdg.getMapName(), fileName);
|
||||
SWTHeaderData swtHeaderData = makeSwtHeader(records);
|
||||
|
|
@ -127,8 +127,8 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
}
|
||||
|
||||
// Выборка
|
||||
protected Collection<T> selectItems() {
|
||||
return sdfImdg.getAllValues();
|
||||
protected Collection<T> selectItems(Long groupId) {
|
||||
return sdfImdg.getCollectionObjectsBySQL("generationId = %d".formatted(groupId));
|
||||
}
|
||||
|
||||
// Конвертация (поля см. meta.xml)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class LauncherCommandReceiver extends QueueConsumer implements Initializi
|
|||
for (AbstractExporterService exporter : exporterServices) {
|
||||
log.debug("Export {}", exporter);
|
||||
try {
|
||||
exporter.process();
|
||||
exporter.process(-1L);
|
||||
} catch (Exception e) {
|
||||
log.error("One of exporter has error: {}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ public class LauncherCommandReceiver extends QueueConsumer implements Initializi
|
|||
if (exporter.getType().getKey().equals(req.getType())) {
|
||||
log.debug("Export {}", exporter);
|
||||
try {
|
||||
exporter.process();
|
||||
exporter.process(req.getGroupId());
|
||||
} catch (Exception e) {
|
||||
log.error("Exporter has error: {}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ public class SwtExporterRequest {
|
|||
@JsonProperty
|
||||
public String type;
|
||||
|
||||
@JsonProperty
|
||||
public Long groupId;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
|
@ -13,4 +16,12 @@ public class SwtExporterRequest {
|
|||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue