|
|
@ -45,9 +45,9 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
|
|
|
|
private String sftpUsername;
|
|
|
|
private String sftpUsername;
|
|
|
|
@Value("${app.hanyin-secure.sftp-pwd}")
|
|
|
|
@Value("${app.hanyin-secure.sftp-pwd}")
|
|
|
|
private String sftpPwd;
|
|
|
|
private String sftpPwd;
|
|
|
|
@Value("${app.securepay.sftp.username:upitest}")
|
|
|
|
@Value("${app.securepay.sftp.username:securepay}")
|
|
|
|
private String securePaySftpName;
|
|
|
|
private String securePaySftpName;
|
|
|
|
@Value("${app.securepay.sftp.password:upitest}")
|
|
|
|
@Value("${app.securepay.sftp.password:k0uShtrmUvZ9}")
|
|
|
|
private String securePaySftpPwd;
|
|
|
|
private String securePaySftpPwd;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private TransactionMapper transactionMapper;
|
|
|
|
private TransactionMapper transactionMapper;
|
|
|
@ -139,7 +139,7 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
|
|
|
|
scpayMchs.forEach(mch -> {
|
|
|
|
scpayMchs.forEach(mch -> {
|
|
|
|
TradeLogQuery query = new TradeLogQuery();
|
|
|
|
TradeLogQuery query = new TradeLogQuery();
|
|
|
|
query.setDatefrom(dateStr);
|
|
|
|
query.setDatefrom(dateStr);
|
|
|
|
query.setDatefrom(dateStr);
|
|
|
|
query.setDateto(dateStr);
|
|
|
|
byte[] fileData = tradeLogService.exportPDFSettlement(query, mch);
|
|
|
|
byte[] fileData = tradeLogService.exportPDFSettlement(query, mch);
|
|
|
|
String fileName = dateStr + "-SETTLEMENT-" + RandomStringUtils.random(9, true, true).toUpperCase() + "-"
|
|
|
|
String fileName = dateStr + "-SETTLEMENT-" + RandomStringUtils.random(9, true, true).toUpperCase() + "-"
|
|
|
|
+ mch.getString("client_moniker") + ".pdf";
|
|
|
|
+ mch.getString("client_moniker") + ".pdf";
|
|
|
@ -157,11 +157,15 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
|
|
|
|
channel.connect();
|
|
|
|
channel.connect();
|
|
|
|
command = (ChannelSftp) channel;
|
|
|
|
command = (ChannelSftp) channel;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
command.put(new ByteArrayInputStream(data), "/" + StringUtils.substring(dateStr, 0, 6) + "/" + fileName);
|
|
|
|
command.mkdir(StringUtils.substring(dateStr, 0, 6));
|
|
|
|
logger.info("文件发送成功!");
|
|
|
|
|
|
|
|
} catch (SftpException e) {
|
|
|
|
} catch (SftpException e) {
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
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) {
|
|
|
|
} catch (IOException | JSchException e) {
|
|
|
|
throw new ChannelNetworkException("Send Settlement file failed", e);
|
|
|
|
throw new ChannelNetworkException("Send Settlement file failed", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
@ -174,7 +178,8 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
|
|
|
|
|
|
|
|
|
|
|
|
private Session initSFTPConnection(String sftpUsername, String sftpPassword) throws IOException {
|
|
|
|
private Session initSFTPConnection(String sftpUsername, String sftpPassword) throws IOException {
|
|
|
|
FileSystemOptions fso = new FileSystemOptions();
|
|
|
|
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);
|
|
|
|
sftpUsername.toCharArray(), sftpPassword.toCharArray(), fso);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|