[Y] securepay

master
taylor.dang 4 years ago
parent 63355f405e
commit 489368afed

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>2.3.48</version> <version>2.3.49</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version> <jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>
@ -223,6 +223,11 @@
<artifactId>flying-saucer-pdf</artifactId> <artifactId>flying-saucer-pdf</artifactId>
<version>9.0.3</version> <version>9.0.3</version>
</dependency> </dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -581,7 +581,7 @@ public class TestController {
} }
@GetMapping(value = "/securepay/settle/file") @GetMapping(value = "/securepay/settle/file")
public void sendSecurePaySettleFile() { public void sendSecurePaySettleFile(@RequestParam String dateStr) {
tradeSecureService.sendSecurePaySettleFile("20200803"); tradeSecureService.sendSecurePaySettleFile(dateStr);
} }
} }

@ -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);
} }

@ -2012,6 +2012,24 @@ public class TradeLogServiceImpl implements TradeLogService {
item.put("rate", item.getBigDecimal("rate") == null ? "-" : item.getBigDecimal("rate").toPlainString() + "%"); 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); JRDataSource jrDataSource = new JRBeanCollectionDataSource(settlementLogDetailList);
return JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource); return JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource);
} catch (Exception e) { } catch (Exception e) {

@ -1420,7 +1420,7 @@
#{clearing_order} #{clearing_order}
</foreach> </foreach>
</if> </if>
ORDER BY transaction_time DESC ORDER BY t.transaction_time DESC
</select> </select>
<select id="getClientOrderByTransactionTime" resultType="com.alibaba.fastjson.JSONObject"> <select id="getClientOrderByTransactionTime" resultType="com.alibaba.fastjson.JSONObject">

Loading…
Cancel
Save