Merge branch 'develop'

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java
#	src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java
#	src/main/resources/templates/app/invoice.html
master
yixian 4 years ago
commit 4931efd039

@ -5,11 +5,11 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>2.2.10</version>
<version>2.2.11</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>2.3.65</version>
<version>2.3.66</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

@ -66,12 +66,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
public JSONObject findMchInfoBySourceCode(JSONObject device, String sourceCode, boolean debug) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject clientConfig = clientConfigMapper.find(device.getIntValue("client_id"));
if (!debug && !clientConfig.getBooleanValue("geek_shop_status")
&& device.getIntValue("client_id") != 9
&& device.getIntValue("client_id") != 4181) {
throw new NotFoundException();
}
JSONObject svcInfo = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(sourceCode);
if (svcInfo == null || StringUtils.isEmpty(svcInfo.getString("channel_pub_key"))
|| StringUtils.isEmpty(svcInfo.getString("platform_pub_key")) || StringUtils.isEmpty("platform_pri_key")) {

@ -71,6 +71,7 @@ import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -584,4 +585,18 @@ public class TestController {
public void sendSecurePaySettleFile(@RequestParam String dateStr) {
tradeSecureService.sendSecurePaySettleFile(dateStr);
}
@GetMapping(value = "/securepay/invoice/file")
public void sendSecurePayInvoiceFile() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
//获取前一个月第一天
Calendar calendar1 = Calendar.getInstance();
calendar1.add(Calendar.MONTH, -1);
calendar1.set(Calendar.DAY_OF_MONTH,1);
String firstDay = sdf.format(calendar1.getTime());
//获取前一个月最后一天
Calendar calendar2 = Calendar.getInstance();
calendar2.set(Calendar.DAY_OF_MONTH, 0);
String lastDay = sdf.format(calendar2.getTime());
tradeSecureService.sendSecurePayInvoiceFile(firstDay,lastDay);
}
}

@ -18,4 +18,6 @@ public interface TradeSecureService {
TradeSecureFile getSecureReportFile(Date date);
void sendSecurePaySettleFile(String dateStr);
void sendSecurePayInvoiceFile(String beginDate,String endDate);
}

@ -147,7 +147,27 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
});
}
@Override
public void sendSecurePayInvoiceFile(String begin,String end) {
List<JSONObject> scpayMchs = clientAnalysisMapper.listSecurePayMchs();
scpayMchs.forEach(mch -> {
TradeLogQuery query = new TradeLogQuery();
query.setDatefrom(begin);
query.setDateto(end);
query.setClearing_status(-1);
byte[] fileData = new byte[0];
try {
fileData=tradeLogService.exportTransFlowForSecurePay(query, mch);
} catch (Exception e) {
e.printStackTrace();
}
String fileName = StringUtils.substring(begin, 0, 6) + "-Invoice-" + RandomStringUtils.random(9, true, true).toUpperCase() + "-"
+ mch.getString("client_moniker") + ".pdf";
sendSftpFile(begin, fileName, fileData);
});
}
private void sendSftpFile(String dateStr, String fileName, byte[] data) {
Session session = null;
ChannelSftp command = null;

@ -0,0 +1,39 @@
package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.system.core.TradeSecureService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class SecurePayInvoiceFileTask {
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Resource
private TradeSecureService tradeSecureService;
@Scheduled(cron = "0 30 3 1 * *")
public void sendSecurePaySettleFile() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
//获取前一个月第一天
Calendar calendar1 = Calendar.getInstance();
calendar1.add(Calendar.MONTH, -1);
calendar1.set(Calendar.DAY_OF_MONTH,1);
String firstDay = sdf.format(calendar1.getTime());
//获取前一个月最后一天
Calendar calendar2 = Calendar.getInstance();
calendar2.set(Calendar.DAY_OF_MONTH, 0);
String lastDay = sdf.format(calendar2.getTime());
synchronizedScheduler.executeProcess("task:securepay_invoice_file_sending", 60_000, () ->
tradeSecureService.sendSecurePayInvoiceFile(firstDay,lastDay)
);
}
}

@ -37,6 +37,8 @@ public interface TradeLogService {
void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception;
byte[] exportTransFlowForSecurePay(TradeLogQuery query, JSONObject client) throws Exception;
ModelAndView exportTransFlow(TradeLogQuery query, JSONObject partner, Model model) throws Exception;
void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception;

@ -593,6 +593,32 @@ public class TradeLogServiceImpl implements TradeLogService {
result.put("analysis", analysis);
return result;
}
private JSONObject listPartnerTransFlowByExportPdfSecurePay(TradeLogQuery query, JSONObject client, String[] channels) throws Exception {
int clientId = client.getIntValue("client_id");
String timezone = client.getString("timezone");
JSONObject params = query.toParams(timezone);
// params.put("channel", channels);
clientManager.validateClients(clientId, params);
params.put("client_id", clientId);
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id"));
params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
params.put("channel", channels);
clientManager.queryModifyClientIds(clientId, params);
List<JSONObject> logs = transactionMapper.listTransFlow(params);
TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy HH:mm:ss", Collections.singletonList("transaction_time"));
TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy", Collections.singletonList("clearing_time"));
final JSONObject analysis = analysisTransLogs(logs);
JSONObject result = new JSONObject();
result.put("data", logs);
analysis.put("balance", transactionMapper.analysisBalance(params));
if (analysis.containsKey("paid_fee") && analysis.containsKey("refund_fee")) {
analysis.put("actual_fee", analysis.getBigDecimal("paid_fee").add(analysis.getBigDecimal("refund_fee")));
}
result.put("analysis", analysis);
return result;
}
private JSONObject analysisTransLogs(List<JSONObject> logs) {
final JSONObject analysis = new JSONObject();
@ -775,93 +801,180 @@ public class TradeLogServiceImpl implements TradeLogService {
JSONObject analysis = transFlow.getJSONObject("analysis");
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
Context ctx = new Context();
if (!transFlow.getJSONArray("data").isEmpty()) {
try (OutputStream outs = response.getOutputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream();
) {
List<JSONObject> dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class);
JSONObject parmerters = new JSONObject();
parmerters.put("records", dataList.size());
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom())
? DateFormatUtils.format(DateUtils.parseDate(query.getDatefrom(), "yyyyMMdd"), "dd/MM/yyyy") : "");
parmerters.put("dateTo",
StringUtils.isNotBlank(query.getDateto())
? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy")
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + " ~ "
+ parmerters.getString("dateTo"));
parmerters.put("partnerCode", client.getString("client_moniker"));
parmerters.put("clientName", client.getString("company_name"));
parmerters.put("clientAddress", client.getString("address"));
parmerters.put("balance", analysis.getDoubleValue("balance"));
parmerters.put("logo", logo.getInputStream());
parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO));
parmerters.put("totalSettledAmount", takeDecimalOrDefault(analysis, "total_settle_amount", BigDecimal.ZERO));
parmerters.put("royalpay_charge", takeDecimalOrDefault(analysis, "total_royal_surcharge", BigDecimal.ZERO));
parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO));
parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO));
parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO));
parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO));
parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO));
parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", 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("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP));
JSONObject parmerters = new JSONObject();
int recordsSize=transFlow.getJSONArray("data").isEmpty()?0:transFlow.getJSONArray("data").size();
parmerters.put("records",recordsSize);
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom())
? DateFormatUtils.format(DateUtils.parseDate(query.getDatefrom(), "yyyyMMdd"), "dd/MM/yyyy") : "");
parmerters.put("dateTo",
StringUtils.isNotBlank(query.getDateto())
? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy")
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + " ~ "
+ parmerters.getString("dateTo"));
parmerters.put("partnerCode", client.getString("client_moniker"));
parmerters.put("clientName", client.getString("company_name"));
parmerters.put("clientAddress", client.getString("address"));
parmerters.put("balance", analysis.getDoubleValue("balance"));
parmerters.put("logo", logo.getInputStream());
parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO));
parmerters.put("totalSettledAmount", takeDecimalOrDefault(analysis, "total_settle_amount", BigDecimal.ZERO));
parmerters.put("royalpay_charge", takeDecimalOrDefault(analysis, "total_royal_surcharge", BigDecimal.ZERO));
parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO));
parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO));
parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO));
parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO));
parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO));
parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", 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("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP));
ctx.setVariable("parmerters", parmerters);
JSONObject orgInfo = orgManager.getOrgDetail(client.getIntValue("org_id"), null);
if (!orgInfo.containsKey("logo") || orgInfo.getIntValue("org_id") == 1) {
orgInfo.put("logo", "none");
}
ctx.setVariable("orgInfo", orgInfo);
try {
OutputStream outs = response.getOutputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream();
List<JSONObject> dataList= transTransform(transFlow);
ctx.setVariable("dataList", dataList);
final String html = thymeleaf.process("app/invoice.html", ctx);
response.setContentType("application/pdf");
String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", "");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
ITextRenderer renderer = new ITextRenderer();
//添加字体库end
renderer.setDocumentFromString(html);
renderer.layout();
renderer.createPDF(os);
byte[] bytes = os.toByteArray();
outs.write(bytes, 0, bytes.length);
outs.flush();
renderer.finishPDF();
}
dataList.parallelStream().forEach(item -> {
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 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 royalpayTax = taxAmount.subtract(incrementalTax);
BigDecimal realRoyalpayCharge = royalpaySurhcarge
.add(surhcargeBack)
.add(channelSurcharge)
.add(royalpayTax);
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
item.put("real_royalpay_surcharge", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
scaleDecimalVal(item, "display_amount", item.getString("currency"));
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
scaleDecimalVal(item, "clearing_amount", platformCurrency);
scaleDecimalVal(item, "settle_amount", platformCurrency);
scaleDecimalVal(item, "total_surcharge", platformCurrency);
String debit = item.getString("transaction_type").equals("Debit") ? item.getBigDecimal("clearing_amount").toString()
: "-";
String credit = item.getString("transaction_type").equals("Credit") ? item.getBigDecimal("clearing_amount").toString()
: "-";
item.put("debit", debit);
item.put("credit", credit);
item.putIfAbsent("settle_amount", "-");
});
ctx.setVariable("parmerters", parmerters);
ctx.setVariable("dataList", dataList);
JSONObject orgInfo = orgManager.getOrgDetail(client.getIntValue("org_id"), null);
if (!orgInfo.containsKey("logo") || orgInfo.getIntValue("org_id") == 1) {
orgInfo.put("logo", "none");
}
ctx.setVariable("orgInfo", orgInfo);
final String html = thymeleaf.process("app/invoice.html", ctx);
response.setContentType("application/pdf");
String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", "");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
ITextRenderer renderer = new ITextRenderer();
//添加字体库end
renderer.setDocumentFromString(html);
renderer.layout();
renderer.createPDF(os);
byte[] bytes = os.toByteArray();
outs.write(bytes, 0, bytes.length);
outs.flush();
renderer.finishPDF();
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
@Override
public byte[] exportTransFlowForSecurePay(TradeLogQuery query, JSONObject client) throws Exception {
JSONObject transFlow = listPartnerTransFlowByExportPdfSecurePay(query, client, new String[]{"Wechat", "Alipay", "AlipayOnline"});
JSONObject analysis = transFlow.getJSONObject("analysis");
// JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
Context ctx = new Context();
JSONObject parmerters = new JSONObject();
int recordsSize=transFlow.getJSONArray("data").isEmpty()?0:transFlow.getJSONArray("data").size();
parmerters.put("records",recordsSize);
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom())
? DateFormatUtils.format(DateUtils.parseDate(query.getDatefrom(), "yyyyMMdd"), "dd/MM/yyyy") : "");
parmerters.put("dateTo",
StringUtils.isNotBlank(query.getDateto())
? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy")
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + " ~ "
+ parmerters.getString("dateTo"));
parmerters.put("partnerCode", client.getString("client_moniker"));
parmerters.put("clientName", client.getString("company_name"));
parmerters.put("clientAddress", client.getString("address"));
parmerters.put("balance", analysis.getDoubleValue("balance"));
parmerters.put("logo", logo.getInputStream());
parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO));
parmerters.put("totalSettledAmount", takeDecimalOrDefault(analysis, "total_settle_amount", BigDecimal.ZERO));
parmerters.put("royalpay_charge", takeDecimalOrDefault(analysis, "total_royal_surcharge", BigDecimal.ZERO));
parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO));
parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO));
parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO));
parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO));
parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO));
parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", 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("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP));
ctx.setVariable("parmerters", parmerters);
JSONObject orgInfo = orgManager.getOrgDetail(client.getIntValue("org_id"), null);
if (!orgInfo.containsKey("logo") || orgInfo.getIntValue("org_id") == 1) {
orgInfo.put("logo", "none");
}
ctx.setVariable("orgInfo", orgInfo);
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
List<JSONObject> dataList= transTransform(transFlow);
ctx.setVariable("dataList", dataList);
final String html = thymeleaf.process("app/invoice.html", ctx);
ITextRenderer renderer = new ITextRenderer();
//添加字体库end
renderer.setDocumentFromString(html);
renderer.layout();
renderer.createPDF(os);
byte[] bytes = os.toByteArray();
renderer.finishPDF();
os.close();
return bytes;
}
catch (Exception e) {
e.printStackTrace();
}
return null;
}
private List<JSONObject> transTransform( JSONObject transFlow ){
List<JSONObject> dataList;
if (!transFlow.getJSONArray("data").isEmpty()) {
dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class);
dataList.parallelStream().forEach(item -> {
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 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 royalpayTax = taxAmount.subtract(incrementalTax);
BigDecimal realRoyalpayCharge = royalpaySurhcarge
.add(surhcargeBack)
.add(channelSurcharge)
.add(royalpayTax);
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
item.put("real_royalpay_surcharge", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
scaleDecimalVal(item, "display_amount", item.getString("currency"));
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
scaleDecimalVal(item, "clearing_amount", platformCurrency);
scaleDecimalVal(item, "settle_amount", platformCurrency);
scaleDecimalVal(item, "total_surcharge", platformCurrency);
String debit = item.getString("transaction_type").equals("Debit") ? item.getBigDecimal("clearing_amount").toString()
: "-";
String credit = item.getString("transaction_type").equals("Credit") ? item.getBigDecimal("clearing_amount").toString()
: "-";
item.put("debit", debit);
item.put("credit", credit);
item.putIfAbsent("settle_amount", "-");
});
}else{
dataList=new ArrayList<>();
JSONObject jsonObject=new JSONObject();
jsonObject.put("transaction_time","-");
jsonObject.put("client_order_id","-");
jsonObject.put("order_id","-");
jsonObject.put("debit","-");
jsonObject.put("credit","-");
jsonObject.put("real_royalpay_surcharge","-");
jsonObject.put("incremental_surcharge","-");
jsonObject.put("settle_amount","-");
dataList.add(jsonObject);
}
return dataList;
}
@Override
public ModelAndView exportTransFlow(TradeLogQuery query, JSONObject partner, Model model) throws Exception {
JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner, new String[]{"Wechat", "Alipay", "AlipayOnline"});
@ -1985,8 +2098,13 @@ public class TradeLogServiceImpl implements TradeLogService {
clientManager.queryModifyClientIds(client.getIntValue("client_id"), params);
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
JSONObject parmerters = new JSONObject();
parmerters.put("dateRange", "(Period " + begin + "~"
+ end + ")");
try {
String beginParse= DateFormatUtils.format(DateUtils.parseDate(begin,"yyyyMMdd"),"dd.MM.yyyy");
parmerters.put("dateRange", "Your Statement For:"+beginParse+"");
} catch (ParseException e) {
e.printStackTrace();
}
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"));
@ -2030,8 +2148,31 @@ public class TradeLogServiceImpl implements TradeLogService {
mockJson.put("rate", BigDecimal.ZERO);
settlementLogDetailList.add(mockJson);
}
JRDataSource jrDataSource = new JRBeanCollectionDataSource(settlementLogDetailList);
return JasperRunManager.runReportToPdf(securepay_settlement_flow.getInputStream(), parmerters, jrDataSource);
Context ctx = new Context();
JSONObject orgInfo = orgManager.getOrgDetail(client.getIntValue("org_id"), null);
if (!orgInfo.containsKey("logo") || orgInfo.getIntValue("org_id") == 1) {
orgInfo.put("logo", "none");
}
ctx.setVariable("orgInfo", orgInfo);
ctx.setVariable("parmerters",parmerters);
ctx.setVariable("settlementLogDetailList",settlementLogDetailList);
System.out.println("=====>reports/securepay_settlement.html:");
ByteArrayOutputStream os = new ByteArrayOutputStream();
final String html = thymeleaf.process("reports/securepay_settlement.html", ctx);
ITextRenderer renderer = new ITextRenderer();
//添加字体库end
renderer.setDocumentFromString(html);
renderer.layout();
renderer.createPDF(os);
byte[] bytes = os.toByteArray();
renderer.finishPDF();
os.close();
// JRDataSource jrDataSource = new JRBeanCollectionDataSource(settlementLogDetailList);
// return JasperRunManager.runReportToPdf(securepay_settlement_flow.getInputStream(), parmerters, jrDataSource);
return bytes;
} catch (Exception e) {
throw new ServerErrorException(e);
}

@ -11,6 +11,9 @@
<title> [[${#dates.format((new java.util.Date()), 'dd-MM-yyyy')}]] [[${parmerters.partnerCode}]] Invoice</title>
<link rel="stylesheet" href="/static/templates/mch_invoice.css"/>
<style type="text/css">
@page{
size : 300mm 300mm;
}
.divcontent {
width: 100%;
height: auto;
@ -153,12 +156,15 @@
<!-- 商户信息 -->
<div class="divcontent">
<div class="divcontent_left">
<img src="https://mpay.royalpay.com.au/static/images/rp_logo.png" alt="" height="100px"/>
<img th:if="${orgInfo.logo!='none'}" th:src="${orgInfo.logo}" width="150px" height="100px" style="padding-left: 10px"/>
<img src="https://mpay.royalpay.com.au/static/images/rp_logo.png" alt="" style="width: auto;height: 90px"/>
<img th:if="${orgInfo.logo!='none'}" th:src="${orgInfo.logo}" style="padding-left: 30px;height: 70px;margin-bottom:10px;width: auto"/>
<br/>
<div height="20px"></div>
<br/>
<span>Tunnel Show Pty Ltd trading as RoyalPay</span><br/>
<span >Tunnel Show Pty Ltd trading as RoyalPay</span><br/>
<span>ABN 16 601 619 685</span><br/>
<span> Representative of AFSL 448066</span>
<span > Representative of AFSL 448066</span>
<br/><br/>
<span th:text="${parmerters.clientName}"></span><br/>
@ -195,7 +201,7 @@
<span>Client Order ID</span>
</div>
<div class="divinvoiceItem" style="width: 15%">
<span>Order ID</span>
<span>Transaction ID</span>
</div>
<div class="divinvoiceItem" style="width: 10%">
<span>Debit</span>

@ -0,0 +1,250 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"/>
<meta http-equiv="cache-control" content="max-age=0"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
<title> settlement</title>
<link rel="stylesheet" href="/static/templates/mch_invoice.css"/>
<style type="text/css">
@page{
size : 300mm 300mm;
}
.divcontent {
width: 100%;
height: auto;
float: left;
margin: 1px;
align-items: start;
display: flex;
text-align: center;
margin-top: 5%;
margin-left: 5%;
margin-right: 5%;
}
.divcontent_left {
width: 48%;
height: auto;
text-align: left;
float: left;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
}
.divcontent_right {
width: 52%;
height: auto;
float: right;
text-align: left;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
padding-top: 20px;
}
.divfoot_right {
line-height: 30px;
width: 60%;
height: auto;
float: right;
text-align: left;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
}
.divinvoicesTitle {
width: 100%;
height: auto;
float: left;
background: #FF6600;
display: flex;
align-items: center;
text-align: left;
padding-top: 10px;
padding-bottom: 10px;
color: white;
}
.divinvoicesContent {
width: 100%;
height: auto;
float: left;
background: white;;
display: flex;
flex-wrap: wrap;
align-items: center;
text-align: left;
padding-top: 10px;
padding-bottom: 10px;
color: black;
}
.divinvoiceItem100 {
height: auto;
float: left;
padding-left: 3px;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
width:100px;
}
.divinvoiceItem80 {
height: auto;
float: left;
padding-left: 3px;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
width:80px;
}
.divinvoiceItem {
height: auto;
float: left;
padding-left: 3px;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
width:60px;
}
.divinvoiceItem50 {
height: auto;
float: left;
padding-left: 3px;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
width:50px;
}
.spantitle {
color: #000000;
font-size: 20px;
height: auto;
font-weight: bold;
}
.divSumary {
child-align: middle;
border-bottom: 2px solid #000;
margin-bottom: 10px;
padding-bottom: 10px;
width: 85%;
}
.spancontent-title {
width: 40%;
float: left;
color: #000000;
font-size: 17px;
font-weight: bold;
vertical-align: center;
}
.spanfoot-title{
width: 55%;
float: left;
color: #000000;
font-size: 17px;
vertical-align: center;
}
.spancontent-value {
color: #000000;
font-size: 17px;
font-weight: bold;
padding-left: 5px;
vertical-align: center;
}
.spanfoot-value {
color: #000000;
font-size: 17px;
padding-left: 5px;
vertical-align: center;
}
.statement_title {
padding-bottom: 2%;
padding-top: 2%;
float: left;
padding-left: 5%;
}
</style>
</head>
<body>
<!-- 商户信息 -->
<div class="divcontent">
<div class="divcontent_left">
<img src="https://mpay.royalpay.com.au/static/images/rp_logo.png" alt="" style="width: auto;height: 90px" />
<img th:if="${orgInfo.logo!='none'}" th:src="${orgInfo.logo}" src="https://mpay.royalpay.com.au/static/images/rp_logo.png" style="padding-left: 30px;margin-bottom:10px;height: 70px;width: auto"/>
<br/>
<div height="20px"></div>
<br/>
<span th:text="${parmerters.clientName}" ></span><br/>
<span th:text="${parmerters.clientAddress}"></span><br/>
<span th:text="${parmerters.clientLocation}"></span>
<br/><br/>
<!--<span th:text="${parmerters.clientName}"></span><br/>-->
</div>
<div class="divcontent_right">
<span>Tunnel Show Pty Ltd trading as</span><br/>
<span>ABN 16 601 619 685 Representative of AFSL</span><br/>
<span>Level 11, 15 William Street, Melbourne, Victoria</span>
<br/><br/>
</div>
</div>
<div class="statement_title">
<span class="spantitle" th:text="${parmerters.dateRange}"></span><br/>
</div>
<!-- 列表标题 -->
<!-- 列表循环 -->
<div class="divinvoicesContent">
<table border="1" cellspacing="0" cellpadding="0" style="width:1020px;">
<tr style="width:1020px;">
<th ><span style="font-size: small" class="divinvoiceItem100">Transaction ID</span></th>
<th ><span style="font-size: small" class="divinvoiceItem100">Client Order Id</span></th>
<th ><span style="font-size: small" class="divinvoiceItem100">Transaction Time</span></th>
<th ><span style="font-size: small" class="divinvoiceItem80">Channel</span></th>
<th ><span style="font-size: small" class="divinvoiceItem80">Exchange Rate</span></th>
<th ><span style="font-size: small" class="divinvoiceItem80">Transaction Type</span></th>
<th ><span style="font-size: small" class="divinvoiceItem80">Currency</span></th>
<th > <span style="font-size: small" class="divinvoiceItem80">Total Amount</span></th>
<th ><span style="font-size: small" class="divinvoiceItem80">Surcharge Rate</span></th>
<th ><span style="font-size: small" class="divinvoiceItem">Settle amount</span></th>
<th ><span style="font-size: small" class="divinvoiceItem">Transaction Fee</span></th>
<th ><span style="font-size: small" class="divinvoiceItem">gst</span></th>
</tr>
<tr th:each="settlementLogDetail:${settlementLogDetailList}" style="width:1020px" >
<td ><span style="font-size: small" class="divinvoiceItem100" th:text="${settlementLogDetail.order_id}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem100" th:text="${settlementLogDetail.client_order_id}"> </span></td>
<td ><span style="font-size: small" class="divinvoiceItem100" th:text="${settlementLogDetail.transaction_time}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem80" th:text="${settlementLogDetail.channel}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem80" th:text="${settlementLogDetail.exchange_rate}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem80" th:text="${settlementLogDetail.transaction_type}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem80" th:text="${settlementLogDetail.transaction_currency}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem80" th:text="${settlementLogDetail.transaction_amount}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem80" th:text="${settlementLogDetail.rate}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem" th:text="${settlementLogDetail.settle_amount}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem" th:text="${settlementLogDetail.transaction_fee}"></span></td>
<td ><span style="font-size: small" class="divinvoiceItem" th:text="${settlementLogDetail.tax_amount}"></span></td>
</tr>
</table>
</div>
</body>
</html>

@ -1,33 +1,35 @@
.ml-select-box{
position: absolute;
height: 300px;
white-space: nowrap;
z-index: 9999;
.ml-select-box {
position: absolute;
height: 300px;
white-space: nowrap;
z-index: 9999;
background: white;
}
.ml-select-box ul.select-group{
display: inline-block;
width: 240px;
overflow: auto;
height: 200px;
margin: 0;
padding: 0;
list-style: none;
.ml-select-box ul.select-group {
display: inline-block;
/* width: 240px; */
overflow: auto;
height: 200px;
margin: 0;
padding: 0;
list-style: none;
}
.ml-select-box ul.select-group li{
list-style: none;
width: 100%;
display: block;
height: 30px;
line-height: 30px;
cursor:pointer;
background: #fff;
font-size: 14px;
padding: 0 5px;
.ml-select-box ul.select-group li {
list-style: none;
width: 100%;
display: block;
height: 30px;
line-height: 30px;
cursor: pointer;
background: #fff;
font-size: 14px;
padding: 0 5px;
}
.ml-select-box ul.select-group li:hover,.ml-select-box ul.select-group li.active{
background: #c0c0c0;
font-weight: bold;
}
.ml-select-box ul.select-group li:hover,
.ml-select-box ul.select-group li.active {
background: #c0c0c0;
font-weight: bold;
}

Loading…
Cancel
Save