diff --git a/pom.xml b/pom.xml
index 330d44d93..9ec92ceaa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
4.0.0
manage
- 2.3.48
+ 2.3.49
UTF-8
2.4.0
@@ -223,6 +223,11 @@
flying-saucer-pdf
9.0.3
+
+ com.jcraft
+ jsch
+ 0.1.55
+
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 fcdf0bccf..2ab2aa342 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
@@ -581,7 +581,7 @@ public class TestController {
}
@GetMapping(value = "/securepay/settle/file")
- public void sendSecurePaySettleFile() {
- tradeSecureService.sendSecurePaySettleFile("20200803");
+ public void sendSecurePaySettleFile(@RequestParam String dateStr) {
+ tradeSecureService.sendSecurePaySettleFile(dateStr);
}
}
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 23ee9beaa..82261922a 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:upitest}")
+ @Value("${app.securepay.sftp.username:securepay}")
private String securePaySftpName;
- @Value("${app.securepay.sftp.password:upitest}")
+ @Value("${app.securepay.sftp.password:k0uShtrmUvZ9}")
private String securePaySftpPwd;
@Resource
private TransactionMapper transactionMapper;
@@ -139,7 +139,7 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
scpayMchs.forEach(mch -> {
TradeLogQuery query = new TradeLogQuery();
query.setDatefrom(dateStr);
- query.setDatefrom(dateStr);
+ query.setDateto(dateStr);
byte[] fileData = tradeLogService.exportPDFSettlement(query, mch);
String fileName = dateStr + "-SETTLEMENT-" + RandomStringUtils.random(9, true, true).toUpperCase() + "-"
+ mch.getString("client_moniker") + ".pdf";
@@ -157,11 +157,15 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
channel.connect();
command = (ChannelSftp) channel;
try {
- command.put(new ByteArrayInputStream(data), "/" + StringUtils.substring(dateStr, 0, 6) + "/" + fileName);
- logger.info("文件发送成功!");
+ command.mkdir(StringUtils.substring(dateStr, 0, 6));
} catch (SftpException e) {
logger.error(e.getMessage());
}
+ try {
+ command.put(new ByteArrayInputStream(data), StringUtils.substring(dateStr, 0, 6) + "/" + fileName);
+ logger.info("文件发送成功!");
+ } catch (SftpException ignore) {
+ }
} catch (IOException | JSchException e) {
throw new ChannelNetworkException("Send Settlement file failed", e);
} finally {
@@ -174,7 +178,8 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
private Session initSFTPConnection(String sftpUsername, String sftpPassword) throws IOException {
FileSystemOptions fso = new FileSystemOptions();
- return SftpClientFactory.createConnection("124.156.126.236", 2022,
+ SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fso, "no");
+ return SftpClientFactory.createConnection("sftp.royalpay.com.au", 2022,
sftpUsername.toCharArray(), sftpPassword.toCharArray(), fso);
}
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 e8e35e2cb..b754c61a4 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
@@ -2012,6 +2012,24 @@ public class TradeLogServiceImpl implements TradeLogService {
item.put("rate", item.getBigDecimal("rate") == null ? "-" : item.getBigDecimal("rate").toPlainString() + "%");
});
}
+ if (clientOrderList.size() <= 0) {
+ JSONObject mockJson = new JSONObject();
+ mockJson.put("order_id", "-");
+ mockJson.put("transaction_time", "-");
+ mockJson.put("channel", "-");
+ mockJson.put("gateway", "-");
+ mockJson.put("exchange_rate", BigDecimal.ZERO);
+ mockJson.put("transaction_type", "-");
+ mockJson.put("transaction_currency", "-");
+ mockJson.put("display_amount", BigDecimal.ZERO);
+ mockJson.put("settle_amount", BigDecimal.ZERO);
+ mockJson.put("remark", "");
+ mockJson.put("transaction_amount", BigDecimal.ZERO);
+ mockJson.put("total_surcharge", BigDecimal.ZERO);
+ mockJson.put("clearing_amount", BigDecimal.ZERO);
+ mockJson.put("rate", BigDecimal.ZERO);
+ settlementLogDetailList.add(mockJson);
+ }
JRDataSource jrDataSource = new JRBeanCollectionDataSource(settlementLogDetailList);
return JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource);
} catch (Exception e) {
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml
index 242c3f775..9fc3bf234 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml
@@ -1420,7 +1420,7 @@
#{clearing_order}
- ORDER BY transaction_time DESC
+ ORDER BY t.transaction_time DESC