master
taylor.dang 4 years ago
parent e30945a794
commit aa2e3acbb4

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>2.3.47</version>
<version>2.3.48</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

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

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

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

@ -1986,31 +1986,31 @@ public class TradeLogServiceImpl implements TradeLogService {
}
clientManager.queryModifyClientIds(client.getIntValue("client_id"), params);
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order")));
List<JSONObject> 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<JSONObject> 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<Integer> 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);

Loading…
Cancel
Save