|
|
@ -138,6 +138,8 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
private org.springframework.core.io.Resource incremental_trans_flow;
|
|
|
|
private org.springframework.core.io.Resource incremental_trans_flow;
|
|
|
|
@Value("classpath:/jasper/partner_upay_invoice_gst.jasper")
|
|
|
|
@Value("classpath:/jasper/partner_upay_invoice_gst.jasper")
|
|
|
|
private org.springframework.core.io.Resource upay_trans_flow;
|
|
|
|
private org.springframework.core.io.Resource upay_trans_flow;
|
|
|
|
|
|
|
|
@Value("classpath:/jasper/incremental_partner_upay_invoice_gst.jasper")
|
|
|
|
|
|
|
|
private org.springframework.core.io.Resource incremental_upay_trans_flow;
|
|
|
|
@Value("classpath:/jasper/royalpay_logo.png")
|
|
|
|
@Value("classpath:/jasper/royalpay_logo.png")
|
|
|
|
private org.springframework.core.io.Resource logo;
|
|
|
|
private org.springframework.core.io.Resource logo;
|
|
|
|
@Value("classpath:/jasper/trans_excel.jasper")
|
|
|
|
@Value("classpath:/jasper/trans_excel.jasper")
|
|
|
@ -822,20 +824,23 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO));
|
|
|
|
parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO));
|
|
|
|
parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO));
|
|
|
|
parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO));
|
|
|
|
parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2,RoundingMode.HALF_UP));
|
|
|
|
parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2,RoundingMode.HALF_UP));
|
|
|
|
parmerters.put("total_transaction_fee", analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2,RoundingMode.HALF_UP));
|
|
|
|
BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
parmerters.put("total_royalpay_fee", analysis.getBigDecimal("total_surcharge").subtract(parmerters.getBigDecimal("total_transaction_fee")).setScale(2,RoundingMode.HALF_UP));
|
|
|
|
BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge")
|
|
|
|
|
|
|
|
.subtract(analysis.getBigDecimal("total_transaction_fee"))
|
|
|
|
|
|
|
|
.subtract(analysis.getBigDecimal("total_transaction_fee_tax"))
|
|
|
|
|
|
|
|
.subtract(analysis.getBigDecimal("total_incremental_surcharge"))
|
|
|
|
|
|
|
|
.subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
|
|
parmerters.put("total_transaction_fee", totalTransactionFee);
|
|
|
|
|
|
|
|
parmerters.put("total_royalpay_fee", totalRoyalpayFee);
|
|
|
|
|
|
|
|
parmerters.put("total_card_fee", totalRoyalpayFee.add(totalTransactionFee));
|
|
|
|
|
|
|
|
parmerters.put("total_incremental_fee", parmerters.getBigDecimal("incremental_fee").add(parmerters.getBigDecimal("incremental_gst")));
|
|
|
|
dataList.parallelStream().forEach(item -> {
|
|
|
|
dataList.parallelStream().forEach(item -> {
|
|
|
|
BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO;
|
|
|
|
BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO;
|
|
|
|
BigDecimal taxAmount = item.containsKey("tax_amount") ? item.getBigDecimal("tax_amount") : BigDecimal.ZERO;
|
|
|
|
BigDecimal taxAmount = item.containsKey("tax_amount") ? item.getBigDecimal("tax_amount") : BigDecimal.ZERO;
|
|
|
|
BigDecimal royalpaySurhcarge = item.containsKey("royal_surcharge") ? item.getBigDecimal("royal_surcharge") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal surhcargeBack = item.containsKey("surcharge_cashback") ? item.getBigDecimal("surcharge_cashback") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal channelSurcharge = item.containsKey("channel_surcharge") ? item.getBigDecimal("channel_surcharge") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal incrementalTax = incrementalSurcharge.divide(new BigDecimal(10), 2, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal incrementalTax = incrementalSurcharge.divide(new BigDecimal(10), 2, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal transactionFee = item.getBigDecimal("transaction_fee");
|
|
|
|
BigDecimal transactionFee = item.getBigDecimal("transaction_fee");
|
|
|
|
BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal royalpayTax = taxAmount.subtract(incrementalTax).subtract(transactionFeeTax);
|
|
|
|
BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax);
|
|
|
|
BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax);
|
|
|
|
|
|
|
|
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("total_surcharge_intax", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("total_surcharge_intax", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2,RoundingMode.HALF_UP));
|
|
|
|
item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2,RoundingMode.HALF_UP));
|
|
|
@ -850,9 +855,8 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
String fileName = client.getString("client_moniker") + "_Card_Payment_" + parmerters.getString("dateRange").replaceAll("/", "");
|
|
|
|
String fileName = client.getString("client_moniker") + "_Card_Payment_" + parmerters.getString("dateRange").replaceAll("/", "");
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
|
|
|
|
OutputStream outs = response.getOutputStream();
|
|
|
|
OutputStream outs = response.getOutputStream();
|
|
|
|
// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城");
|
|
|
|
JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城");
|
|
|
|
// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream();
|
|
|
|
InputStream jasper = clientIncrement == null ? upay_trans_flow.getInputStream() : incremental_upay_trans_flow.getInputStream();
|
|
|
|
InputStream jasper = upay_trans_flow.getInputStream();
|
|
|
|
|
|
|
|
byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource);
|
|
|
|
byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource);
|
|
|
|
outs.write(bytes, 0, bytes.length);
|
|
|
|
outs.write(bytes, 0, bytes.length);
|
|
|
|
outs.flush();
|
|
|
|
outs.flush();
|
|
|
|