master
taylor.dang 4 years ago
parent e30945a794
commit aa2e3acbb4

@ -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.47</version> <version>2.3.48</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>

@ -579,4 +579,9 @@ public class TestController {
params.put("client_moniker", clientMoniker); params.put("client_moniker", clientMoniker);
return params; 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; 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}") @Value("${app.securepay.sftp.username:upitest}")
private String securePaySftpName; private String securePaySftpName;
@Value("${app.securepay.sftp.password}") @Value("${app.securepay.sftp.password:upitest}")
private String securePaySftpPwd; private String securePaySftpPwd;
@Resource @Resource
private TransactionMapper transactionMapper; private TransactionMapper transactionMapper;
@ -174,8 +174,7 @@ 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();
SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fso, "no"); return SftpClientFactory.createConnection("124.156.126.236", 2022,
return SftpClientFactory.createConnection("sftp.royalpay.com.au", 2022,
sftpUsername.toCharArray(), sftpPassword.toCharArray(), fso); sftpUsername.toCharArray(), sftpPassword.toCharArray(), fso);
} }

@ -21,7 +21,7 @@ public class SecurePaySettleFileTask {
@Scheduled(cron = "0 0 3 * * *") @Scheduled(cron = "0 0 3 * * *")
public void sendSecurePaySettleFile() { 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")) tradeSecureService.sendSecurePaySettleFile(DateFormatUtils.format(new Date(), "yyyyMMdd"))
); );
} }

@ -1986,31 +1986,31 @@ public class TradeLogServiceImpl implements TradeLogService {
} }
clientManager.queryModifyClientIds(client.getIntValue("client_id"), params); clientManager.queryModifyClientIds(client.getIntValue("client_id"), params);
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params); List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size()); JSONObject parmerters = new JSONObject();
clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order"))); parmerters.put("dateRange", "(Statement Period " + begin + "~"
List<JSONObject> settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders); + end + ")");
TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Collections.singletonList("transaction_time")); 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 { 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()); parmerters.put("logo", logo.getInputStream());
settlementLogDetailList.parallelStream().forEach(item -> { if (clientOrderList.size() > 0) {
scaleDecimalVal(item, "display_amount", item.getString("transaction_currency")); List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order")));
scaleDecimalVal(item, "clearing_amount", platformCurrency); settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);
scaleDecimalVal(item, "settle_amount", platformCurrency); TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Collections.singletonList("transaction_time"));
scaleDecimalVal(item, "total_surcharge", platformCurrency); settlementLogDetailList.parallelStream().forEach(item -> {
scaleDecimalVal(item, "transaction_amount", platformCurrency); scaleDecimalVal(item, "display_amount", item.getString("transaction_currency"));
item.put("exchange_rate", item.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN)); String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
item.put("gateway", item.getInteger("gateway") == null ? "-" : TradeType.fromGatewayNumber(item.getIntValue("gateway")).getTradeType()); scaleDecimalVal(item, "clearing_amount", platformCurrency);
item.put("rate", item.getBigDecimal("rate") == null ? "-" : item.getBigDecimal("rate").toPlainString() + "%"); scaleDecimalVal(item, "settle_amount", platformCurrency);
}); scaleDecimalVal(item, "total_surcharge", platformCurrency);
if (settlementLogDetailList == null) { scaleDecimalVal(item, "transaction_amount", platformCurrency);
settlementLogDetailList = new ArrayList<>(); 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); JRDataSource jrDataSource = new JRBeanCollectionDataSource(settlementLogDetailList);
return JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource); return JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource);

Loading…
Cancel
Save