From 2ad3ba5e7302e2e0556d8c3b283fc9dfbaed248f Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 4 Apr 2019 17:54:01 +0800 Subject: [PATCH 1/3] commit tmp --- ...FinancialSurchargeAccountDetailMapper.java | 9 ++-- .../core/SurchargeAccountService.java | 2 + .../impl/SurchargeAccountServiceImpl.java | 48 ++++++++++++++++++- .../web/SurchargeAccountController.java | 6 ++- .../task/SurchargeAccountMonthTask.java | 3 -- .../ClearingDistributedSurchargeMapper.xml | 3 +- .../partner-surcharge-account.js | 34 ++++++++++++- .../templates/account_month_logs.html | 18 +++++-- 8 files changed, 108 insertions(+), 15 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java index 627d47cbe..0652c16ff 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java @@ -13,6 +13,9 @@ import java.util.List; @AutoMapper(tablename = "financial_surcharge_account_detail", pkName = "detail_id") public interface FinancialSurchargeAccountDetailMapper { + @AutoSql(type = SqlType.SELECT) + JSONObject findByDetailId(@Param("detail_id") String detail_id); + List findDetailsByMonth(@Param("settle_month") String settle_month); List findDetailsByClientId(@Param("client_id") int client_id); @@ -20,9 +23,9 @@ public interface FinancialSurchargeAccountDetailMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject detail); - List listSettlementDatesInMonth(@Param("month") String month); - - + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject detail); + List listSettlementDatesInMonth(@Param("month") String month); } diff --git a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/SurchargeAccountService.java b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/SurchargeAccountService.java index 1b86f2c97..fb86eaf0a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/SurchargeAccountService.java +++ b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/SurchargeAccountService.java @@ -11,4 +11,6 @@ public interface SurchargeAccountService { List listSettledDatesInMonth(String mon); + void fillMothsSurcharge(JSONObject manager, String detail_id); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java index cf83bdac9..24f7b9c92 100644 --- a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java @@ -1,9 +1,14 @@ package au.com.royalpay.payment.manage.surchargeAccount.core.impl; import au.com.royalpay.payment.manage.mappers.system.ClearingDistributedSurchargeMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientsSurchargeAccountsMapper; import au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper; import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService; import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl; +import au.com.royalpay.payment.tools.exceptions.ForbiddenException; +import au.com.royalpay.payment.tools.exceptions.ServerErrorException; +import au.com.royalpay.payment.tools.lock.Locker; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.time.DateFormatUtils; import org.slf4j.Logger; @@ -12,6 +17,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -24,6 +30,10 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{ private ClearingDistributedSurchargeMapper clearingDistributedSurchargeMapper; @Resource private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper; + @Resource + private Locker locker; + @Resource + private ClientsSurchargeAccountsMapper clientsSurchargeAccountsMapper; Logger logger = LoggerFactory.getLogger(ClientContractServiceImpl.class); @@ -50,6 +60,7 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{ detail.put("wx_send", 0); detail.put("settle_month", DateFormatUtils.format(datefrom, "yyyy-MM")); detail.put("create_time", new Date()); + detail.put("is_valid", 0); financialSurchargeAccountDetailMapper.save(detail); } @@ -59,8 +70,41 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{ @Override public List listSettledDatesInMonth(String mon) { - List settledDates = financialSurchargeAccountDetailMapper.listSettlementDatesInMonth(mon); + return financialSurchargeAccountDetailMapper.listSettlementDatesInMonth(mon); + } - return settledDates; + @Override + public void fillMothsSurcharge(JSONObject manager, String detail_id) { + if (!(ManagerRole.ADMIN.hasRole(manager.getIntValue("role")) || ManagerRole.OPERATOR.hasRole(manager.getIntValue("role")) || ManagerRole.FINANCIAL_STAFF.hasRole(manager.getIntValue("role")))) { + throw new ForbiddenException("无法执行平账操作,权限不足"); + } + JSONObject detail = financialSurchargeAccountDetailMapper.findByDetailId(detail_id); + if (!locker.lock(detail.getIntValue("client_id") + "_" + detail.getString("settle_month") + "_fill", 120_000)) { + throw new ServerErrorException("Processing task, wait for a moment"); + } + try { + JSONObject surcharge_account = clientsSurchargeAccountsMapper.find(detail.getIntValue("client_id")); + JSONObject transaction = new JSONObject(); + transaction.put("client_id", detail.getIntValue("client_id")); + transaction.put("settle_date", detail.getString("settle_date")); + transaction.put("type", "Credit"); + transaction.put("total_surcharge", BigDecimal.ZERO); + transaction.put("tax_amount", BigDecimal.ZERO); + transaction.put("amount", detail.getBigDecimal("debit_amount")); + transaction.put("post_balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount"))); + transaction.put("operation", manager.getString("manager_id")); + transaction.put("create_time", new Date()); + transaction.put("remark", detail.getString("settle_date")+"冲正"); + clearingDistributedSurchargeMapper.save(transaction); + + surcharge_account.put("balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount"))); + clientsSurchargeAccountsMapper.update(surcharge_account); + + detail.put("is_valid", 1); + detail.put("operator_id", manager.getString("manager_id")); + financialSurchargeAccountDetailMapper.update(detail); + } finally { + locker.unlock(detail.getIntValue("client_id") + "_" + detail.getString("settle_month") + "_fill"); + } } } diff --git a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/web/SurchargeAccountController.java b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/web/SurchargeAccountController.java index 114f4ba4e..ca7729a21 100644 --- a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/web/SurchargeAccountController.java +++ b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/web/SurchargeAccountController.java @@ -19,7 +19,6 @@ import java.util.List; @RestController public class SurchargeAccountController { - @Resource private SurchargeAccountService surchargeAccountService; @@ -27,4 +26,9 @@ public class SurchargeAccountController { public List surchargeAccountSettledDates(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String month) { return surchargeAccountService.listSettledDatesInMonth(month); } + + @ManagerMapping(value = "/fill/{detail_id}", role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF}, method = RequestMethod.PUT) + public void fillMothsSurcharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String detail_id) { + surchargeAccountService.fillMothsSurcharge(manager, detail_id); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java b/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java index 4897b1e2b..9abb2d8ad 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java @@ -16,9 +16,6 @@ public class SurchargeAccountMonthTask { @Resource private SurchargeAccountService surchargeAccountService; - - - @Scheduled(cron = "0 30 6 1 * ?") public void generateSurchargeAccountDetail() { synchronizedScheduler.executeProcess("manage_task:generateSurchargeAccountMonth", 120_000, () -> diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml index 99897a8f2..cf134f79b 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml @@ -5,7 +5,8 @@ =#{datefrom} AND d.create_time < #{dateto} AND c.is_valid= 1 diff --git a/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js b/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js index 161f419fc..ded9f5836 100644 --- a/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js +++ b/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js @@ -67,7 +67,6 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func return start <= mon && end >= mon }; $scope.loadReport = function (mon) { - $http.get('/sys/surcharge_account/month/' + mon + '/settled_dates').then(function (resp) { $scope.report = { month: mon, @@ -97,6 +96,39 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.loadReport($scope.report.month); }); }; + $scope.openClientBoard = function (client) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/partner_card.html', + controller: 'partnerCardCtrl', + resolve: { + clientMoniker: function () { + return client.client_moniker + } + }, + size: 'lg' + }) + + }; + $scope.fillMonthsSurcharge = function (details) { + var contentHtml = $sce.trustAsHtml('即将为[' + $scope.details.short_name + '],冲正,请确认商户信息'); + + commonDialog.confirm({ + title: '后付费账户冲正', + content: '', + choises: [{label: 'OK', className: 'btn-success', key: '1'}, + {label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}], + contentHtml: contentHtml + }).then(function () { + $http.post('/sys/settlement/settlement_notice').then(function () { + commonDialog.alert({title: 'Success', content: '发送成功', type: 'success'}); + $scope.noticeResend = false; + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + $scope.noticeResend = false; + }); + }) + + }; diff --git a/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html b/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html index 2b2a39c8b..663aa6ca9 100644 --- a/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html +++ b/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html @@ -48,24 +48,34 @@ Short Name 充值总额 支出总额 - 余额 + 已结清 + 操作 - + + + + - {{details.balance|currency:'$'}} - {{details.balance|currency:'$'}} + 已结清 + 未付款 + + + + + From 652c076016ba924681a382cea51e99480cfb28cd Mon Sep 17 00:00:00 2001 From: luoyang Date: Mon, 8 Apr 2019 10:31:26 +0800 Subject: [PATCH 2/3] tmp commit fix getClearDetailTotal --- .../merchants/core/impls/ClientManagerImpl.java | 1 - .../core/impl/SurchargeAccountServiceImpl.java | 15 +++++++-------- .../manage/task/SurchargeAccountMonthTask.java | 2 +- .../manage/mappers/payment/TransactionMapper.xml | 5 +++++ .../surchargeaccount/partner-surcharge-account.js | 13 ++++++------- .../templates/account_month_logs.html | 14 +++++++------- 6 files changed, 26 insertions(+), 24 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 e2e783400..f82b820e5 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 @@ -3446,7 +3446,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - JSONObject params = new JSONObject(); params.put("client_id", client.getIntValue("client_id")); params.put("year", date.substring(0, 4)); diff --git a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java index 24f7b9c92..ccc0a6064 100644 --- a/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/surchargeAccount/core/impl/SurchargeAccountServiceImpl.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientsSurchargeAccountsMap import au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper; import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService; import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.lock.Locker; @@ -50,11 +51,9 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{ Date dateto = monthCal.getTime(); monthCal.set(Calendar.MONTH, (monthCal.get(Calendar.MONTH) - 1)); Date datefrom = monthCal.getTime(); - logger.info("===============Start generator surcharge account month detail===============" + new Date()); List thisMonthDetail = clearingDistributedSurchargeMapper.getMonthDetailByClientId(datefrom, dateto); logger.info("this month details : " + thisMonthDetail.toString()); - for (JSONObject detail : thisMonthDetail) { detail.put("send_mail", 0); detail.put("wx_send", 0); @@ -63,9 +62,7 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{ detail.put("is_valid", 0); financialSurchargeAccountDetailMapper.save(detail); } - logger.info("===============generator OVER===============" + new Date()); - } @Override @@ -79,6 +76,9 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{ throw new ForbiddenException("无法执行平账操作,权限不足"); } JSONObject detail = financialSurchargeAccountDetailMapper.findByDetailId(detail_id); + if (detail.getBooleanValue("is_valid")) { + throw new BadRequestException("该记录已结清"); + } if (!locker.lock(detail.getIntValue("client_id") + "_" + detail.getString("settle_month") + "_fill", 120_000)) { throw new ServerErrorException("Processing task, wait for a moment"); } @@ -86,20 +86,19 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{ JSONObject surcharge_account = clientsSurchargeAccountsMapper.find(detail.getIntValue("client_id")); JSONObject transaction = new JSONObject(); transaction.put("client_id", detail.getIntValue("client_id")); - transaction.put("settle_date", detail.getString("settle_date")); +// transaction.put("settle_date", detail.getString("settle_month")); transaction.put("type", "Credit"); transaction.put("total_surcharge", BigDecimal.ZERO); transaction.put("tax_amount", BigDecimal.ZERO); - transaction.put("amount", detail.getBigDecimal("debit_amount")); + transaction.put("amount", detail.getBigDecimal("debit_amount").negate()); transaction.put("post_balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount"))); transaction.put("operation", manager.getString("manager_id")); transaction.put("create_time", new Date()); - transaction.put("remark", detail.getString("settle_date")+"冲正"); + transaction.put("remark", detail.getString("settle_month")+"冲正"); clearingDistributedSurchargeMapper.save(transaction); surcharge_account.put("balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount"))); clientsSurchargeAccountsMapper.update(surcharge_account); - detail.put("is_valid", 1); detail.put("operator_id", manager.getString("manager_id")); financialSurchargeAccountDetailMapper.update(detail); diff --git a/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java b/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java index 9abb2d8ad..eaa7e9031 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/SurchargeAccountMonthTask.java @@ -16,7 +16,7 @@ public class SurchargeAccountMonthTask { @Resource private SurchargeAccountService surchargeAccountService; - @Scheduled(cron = "0 30 6 1 * ?") + @Scheduled(cron = "0 30 23 1 * ?") public void generateSurchargeAccountDetail() { synchronizedScheduler.executeProcess("manage_task:generateSurchargeAccountMonth", 120_000, () -> surchargeAccountService.generatorMonthDetail()); 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 9ad45c620..62d7ec5c2 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 @@ -1074,10 +1074,15 @@ WHERE t.channel = 'Settlement' ]]> + AND t.client_id IN #{clientId} + + + and t.client_id=#{client_id} + and t.transaction_time >= #{from} and t.transaction_time < #{to} GROUP BY diff --git a/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js b/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js index ded9f5836..f117705df 100644 --- a/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js +++ b/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js @@ -47,8 +47,8 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func }]); - app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser', - function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser) { + app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser','$sce', + function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser, $sce) { $scope.params = {year: new Date().getFullYear()}; $scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()]; $scope.initMonth = function (year) { @@ -110,7 +110,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func }; $scope.fillMonthsSurcharge = function (details) { - var contentHtml = $sce.trustAsHtml('即将为[' + $scope.details.short_name + '],冲正,请确认商户信息'); + var contentHtml = $sce.trustAsHtml('即将为[' + details.short_name + ']冲正,请确认商户信息'); commonDialog.confirm({ title: '后付费账户冲正', @@ -119,12 +119,11 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func {label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}], contentHtml: contentHtml }).then(function () { - $http.post('/sys/settlement/settlement_notice').then(function () { - commonDialog.alert({title: 'Success', content: '发送成功', type: 'success'}); - $scope.noticeResend = false; + $http.put('/sys/surcharge_account/fill/' + details.detail_id).then(function () { + commonDialog.alert({title: 'Success', content: '冲正成功', type: 'success'}); + $scope.loadReport($scope.report.month); }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - $scope.noticeResend = false; }); }) diff --git a/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html b/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html index 663aa6ca9..729de8427 100644 --- a/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html +++ b/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html @@ -55,15 +55,15 @@ - + - - - - + + + + 已结清 未付款 @@ -71,11 +71,11 @@ - + - + From f777b4cee46ca29de4c33dfd3985362e9b07c3f6 Mon Sep 17 00:00:00 2001 From: luoyang Date: Mon, 8 Apr 2019 14:52:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?commit=20=E7=AD=89=E5=BE=85invoice=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clearing/core/impl/CleanServiceImpl.java | 8 +- .../web/CleanLogManagementController.java | 13 ++- .../ClearingDistributedSurchargeMapper.java | 2 - ...FinancialSurchargeAccountDetailMapper.java | 2 + .../manage/merchants/core/ClientManager.java | 2 + .../core/impls/ClientManagerImpl.java | 9 +++ .../merchants/web/PartnerViewController.java | 12 +++ .../ClearingDistributedSurchargeMapper.xml | 1 + .../FinancialSurchargeAccountDetailMapper.xml | 13 ++- src/main/ui/manage.html | 5 ++ .../ui/static/menu/templates/main_menu.html | 10 +++ .../partner-surcharge-account.js | 43 ++++++---- .../templates/account_month_logs.html | 6 +- .../templates/client_surcharge_account.html | 79 +++++++++++++------ .../client_surcharge_account_dialog.html | 39 +++++++++ .../partner_surcharge_account_dialog.html | 7 +- 16 files changed, 198 insertions(+), 53 deletions(-) create mode 100644 src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account_dialog.html 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 b225324dc..4f7b43440 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 @@ -734,11 +734,11 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider JSONObject client = clientManager.getClientInfo(client_id); Assert.notNull(client, "Client not exists"); int parent_client_id = client.getIntValue("parent_client_id"); - - if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) { - throw new ForbiddenException("No Permission"); + if (partner.get("client_id") != null) { + if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) { + throw new ForbiddenException("No Permission"); + } } - JSONObject clearClient = clearingDetailMapper.listReport(clearingDetailId, client_id); if (clearClient == null) { throw new NotFoundException(); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogManagementController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogManagementController.java index 23a43c2b3..3d196aaa0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogManagementController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogManagementController.java @@ -1,17 +1,16 @@ package au.com.royalpay.payment.manage.management.clearing.web; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; +import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery; import au.com.royalpay.payment.tools.CommonConsts; import com.alibaba.fastjson.JSONObject; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -44,4 +43,10 @@ public class CleanLogManagementController { return cleanService.getSettlementLogs(query, manager); } + @PartnerMapping("/{client_id}/settlement_logs/{clearingDetailId}/export") + public void exportListClearingTransactions(@PathVariable int client_id, @PathVariable String clearingDetailId, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject partner, HttpServletResponse resp) { + cleanService.exportListClearingTransactions(client_id, clearingDetailId, partner, resp); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.java index 9ee7f24e5..02e44f2c3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.java @@ -22,6 +22,4 @@ public interface ClearingDistributedSurchargeMapper { List getMonthDetailByClientId(@Param("datefrom") Date datefrom, @Param("dateto") Date dateto); List findTransactionsByDate(JSONObject params); - - } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java index 0652c16ff..eb598b9b4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/FinancialSurchargeAccountDetailMapper.java @@ -27,5 +27,7 @@ public interface FinancialSurchargeAccountDetailMapper { void update(JSONObject detail); List listSettlementDatesInMonth(@Param("month") String month); + + List listSettlementDatesByClientId(@Param("client_id") int client_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 4c6106903..a8b73985e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -287,6 +287,8 @@ public interface ClientManager { List getAccountTransactions(JSONObject account,String clientMoniker); + List getAccountDetailByMonths(JSONObject account,String clientMoniker); + List getAccountTransactionsByDate(JSONObject account,String clientMoniker, String date); List getAccountMonthDetails(JSONObject account,String clientMoniker); 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 f82b820e5..851f1fe89 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 @@ -3440,6 +3440,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return transactions; } + @Override + public List getAccountDetailByMonths(JSONObject account, String clientMoniker) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + return financialSurchargeAccountDetailMapper.listSettlementDatesByClientId(client.getIntValue("client_id")); + } + @Override public List getAccountTransactionsByDate(JSONObject account, String clientMoniker, String date) { JSONObject client = getClientInfoByMoniker(clientMoniker); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index 25e7ae85d..64058ab27 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -195,6 +195,18 @@ public class PartnerViewController { return clientManager.getAccountTransactions(manager, clientMoniker); } + @PartnerMapping(value = "/{clientMoniker}/account/transactions/date", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER}) + @ResponseBody + public List accountTransactionsByDate(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject manager, @PathVariable String clientMoniker,@RequestParam String date) { + return clientManager.getAccountTransactionsByDate(manager, clientMoniker, date); + } + + @PartnerMapping(value = "/{clientMoniker}/account/months", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER}) + @ResponseBody + public List getAccountDetailByMonths(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject manager, @PathVariable String clientMoniker){ + return clientManager.getAccountDetailByMonths(manager, clientMoniker); + } + @PartnerMapping(value = "/accounts/{accountId}/audit_refund", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) @ResponseBody public void toggleAccountAuditRefund(@PathVariable String accountId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) { diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml index cf134f79b..5632543bf 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClearingDistributedSurchargeMapper.xml @@ -4,6 +4,7 @@ + \ No newline at end of file diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index 38d1a8ee3..250e8c82b 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -608,6 +608,11 @@ margin-bottom: 10%;"/> 商户欠款|Pre Refund +
  • + + 后付费收款 + +
  • diff --git a/src/main/ui/static/menu/templates/main_menu.html b/src/main/ui/static/menu/templates/main_menu.html index cccf149df..30a9608b8 100644 --- a/src/main/ui/static/menu/templates/main_menu.html +++ b/src/main/ui/static/menu/templates/main_menu.html @@ -821,6 +821,16 @@ +
    diff --git a/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js b/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js index f117705df..c122470b7 100644 --- a/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js +++ b/src/main/ui/static/payment/surchargeaccount/partner-surcharge-account.js @@ -21,18 +21,16 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func controller: 'surchargeAccountMonthCtrl' }) }]); - app.controller('clientSurchargeAccountCtrl', ['$scope', '$http','$state','$filter', 'commonDialog','partner', function ($scope, $http,$state,$filter, commonDialog, partner) { + app.controller('clientSurchargeAccountCtrl', ['$scope', '$http','$state','$filter', 'commonDialog','partner','$uibModal', function ($scope, $http,$state,$filter, commonDialog, partner,$uibModal) { $scope.partner = angular.copy(partner.data); $scope.getBalance = function () { $scope.surcharge = {}; - if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == "distributed") { $http.get('/client/partner_info/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) { $scope.surcharge = resp.data; }) - } }; @@ -45,6 +43,32 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.getBalance(); $scope.getTransactions(); + $scope.getDetailByMonths = function () { + $http.get('/client/partner_info/' + $scope.partner.client_moniker + '/account/months').then(function (resp) { + $scope.report = resp.data; + }) + }; + $scope.getDetailByMonths(); + $scope.surchargeAccountDetail = function (client_moniker,mon) { + $uibModal.open({ + templateUrl: '/static/payment/surchargeaccount/templates/client_surcharge_account_dialog.html', + controller: 'accountDetailCtrl', + size: 'lg', + resolve: { + client_moniker: function () { + return client_moniker; + }, + month: function () { + return mon; + }, + transactions: ['$http', function ($http) { + return $http.get('/client/partner_info/' + client_moniker + '/account/transactions/date?date=' + mon); + }] + } + }); + }; + + }]); app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser','$sce', @@ -96,19 +120,6 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.loadReport($scope.report.month); }); }; - $scope.openClientBoard = function (client) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/partner_card.html', - controller: 'partnerCardCtrl', - resolve: { - clientMoniker: function () { - return client.client_moniker - } - }, - size: 'lg' - }) - - }; $scope.fillMonthsSurcharge = function (details) { var contentHtml = $sce.trustAsHtml('即将为[' + details.short_name + ']冲正,请确认商户信息'); diff --git a/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html b/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html index 729de8427..acc93428d 100644 --- a/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html +++ b/src/main/ui/static/payment/surchargeaccount/templates/account_month_logs.html @@ -46,9 +46,10 @@ 商户编号 Short Name + Total Surcharge 充值总额 支出总额 - 已结清 + 是否结清 操作 @@ -57,10 +58,11 @@ + ui-sref="partners.detail({clientMoniker:details.client_moniker})"> + diff --git a/src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account.html b/src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account.html index 184c4becb..43e3e0e12 100644 --- a/src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account.html +++ b/src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account.html @@ -1,4 +1,3 @@ -

    Client Surcharge Account @@ -14,40 +13,31 @@
    -
    +

    {{surcharge.balance|currency:'AUD'}}

    - - - - - + + + + + - - - - - - - + + + + + + +
    -
    @@ -112,3 +102,46 @@

    +
    +

    + 每月手续费 +

    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + +
    清算月份Total Surcharge支出总额是否结清操作
    + 已结清 + 未付款 + + +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account_dialog.html b/src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account_dialog.html new file mode 100644 index 000000000..acf867ea1 --- /dev/null +++ b/src/main/ui/static/payment/surchargeaccount/templates/client_surcharge_account_dialog.html @@ -0,0 +1,39 @@ + + diff --git a/src/main/ui/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html b/src/main/ui/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html index 43d081316..8ebfc3457 100644 --- a/src/main/ui/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html +++ b/src/main/ui/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html @@ -78,7 +78,12 @@ - + + {{tr.remark}} + + + +