From 243a085b444bcf3e64c502ffb3c1d19bbe888025 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 21 Mar 2018 09:53:21 +0800 Subject: [PATCH] add manual settle --- src/db/modify.sql | 3 +- .../impls/ActMonDelaySettleServiceImp.java | 16 ++-------- .../manage/merchants/core/ClientManager.java | 2 +- .../core/impls/ClientManagerImpl.java | 19 ++++++++++- .../web/PartnerManageController.java | 6 ++++ .../merchants/web/PartnerViewController.java | 32 +++++++++++++++---- .../templates/activity/mondelay/mondelay.html | 2 +- .../static/payment/partner/partner-manage.js | 5 +++ src/main/ui/static/payment/partner/partner.js | 5 +++ .../templates/client_bankaccounts.html | 7 ++++ .../templates/partner_bankaccounts.html | 8 +++++ 11 files changed, 80 insertions(+), 25 deletions(-) diff --git a/src/db/modify.sql b/src/db/modify.sql index b33903140..deb2a8469 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -327,7 +327,8 @@ alter table sys_clients add column `manual_settle` tinyint(1) DEFAULT 0; create table log_clients_operation( id varchar(50) not null, client_id int(11) not null, -account_id varchar(50) not null comment '操作人者 账户ID', +operator_id varchar(50) not null comment '操作人者 账户ID', +operator_type SMALLINT (2) not null comment '操作人者类型', create_time datetime not null, operation varchar(50) DEFAULT NULL, PRIMARY key(`id`) diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java index 5b0e9fc65..cabb285fe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java @@ -136,8 +136,7 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { device.put("rate", params.getBigDecimal("rate") == null ? new BigDecimal(0.15) : params.getBigDecimal("rate")); device.put("expire_time", act.getDate("expire_date")); actMonDelaySettleMapper.save(device); - clientManager.changeManualSettle(client_id,true); - saveActClientLog(device.getString("account_id"),client_id,"参加活动打开手动清算"); + clientManager.changeManualSettle(client_id,true,device.getString("account_id"),1,"参加活动打开手动清算"); } @@ -159,19 +158,8 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { clientLog.put("is_valid", 0); clientLog.put("expire_time", new Date()); actMonDelaySettleMapper.update(clientLog); - JSONObject act = actAppMapper.getActDetail("1"); - clientManager.changeManualSettle(client_id,false); - saveActClientLog(device.getString("account_id"), client_id,"退出活动关闭手动清算"); + clientManager.changeManualSettle(client_id,false,device.getString("account_id"),1,"退出活动关闭手动清算"); } - private void saveActClientLog(String account_id, int client_id,String operation) { - JSONObject actClientLog = new JSONObject(); - actClientLog.put("client_id",client_id); - actClientLog.put("account_id",account_id); - actClientLog.put("operation",operation); - actClientLog.put("create_time",new Date()); - clientsOperationLogMapper.save(actClientLog); - - } } 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 835c9893d..21cf9b55b 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 @@ -231,7 +231,7 @@ public interface ClientManager { void changePaymentPage(JSONObject account, String paypad_version); - void changeManualSettle(int client_id, boolean manual_settle); + void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation); void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge); 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 d82639e66..8c9b3867f 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 @@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.device.core.DeviceManager; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper; +import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; @@ -219,6 +220,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private ClientContractService clientContractService; @Resource private MessageSource messageSource; + @Resource + private ClientsOperationLogMapper clientsOperationLogMapper; private static final String SOURCE_AGREE_FILE = "source_agree_file"; private static final String CLIENT_BANK_FILE = "client_bank_file"; @@ -2608,11 +2611,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void changeManualSettle(int client_id, boolean manual_settle) { + @Transactional + public void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation) { + JSONObject client = getClientInfo(client_id); + if(client==null){ + throw new BadRequestException("merchant not found"); + } JSONObject record = new JSONObject(); record.put("client_id",client_id); record.put("manual_settle",manual_settle); clientMapper.update(record); + + JSONObject actClientLog = new JSONObject(); + actClientLog.put("client_id",client_id); + actClientLog.put("operator_id",operator_id); + actClientLog.put("operation",operation); + actClientLog.put("create_time",new Date()); + actClientLog.put("operator_type",type); + clientsOperationLogMapper.save(actClientLog); + } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 5343e2075..a2b6671b1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -524,6 +524,12 @@ public class PartnerManageController { return clientManager.listMerchantIds(clientMoniker,manager); } + @ManagerMapping(value = "/{clientMoniker}/manual_settle",method = RequestMethod.PUT,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN}) + public void manualSettle(@PathVariable String clientMoniker, @RequestParam boolean manual_settle, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); + clientManager.changeManualSettle(client.getIntValue("client_id"),manual_settle,manager.getString("manager_id"),2,"运营人员修改"); + } + @PartnerMapping(value = "/check", method = RequestMethod.GET) public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id")); 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 3782de3b1..6463c75e4 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 @@ -2,14 +2,12 @@ package au.com.royalpay.payment.manage.merchants.web; import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; -import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientSignEventSupport; import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; +import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.manage.support.wechatclients.KangaLandWechatApiImpl; import au.com.royalpay.payment.manage.support.wechatclients.RedpackWechatApiImpl; -import au.com.royalpay.payment.tools.permission.enums.PartnerRole; -import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.tools.CommonConsts; @@ -17,20 +15,31 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.http.HttpUtils; +import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; +import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.wechat.WechatMapping; + import com.alibaba.fastjson.JSONObject; + import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.Errors; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; import java.io.IOException; import java.io.OutputStream; import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + /** * view for partner client * Created by yixian on 2016-07-03. @@ -348,4 +357,13 @@ public class PartnerViewController { public void fullReleasePreAuthorization(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody TradeLogQuery query) throws Exception { tradeLogService.fullReleasePreAuthorization(account, query); } + + + @PartnerMapping(value = "/manual_settle", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) + @ResponseBody + public void manualSettle(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam boolean manual_settle) { + clientManager.changeManualSettle(account.getIntValue("client_id"),manual_settle,account.getString("account_id"),1,"商户修改修改"); + } + + } diff --git a/src/main/resources/templates/activity/mondelay/mondelay.html b/src/main/resources/templates/activity/mondelay/mondelay.html index 2fc2237b4..e21edce0b 100644 --- a/src/main/resources/templates/activity/mondelay/mondelay.html +++ b/src/main/resources/templates/activity/mondelay/mondelay.html @@ -143,7 +143,7 @@ if(is_weixin()){ return; } else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { - window.webkit.messageHandlers.appCmd.postMessage({type:'cmd_cancel_mondelay',waring:cancel_waring}); + window.webkit.messageHandlers.appCmd.postMessage({type:'cmd_cancel_mondelay',cancel_waring:cancel_waring}); } else if (/(Android)/i.test(navigator.userAgent)) { android.appCmd('{\"type\":\"cmd_cancel_mondelay\"}'); } else { diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index cf3d968de..d49a95a67 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1339,6 +1339,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; + $scope.manualSettle = function (manualSettle) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/manual_settle?'+'manual_settle='+manualSettle).then(function (resp) { + + }) + }; $scope.settleHours = [{value: undefined, label: 'Default(24:00, GMT+10)'}]; for (var h = 24; h > 0; h--) { $scope.settleHours.push({value: h, label: ('00' + h).substr(-2) + ':00, ' + $scope.partner.timezone}); diff --git a/src/main/ui/static/payment/partner/partner.js b/src/main/ui/static/payment/partner/partner.js index e28d090be..181ff13af 100644 --- a/src/main/ui/static/payment/partner/partner.js +++ b/src/main/ui/static/payment/partner/partner.js @@ -220,6 +220,11 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct }) }); }; + $scope.manualSettle = function (manualSettle) { + $http.put('/client/partner_info/manual_settle?'+'manual_settle='+manualSettle).then(function (resp) { + + }) + }; $scope.getRates(); }]); app.controller('clientSubPartnersCtrl', ['$scope', '$http', function ($scope, $http) { diff --git a/src/main/ui/static/payment/partner/templates/client_bankaccounts.html b/src/main/ui/static/payment/partner/templates/client_bankaccounts.html index 8df7020df..fb1d41a86 100644 --- a/src/main/ui/static/payment/partner/templates/client_bankaccounts.html +++ b/src/main/ui/static/payment/partner/templates/client_bankaccounts.html @@ -1,4 +1,11 @@