This commit is contained in:
parent
5ccd97f528
commit
07df32cfad
3 changed files with 25 additions and 5 deletions
|
|
@ -1,10 +1,15 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
import ru.spcex.platform.utils.log.ExceptionUtils;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
@JsonSubTypes({
|
||||
|
|
@ -19,6 +24,7 @@ import ru.spcex.platform.enumeration.CurrencyCode;
|
|||
})
|
||||
@JsonIgnoreProperties(value = { "clazz", "currency" })
|
||||
public abstract class ObjectTag<T1 extends SpcexObjectBase> {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
public final static String ruCurrency = CurrencyCode.RUB.getKey();
|
||||
public Class<T1> clazz;
|
||||
|
||||
|
|
@ -29,4 +35,16 @@ public abstract class ObjectTag<T1 extends SpcexObjectBase> {
|
|||
public abstract void setData(T1 entity);
|
||||
|
||||
public abstract String getCurrency();
|
||||
|
||||
public ObjectTag<T1> cloneObject() {
|
||||
ObjectTag<T1> cloneObj = null;
|
||||
try {
|
||||
Constructor<? extends ObjectTag> declaredConstructor = getClass().getDeclaredConstructor();
|
||||
cloneObj = declaredConstructor.newInstance();
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
|
||||
// unreachable
|
||||
log.error("Can't create clone for {}, cause: {}", clazz.getName(), ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
return cloneObj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,8 @@ public class ExportFromHazelcast {
|
|||
List<ObjectTag<? extends SpcexObjectBase>> result = new ArrayList<>();
|
||||
|
||||
for (T row : tableRows) {
|
||||
ObjectTag<T> value = (ObjectTag<T>) objectTagMap.get(table);
|
||||
ObjectTag<T> template = (ObjectTag<T>) objectTagMap.get(table);
|
||||
ObjectTag<T> value = template.cloneObject();
|
||||
value.setData(row);
|
||||
result.add(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,10 +44,11 @@ public class PrepareXMLFile implements InitializingBean {
|
|||
}
|
||||
List<SftpFileInfo> files = new ArrayList<>();
|
||||
log.trace("Get files from SFTP paths: {}", settings.getStore().getOutPayValDir().values());
|
||||
// for (String path : settings.getStore().getOutPayValDir().values()) {
|
||||
// files.addAll(gateway.listFiles(path));
|
||||
// }
|
||||
// log.info("There are {} files on the sFTP server in the search directories.", files.size());
|
||||
for (String path : settings.getStore().getOutPayValDir().values()) {
|
||||
if (!path.endsWith("/")) path += "/";
|
||||
files.addAll(gateway.listFiles(path));
|
||||
}
|
||||
log.info("There are {} files on the sFTP server in the search directories.", files.size());
|
||||
Table table = resultContainer.getTableForExport();
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
resultContainer.setRegistrationDateTime(currentDateTime);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue