diff --git a/pom.xml b/pom.xml index 4c9989945..330d44d93 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.47 + 2.3.48 UTF-8 2.4.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 6a7c5f977..fcdf0bccf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -579,4 +579,9 @@ public class TestController { params.put("client_moniker", clientMoniker); return params; } + + @GetMapping(value = "/securepay/settle/file") + public void sendSecurePaySettleFile() { + tradeSecureService.sendSecurePaySettleFile("20200803"); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/TradeSecureServiceHanyinImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/TradeSecureServiceHanyinImpl.java index 0f0e1ef92..23ee9beaa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/TradeSecureServiceHanyinImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/TradeSecureServiceHanyinImpl.java @@ -45,9 +45,9 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService { private String sftpUsername; @Value("${app.hanyin-secure.sftp-pwd}") private String sftpPwd; - @Value("${app.securepay.sftp.username}") + @Value("${app.securepay.sftp.username:upitest}") private String securePaySftpName; - @Value("${app.securepay.sftp.password}") + @Value("${app.securepay.sftp.password:upitest}") private String securePaySftpPwd; @Resource private TransactionMapper transactionMapper; @@ -174,8 +174,7 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService { private Session initSFTPConnection(String sftpUsername, String sftpPassword) throws IOException { FileSystemOptions fso = new FileSystemOptions(); - SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fso, "no"); - return SftpClientFactory.createConnection("sftp.royalpay.com.au", 2022, + return SftpClientFactory.createConnection("124.156.126.236", 2022, sftpUsername.toCharArray(), sftpPassword.toCharArray(), fso); } diff --git a/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java b/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java index 3076e9384..70f58b530 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java @@ -21,7 +21,7 @@ public class SecurePaySettleFileTask { @Scheduled(cron = "0 0 3 * * *") public void sendSecurePaySettleFile() { - synchronizedScheduler.executeProcess("task:securepay_settle_file_sending", 600_000, () -> + synchronizedScheduler.executeProcess("task:securepay_settle_file_sending", 60_000, () -> tradeSecureService.sendSecurePaySettleFile(DateFormatUtils.format(new Date(), "yyyyMMdd")) ); } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index bc493adfd..e8e35e2cb 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -1986,31 +1986,31 @@ public class TradeLogServiceImpl implements TradeLogService { } clientManager.queryModifyClientIds(client.getIntValue("client_id"), params); List clientOrderList = transactionMapper.getClientOrderByTransactionTime(params); - List clientOrders = new ArrayList<>(clientOrderList.size()); - clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order"))); - List settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders); - TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Collections.singletonList("transaction_time")); + JSONObject parmerters = new JSONObject(); + parmerters.put("dateRange", "(Statement Period " + begin + "~" + + end + ")"); + parmerters.put("clientName", client.getString("company_name")); + parmerters.put("clientAddress", client.getString("address")); + parmerters.put("clientLocation", client.getString("suburb") + "," + client.getString("state") + "," + client.getString("postcode")); + List settlementLogDetailList = new ArrayList<>(); try { - JSONObject parmerters = new JSONObject(); - parmerters.put("dateRange", "(Statement Period " + begin + "~" - + end + ")"); - parmerters.put("clientName", client.getString("company_name")); - parmerters.put("clientAddress", client.getString("address")); - parmerters.put("clientLocation", client.getString("suburb") + "," + client.getString("state") + "," + client.getString("postcode")); parmerters.put("logo", logo.getInputStream()); - settlementLogDetailList.parallelStream().forEach(item -> { - scaleDecimalVal(item, "display_amount", item.getString("transaction_currency")); - String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); - scaleDecimalVal(item, "clearing_amount", platformCurrency); - scaleDecimalVal(item, "settle_amount", platformCurrency); - scaleDecimalVal(item, "total_surcharge", platformCurrency); - scaleDecimalVal(item, "transaction_amount", platformCurrency); - item.put("exchange_rate", item.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN)); - item.put("gateway", item.getInteger("gateway") == null ? "-" : TradeType.fromGatewayNumber(item.getIntValue("gateway")).getTradeType()); - item.put("rate", item.getBigDecimal("rate") == null ? "-" : item.getBigDecimal("rate").toPlainString() + "%"); - }); - if (settlementLogDetailList == null) { - settlementLogDetailList = new ArrayList<>(); + if (clientOrderList.size() > 0) { + List clientOrders = new ArrayList<>(clientOrderList.size()); + clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order"))); + settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders); + TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Collections.singletonList("transaction_time")); + settlementLogDetailList.parallelStream().forEach(item -> { + scaleDecimalVal(item, "display_amount", item.getString("transaction_currency")); + String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); + scaleDecimalVal(item, "clearing_amount", platformCurrency); + scaleDecimalVal(item, "settle_amount", platformCurrency); + scaleDecimalVal(item, "total_surcharge", platformCurrency); + scaleDecimalVal(item, "transaction_amount", platformCurrency); + item.put("exchange_rate", item.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN)); + item.put("gateway", item.getInteger("gateway") == null ? "-" : TradeType.fromGatewayNumber(item.getIntValue("gateway")).getTradeType()); + item.put("rate", item.getBigDecimal("rate") == null ? "-" : item.getBigDecimal("rate").toPlainString() + "%"); + }); } JRDataSource jrDataSource = new JRBeanCollectionDataSource(settlementLogDetailList); return JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource);