Sdf07/Sdf09 fix
This commit is contained in:
parent
9f9b260a4f
commit
7279fdf743
5 changed files with 32 additions and 11 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;
|
||||
|
|
@ -86,11 +88,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) {
|
||||
|
|
|
|||
|
|
@ -13,10 +13,14 @@ import ru.spcex.platform.enumeration.SwtTable;
|
|||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static ru.spcex.clearing.platform.messaging.domain.Consts.JOURNAL_SERVICE;
|
||||
|
||||
|
|
@ -56,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);
|
||||
|
|
@ -66,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);
|
||||
|
|
@ -123,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