|
|
@ -153,6 +153,10 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
private org.springframework.core.io.Resource austrac_report;
|
|
|
|
private org.springframework.core.io.Resource austrac_report;
|
|
|
|
@Value("classpath:/jasper/partner_settlement_detail.jasper")
|
|
|
|
@Value("classpath:/jasper/partner_settlement_detail.jasper")
|
|
|
|
private org.springframework.core.io.Resource partner_settlement_flow;
|
|
|
|
private org.springframework.core.io.Resource partner_settlement_flow;
|
|
|
|
|
|
|
|
@Value("classpath:/jasper/securepay_logo.png")
|
|
|
|
|
|
|
|
private org.springframework.core.io.Resource securepay_logo;
|
|
|
|
|
|
|
|
@Value("classpath:/jasper/securepay_settlement_detail.jasper")
|
|
|
|
|
|
|
|
private org.springframework.core.io.Resource securepay_settlement_flow;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject listPartnerTradeLogs(JSONObject manager, JSONObject account, String shortId, TradeLogQuery query, String timezone) throws Exception {
|
|
|
|
public JSONObject listPartnerTradeLogs(JSONObject manager, JSONObject account, String shortId, TradeLogQuery query, String timezone) throws Exception {
|
|
|
@ -1981,7 +1985,7 @@ 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);
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
parmerters.put("dateRange", "(Statement Period " + begin + "~"
|
|
|
|
parmerters.put("dateRange", "(Period " + begin + "~"
|
|
|
|
+ end + ")");
|
|
|
|
+ end + ")");
|
|
|
|
parmerters.put("clientName", client.getString("company_name"));
|
|
|
|
parmerters.put("clientName", client.getString("company_name"));
|
|
|
|
parmerters.put("clientAddress", client.getString("address"));
|
|
|
|
parmerters.put("clientAddress", client.getString("address"));
|
|
|
@ -1989,43 +1993,45 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
List<JSONObject> settlementLogDetailList = new ArrayList<>();
|
|
|
|
List<JSONObject> settlementLogDetailList = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
parmerters.put("logo", logo.getInputStream());
|
|
|
|
parmerters.put("logo", logo.getInputStream());
|
|
|
|
|
|
|
|
parmerters.put("org_logo", securepay_logo.getInputStream());
|
|
|
|
if (!clientOrderList.isEmpty()) {
|
|
|
|
if (!clientOrderList.isEmpty()) {
|
|
|
|
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
|
|
|
|
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
|
|
|
|
clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order")));
|
|
|
|
clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order")));
|
|
|
|
settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);
|
|
|
|
settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);
|
|
|
|
TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Collections.singletonList("transaction_time"));
|
|
|
|
TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Collections.singletonList("transaction_time"));
|
|
|
|
settlementLogDetailList.parallelStream().forEach(item -> {
|
|
|
|
settlementLogDetailList.parallelStream().forEach(item -> {
|
|
|
|
scaleDecimalVal(item, "display_amount", item.getString("transaction_currency"));
|
|
|
|
|
|
|
|
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
|
|
|
|
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
|
|
|
|
scaleDecimalVal(item, "clearing_amount", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "clearing_amount", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "settle_amount", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "settle_amount", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "total_surcharge", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "total_surcharge", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "transaction_amount", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "transaction_amount", platformCurrency);
|
|
|
|
item.put("exchange_rate", item.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN));
|
|
|
|
item.put("exchange_rate", item.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN).stripTrailingZeros());
|
|
|
|
item.put("gateway", item.getInteger("gateway") == null ? "-" : TradeType.fromGatewayNumber(item.getIntValue("gateway")).getTradeType());
|
|
|
|
item.put("gateway", item.getInteger("gateway") == null ? "-" : TradeType.fromGatewayNumber(item.getIntValue("gateway")).getTradeType());
|
|
|
|
item.put("rate", item.getBigDecimal("rate") == null ? "-" : item.getBigDecimal("rate").toPlainString() + "%");
|
|
|
|
item.put("rate", item.getBigDecimal("rate") == null ? "-" : item.getBigDecimal("rate").stripTrailingZeros().toPlainString() + "%");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (clientOrderList.size() <= 0) {
|
|
|
|
if (clientOrderList.size() <= 0) {
|
|
|
|
JSONObject mockJson = new JSONObject();
|
|
|
|
JSONObject mockJson = new JSONObject();
|
|
|
|
mockJson.put("order_id", "-");
|
|
|
|
mockJson.put("order_id", "-");
|
|
|
|
|
|
|
|
mockJson.put("client_order_id", "-");
|
|
|
|
mockJson.put("transaction_time", "-");
|
|
|
|
mockJson.put("transaction_time", "-");
|
|
|
|
mockJson.put("channel", "-");
|
|
|
|
mockJson.put("channel", "-");
|
|
|
|
mockJson.put("gateway", "-");
|
|
|
|
mockJson.put("gateway", "-");
|
|
|
|
mockJson.put("exchange_rate", BigDecimal.ZERO);
|
|
|
|
mockJson.put("exchange_rate", BigDecimal.ZERO);
|
|
|
|
mockJson.put("transaction_type", "-");
|
|
|
|
mockJson.put("transaction_type", "-");
|
|
|
|
mockJson.put("transaction_currency", "-");
|
|
|
|
mockJson.put("transaction_currency", "-");
|
|
|
|
mockJson.put("display_amount", BigDecimal.ZERO);
|
|
|
|
|
|
|
|
mockJson.put("settle_amount", BigDecimal.ZERO);
|
|
|
|
mockJson.put("settle_amount", BigDecimal.ZERO);
|
|
|
|
mockJson.put("remark", "");
|
|
|
|
mockJson.put("remark", "");
|
|
|
|
mockJson.put("transaction_amount", BigDecimal.ZERO);
|
|
|
|
mockJson.put("transaction_amount", BigDecimal.ZERO);
|
|
|
|
mockJson.put("total_surcharge", BigDecimal.ZERO);
|
|
|
|
mockJson.put("total_surcharge", BigDecimal.ZERO);
|
|
|
|
mockJson.put("clearing_amount", BigDecimal.ZERO);
|
|
|
|
mockJson.put("clearing_amount", BigDecimal.ZERO);
|
|
|
|
|
|
|
|
mockJson.put("transaction_fee", BigDecimal.ZERO);
|
|
|
|
|
|
|
|
mockJson.put("tax_amount", BigDecimal.ZERO);
|
|
|
|
mockJson.put("rate", BigDecimal.ZERO);
|
|
|
|
mockJson.put("rate", BigDecimal.ZERO);
|
|
|
|
settlementLogDetailList.add(mockJson);
|
|
|
|
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(securepay_settlement_flow.getInputStream(), parmerters, jrDataSource);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new ServerErrorException(e);
|
|
|
|
throw new ServerErrorException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|