From 3f9e736a6921b909dd0a0711dc24a8d19a3c2667 Mon Sep 17 00:00:00 2001 From: dulingling Date: Mon, 18 May 2020 11:50:29 +0800 Subject: [PATCH 01/14] =?UTF-8?q?Upd:=E5=8D=A1=E5=90=88=E8=A7=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6-=E3=80=90=E4=BC=98=E6=83=A0=E8=B4=B9=E7=8E=87?= =?UTF-8?q?=E4=BF=A1=E3=80=91BD=E5=8F=AF=E9=87=8D=E5=A4=8D=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/payment/partner/templates/partner_mw_auth_files.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html b/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html index f5ce6cb1a..588b271bb 100644 --- a/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html +++ b/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html @@ -330,7 +330,7 @@
- From e574a6912c73d9b2855f8658da6f16ccd593f379 Mon Sep 17 00:00:00 2001 From: dulingling Date: Mon, 18 May 2020 14:10:01 +0800 Subject: [PATCH 02/14] =?UTF-8?q?Upd:=E5=90=88=E8=A7=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0=E8=A7=84=E5=88=99=EF=BC=8C?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E5=90=8EBD=E5=8F=AA=E5=8F=AF=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E4=B8=8D=E5=88=A0=E9=99=A4=E5=90=88=E8=A7=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/partner_cp_auth_files.html | 12 +++++----- .../templates/partner_mw_auth_files.html | 22 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/ui/static/payment/partner/templates/partner_cp_auth_files.html b/src/main/ui/static/payment/partner/templates/partner_cp_auth_files.html index 10454f48d..0633354ec 100644 --- a/src/main/ui/static/payment/partner/templates/partner_cp_auth_files.html +++ b/src/main/ui/static/payment/partner/templates/partner_cp_auth_files.html @@ -33,7 +33,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -252,7 +252,7 @@ - + @@ -289,7 +289,7 @@ - + @@ -328,7 +328,7 @@ - diff --git a/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html b/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html index 588b271bb..6f5f0eb1e 100644 --- a/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html +++ b/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html @@ -69,7 +69,7 @@
- @@ -98,7 +98,7 @@
- @@ -127,7 +127,7 @@
- @@ -156,7 +156,7 @@
- @@ -185,7 +185,7 @@
- @@ -214,7 +214,7 @@
- @@ -243,7 +243,7 @@
- @@ -272,7 +272,7 @@
- @@ -301,7 +301,7 @@
- @@ -359,7 +359,7 @@
- @@ -388,7 +388,7 @@
- From 50beb7d98bd299d1bcd8da09f572bc71bdc7e8c3 Mon Sep 17 00:00:00 2001 From: dulingling Date: Mon, 18 May 2020 17:23:53 +0800 Subject: [PATCH 03/14] =?UTF-8?q?Upd:=E6=96=B0=E5=A2=9E=E8=B4=B9=E7=8E=87,?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E4=B9=8B=E5=89=8D=E6=89=80=E6=9C=89=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=97=B6=E9=97=B4=E5=86=85=E8=B4=B9=E7=8E=87=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/impls/ClientManagerImpl.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 15667f54d..2e0bce146 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -1935,8 +1935,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid newConfig.putAll(config); newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_name", channel); - if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), - config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { + if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; } if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { @@ -1946,11 +1945,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }}; newConfig.put("ext_rates", extRateParams.toJSONString()); } + pastRate(clientId,channel); clientRateMapper.saveRate(newConfig); logger.info(clientId + "的" + channel + "费率设置成功"); } } + private void pastRate(int clientId,String rateName){ + List rates = clientRateMapper.listClientRates(clientId, rateName); + if (!rates.isEmpty()) { + Date today = DateUtils.truncate(new Date(), Calendar.DATE); + for (JSONObject rateItem : rates) { + if (rateItem.getDate("expiry_time").before(today) || rateItem.getDate("active_time").after(today)) { + continue; + } + rateItem.put("expiry_time",DateUtils.addDays(new Date(), -1)); + clientRateMapper.updateConfig(rateItem); + } + } + } + @Override @Transactional public void modifyRateConfig(JSONObject manager, String clientMoniker, int rateId, ClientRateConfig config) { From 268e622ad589bc511da7e68261bc28b2ead78594 Mon Sep 17 00:00:00 2001 From: dulingling Date: Mon, 18 May 2020 17:28:59 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f06802e7e..a27c8a20b 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.3 + 2.3.4 UTF-8 2.2.0 From 0c0e6ae458f09ef5e9ccff8ca6767e8bbe447256 Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 21 May 2020 13:50:16 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=BE=E5=AE=9A=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- .../manage/merchants/core/impls/ClientManagerImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a27c8a20b..a450731b9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ au.com.royalpay.payment payment-parent - 2.1.47 + 2.1.48 4.0.0 manage - 2.3.4 + 2.3.3 UTF-8 2.2.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 2e0bce146..b3e5ad078 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -1959,7 +1959,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (rateItem.getDate("expiry_time").before(today) || rateItem.getDate("active_time").after(today)) { continue; } - rateItem.put("expiry_time",DateUtils.addDays(new Date(), -1)); + rateItem.put("expiry_time",new Date()); clientRateMapper.updateConfig(rateItem); } } From 5d1698dccd27ad7fb480111d51088f598467f281 Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 21 May 2020 13:50:49 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=BE=E5=AE=9A=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a450731b9..b47433e45 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ au.com.royalpay.payment payment-parent - 2.1.48 + 2.1.47 4.0.0 manage - 2.3.3 + 2.3.5 UTF-8 2.2.0 From 7a55f6d9b2512d506b78b319ee184c99165f0069 Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 21 May 2020 13:55:17 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=BE=E5=AE=9A=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b47433e45..3060a588b 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.5 + 2.3.6 UTF-8 2.2.0 From 49c18534f9c060bb23948ea40e4b25b47493e064 Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 21 May 2020 13:56:59 +0800 Subject: [PATCH 08/14] =?UTF-8?q?Upd:=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3060a588b..7b1fae1a2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ au.com.royalpay.payment payment-parent - 2.1.47 + 2.1.48 4.0.0 manage From 264c01fcda5bc4b35e117e09c2c11283284b55a0 Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 21 May 2020 16:17:15 +0800 Subject: [PATCH 09/14] =?UTF-8?q?Upd:=E5=BC=80=E6=94=BE=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- src/main/ui/static/payment/partner/templates/add_partner.html | 2 +- src/main/ui/static/payment/partner/templates/partner_edit.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 7b1fae1a2..9258ce330 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.6 + 2.3.7 UTF-8 2.2.0 diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index c51dcc45f..7a9bcc2c6 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -156,7 +156,7 @@
+ type="text" name="acceptor_name" maxlength="100">

Required diff --git a/src/main/ui/static/payment/partner/templates/partner_edit.html b/src/main/ui/static/payment/partner/templates/partner_edit.html index f27a81e28..10b1aaf8d 100644 --- a/src/main/ui/static/payment/partner/templates/partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/partner_edit.html @@ -214,7 +214,7 @@

+ type="text" name="acceptor_name" maxlength="100">

Required From 5fb90658a80b72d25e6b063021caa642024ac223 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Thu, 21 May 2020 18:36:29 +0800 Subject: [PATCH 10/14] =?UTF-8?q?HTML=20=E8=BD=ACpdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 22 +++ .../core/impls/TradeLogServiceImpl.java | 178 +++++++++++++++-- src/main/resources/templates/app/invoice.html | 185 ++++++++++++++++++ 3 files changed, 366 insertions(+), 19 deletions(-) create mode 100644 src/main/resources/templates/app/invoice.html diff --git a/pom.xml b/pom.xml index 5c1bb14a2..8dabbb902 100644 --- a/pom.xml +++ b/pom.xml @@ -219,6 +219,28 @@ org.projectlombok lombok + + + com.itextpdf + itextpdf + 5.5.13 + + + com.itextpdf.tool + xmlworker + 5.5.13 + + + com.itextpdf + itext-asian + 5.2.0 + + + org.xhtmlrenderer + flying-saucer-pdf + 9.0.3 + + diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 8d06b70dc..07e2124c1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -60,6 +60,10 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import org.springframework.ui.Model; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring5.SpringTemplateEngine; +import org.xhtmlrenderer.pdf.ITextFontResolver; +import org.xhtmlrenderer.pdf.ITextRenderer; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; @@ -130,6 +134,9 @@ public class TradeLogServiceImpl implements TradeLogService { @Resource private Locker locker; + @Resource + private SpringTemplateEngine thymeleaf; + // @Value("classpath:/jasper/trans_flow.jasper") // @Value("classpath:/jasper/trans_flow_new.jasper") @Value("classpath:/jasper/partner_invoice_gst.jasper") @@ -677,11 +684,89 @@ public class TradeLogServiceImpl implements TradeLogService { return "Credit".equals(log.getString("transaction_type")) || "Settlement".equals(log.getString("channel")) ? BigDecimal.ONE : BigDecimal.valueOf(-1); } + // @Override +// public void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { +// JSONObject transFlow = listPartnerTransFlow(query, partner); +// JSONObject analysis = transFlow.getJSONObject("analysis"); +// JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); +// if (!transFlow.getJSONArray("data").isEmpty()) { +// try { +// List dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class); +// JSONObject parmerters = new JSONObject(); +// 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("bestpay_fee", takeDecimalOrDefault(analysis, "bestpay_fee", BigDecimal.ZERO)); +// parmerters.put("jd_fee", takeDecimalOrDefault(analysis, "jd_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)); +// +// 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); +// }); +// JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList); +// response.setContentType("application/pdf"); +// String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", ""); +// response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); +// OutputStream outs = response.getOutputStream(); +// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); +// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream(); +// byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); +// outs.write(bytes, 0, bytes.length); +// outs.flush(); +// outs.close(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// } +// } @Override public void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { JSONObject transFlow = listPartnerTransFlow(query, partner); JSONObject analysis = transFlow.getJSONObject("analysis"); JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); + Context ctx = new Context(); + +// JSONObject manager = managerMapper.findById(device.getString("manager_id")); +// ctx.setVariable("firstname","lu"); if (!transFlow.getJSONArray("data").isEmpty()) { try { List dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class); @@ -712,7 +797,7 @@ public class TradeLogServiceImpl implements TradeLogService { 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)); + parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP)); dataList.parallelStream().forEach(item -> { BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO; @@ -733,18 +818,74 @@ public class TradeLogServiceImpl implements TradeLogService { 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); + + }); + ctx.setVariable("parmerters",parmerters); + ctx.setVariable("dataList",dataList); + final String html = thymeleaf.process("app/invoice.html", ctx); + JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList); response.setContentType("application/pdf"); String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", ""); response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); OutputStream outs = response.getOutputStream(); JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); - InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream(); - byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); +// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream(); +// byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); + System.out.println("------>content:"+html); + + ByteArrayOutputStream os = new ByteArrayOutputStream(); + ITextRenderer renderer = new ITextRenderer(); + ITextFontResolver fontResolver = (ITextFontResolver) renderer.getSharedContext().getFontResolver(); + //添加字体库 begin +// File f = new File(fontDir); +// if (f.isDirectory()) { +// File[] files = f.listFiles(new FilenameFilter() { +// public boolean accept(File dir, String name) { +// String lower = name.toLowerCase(); +// return lower.endsWith(".otf") || lower.endsWith(".ttf") ; +// } +// }); +// for (int i = 0; i < files.length; i++) { +// fontResolver.addFont(files[i].getAbsolutePath(), BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); +// } +// } + //添加字体库end + renderer.setDocumentFromString(html); + renderer.layout(); + renderer.createPDF(os); + renderer.finishPDF(); + byte[] bytes = os.toByteArray(); outs.write(bytes, 0, bytes.length); outs.flush(); outs.close(); + +// final String html = thymeleaf.process("invoice.html", ctx); + +// response.setContentType("application/pdf"); +// String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", ""); +// response.setHeader("Content-Disposition", "attachment;fileName=123.pdf"); +// OutputStream outs = null; +// try { +// outs = response.getOutputStream(); +//// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); +//// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream(); +//// byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); +// outs.write(buff, 0, buff.length); +// outs.flush(); +// outs.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } + + } catch (Exception e) { e.printStackTrace(); } @@ -761,30 +902,29 @@ public class TradeLogServiceImpl implements TradeLogService { if (client == null) { throw new InvalidShortIdException(); } - partner.put("client_id",client.getIntValue("client_id")); - partner.put("client",client); + partner.put("client_id", client.getIntValue("client_id")); + partner.put("client", client); long internal = 0; - try{ + try { SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); long start = formatter.parse(query.getDatefrom()).getTime(); - long end= formatter.parse(query.getDateto()).getTime(); - internal = (end-start)/(1000*60*60*24); - }catch (Exception e){ + long end = formatter.parse(query.getDateto()).getTime(); + internal = (end - start) / (1000 * 60 * 60 * 24); + } catch (Exception e) { throw new ServerErrorException("查询参数格式不正确"); } - if(internal > 90){ - throw new ServerErrorException("最大查询区间为90天,请确认查询区间"); - } + if (internal > 90) { + throw new ServerErrorException("最大查询区间为90天,请确认查询区间"); + } - try{ + try { if (!locker.lock(clientKey, 300_000)) { throw new ServerErrorException("其他Invoice正在生成中,请稍后再试"); } - exportTransFlow( query, partner, response); - } - finally { + exportTransFlow(query, partner, response); + } finally { locker.unlock(clientKey); } } @@ -883,7 +1023,7 @@ public class TradeLogServiceImpl implements TradeLogService { row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type")); row.createCell(18, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clear_status")); row.createCell(19, Cell.CELL_TYPE_STRING).setCellValue(data.getString("gateway")); - row.createCell(20, Cell.CELL_TYPE_STRING).setCellValue(data.containsKey("order_detail")&&!"".equals(data.getString("order_detail"))?data.getString("order_detail"):data.getString("remark")); + row.createCell(20, Cell.CELL_TYPE_STRING).setCellValue(data.containsKey("order_detail") && !"".equals(data.getString("order_detail")) ? data.getString("order_detail") : data.getString("remark")); row.createCell(21, Cell.CELL_TYPE_STRING).setCellValue(data.getString("dev_id")); } @@ -988,7 +1128,7 @@ public class TradeLogServiceImpl implements TradeLogService { String credit = dataItem.getString("transaction_type").equals("Credit") ? dataItem.getBigDecimal("clearing_amount").toString() : "-"; HSSFRichTextString text3 = new HSSFRichTextString(credit); - HSSFRichTextString text4 = new HSSFRichTextString(dataItem.containsKey("order_detail")?dataItem.getString("order_detail"):dataItem.getString("remark")); + HSSFRichTextString text4 = new HSSFRichTextString(dataItem.containsKey("order_detail") ? dataItem.getString("order_detail") : dataItem.getString("remark")); cell0.setCellValue(text0); cell1.setCellValue(text1); cell2.setCellValue(text2); @@ -1787,7 +1927,7 @@ public class TradeLogServiceImpl implements TradeLogService { String[] clientIds = query.getClient_ids(); List clientIdList = new ArrayList<>(); clientIdList.add("ALL"); - if (clientIds!=null && clientIds.length >= 2) { + if (clientIds != null && clientIds.length >= 2) { clientIdList.addAll(Arrays.asList(clientIds)); } HSSFSheet sheet = null; diff --git a/src/main/resources/templates/app/invoice.html b/src/main/resources/templates/app/invoice.html new file mode 100644 index 000000000..26514111e --- /dev/null +++ b/src/main/resources/templates/app/invoice.html @@ -0,0 +1,185 @@ + + + + + + Invoice + + + +

+ +
+
+ Tunnel Show Pty Ltd trading as RoyalPay
+ ABN 16 601 619 685 Representative of AFSL 448066
+ + +
+
+
+ Tax Invoice
+ Merchant code +
+ Statement +
+ Issue Date +
+ Current +
+
+
+
+ + Your Statement
+ +
+
+
+ Date/Time + +
+
+ Transaction ID + +
+
+ Debit + +
+
+ Credit + +
+
+ Service Fee for RoyalPay (GST inclu) + +
+
+ Service fee for Mini Program(GST Inclu) +
+ +
+ Settlement Amount +
+
+
+
+
+ +
+
+ + +
+
+ + +
+
+ Credit +
+
+ + +
+
+ +
+ +
+ +
+
+ +
+ + + + + \ No newline at end of file From 18da986c6b0cafa0337dfeb4d50c55424f8ee019 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Fri, 22 May 2020 11:54:29 +0800 Subject: [PATCH 11/14] =?UTF-8?q?HTML=20=E8=BD=ACpdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/impls/TradeLogServiceImpl.java | 30 +++------- src/main/resources/templates/app/invoice.html | 58 +++++++++++-------- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index f6790a08b..ebdfda893 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -52,6 +52,7 @@ import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; +import org.apache.http.util.TextUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.*; @@ -832,9 +833,12 @@ public class TradeLogServiceImpl implements TradeLogService { : "-"; item.put("debit", debit); item.put("credit", credit); - - + if(item.get("settle_amount")==null){ + item.put("settle_amount","-"); + } }); + System.out.println("------>dataList:"+dataList); + System.out.println("------>parmerters:"+parmerters); ctx.setVariable("parmerters",parmerters); ctx.setVariable("dataList",dataList); final String html = thymeleaf.process("app/invoice.html", ctx); @@ -844,14 +848,14 @@ public class TradeLogServiceImpl implements TradeLogService { String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", ""); response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); 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(); // byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); System.out.println("------>content:"+html); ByteArrayOutputStream os = new ByteArrayOutputStream(); ITextRenderer renderer = new ITextRenderer(); - ITextFontResolver fontResolver = (ITextFontResolver) renderer.getSharedContext().getFontResolver(); +// ITextFontResolver fontResolver = (ITextFontResolver) renderer.getSharedContext().getFontResolver(); //添加字体库 begin // File f = new File(fontDir); // if (f.isDirectory()) { @@ -875,24 +879,6 @@ public class TradeLogServiceImpl implements TradeLogService { outs.flush(); outs.close(); -// final String html = thymeleaf.process("invoice.html", ctx); - -// response.setContentType("application/pdf"); -// String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", ""); -// response.setHeader("Content-Disposition", "attachment;fileName=123.pdf"); -// OutputStream outs = null; -// try { -// outs = response.getOutputStream(); -//// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); -//// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream(); -//// byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); -// outs.write(buff, 0, buff.length); -// outs.flush(); -// outs.close(); -// } catch (IOException e) { -// e.printStackTrace(); -// } - } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/resources/templates/app/invoice.html b/src/main/resources/templates/app/invoice.html index 26514111e..376e72a54 100644 --- a/src/main/resources/templates/app/invoice.html +++ b/src/main/resources/templates/app/invoice.html @@ -72,18 +72,26 @@ height: auto; font-weight: bold; } + .divSumary{ + child-align: middle; + } .spancontent-title{ width: 40%; float: left; color: #000000; font-size: 17px; font-weight: bold; + vertical-align: center; + } + .spancontent-value{ color: #000000; font-size: 17px; font-weight: bold; padding-left: 5px; + vertical-align: center; + } .hrclass{ background-color: #bf7a12; @@ -98,23 +106,25 @@
Tunnel Show Pty Ltd trading as RoyalPay
ABN 16 601 619 685 Representative of AFSL 448066
- +
+
- Tax Invoice
- Merchant code + Tax Invoice +
+
Merchant code

- Statement +
Statement

- Issue Date +
Issue Date-

- Current +
Current

-
+
Your Statement
@@ -124,15 +134,15 @@ Date/Time
-
+
Transaction ID
-
+
Debit
-
+
Credit
@@ -140,40 +150,40 @@ Service Fee for RoyalPay (GST inclu)
-
+
Service fee for Mini Program(GST Inclu)
-
+
Settlement Amount
- +
-
- +
+
-
- +
+ -
-
- Credit +
+ -
- +
-
- +
+
-
- +
+
From e5eb03cc2e9b1b93ed9a99fd1fb44f4ca0c0fb1e Mon Sep 17 00:00:00 2001 From: dulingling Date: Fri, 22 May 2020 14:05:54 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B4=B9=E7=8E=87?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../core/impls/ClientManagerImpl.java | 20 +++++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index b23cc0bec..ab17ae172 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.7 + 2.3.8 UTF-8 2.2.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index b3e5ad078..4c707df9a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -1938,6 +1938,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; } + List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); + for (JSONObject rateLog : existRate) { + rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); + clientRateMapper.updateConfig(rateLog); + } if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { JSONObject extRateParams = new JSONObject() {{ put("domestic_rate_value", config.getBigDecimal("rate_value")); @@ -1945,26 +1950,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }}; newConfig.put("ext_rates", extRateParams.toJSONString()); } - pastRate(clientId,channel); clientRateMapper.saveRate(newConfig); logger.info(clientId + "的" + channel + "费率设置成功"); } } - private void pastRate(int clientId,String rateName){ - List rates = clientRateMapper.listClientRates(clientId, rateName); - if (!rates.isEmpty()) { - Date today = DateUtils.truncate(new Date(), Calendar.DATE); - for (JSONObject rateItem : rates) { - if (rateItem.getDate("expiry_time").before(today) || rateItem.getDate("active_time").after(today)) { - continue; - } - rateItem.put("expiry_time",new Date()); - clientRateMapper.updateConfig(rateItem); - } - } - } - @Override @Transactional public void modifyRateConfig(JSONObject manager, String clientMoniker, int rateId, ClientRateConfig config) { From c89893d3fb8eafcebc52bcde0bc4075345fde3d3 Mon Sep 17 00:00:00 2001 From: yixian Date: Fri, 22 May 2020 17:55:59 +1000 Subject: [PATCH 13/14] 3ds --- pom.xml | 4 ++-- src/document/openapi/cn/document.yml | 16 +++++++++++++++- src/document/openapi/en/document.yml | 18 ++++++++++++++++-- .../mappers/payment/TransactionMapper.java | 11 +++-------- .../ui/static/templates/payment/v1/card_pay.js | 11 ++++++++++- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index ab17ae172..843cdd552 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ au.com.royalpay.payment payment-parent - 2.1.48 + 2.1.49 4.0.0 manage - 2.3.8 + 2.3.9 UTF-8 2.2.0 diff --git a/src/document/openapi/cn/document.yml b/src/document/openapi/cn/document.yml index b77863011..ac99dd9d4 100644 --- a/src/document/openapi/cn/document.yml +++ b/src/document/openapi/cn/document.yml @@ -555,6 +555,10 @@ paths: type: boolean default: false description: 如果希望禁止消费者使用信用卡支付可传入true + disable_threeds: + type: boolean + default: false + description: 平台会协助商户自动开启3DS校验以减少盗刷风险。如果商户希望关闭这个功能,可以提交当前参数为true。(3DS校验需要消费者多一步银行端验证,并且如小程序等场景无法实现网页跳转到银行页面导致流程无法继续) tokenize: type: boolean default: false @@ -669,6 +673,10 @@ paths: type: boolean default: false description: 如果希望禁止消费者使用信用卡支付可传入true + disable_threeds: + type: boolean + default: false + description: 平台会协助商户自动开启3DS校验以减少盗刷风险。如果商户希望关闭这个功能,可以提交当前参数为true。(3DS校验需要消费者多一步银行端验证,并且如小程序等场景无法实现网页跳转到银行页面导致流程无法继续) customer: $ref: 'components_order.yml#/cardCustomerParam' responses: @@ -677,7 +685,13 @@ paths: content: application/json: schema: - $ref: 'components_order.yml#/orderBasicResponse' + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: 当开启3DS校验时系统会返回当前参数,商户应该引导消费者跳转到此页面完成3DS认证 /micropay/partners/{partner_code}/orders/{partner_order_id}: put: summary: 付款码下单 diff --git a/src/document/openapi/en/document.yml b/src/document/openapi/en/document.yml index 56b998930..09e5846c4 100644 --- a/src/document/openapi/en/document.yml +++ b/src/document/openapi/en/document.yml @@ -568,6 +568,10 @@ paths: type: boolean default: false description: pass true if merchant want to disable credit cards from paying to this order. + disable_threeds: + type: boolean + default: false + description: We will help merchants to enable 3DS verify by default. If you want to disable this feature please set this parameter as true tokenize: type: boolean default: false @@ -619,7 +623,7 @@ paths: put: summary: Create Card Order description: | - Input https://channel.rpayplus.com/channel/v1/view/card_input_frame.js in merchant's webpage. + Input https://channel-gateway.royalpay.com.au/channel/v1/view/card_input_frame.js in merchant's webpage. After called commit, it will return `key_id` and `secret` parameter asyncronized by callback. Post these parameter to royalpay and finish payment directly. @@ -690,6 +694,10 @@ paths: type: boolean default: false description: Pass true if want to refuse credit cards. + disable_threeds: + type: boolean + default: false + description: We will help merchants to enable 3DS verify by default. If you want to disable this feature please set this parameter as true customer: $ref: 'components_order.yml#/cardCustomerParam' responses: @@ -698,7 +706,13 @@ paths: content: application/json: schema: - $ref: 'components_order.yml#/orderBasicResponse' + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: If order requires 3DS verify. it will return this parameter. Merchants's system should guide customer to redirect to this url and finish 3DS verify. Remember to add signatures and return_url param /micropay/partners/{partner_code}/orders/{partner_order_id}: put: summary: Retail Passive Payment Order diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java index 2a0c9e8f4..b143ee3ad 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java @@ -1,13 +1,13 @@ package au.com.royalpay.payment.manage.mappers.payment; +import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import com.yixsoft.support.mybatis.paginator.annotations.CountRef; -import com.alibaba.fastjson.JSONObject; -import com.github.miemiedev.mybatis.paginator.domain.PageBounds; -import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator; @@ -20,8 +20,6 @@ import java.util.List; */ @AutoMapper(tablename = "pmt_transactions", pkName = "transaction_id", keyGenerator = Jdbc3KeyGenerator.class) public interface TransactionMapper { - @AutoSql(SqlType.INSERT) - void save(JSONObject transaction); @CountRef(".countTransFlowPage") PageList listTransFlowPage(JSONObject params, PageBounds pagination); @@ -38,9 +36,6 @@ public interface TransactionMapper { @AdvanceSelect(addonWhereClause = "transaction_type = 'Credit'") JSONObject findByOrderId(@Param("order_id") String orderId); - @AutoSql(SqlType.UPDATE) - void update(JSONObject transaction); - JSONObject findLastIncome(); double getClientUnClearedAmount(@Param("client_id") int clientId); diff --git a/src/main/ui/static/templates/payment/v1/card_pay.js b/src/main/ui/static/templates/payment/v1/card_pay.js index 8506924ab..8ebbabd84 100644 --- a/src/main/ui/static/templates/payment/v1/card_pay.js +++ b/src/main/ui/static/templates/payment/v1/card_pay.js @@ -10,7 +10,16 @@ $(function () { data: JSON.stringify(secretData), contentType: 'application/json', method: 'POST', - success: function () { + success: function (res) { + if (res.sdk_params) { + let threeDsParams = JSON.parse(res.sdk_params); + let form = $('
').attr('action', threeDsParams.acs_url).attr('method', 'post').css('display', 'none'); + $('').attr('name', 'paReq').val(threeDsParams.pa_req).attr('type', 'hidden').appendTo(form); + $('').attr('name', 'TermURL').val(threeDsParams.term_url).attr('type', 'hidden').appendTo(form); + $(body).append(form); + form.commit(); + return; + } startCheckOrder(window.client_moniker, window.partner_order_id); }, error: function (jqXHR) { From ef2bf3659b1a74bb5b0ba847afc557ad6515eafe Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Fri, 22 May 2020 16:28:52 +0800 Subject: [PATCH 14/14] =?UTF-8?q?invoice=E6=94=AF=E6=8C=81html=E8=BD=ACpdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +- .../manage/dev/web/TestController.java | 21 ++ .../ReadOnlyConnectionInterceptor.java | 3 +- .../manage/tradelog/core/TradeLogService.java | 3 + .../core/impls/TradeLogServiceImpl.java | 160 +++++++++----- .../web/ManageTradelogController.java | 27 +-- src/main/resources/templates/app/invoice.html | 206 ++++++++++-------- src/main/ui/static/templates/mch_invoice.css | 108 +++++++++ 8 files changed, 372 insertions(+), 160 deletions(-) create mode 100644 src/main/ui/static/templates/mch_invoice.css diff --git a/pom.xml b/pom.xml index 843cdd552..c3cfc1b87 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,10 @@ 4.0.0 manage - 2.3.9 + 2.3.10 UTF-8 - 2.2.0 + 2.3.0 ${project.version} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index e8f61f5c1..738a378f5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -26,6 +26,7 @@ import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection; import au.com.royalpay.payment.manage.system.core.TradeSecureService; +import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; @@ -52,6 +53,7 @@ import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; +import org.springframework.ui.Model; import org.springframework.util.Assert; import org.springframework.util.MimeTypeUtils; import org.springframework.validation.Errors; @@ -394,6 +396,7 @@ public class TestController { public void aliforexcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse, AliExcel query) throws Exception { aliforexcelService.listClients(httpResponse, manager, query); } + @ManagerMapping(value = "/partner/reset_password", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) public void resetPartnerPassword() { clientManager.updateAllPartnerPassword("PINE"); @@ -548,4 +551,22 @@ public class TestController { model.addObject("client", result); return model; } + + @GetMapping(value = "/trans_flow/pdf") + @ReadOnlyConnection + public ModelAndView exportTransFlowPDFHtml(TradeLogQuery query, @RequestParam String client_moniker, Model model) throws Exception { + return tradeLogService.exportTransFlow(query, getPartnerParams(client_moniker), model); + } + + private JSONObject getPartnerParams(String clientMoniker) { + JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new NotFoundException("Client Not Exists"); + } + JSONObject params = new JSONObject(); + params.put("client_id", client.getIntValue("client_id")); + params.put("client", client); + params.put("client_moniker", clientMoniker); + return params; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java index eaa04b71a..1ac0a8b4b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java +++ b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java @@ -19,8 +19,7 @@ public class ReadOnlyConnectionInterceptor implements Ordered { public Object proceed(ProceedingJoinPoint proceedingJoinPoint, ReadOnlyConnection readOnlyConnection) throws Throwable { try { DbContextHolder.setDbType(DbContextHolder.DbType.SLAVE); - Object result = proceedingJoinPoint.proceed(); - return result; + return proceedingJoinPoint.proceed(); } finally { DbContextHolder.clearDbType(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java index a9e3a978a..7dcf8e398 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java @@ -4,6 +4,7 @@ import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import com.alibaba.fastjson.JSONObject; import org.springframework.ui.Model; +import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -36,6 +37,8 @@ public interface TradeLogService { void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; + ModelAndView exportTransFlow(TradeLogQuery query, JSONObject partner, Model model) throws Exception; + void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index ebdfda893..08d6f8583 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -52,7 +52,6 @@ import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; -import org.apache.http.util.TextUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.*; @@ -62,9 +61,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.ui.Model; +import org.springframework.web.servlet.ModelAndView; import org.thymeleaf.context.Context; import org.thymeleaf.spring5.SpringTemplateEngine; -import org.xhtmlrenderer.pdf.ITextFontResolver; import org.xhtmlrenderer.pdf.ITextRenderer; import javax.annotation.Resource; @@ -523,9 +522,6 @@ public class TradeLogServiceImpl implements TradeLogService { params.put("client_id", client_id); JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id")); params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch")); - -// PageList logs = transactionMapper.listTransFlowPage(params, -// new PageBounds(query.getPage(), query.getLimit(), Order.formString("transaction_time.desc"))); List logs = transactionMapper.listTransFlow(params); TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time"); Paginator paginator = new Paginator(query.getPage(), query.getLimit(), logs.size()); @@ -570,9 +566,11 @@ public class TradeLogServiceImpl implements TradeLogService { int clientId = partner.getIntValue("client_id"); String timezone = partner.getJSONObject("client").getString("timezone"); JSONObject params = query.toParams(timezone); - params.put("channel", channels); +// params.put("channel", channels); clientManager.validateClients(clientId, params); params.put("client_id", clientId); + JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id")); + params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch")); clientManager.queryModifyClientIds(clientId, params); List logs = transactionMapper.listTransFlow(params); TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy HH:mm:ss", Collections.singletonList("transaction_time")); @@ -771,15 +769,14 @@ public class TradeLogServiceImpl implements TradeLogService { // } @Override public void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { - JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"Wechat","Alipay","AlipayOnline"}); + JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner, new String[]{"Wechat", "Alipay", "AlipayOnline"}); JSONObject analysis = transFlow.getJSONObject("analysis"); JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); Context ctx = new Context(); - -// JSONObject manager = managerMapper.findById(device.getString("manager_id")); -// ctx.setVariable("firstname","lu"); if (!transFlow.getJSONArray("data").isEmpty()) { - try { + try (OutputStream outs = response.getOutputStream(); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + ) { List dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class); JSONObject parmerters = new JSONObject(); parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) @@ -788,7 +785,7 @@ public class TradeLogServiceImpl implements TradeLogService { 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.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")); @@ -833,63 +830,116 @@ public class TradeLogServiceImpl implements TradeLogService { : "-"; item.put("debit", debit); item.put("credit", credit); - if(item.get("settle_amount")==null){ - item.put("settle_amount","-"); - } + item.putIfAbsent("settle_amount", "-"); }); - System.out.println("------>dataList:"+dataList); - System.out.println("------>parmerters:"+parmerters); - ctx.setVariable("parmerters",parmerters); - ctx.setVariable("dataList",dataList); + 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); - - JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList); response.setContentType("application/pdf"); String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", ""); response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); - OutputStream outs = response.getOutputStream(); -// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); -// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream(); -// byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); - System.out.println("------>content:"+html); - - ByteArrayOutputStream os = new ByteArrayOutputStream(); ITextRenderer renderer = new ITextRenderer(); -// ITextFontResolver fontResolver = (ITextFontResolver) renderer.getSharedContext().getFontResolver(); - //添加字体库 begin -// File f = new File(fontDir); -// if (f.isDirectory()) { -// File[] files = f.listFiles(new FilenameFilter() { -// public boolean accept(File dir, String name) { -// String lower = name.toLowerCase(); -// return lower.endsWith(".otf") || lower.endsWith(".ttf") ; -// } -// }); -// for (int i = 0; i < files.length; i++) { -// fontResolver.addFont(files[i].getAbsolutePath(), BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); -// } -// } //添加字体库end renderer.setDocumentFromString(html); renderer.layout(); renderer.createPDF(os); - renderer.finishPDF(); byte[] bytes = os.toByteArray(); outs.write(bytes, 0, bytes.length); outs.flush(); - outs.close(); + renderer.finishPDF(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + } + @Override + public ModelAndView exportTransFlow(TradeLogQuery query, JSONObject partner, Model model) throws Exception { + JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner, new String[]{"Wechat", "Alipay", "AlipayOnline"}); + JSONObject analysis = transFlow.getJSONObject("analysis"); + JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); + ModelAndView view = new ModelAndView("app/invoice.html"); + if (!transFlow.getJSONArray("data").isEmpty()) { + try { + List dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class); + JSONObject parmerters = new JSONObject(); + 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)); + 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", "-"); + }); + view.addObject("parmerters", parmerters); + view.addObject("dataList", dataList); + JSONObject orgInfo = orgManager.getOrgDetail(client.getIntValue("org_id"), null); + if (!orgInfo.containsKey("logo") || orgInfo.getIntValue("org_id") == 1) { + orgInfo.put("logo", "none"); + } + view.addObject("orgInfo", orgInfo); } catch (Exception e) { e.printStackTrace(); } - } + return view; } @Override - public void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { - JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"rpaypmt_card","rpaypmt_dd"}); + public void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws + Exception { + JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner, new String[]{"rpaypmt_card", "rpaypmt_dd"}); JSONObject analysis = transFlow.getJSONObject("analysis"); JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); if (!transFlow.getJSONArray("data").isEmpty()) { @@ -920,7 +970,7 @@ public class TradeLogServiceImpl implements TradeLogService { 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)); + parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_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); BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge") .subtract(analysis.getBigDecimal("total_transaction_fee")) @@ -944,7 +994,7 @@ public class TradeLogServiceImpl implements TradeLogService { BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax); 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("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2,RoundingMode.HALF_UP)); + item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2, RoundingMode.HALF_UP)); scaleDecimalVal(item, "display_amount", item.getString("currency")); String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); scaleDecimalVal(item, "clearing_amount", platformCurrency); @@ -970,7 +1020,8 @@ public class TradeLogServiceImpl implements TradeLogService { } @Override - public void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { + public void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws + Exception { query.setClearing_status(-1); String clientKey = "exportTransFlow:" + partner.getString("client_id"); @@ -1020,7 +1071,8 @@ public class TradeLogServiceImpl implements TradeLogService { } @Override - public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { + public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws + Exception { logger.debug("excel The method======= exportExcel() start......................."); JSONObject transFlow = listPartnerTransFlow(query, partner); JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); @@ -1105,7 +1157,8 @@ public class TradeLogServiceImpl implements TradeLogService { } @Override - public void exportExcelNew(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { + public void exportExcelNew(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws + Exception { logger.debug("excel The method======= exportExcelNew() start......................."); JSONObject transFlow = listPartnerTransFlow(query, partner); JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); @@ -1926,7 +1979,8 @@ public class TradeLogServiceImpl implements TradeLogService { } @Override - public void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) throws Exception { + public void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) throws + Exception { logger.debug("excel The method======= exportExcel() start......................."); int clientId1 = partner.getIntValue("client_id"); String timezone = partner.getJSONObject("client").getString("timezone"); diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/ManageTradelogController.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/ManageTradelogController.java index f81569efb..a54a2360d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/ManageTradelogController.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/ManageTradelogController.java @@ -27,6 +27,7 @@ public class ManageTradelogController { private TradeLogService tradeLogService; @Resource private ClientManager clientManager; + @RequestMapping(method = RequestMethod.GET) @ReadOnlyConnection @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF, ManagerRole.SERVANT, ManagerRole.DIRECTOR}) @@ -34,7 +35,7 @@ public class ManageTradelogController { return tradeLogService.listAllTradeLogs(query, manager); } - @RequestMapping(value = "/incremental",method = RequestMethod.GET) + @RequestMapping(value = "/incremental", method = RequestMethod.GET) @ReadOnlyConnection @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF, ManagerRole.SERVANT, ManagerRole.DIRECTOR}) public JSONObject listAllIncrementalTradeLogs(TradeLogQuery query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @@ -52,30 +53,30 @@ public class ManageTradelogController { @ManagerMapping(value = "/report/excel", method = RequestMethod.GET) @ReadOnlyConnection public void exportExcel(TradeLogQuery query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception { - tradeLogService.exportTransLog(query,manager,httpResponse); + tradeLogService.exportTransLog(query, manager, httpResponse); } - @ManagerMapping(value = "/trans_flow",method = RequestMethod.GET,role = {ManagerRole.FINANCIAL_STAFF}) + @ManagerMapping(value = "/trans_flow", method = RequestMethod.GET, role = {ManagerRole.FINANCIAL_STAFF}) @ReadOnlyConnection - public JSONObject listTransFlow(TradeLogQuery query,@RequestParam(required = true) String client_moniker) throws Exception { - return tradeLogService.listPartnerTransFlowPage(query,getPartnerParams(client_moniker)); + public JSONObject listTransFlow(TradeLogQuery query, @RequestParam String client_moniker) throws Exception { + return tradeLogService.listPartnerTransFlowPage(query, getPartnerParams(client_moniker)); } - @ManagerMapping(value = "/trans_flow/pdf", method = RequestMethod.GET,role = {ManagerRole.FINANCIAL_STAFF}) + @ManagerMapping(value = "/trans_flow/pdf", method = RequestMethod.GET, role = {ManagerRole.FINANCIAL_STAFF}) @ReadOnlyConnection - public void exportTransFlowPDF(TradeLogQuery query, @RequestParam(required = true) String client_moniker, HttpServletResponse httpResponse) throws Exception { - tradeLogService.exportTransFlow(query,getPartnerParams(client_moniker),httpResponse); + public void exportTransFlowPDF(TradeLogQuery query, @RequestParam String client_moniker, HttpServletResponse httpResponse) throws Exception { + tradeLogService.exportTransFlow(query, getPartnerParams(client_moniker), httpResponse); } - private JSONObject getPartnerParams(String clientMoniker){ + private JSONObject getPartnerParams(String clientMoniker) { JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); - if(client==null){ + if (client == null) { throw new NotFoundException("Client Not Exists"); } JSONObject params = new JSONObject(); - params.put("client_id",client.getIntValue("client_id")); - params.put("client",client); - params.put("client_moniker",clientMoniker); + params.put("client_id", client.getIntValue("client_id")); + params.put("client", client); + params.put("client_moniker", clientMoniker); return params; } } diff --git a/src/main/resources/templates/app/invoice.html b/src/main/resources/templates/app/invoice.html index 376e72a54..73555826b 100644 --- a/src/main/resources/templates/app/invoice.html +++ b/src/main/resources/templates/app/invoice.html @@ -1,11 +1,17 @@ - + - - - Invoice + + + + + + + [[${#dates.format((new java.util.Date()), 'dd-MM-yyyy')}]] [[${parmerters.partnerCode}]] Invoice + @@ -103,42 +126,48 @@
-
+ + +
Tunnel Show Pty Ltd trading as RoyalPay
- ABN 16 601 619 685 Representative of AFSL 448066
-
- + ABN 16 601 619 685
+ Representative of AFSL 448066 +

+
-
+
Tax Invoice
-
Merchant code
-
-
Statement
-
-
Issue Date-
-
-
Current
-
+
Merchant code +
+
Statement +
+
+ Issue Date + +
+
Current +
-
- - Your Statement
- +
+ Your Statement
Date/Time -
-
+
Transaction ID
-
+
Debit
@@ -146,15 +175,15 @@ Credit
-
+
Service Fee for RoyalPay (GST inclu)
-
+
Service fee for Mini Program(GST Inclu)
-
+
Settlement Amount
@@ -163,33 +192,30 @@
-
+
-
+
-
-
-
+
-
- +
+
-
- +
+
- - - - \ No newline at end of file + diff --git a/src/main/ui/static/templates/mch_invoice.css b/src/main/ui/static/templates/mch_invoice.css new file mode 100644 index 000000000..32a5b27a1 --- /dev/null +++ b/src/main/ui/static/templates/mch_invoice.css @@ -0,0 +1,108 @@ +.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: 50%; + height: auto; + text-align: left; + float: left; + white-space: normal; + word-break: break-all; + word-wrap: break-word; +} + +.divcontent_right { + width: 50%; + 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; +} + +.divinvoiceItem { + height: auto; + float: left; + padding-left: 3px; + white-space: normal; + word-break: break-all; + word-wrap: break-word; +} + +.spantitle { + color: #FF6600; + 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; + +} + +.spancontent-value { + color: #000000; + font-size: 17px; + font-weight: bold; + padding-left: 5px; + vertical-align: center; + +} +.statement_title{ + padding-bottom: 2%; + padding-top: 2%; + float: left; + padding-left: 5%; +}