From ff33494391099b7b2dcc36142a84443787767476 Mon Sep 17 00:00:00 2001 From: dulingling Date: Wed, 22 Apr 2020 11:36:35 +0800 Subject: [PATCH 01/12] =?UTF-8?q?Upd:=E4=BF=AE=E5=A4=8D=E5=95=86=E6=88=B7?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=85=8D=E7=BD=AE-=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=AD=90=E5=95=86=E6=88=B7id=E4=BF=AE=E6=94=B9=E5=90=8E?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E4=B8=8D=E6=B6=88=E5=A4=B1?= 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 1c886dbbc..19eca1053 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.2.6 + 2.2.7 UTF-8 1.8.0 From 4fa6d70ee1277e9d9d7ef57564fe9f8dff79f349 Mon Sep 17 00:00:00 2001 From: dulingling Date: Wed, 22 Apr 2020 11:36:58 +0800 Subject: [PATCH 02/12] =?UTF-8?q?Upd:=E4=BF=AE=E5=A4=8D=E5=95=86=E6=88=B7?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=85=8D=E7=BD=AE-=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=AD=90=E5=95=86=E6=88=B7id=E4=BF=AE=E6=94=B9=E5=90=8E?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E4=B8=8D=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/ui/static/payment/partner/partner-manage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index d0394b4a5..2db44bf3f 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1958,6 +1958,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.saveSubMerchantId = function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) { $scope.refreshWechatInstitutionMerchantId(); + $scope.ctrl.editSubMerchant = false; }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); @@ -1965,8 +1966,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.refreshWechatInstitutionMerchantId = function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) { + debugger $scope.loadPartnerPaymentInfo(); }, function (resp) { + debugger commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); }; From 6d6c8e52a3357b161fe325219a7d2d8ff8c493ca Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 22 Apr 2020 21:18:51 +1000 Subject: [PATCH 03/12] aba config --- .../clearing/core/CleanService.java | 4 +- .../clearing/core/impl/CleanServiceImpl.java | 51 ++++++++++++------ .../clearing/web/SettlementDevController.java | 11 ++-- .../manage/support/abafile/ABAConfig.java | 53 +++++++++++-------- .../manage/support/abafile/ABATemplate.java | 7 ++- src/main/resources/application.yml | 33 ++++++++---- src/main/ui/static/analysis/clearing-log.js | 29 +++++----- .../payment/manage/task/RefundTest.java | 34 ++++++++++++ .../payment/manage/task/SettleMailTest.java | 2 +- 9 files changed, 157 insertions(+), 67 deletions(-) create mode 100644 src/test/java/au/com/royalpay/payment/manage/task/RefundTest.java diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java index 073af0d8f..f994fa5f5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java @@ -50,7 +50,7 @@ public interface CleanService { List getSettleLogs(Date dt, List clearIds); - List getAba(Date dt, String bank, List logs) throws IOException; + List getAba(Date dt, List logs) throws IOException; void settlementAba(Date date, HttpServletResponse response) throws IOException; @@ -105,4 +105,6 @@ public interface CleanService { void undoSettle(Date date, int clearingId); ByteArrayResource downloadBatchSettleReportXlsx(int batchId); + + JSONObject findSettleLog(int clearingId); } 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 df8299a7b..927780431 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 @@ -32,6 +32,7 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.locale.LocaleSupport; import au.com.royalpay.payment.tools.lock.Locker; +import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent; import au.com.royalpay.payment.tools.utils.DateVaildUtil; @@ -321,7 +322,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider JSONObject client = clientManager.getClientInfo(clientId); Assert.notNull(client, "Client ID invalid"); checkOrgPermission(manager, client); - List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,clientId, + List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate, clientId, new PageBounds(Order.formString("order_id.asc"))); clearClient.put("report", transactions); List channels = clearingDetailAnalysisMapper.listReportChannelsOfMergeSettle(reportDate, clientId); @@ -536,15 +537,16 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public List getAba(Date dt, String bank, List logs) { + public List getAba(Date dt, List logs) { List files = new ArrayList<>(); for (JSONObject log : logs) { List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); details = mergeBatchSettleClients(details); String remark = extractSettleRemark(log); - files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), remark)); + BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group")); + files.addAll(generateSettleAbaFiles(dt, group, details, log.getDate("operate_time"), remark)); } - return files.stream().filter(file -> bank.equals(file.bank())).collect(Collectors.toList()); + return files; } public String extractSettleRemark(JSONObject log) { @@ -589,7 +591,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider for (JSONObject log : logs) { List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); details = mergeBatchSettleClients(details); - files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), extractSettleRemark(log))); + BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group")); + files.addAll(generateSettleAbaFiles(dt, group, details, log.getDate("operate_time"), extractSettleRemark(log))); } OutputStream ous = resp.getOutputStream(); if (files.size() == 1) { @@ -633,7 +636,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider resp.addHeader("Content-Disposition", "attachment; filename=" + zipName); OutputStream ous = resp.getOutputStream(); - List abaFiles = generateSettleAbaFiles(settleDate, details, opTime, extractSettleRemark(clearing)); + BalanceGroup group = BalanceGroup.valueOf(clearing.getString("balance_group")); + List abaFiles = generateSettleAbaFiles(settleDate, group, details, opTime, extractSettleRemark(clearing)); try (ZipOutputStream zos = new ZipOutputStream(ous)) { for (ABAFile aba : abaFiles) { zos.putNextEntry(new ZipEntry(aba.filename())); @@ -644,16 +648,16 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } } - private List generateSettleAbaFiles(Date dt, List settlements, Date operateTime, String remark) { + private List generateSettleAbaFiles(Date dt, BalanceGroup group, List settlements, Date operateTime, String remark) { List banks = settlements.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList()); - return banks.stream().map(bank -> generateSettleAbaFile(bank, dt, settlements)) + return banks.stream().map(bank -> generateSettleAbaFile(bank, group, dt, settlements)) .peek(file -> file.setOperateTime(operateTime)) .peek(file -> file.setRemark(remark)) .collect(Collectors.toList()); } - private ABAFile generateSettleAbaFile(String bank, Date dt, List settlements) { - ABAFile aba = ABATemplate.getConfig().initFile(bank, dt); + private ABAFile generateSettleAbaFile(String bank, BalanceGroup group, Date dt, List settlements) { + ABAFile aba = ABATemplate.getConfig().initFile(group, bank, dt); for (JSONObject settle : settlements) { if (!bank.equals(settle.getString("settle_bank"))) { continue; @@ -890,7 +894,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (clearClient == null) { throw new NotFoundException(); } - List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,client_id, + List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate, client_id, new PageBounds(Order.formString("order_id.asc"))); String timezone_client = client.getString("timezone"); @@ -1026,10 +1030,10 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) { + public void exportListClearingTransactions(int clientId, String clearingDetailId, JSONObject partner, HttpServletResponse resp) { OutputStream ous = null; try { - JSONObject clearTransation = listClearingTransactions(client_id, clearingDetailId, partner); + JSONObject clearTransation = listClearingTransactions(clientId, clearingDetailId, partner); resp.setContentType("application/octet-stream;"); Date reportDate = clearTransation.getDate("report_date"); resp.addHeader("Content-Disposition", @@ -1114,7 +1118,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider 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.containsKey("order_detail")?settle.getString("order_detail"):settle.getString("remark")); + row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(settle.containsKey("order_detail") ? settle.getString("order_detail") : settle.getString("remark")); String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-"); JSONObject device = clientDeviceMapper.find(settle.getString("dev_id")); String clientDevRemark = "-"; @@ -1174,7 +1178,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + reportDate); int rowNum = 0; Row row = sheet.createRow(rowNum); - String[] title = {"Client Moniker","Short Name","order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", + String[] title = {"Client Moniker", "Short Name", "order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", "Input Amount", "Total Amount", "Clearing Amount(AUD)", "Sruchange Rate", "Surcharge(AUD)", "GST(AUD)", "Settle Amount(AUD)", "Remark", "Dev No", "Dev Remark"}; 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++) { @@ -1380,7 +1384,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider attachList.add(attach1); JSONObject attach2 = new JSONObject(); - List abaFileList = getAba(date, "CBA", clearLogs); + List abaFileList = getAba(date, clearLogs); String fileName2 = "Merchant_Settlement_Info_aba_" + DateFormatUtils.format(date, "yyyyMMdd"); if (abaFileList.size() > 1) { fileName2 += ".zip"; @@ -1523,7 +1527,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider throw new ForbiddenException("Settlement log has been sent and unable to edit"); } ABAConfig config = ABATemplate.getConfig(); - String defaultBank = config.getRemainsTo(); + BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group")); + String defaultBank = config.getRemainsTo(group); clearingDetailMapper.updateAllBanks(defaultBank, clearingId); List details = clearingDetailMapper.listReportsOfSettlement(clearingId); details = mergeBatchSettleClients(details); @@ -1547,6 +1552,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (base == null) { throw new BadRequestException("Invalid bank code:" + bank); } + if (base.acceptBalanceGroup(group)) { + throw new BadRequestException("Balance group not match:" + group + ":" + bank); + } BigDecimal bankAmount = bankDistribution.getBigDecimal(bank); for (JSONObject detail : details) { String detailBank = detail.getString("settle_bank"); @@ -1639,6 +1647,15 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } } + @Override + public JSONObject findSettleLog(int clearingId) { + JSONObject clearing = clearingLogMapper.findById(clearingId); + if (clearing == null) { + throw new NotFoundException("Settle record not found:" + clearingId); + } + return clearing; + } + private void releaseDistributedSurcharge(JSONObject clearingDetail) { int clientId = clearingDetail.getIntValue("client_id"); BigDecimal distributedSurcharge = clearingDetail.getBigDecimal("distributed_surcharge"); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java index b3212360b..288da4cf8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java @@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.support.abafile.ABATemplate; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONObject; import org.springframework.core.io.ByteArrayResource; @@ -56,11 +57,13 @@ public class SettlementDevController { } } - @GetMapping("/available_banks") - public JSONObject getAvailableBanks() { - List banks = ABATemplate.getConfig().availableBanks(); + @GetMapping("/clearings/{clearingId}/available_banks") + public JSONObject getAvailableBanks(@PathVariable int clearingId) { + JSONObject clearing = cleanService.findSettleLog(clearingId); + BalanceGroup group = BalanceGroup.valueOf(clearing.getString("balance_group")); + List banks = ABATemplate.getConfig().availableBanks(group); JSONObject res = new JSONObject(); - res.put("remains_to", ABATemplate.getConfig().getRemainsTo()); + res.put("remains_to", ABATemplate.getConfig().getRemainsTo(group)); res.put("banks", banks); return res; } diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java index a7b70591f..dd7f85f77 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java @@ -1,9 +1,12 @@ package au.com.royalpay.payment.manage.support.abafile; import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup; +import org.apache.commons.lang3.ArrayUtils; import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.*; +import java.util.stream.Collectors; /** * Create by yixian at 2018-06-25 17:39 @@ -12,24 +15,24 @@ import java.util.*; public class ABAConfig { private Map bank = new HashMap<>(); - private String defaultBank; - private String remainsTo; - public ABAFile initFile(String bank, Date settleDate) { + public ABAFile initFile(BalanceGroup group, String bank, Date settleDate) { ABABase base = this.bank.get(bank); if (base == null) { throw new BadRequestException("Invalid bank:" + bank); } + if (!base.acceptBalanceGroup(group)) { + throw new BadRequestException("Balance group not match:" + group + "," + bank); + } return base.initFile(settleDate); } - public String getDefaultBank() { - return defaultBank; - } - - public ABAConfig setDefaultBank(String defaultBank) { - this.defaultBank = defaultBank; - return this; + public String getRemainsTo(BalanceGroup group) { + return bank.entrySet().stream() + .filter(entry -> entry.getValue().acceptBalanceGroup(group)) + .filter(entry -> !entry.getValue().isManualSending()) + .map(Map.Entry::getKey) + .findFirst().orElse(null); } public Map getBank() { @@ -45,17 +48,11 @@ public class ABAConfig { return this; } - public String getRemainsTo() { - return remainsTo; - } - - public ABAConfig setRemainsTo(String remainsTo) { - this.remainsTo = remainsTo; - return this; - } - - public List availableBanks() { - return new ArrayList<>(bank.keySet()); + public List availableBanks(BalanceGroup group) { + return bank.entrySet().stream() + .filter(entry -> entry.getValue().acceptBalanceGroup(group)) + .map(Map.Entry::getKey) + .collect(Collectors.toList()); } public static class ABABase { @@ -65,6 +62,7 @@ public class ABAConfig { private String bsb; private String accountNo; private String accountName; + private BalanceGroup[] balanceGroup; public ABAFile initFile(Date settleDate) { return new ABAFile(this, settleDate); @@ -123,5 +121,18 @@ public class ABAConfig { this.accountName = accountName; return this; } + + public BalanceGroup[] getBalanceGroup() { + return balanceGroup; + } + + public ABABase setBalanceGroup(BalanceGroup[] balanceGroup) { + this.balanceGroup = balanceGroup; + return this; + } + + public boolean acceptBalanceGroup(BalanceGroup group) { + return ArrayUtils.contains(balanceGroup, group); + } } } diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java index 0a82a12bf..9f9d9a41e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java @@ -13,7 +13,6 @@ import javax.annotation.PostConstruct; @EnableConfigurationProperties(ABAConfig.class) public class ABATemplate { private static ABATemplate tpl; - @Autowired private ABAConfig config; @PostConstruct @@ -24,4 +23,10 @@ public class ABATemplate { public static ABAConfig getConfig() { return tpl.config; } + + @Autowired + public ABATemplate setConfig(ABAConfig config) { + this.config = config; + return this; + } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 91c8f2a2f..c60ec9e93 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -121,24 +121,39 @@ settle: bank: ANZ: account-name: Tunnel Show Pty Ltd - account-no: 837022519 - apca: 514624 + account-no: '837022519' + apca: '514624' bank: ANZ - bsb: 13006 + bsb: '013006' manual-sending: true + balance-group: + - NORMAL_CROSS_BORDER CBA: account-name: Tunnel Show Pty Ltd - account-no: 11655861 - apca: 301500 + account-no: '11655861' + apca: '301500' bank: CBA - bsb: 63109 + bsb: '063109' + balance-group: + - NORMAL_CROSS_BORDER NAB: account-name: Tunnel Show Pty Ltd - account-no: 837022519 - apca: 514624 + account-no: '837022519' + apca: '514624' bank: NAB - bsb: 13006 + bsb: '013006' manual-sending: true + balance-group: + - NORMAL_CROSS_BORDER + CARD: + account-name: UPay Pty Ltd + account-no: '13677888' + apca: '301500' + bank: CBA + bsb: '063010' + balance-group: + - RPAY_SVC_CARD + - RPAY_SVC_DIRECTDEBIT default-bank: CBA remains-to: ANZ spring: diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js index ab825af23..3349db3f4 100644 --- a/src/main/ui/static/analysis/clearing-log.js +++ b/src/main/ui/static/analysis/clearing-log.js @@ -387,7 +387,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func }; $scope.distributeBankDialog = function () { - var log = $scope.getCurrentLog(); + let log = $scope.getCurrentLog(); $uibModal.open({ templateUrl: '/static/analysis/templates/settlement_bank_distribution_dialog.html', controller: 'bankDistributionDialogCtrl', @@ -396,7 +396,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func return log; }, banksConfig: ['$http', function ($http) { - return $http.get('/sys/settlement/available_banks') + return $http.get('/sys/settlement/clearings/' + log.clearing_id + '/available_banks') }], settleDate: function () { return $stateParams.date; @@ -496,24 +496,24 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.settleLogs = settleLogs.map(log => { let info = { 'id': log.clearing_id, - 'time':log.operate_time, - 'amount':log.net_amount, + 'time': log.operate_time, + 'amount': log.net_amount, 'remark': log.plan_detail.remark || log.plan_detail.plan_id, 'send': false }; return info }); - $scope.sumSelectedAmount = function(){ - let sendingLogs = $scope.settleLogs.filter(log=>log.send); - if(sendingLogs.length){ - return sendingLogs.map(log=>log.amount).reduce((m1,m2)=>m1+m2); - }else{ - return $scope.settleLogs.map(log=>log.amount).reduce((m1,m2)=>m1+m2); + $scope.sumSelectedAmount = function () { + let sendingLogs = $scope.settleLogs.filter(log => log.send); + if (sendingLogs.length) { + return sendingLogs.map(log => log.amount).reduce((m1, m2) => m1 + m2); + } else { + return $scope.settleLogs.map(log => log.amount).reduce((m1, m2) => m1 + m2); } }; $scope.config = {mark_sent: true}; - $scope.switchSendFlag=function(info){ - info.send=!info.send + $scope.switchSendFlag = function (info) { + info.send = !info.send }; $scope.sendCheckCodeButton = false; $scope.sendMailButton = false; @@ -522,7 +522,10 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.error_msg = '正在发送,请稍后。'; $scope.sendMailButton = true; $http.post('/sys/settlement/reports/' + $stateParams.date + '/send_settlement_xlsx', - {clearing_ids:$scope.settleLogs.filter(log=>log.send).map(log=>log.id),mark_sent:$scope.config.mark_sent}).then(function (resp) { + { + clearing_ids: $scope.settleLogs.filter(log => log.send).map(log => log.id), + mark_sent: $scope.config.mark_sent + }).then(function (resp) { $scope.error_msg = resp.data.msg; $scope.sendMailButton = false; if (resp.data.result == 0) { diff --git a/src/test/java/au/com/royalpay/payment/manage/task/RefundTest.java b/src/test/java/au/com/royalpay/payment/manage/task/RefundTest.java new file mode 100644 index 000000000..29c131dd4 --- /dev/null +++ b/src/test/java/au/com/royalpay/payment/manage/task/RefundTest.java @@ -0,0 +1,34 @@ +package au.com.royalpay.payment.manage.task; + +import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.RPayPaymentCardSvcApi; +import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; +import au.com.royalpay.payment.manage.tradelog.refund.RefundService; +import com.alibaba.fastjson.JSONObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import javax.annotation.Resource; +import java.math.BigDecimal; + +/** + * Create by davep at 2020-04-17 15:37 + */ +@SpringBootTest +@ActiveProfiles("officedev,wechat,jd,alipay,bestpay,rpay,yeepay,lakala,rppaysvc") +@RunWith(SpringJUnit4ClassRunner.class) +public class RefundTest { + @Resource + private RPayPaymentCardSvcApi rPayPaymentCardSvcApi; + @Resource + private ManagerMapper managerMapper; + + @Test + public void test() throws InterruptedException { + String refundId = "8956ae96-44c0-48e8-9865-865c05fd3831"; + rPayPaymentCardSvcApi.checkRefundStatus(refundId); + Thread.sleep(60_000); + } +} diff --git a/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java b/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java index 57e03c72f..cf8ed5471 100644 --- a/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java @@ -35,7 +35,7 @@ public class SettleMailTest { public void parse() throws IOException { Date date = DateUtils.truncate(new Date(), Calendar.DATE); final ArrayList clearIds = new ArrayList<>(); - List abaFileList = cleanService.getAba(date, "CBA", cleanService.getSettleLogs(date, clearIds)); + List abaFileList = cleanService.getAba(date, cleanService.getSettleLogs(date, clearIds)); Context ctx = new Context(); ctx.setVariable("date", DateFormatUtils.format(date, "dd-MM-yyyy")); From 93fecf86f36065f5843c591f72f989eff8fd010a Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 22 Apr 2020 21:19:35 +1000 Subject: [PATCH 04/12] aba config --- src/main/resources/application.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c60ec9e93..d409e8f01 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -154,8 +154,6 @@ settle: balance-group: - RPAY_SVC_CARD - RPAY_SVC_DIRECTDEBIT - default-bank: CBA - remains-to: ANZ spring: mail: host: smtp.office365.com From 4a07254f8ecef76a37079d0ec9f0e36714e0b379 Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 23 Apr 2020 09:58:32 +0800 Subject: [PATCH 05/12] fix run-task false --- pom.xml | 2 +- src/main/resources/application-common.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 19eca1053..4b1215746 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.2.7 + 2.2.8 UTF-8 1.8.0 diff --git a/src/main/resources/application-common.yml b/src/main/resources/application-common.yml index b997ca4d9..238e4f272 100644 --- a/src/main/resources/application-common.yml +++ b/src/main/resources/application-common.yml @@ -20,7 +20,6 @@ app: aes-key: NRvwd9dgbT2Cdz6zJz9AWA== control: aes-key: Aa+MtthC4Ztq4Kfa9aL+UA== - run-tasks: false server: ip: 127.0.0.1 settle: From e3fd3bf6c104ff72b4953363d7bb4b204261cf90 Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 23 Apr 2020 14:41:57 +0800 Subject: [PATCH 06/12] fix settlement log detail logo --- src/main/ui/static/analysis/clearing-log.js | 4 ++++ src/main/ui/static/commons/services/clearingDetailService.js | 4 ++++ src/main/ui/static/config/bdprize/bdprize.js | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js index 3349db3f4..5375001b6 100644 --- a/src/main/ui/static/analysis/clearing-log.js +++ b/src/main/ui/static/analysis/clearing-log.js @@ -559,6 +559,10 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func return '/static/images/yeepay_sign_lg.png'; case 'LakalaPay': return '/static/images/lakalapay_sign_lg.png'; + case 'rpaypmt_card': + return '/static/images/card_payment_sign_lg.png'; + case 'rpaypmt_dd': + return '/static/images/direct_debit_sign_lg.png'; } } }); diff --git a/src/main/ui/static/commons/services/clearingDetailService.js b/src/main/ui/static/commons/services/clearingDetailService.js index 7d347e1cf..7e0bd7faa 100644 --- a/src/main/ui/static/commons/services/clearingDetailService.js +++ b/src/main/ui/static/commons/services/clearingDetailService.js @@ -87,6 +87,10 @@ define(['../app','decimal'], function (app,Decimal) { return '/static/images/hf_sign_lg.png'; case 'Rpay': return '/static/images/rpayplus_sign_lg.png'; + case 'rpaypmt_card': + return '/static/images/card_payment_sign_lg.png'; + case 'rpaypmt_dd': + return '/static/images/direct_debit_sign_lg.png'; } } }); diff --git a/src/main/ui/static/config/bdprize/bdprize.js b/src/main/ui/static/config/bdprize/bdprize.js index 46acd352f..eaac60668 100644 --- a/src/main/ui/static/config/bdprize/bdprize.js +++ b/src/main/ui/static/config/bdprize/bdprize.js @@ -415,6 +415,10 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { return '/static/images/yeepay_sign_lg.png'; case 'LakalaPay': return '/static/images/lakalapay_sign_lg.png'; + case 'rpaypmt_card': + return '/static/images/card_payment_sign_lg.png'; + case 'rpaypmt_dd': + return '/static/images/direct_debit_sign_lg.png'; } } }); From 56de9cbe6628c6b713f16742efa86d3dd5945c3a Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 23 Apr 2020 15:07:01 +0800 Subject: [PATCH 07/12] fix settlement log detail logo --- src/main/ui/static/images/bank/CARD.png | Bin 0 -> 1662 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/ui/static/images/bank/CARD.png diff --git a/src/main/ui/static/images/bank/CARD.png b/src/main/ui/static/images/bank/CARD.png new file mode 100644 index 0000000000000000000000000000000000000000..733de6180dd4ebb5adb8465765adeaa001177cd2 GIT binary patch literal 1662 zcmV-^27&pBP)>=E_jetq&Z9kWK&q1zSl(K~#90&72E+(>4@_6JH83NlA&yXx6%2!iJWuEZlZu zP+%Jy|NjpW+e%{Dy6YUt-w){XKIheuj%7Ea5m@Ha8QdR(OL3h}Phvy#Q!LVPdNDY# z*)koE$LTbW4Z^3Wu_~}ZRjiWOBwY*$Y&P9vRTUddSLRQSSUa%mNo=4d`7|51lRhe9 zBUPDS^H}3?wj6-U$&)Ttr80WOibWr509~0+Qvp`B#-c9%$x@6}Z5I($7LR0DQB_V9 zSP@m`Qi*$&QNUCZBdW}`SW#5!Bt}xHUh?gV1>G)8Bt}q~FGYt>bd~x}=0SxaDpIy6SA>Lh_ zI!oMxouXh}_+jn9E)c+Gp4Dn92Hus0;|9?M1Fo1)Cvsr0D*ZZ<1B2{J7>Ro@u!=!R zWMEJ#XMokJ!C+JtU~B6L25=<7N@QUED&6KSEtv1)+X=ufF9!3fnE#n51@lpfBawl* zkJeZc8JMd|j85dh+}^%H3^p1tm%9u3l`bHd{pGOT9fUKO?Zb%qMUp3&oyrgr8JLaA zQ{+zMz!t{a1@;Ef0lP4)nES)NTeAPZ8Jff@Wc~R+1F*0XcUgT-l7F>em`AlJyJ{tg z9xS}Xr%9p*iy~1E=6W0G8nXV79P;?Sv|52Th=W81CaKsYp2Q~K3BiJQ;_5@viAd#X z@D1W=7fYn_1ntR3l9d3fuW}N4$(KEeP0sEOP9g(qRSfU(RT8npuFBvNS1;vQNpkgo zRV(gx+Ryp@7!os;#3t1~Ci@}@D;kNcVwa=gbRq{fnhU;n!%Mb$XM&YnR_9_kFw#A$ z#c4LzJXpoZ+NfGLY|js+GBaCSmBc39FHn(E{$MVVf%U#YMF_dIkr+&6wlP{Nm~Wx~Ib0RSc&qH<~%(Mp>;I45MP?wYpqtiD)Xb zQawALX(VE)r0Nq}FA+&)sa#zq5}8Wa?SgLKD6n*$$W;tARu3hy ziHpiibUz3uk%8G)jL@G@B{s1idjuC=Zi9_Fwr3@|?Tydk7wf(e{SttxT+g~#S14GP zU74*ubtQVAiL%(7mAwluzrjWWX0EdATzFj}Vp*u9+fWjln5v}w_>3u$ff=bJ{FTHR zI+mHr&Jlzyv5A37{uR|jiyIp+Fx||bt^Nrtv58J4xqT5@A_G%bto=sM{5B9BtbJme zUFiaXDO9#j?2r-}n6zTq`cN+X?X(|hR~|3CWM5d~My9gdUwGjj)e10S#SR0`#EGwFN2ht6wWD_{UfKaBGZ? z>$MepmlvhI#_IRQ(0357nIBY=?epE470qy!&fl)vA(@-~RbWYzR^2zXMAA3LsE_4A?NRAOHXW07*qo IM6N<$f(<(q+5i9m literal 0 HcmV?d00001 From 9d4f6375cf3994dace9e408f56de1c000f03bcf4 Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 23 Apr 2020 16:59:22 +0800 Subject: [PATCH 08/12] update 2.1.28 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4b1215746..d9906ee3d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ au.com.royalpay.payment payment-parent - 2.1.26 + 2.1.28 4.0.0 manage - 2.2.8 + 2.2.9 UTF-8 1.8.0 From c952aab8ce904bc4146e5049faf5dab9f661a1fb Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 23 Apr 2020 18:05:27 +0800 Subject: [PATCH 09/12] add synchronizedScheduler citypartner prize --- pom.xml | 2 +- .../manage/task/OrgCommissionTask.java | 24 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index d9906ee3d..3b96f3bfc 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.2.9 + 2.2.10 UTF-8 1.8.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java b/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java index 614ef9212..1a7a42647 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java @@ -5,10 +5,12 @@ 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 org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.Calendar; import java.util.Date; +import java.util.List; @Component @ConditionalOnProperty(value = "app.run-tasks", havingValue = "true") @@ -21,16 +23,18 @@ public class OrgCommissionTask { @Scheduled(cron = "0 15 0 1 * ?") public void generateOrgCommission() { - Calendar monthCal = Calendar.getInstance(); - monthCal.setTime(new Date()); - int year = monthCal.get(Calendar.YEAR); - int month = monthCal.get(Calendar.MONTH); - if (month == 0) { - year = year - 1; - month = 12; - } - String monthStr = year + "-" + month; - cityPartnerPrizeService.generate(monthStr); + synchronizedScheduler.executeProcess("manage_task:cityPartnerPrize", 120_000, () -> { + Calendar monthCal = Calendar.getInstance(); + monthCal.setTime(new Date()); + int year = monthCal.get(Calendar.YEAR); + int month = monthCal.get(Calendar.MONTH); + if (month == 0) { + year = year - 1; + month = 12; + } + String monthStr = year + "-" + month; + cityPartnerPrizeService.generate(monthStr); + }); } } From d98f927d16b2b38dfa355926d8b2c08702d1ac00 Mon Sep 17 00:00:00 2001 From: yixian Date: Fri, 24 Apr 2020 11:42:44 +1000 Subject: [PATCH 10/12] send settle email notify details --- .../management/clearing/core/impl/CleanServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 927780431..ed54117d0 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 @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.management.clearing.core.impl; import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.tasksupport.SettlementSupport; +import au.com.royalpay.payment.core.utils.ExtParamsUtils; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper; @@ -1433,7 +1434,12 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider settleMailRecord.put("notice_status", 0); logSettleMailMapper.save(settleMailRecord); } - sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方", "发送清算通知"); + String detailDescription = clearLogs.stream() + .map(log -> String.format("[%s]%s", log.getString("clearing_id"), + ExtParamsUtils.getExtParamsValue(log.getString("plan_detail"), + detail -> StringUtils.defaultIfEmpty(detail.getString("remark"), detail.getString("plan_id"))))) + .collect(Collectors.joining(",")); + sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方:"+detailDescription, "发送清算通知"); if (autoMarkSent) { if (!clearIds.isEmpty()) { clearingLogMapper.lockSettlementsById(clearLogs.stream().map(log -> log.getString("clearing_id")).collect(Collectors.toList())); From 33dd59d2237665499ee7ea0e1f1a368c894ce35b Mon Sep 17 00:00:00 2001 From: luoyang Date: Fri, 24 Apr 2020 14:21:09 +0800 Subject: [PATCH 11/12] =?UTF-8?q?add=20gateway=E3=80=81channel=20analysis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../core/impls/DashboardServiceImpl.java | 6 +- .../CustomerAndOrdersStatisticsMapper.xml | 2 +- .../mappers/TransactionAnalysisMapper.xml | 8 + .../ui/static/analysis/channels_analysis.js | 77 ++++- .../config/organizations/organizations.js | 13 + .../templates/org_detail_parent.html | 274 ++++-------------- 7 files changed, 154 insertions(+), 228 deletions(-) diff --git a/pom.xml b/pom.xml index 3b96f3bfc..b48a6e73a 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.2.10 + 2.2.11 UTF-8 1.8.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index b248cb2e6..98c6fb3b3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -16,6 +16,7 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DurationFormatUtils; import org.slf4j.Logger; @@ -558,7 +559,10 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT record.put("new_customers",newCustomers); record.put("old_customers",oldCustomers); record.put("client_id",client.getIntValue("client_id")); - customerAndOrdersStatisticsMapper.save(record); + if (StringUtils.equalsIgnoreCase("rpaypmt_card", record.getString("channel")) || StringUtils.equalsIgnoreCase("rpaypmt_dd", record.getString("channel"))) { + record.put("single_amount", record.getBigDecimal("total").divide(record.getBigDecimal("orders"), 2, RoundingMode.HALF_UP)); + } + customerAndOrdersStatisticsMapper.save(record); } } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml index 0cd8a813d..24eea92c2 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml @@ -145,7 +145,7 @@
- -
@@ -462,88 +325,65 @@
-
-
- - + From a5680a8aa4d3888d7bfe2da2b72aae65470cdfe0 Mon Sep 17 00:00:00 2001 From: yixian Date: Sun, 26 Apr 2020 19:01:11 +1000 Subject: [PATCH 12/12] card pay ui --- src/main/ui/static/templates/payment/v1/card_pay.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b8ccf86aa..8506924ab 100644 --- a/src/main/ui/static/templates/payment/v1/card_pay.js +++ b/src/main/ui/static/templates/payment/v1/card_pay.js @@ -1,7 +1,7 @@ $(function () { let $container = $('.card-input-box')[0]; let ctrl = {ready: false, pending: false} - let cardFrame = window.channel_account_id ? new TokenInputFrame($container, window.channel_account_id) : new CardInputFrame($container); + let cardFrame = new CardInputFrame($container, window.card_input_appid, window.card_input_token); let $errorMsgBox = $('#errorMsgBox'); let loading = $('.loading-container'); cardFrame.onSuccess = function (secretData) {