This commit is contained in:
parent
56bc00bcad
commit
0e3cdcac4c
1 changed files with 11 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ public class PrepareXMLFile implements InitializingBean {
|
||||||
if (template.needSftpFiles()) {
|
if (template.needSftpFiles()) {
|
||||||
xmlFile = new File(template.getFileName(resultContainer, files));
|
xmlFile = new File(template.getFileName(resultContainer, files));
|
||||||
} else {
|
} else {
|
||||||
AtomicInteger counter = getOrInitCounter(table, template);
|
AtomicInteger counter = getOrInitCounter(resultContainer, template);
|
||||||
xmlFile = new File(template.getFileName(resultContainer, counter));
|
xmlFile = new File(template.getFileName(resultContainer, counter));
|
||||||
}
|
}
|
||||||
if (sftpConnectionError) {
|
if (sftpConnectionError) {
|
||||||
|
|
@ -109,16 +109,24 @@ public class PrepareXMLFile implements InitializingBean {
|
||||||
return StageResult.OK;
|
return StageResult.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AtomicInteger getOrInitCounter(Table table, FilenameTemplate template) {
|
private AtomicInteger getOrInitCounter(ResultContainer resultContainer, FilenameTemplate template) {
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
if (!today.equals(lastCounterDate)) {
|
if (!today.equals(lastCounterDate)) {
|
||||||
counters.clear();
|
counters.clear();
|
||||||
this.lastCounterDate = today;
|
this.lastCounterDate = today;
|
||||||
}
|
}
|
||||||
|
Table table = resultContainer.getTableForExport();
|
||||||
return counters.computeIfAbsent(table, k -> {
|
return counters.computeIfAbsent(table, k -> {
|
||||||
imdgProvider.waitAvailable();
|
imdgProvider.waitAvailable();
|
||||||
Imdg<SpcexObjectBase> imdg = imdgProvider.getImdg(k.getHazelcastMapName(), SpcexObjectBase.class);
|
Imdg<SpcexObjectBase> imdg = imdgProvider.getImdg(k.getHazelcastMapName(), SpcexObjectBase.class);
|
||||||
ImdgPredicate counterPredicate = template.counterPredicate(imdg.predicateBuilder());
|
var pb = imdg.predicateBuilder();
|
||||||
|
ImdgPredicate counterPredicate = template.counterPredicate(pb);
|
||||||
|
if (resultContainer.getGroupId() != null) {
|
||||||
|
counterPredicate = pb.and(
|
||||||
|
counterPredicate,
|
||||||
|
pb.not(pb.equals("generationId", resultContainer.getGroupId()))
|
||||||
|
);
|
||||||
|
}
|
||||||
Collection<SpcexObjectBase> items = imdg.getCollectionObjectsByPredicate(counterPredicate);
|
Collection<SpcexObjectBase> items = imdg.getCollectionObjectsByPredicate(counterPredicate);
|
||||||
return new AtomicInteger(items.size());
|
return new AtomicInteger(items.size());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue