This commit is contained in:
parent
a980ff8a0c
commit
53577e22b0
2 changed files with 8 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ package ru.spcex.clearing.dflt.management.listener;
|
|||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
|
|
@ -63,6 +63,7 @@ public class TaskListener extends QueueConsumer implements InitializingBean {
|
|||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
|
||||
private final Path storagePath;
|
||||
private final SendOrdersTypes sendOrdersTypes;
|
||||
private final Charset winCharset = Charset.forName("windows-1251");
|
||||
|
||||
@Autowired
|
||||
public TaskListener(Consumer<String, Object> kafkaQueue,
|
||||
|
|
@ -162,7 +163,7 @@ public class TaskListener extends QueueConsumer implements InitializingBean {
|
|||
String content = orderCurrencyTriExportService.exportToTri(orders);
|
||||
Path fileName = storagePath.resolve(String.format("KS_TS_ORDERS_%s.tri",
|
||||
LocalDateTime.now().format(formatter)));
|
||||
Files.writeString(fileName, content, StandardCharsets.UTF_8);
|
||||
Files.writeString(fileName, content, winCharset);
|
||||
if (SendOrdersTypes.FIX == sendOrdersTypes) {
|
||||
log.info("send command to fix service...");
|
||||
kafkaSender.sendRequestToQueue(Consts.SDOR_FIX_TASK, req.getRequestPayload());
|
||||
|
|
|
|||
|
|
@ -114,13 +114,17 @@ public class OrderCurrencyTriExportService {
|
|||
return null;
|
||||
}
|
||||
|
||||
return formatDecimal(rates.getValue());
|
||||
return formatDecimalRate(rates.getValue());
|
||||
}
|
||||
|
||||
private String formatDecimal(BigDecimal value) {
|
||||
return value == null ? "" : value.toPlainString();
|
||||
}
|
||||
|
||||
private String formatDecimalRate(BigDecimal value) {
|
||||
return value == null ? "" : value.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
|
||||
private String nullSafe(Object value) {
|
||||
return value == null ? "" : String.valueOf(value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue