From eea73c3b20859b913715558d99e276934798a508 Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Wed, 11 Dec 2019 19:43:04 +0800 Subject: [PATCH] =?UTF-8?q?[Y]=20R=20service=E6=96=B0=E5=A2=9E=E5=8F=82?= =?UTF-8?q?=E6=95=B0=20&=20=E4=BF=AE=E6=94=B9=E6=B8=85=E7=AE=97=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../manage/appclient/beans/RSvcMchBean.java | 49 +++++++++++++ .../core/impls/RetailRSvcServiceImpl.java | 5 ++ .../clearing/core/impl/CleanServiceImpl.java | 36 +++++---- .../core/impls/ClientManagerImpl.java | 49 ++++++++----- .../mappers/payment/TransactionMapper.xml | 2 + .../mappers/system/ClientAccountMapper.xml | 19 ++++- src/main/ui/static/boot/manager-bootv2.js | 2 +- .../commons/services/clearingDetailService.js | 4 - .../tradelog/partner-settlement-log.js | 9 +-- .../templates/partner_settlement_dialog.html | 73 ++++--------------- .../templates/partner_settlement_logs.html | 22 ++++-- 12 files changed, 157 insertions(+), 115 deletions(-) diff --git a/pom.xml b/pom.xml index 882361977..9bd14029c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.3.3 + 1.3.4 UTF-8 1.4.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RSvcMchBean.java b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RSvcMchBean.java index 282b7db6a..276ad74ee 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RSvcMchBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RSvcMchBean.java @@ -47,4 +47,53 @@ public class RSvcMchBean { * 商户名称 */ private String merchantName; + /** + * 公司地址 address + */ + private String address; + + /** + * 联系人 contact_person + */ + private String contactPerson; + + /** + * 联系人电话 contact_phone + */ + private String contactPhone; + + /** + * 联系人邮箱 contact_email + */ + private String contactEmail; + + /** + * 银行账户名称 + */ + private String accountName; + + /** + * bsb + */ + private String bsbNumber; + + /** + * 银行账户号码 + */ + private String accountNo; + + /** + * 银行注册地址 + */ + private String registeredAddress; + + /** + * 银行电话 + */ + private String telNumber; + + /** + * abn + */ + private String abn; } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java index 7a1f873ef..12fc1dd4e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java @@ -46,11 +46,16 @@ public class RetailRSvcServiceImpl implements RetailRSvcService { result.put("enc_data", new JSONObject() { { put("credentialCode", encData(svcMchBean.getCredentialCode(), key, svcInfo.getString("channel_pub_key"))); + put("payHost", encData(svcMchBean.getPayHost(), key, svcInfo.getString("channel_pub_key"))); put("partnerCode", encData(svcMchBean.getPartnerCode(), key, svcInfo.getString("channel_pub_key"))); put("merchantNumber", encData(svcMchBean.getMerchantNumber(), key, svcInfo.getString("channel_pub_key"))); } }); + result.remove("credentialCode"); + result.remove("payHost"); + result.remove("partnerCode"); + result.remove("merchantNumber"); result.put("nonce_str", aesKeyStr); result.put("timestamp", System.currentTimeMillis()); result = JSONObject.parseObject(JSON.toJSONString(result), Feature.OrderedField); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java index 1baa6564e..4e5c35787 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java @@ -799,7 +799,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider analysis.put("total_credit", total_credit.setScale(2, RoundingMode.HALF_UP)); analysis.put("total_debit", total_debit.setScale(2, RoundingMode.HALF_UP)); analysis.put("net_amount", net_amount_credit.subtract(net_amount_debit).setScale(2, RoundingMode.HALF_UP)); + analysis.put("clearing_amount", net_amount_credit.subtract(net_amount_debit).setScale(2, RoundingMode.HALF_UP)); analysis.put("tax_amount", tax_amount.setScale(2, RoundingMode.HALF_UP)); + analysis.put("total_surcharge", total_charge_credit.subtract(total_charge_debit).setScale(2, RoundingMode.HALF_UP)); analysis.put("total_charge", total_charge_credit.subtract(total_charge_debit).add(tax_amount).setScale(2, RoundingMode.HALF_UP)); analysis.put("gross_amount", total_credit.subtract(total_debit).setScale(2, RoundingMode.HALF_UP)); dayAnalysisMap.put(entry.getKey(), analysis); @@ -837,15 +839,13 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider int rowNum = 0; Row row = sheet.createRow(rowNum); String[] title = {"order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", - "Input Amount", "Total Amount", "Clearing Amount", "Sruchange Rate", "Settle Amount", "Remark", "Dev No"}; - String[] analysis = {"Total Credit", "Total Debit", "Gross Amount", "Total Charge", "Net Amount"}; + "Input Amount", "Total Amount", "Clearing Amount(AUD)", "Sruchange Rate", "Surcharge(AUD)", "GST(AUD)", "Settle Amount(AUD)", "Remark", "Dev No"}; + String[] analysis = {"Total Credit(AUD)", "Total Debit(AUD)", "Gross Amount(AUD)", "Total GST(AUD)", "Total Charge(AUD)", "Net Amount(AUD)"}; for (int i = 0; i < title.length; i++) { row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]); } JSONObject channels = clearTransation.getJSONObject("channels"); - JSONObject device; - String clientDevId = ""; for (Object o : clearTransation.getJSONArray("report")) { JSONObject settle = (JSONObject) o; if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) { @@ -887,17 +887,23 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null); row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(channels.getString(settle.getString("channel")) == null ? "" : channels.getJSONObject(settle.getString("channel")).getBigDecimal("rate").toPlainString() + "%"); - cell = row.createCell(12, Cell.CELL_TYPE_STRING); + //手续费 + gst + row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("total_surcharge") == null ? "" + : settle.getBigDecimal("total_surcharge").setScale(2, RoundingMode.DOWN).toPlainString()); + row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("tax_amount") == null ? "" + : settle.getBigDecimal("tax_amount").setScale(2, RoundingMode.DOWN).toPlainString()); + cell = row.createCell(14, Cell.CELL_TYPE_STRING); cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? "" - : "Credit".equals(settle.getString("transaction_type"))? - settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString(): - "-"+settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); - cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null); - row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail")); - device = clientDeviceMapper.find(settle.getString("dev_id")); + : "Credit".equals(settle.getString("transaction_type")) ? + settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : + "-" + settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); + cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); + row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail")); + String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-"); + JSONObject device = clientDeviceMapper.find(settle.getString("dev_id")); if (device != null) clientDevId = device.getString("client_dev_id"); - row.createCell(14, Cell.CELL_TYPE_STRING).setCellValue(clientDevId); + row.createCell(16, Cell.CELL_TYPE_STRING).setCellValue(clientDevId); } row = sheet.createRow(++rowNum); for (int i = 0; i < analysis.length; i++) { @@ -909,9 +915,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("total_payment")); row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("total_refund")); row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("gross_amount")); - row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getBigDecimal("total_charge").add(clearTransation.getBigDecimal("tax_amount")).toPlainString()); - row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("clearing_amount")); - + row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("tax_amount")); + row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("total_charge")); + row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("clearing_amount")); wb.write(ous); ous.flush(); } catch (IOException e) { 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 26a4f6dd8..ad0e5f69c 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 @@ -2589,8 +2589,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid params.remove("client_id"); } List deviceIds = clientDeviceMapper.listClientDeviceIds(params); - return new JSONObject(){{ - put("data",deviceIds); + return new JSONObject() {{ + put("data", deviceIds); }}; } @@ -3716,7 +3716,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void excelSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query,HttpServletResponse response) { + public void excelSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query, HttpServletResponse response) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -3731,8 +3731,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid query.setDateto(DateFormatUtils.format(new Date(), "yyyyMMdd")); } } - if(query.getClient_ids()!=null){ - if(query.getClient_ids().length>1){ + if (query.getClient_ids() != null) { + if (query.getClient_ids().length > 1) { query.setClient_ids(null); } } @@ -3741,21 +3741,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc"))); //Excel 多sheet导出 try (HSSFWorkbook workbook = new HSSFWorkbook()) { - if(query.getClient_ids() ==null){ - addSheet(0,workbook,client,logs); + if (query.getClient_ids() == null) { + addSheet(0, workbook, client, logs); List childs = clientMapper.listChildClients(client.getIntValue("client_id")); - for (int i=0;i childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc"))); - if(childLogs.size()>0){ - addSheet(i+1,workbook, childs.get(i),childLogs); + if (childLogs.size() > 0) { + addSheet(i + 1, workbook, childs.get(i), childLogs); } } - }else{ - JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0])); - addSheet(0,workbook,chlidClient,logs); + } else { + JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0])); + addSheet(0, workbook, chlidClient, logs); } - String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() ); + String fileName = "Settlement Log - " + (query.getDatefrom() + "~" + query.getDateto()); response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls"); OutputStream outputStream = response.getOutputStream(); try { @@ -3770,9 +3770,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } - private void addSheet(int sheetNum,HSSFWorkbook workbook,JSONObject client,List logs){ + private void addSheet(int sheetNum, HSSFWorkbook workbook, JSONObject client, List logs) { HSSFSheet sheet = workbook.createSheet(); - workbook.setSheetName(sheetNum,client.getString("client_moniker")+"_excel"); + workbook.setSheetName(sheetNum, client.getString("client_moniker") + "_excel"); sheet.setDefaultColumnWidth((short) 40); HSSFCellStyle style = workbook.createCellStyle(); style.setFillForegroundColor(HSSFColor.LIGHT_ORANGE.index); @@ -3843,7 +3843,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject dataItem = logs.get(i); HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name")); HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker")); - HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( dataItem.getDate("report_date"))); + HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dataItem.getDate("report_date"))); HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); @@ -6099,13 +6099,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject partnerIncrementalServiceInfo(String clientMoniker,String channel){ + public JSONObject partnerIncrementalServiceInfo(String clientMoniker, String channel) { JSONObject client = clientMapper.findClientByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } JSONObject incrementalInfo = clientIncrementalMapper.findByClinetIdAndChannel(client.getInteger("client_id"), channel); - if(incrementalInfo==null){ + if (incrementalInfo == null) { throw new BadRequestException("Merchant service not opened"); } return incrementalInfo; @@ -6187,6 +6187,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid svcMchBean.setLogo(mchInfo.getString("logo_url")); svcMchBean.setIndustryCode(mchInfo.getString("industry")); svcMchBean.setIndustryName(findByLookupCode(mchInfo.getString("industry")).getString("lookup_value")); + + svcMchBean.setAddress(mchInfo.getString("address")); + svcMchBean.setRegisteredAddress(mchInfo.getString("bank_address")); + svcMchBean.setContactPerson(mchInfo.getString("contact_person")); + svcMchBean.setContactPhone(mchInfo.getString("contact_phone")); + svcMchBean.setContactEmail(mchInfo.getString("contact_email")); + svcMchBean.setBsbNumber(mchInfo.getString("bsn_no")); + svcMchBean.setAccountNo(mchInfo.getString("account_no")); + svcMchBean.setAccountName(mchInfo.getString("account_name")); + svcMchBean.setTelNumber(mchInfo.getString("bank_phone")); + svcMchBean.setAbn(mchInfo.getString("abn")); return svcMchBean; } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index 4783e302a..d26548491 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -375,6 +375,8 @@ diff --git a/src/main/ui/static/boot/manager-bootv2.js b/src/main/ui/static/boot/manager-bootv2.js index aebce37ff..6d350f1d8 100644 --- a/src/main/ui/static/boot/manager-bootv2.js +++ b/src/main/ui/static/boot/manager-bootv2.js @@ -69,7 +69,7 @@ require(['angular', 'jquery'], function (angular, $) { boot(user); }, error: function (jqXHR) { - if (jqXHR.status == 403) { + if (jqXHR.status === 403) { location.href = 'm_login.html?f=' + encodeURIComponent(location.href); } } diff --git a/src/main/ui/static/commons/services/clearingDetailService.js b/src/main/ui/static/commons/services/clearingDetailService.js index fc23d7390..40c9f8bcb 100644 --- a/src/main/ui/static/commons/services/clearingDetailService.js +++ b/src/main/ui/static/commons/services/clearingDetailService.js @@ -30,10 +30,6 @@ define(['../app','decimal'], function (app,Decimal) { app.controller('clearingDetailCtrl', ['$scope', 'detail', 'is_partner','client_id','detailId','$http', function ($scope, detail, is_partner,client_id,detailId,$http) { $scope.ctrl = {channel: null,day:null}; $scope.report = detail.data; - $scope.report.total_charge = Decimal.add($scope.report.total_charge,$scope.report.tax_amount).toFixed(2); - angular.forEach($scope.report.channels,function (e) { - e.total_charge = Decimal.add(e.total_charge,e.tax_amount).toFixed(2); - }); $scope.is_partner = is_partner; $scope.channelAndDayOfAnalysis = function () { $http.get('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId+'/analysis/'+$scope.ctrl.channel).then(function (resp) { diff --git a/src/main/ui/static/payment/tradelog/partner-settlement-log.js b/src/main/ui/static/payment/tradelog/partner-settlement-log.js index c2caaad00..dc6399f91 100644 --- a/src/main/ui/static/payment/tradelog/partner-settlement-log.js +++ b/src/main/ui/static/payment/tradelog/partner-settlement-log.js @@ -43,7 +43,6 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { } }); $scope.params.client_ids = angular.copy($scope.clientIds); - $scope.loadSettlementLogs(1); }) } @@ -118,9 +117,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { }); } return url; - } - $scope.loadSettlementLogs(1); - + }; $scope.chooseLast7Days(); $scope.exportSettlementLogs = function(pattern) { @@ -180,7 +177,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { $scope.isAll = false; $scope.showLevel3Clients = false; } - $scope.loadSettlementLogs(); + $scope.loadSettlementLogs(1); }; $scope.chooseLevel3Client = function (client) { @@ -193,7 +190,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { $scope.params.client_ids = [client.client_id]; $scope.isLevel3All = false; } - $scope.loadSettlementLogs(); + $scope.loadSettlementLogs(1); }; $scope.getClearingTransactions = function (client_id, detailId) { diff --git a/src/main/ui/static/payment/tradelog/templates/partner_settlement_dialog.html b/src/main/ui/static/payment/tradelog/templates/partner_settlement_dialog.html index 3477729cd..cf039c65d 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_settlement_dialog.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_settlement_dialog.html @@ -85,6 +85,11 @@
+
+ Tax Amount + + +
Total Charge @@ -98,59 +103,19 @@
RoyalPay Charge - +
Net Amount - + -
-
- Tax Amount - + ng-bind="(report.channels[ctrl.channel].gross_amount - report.channels[ctrl.channel].total_charge-report.channels[ctrl.channel].tax_amount)|currency:''">
-
@@ -169,25 +134,17 @@
- Total Charge - -
-
- Channel Charge - + Tax Amount +
-
- RoyalPay Charge - +
+ Total Charge +
Net Amount
-
- Tax Amount - -
diff --git a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html index 681c6860e..e1077c1fd 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html @@ -134,10 +134,11 @@ Date - Transaction Amount - Transfer to Merchant - Merchant Service Fee - + Transaction Amount(AUD) + Transfer to Merchant(AUD) + GST(AUD) + Total Surcharge(AUD) + Merchant Service Fee(AUD) Operation @@ -149,13 +150,20 @@ - + + + {{log.fee}} - + - +