From 5daa8ab0b351effd80078690571f0676dfbc2aaf Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Wed, 17 Oct 2018 14:49:53 +0800 Subject: [PATCH] [fix] --- .../core/RiskBusinessService.java | 2 +- .../core/impl/RiskBusinessServiceImpl.java | 12 +- .../web/RiskBusinessController.java | 9 +- src/main/ui/static/analysis/risk_business.js | 109 +++++++----------- 4 files changed, 56 insertions(+), 76 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java index b4d76eccb..e5b695785 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java @@ -45,7 +45,7 @@ public interface RiskBusinessService { * 新增风险事件 * @param params */ - void addRiskEvent(JSONObject params); + void addRiskEvent(JSONObject params, JSONObject manager); /** * 更新事件 diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java index 2f10af19e..3563398a2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java @@ -124,7 +124,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { } @Override - public void addRiskEvent(JSONObject params) { + public void addRiskEvent(JSONObject params, JSONObject manager) { // 通用号调单不需要填写client_moniker JSONObject client = null; String clientMoniker = params.getString("client_moniker"); @@ -134,6 +134,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { throw new InvalidShortIdException(); } } + + params.put("fillin_id", manager.getString("manager_id")); + params.put("fillin_person", manager.getString("display_name")); + String orderIds = params.getString("order_ids"); + if (StringUtils.isNotBlank(orderIds)) { + orderIds = orderIds.trim().replace(",", ","); + params.put("order_ids", orderIds); + } riskEventMapper.save(params); } @@ -152,7 +160,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { param.put("orderby_type", "update_time"); JSONObject riskMaterial = getRiskMaterial(param); try { - String downloadFilename = clientMoniker + "_audit_materials_" + DateFormatUtils.format(new Date(), "dd/MM/yyyy HH:mm:ss").toString() + ".zip";// 文件的名称 + String downloadFilename = clientMoniker + "_audit_materials_" + DateFormatUtils.format(new Date(), "dd/MM/yyyy HH:mm:ss").toString() + ".zip"; response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename); ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java index f893da222..63eb3cd31 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java @@ -55,14 +55,7 @@ public class RiskBusinessController { @PostMapping(value = "events") public void RegisterRiskEvent(@RequestBody JSONObject params, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - params.put("fillin_id", manager.getString("manager_id")); - params.put("fillin_person", manager.getString("display_name")); - String orderIds = params.getString("order_ids"); - if (StringUtils.isNotBlank(orderIds)) { - orderIds = orderIds.trim().replace(",", ","); - params.put("order_ids", orderIds); - } - riskBusinessService.addRiskEvent(params); + riskBusinessService.addRiskEvent(params, manager); } @PutMapping(value = "events") diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index aeeb5907a..54795d116 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -18,13 +18,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], "2": "BD已提交材料,等待审核", "3": "材料审核通过", "4": "材料审核不通过,已打回", - "5": "已处理", + "5": "已处理" }; var emailStatusMap = { "0": "未发送", "1": "已发送", - "2": "打回并已发送" + "2": "打回并已发送", + "3": "已发送催促邮件" }; var app = angular.module('riskBusinessApp', ['ui.router']); @@ -63,6 +64,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.pagination = {}; $scope.params = {}; + // 加载风险注册事件 $scope.loadRiskEvents = function (page) { var params = angular.copy($scope.params); params.page = page || $scope.pagination.page || 1; @@ -84,6 +86,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.orderTypes = orderTypesMap; $scope.riskEvent = riskEvent.data; + // 获取数据库中对应的渠道字段 var orderChannel = 'enable_'; if ($scope.riskEvent.order_type == 1) { orderChannel += 'wechat'; @@ -154,27 +157,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], * 关停渠道 * @param orderType 调单类型 * @param channelFlag - * @param temporaryFlag 是否临时关闭 - - $scope.updateChannel = function (orderType, channelFlag, temporaryFlag) { - var channel; - if (orderType == "1") - channel = 'wechat'; - else if (orderType == "2") - channel = 'alipay'; - $http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/channels/' + channel + '/permission', {allow: channelFlag}).then(function () { - - $state.reload('analysis_monitoring.riskEvent_detail'); - }, function (resp) { - commonDialog.alert({ - title: 'Failed to change ' + channel + ' channel permission status', - content: resp.data.message, - type: 'error' - }) - }); - };*/ - - + * @param temporaryFlag 是否临时关停 + */ $scope.updateChannel = function (orderType, channelFlag, temporaryFlag) { var channel; if (orderType == "1") @@ -182,33 +166,37 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], else if (orderType == "2") channel = 'alipay'; $scope.riskEvent.temporary_close_channel = temporaryFlag; - $http.put('/risk/business/channel/' + channel + '/permission/' + channelFlag, $scope.riskEvent).then(function () { - - $state.reload('analysis_monitoring.riskEvent_detail'); - }, function (resp) { - commonDialog.alert({ - title: 'Failed to change ' + channel + ' channel permission status', - content: resp.data.message, - type: 'error' - }) - }); + commonDialog.confirm({ + title: 'Warning', + content: 'Are you sure?' + }).then(function () { + $http.put('/risk/business/channel/' + channel + '/permission/' + channelFlag, $scope.riskEvent).then(function () { + $state.reload('analysis_monitoring.riskEvent_detail'); + }, function (resp) { + commonDialog.alert({ + title: 'Failed to change ' + channel + ' channel permission status', + content: resp.data.message, + type: 'error' + }) + }); + }) }; // 关停商户 $scope.updateClient = function(isValid, temporaryFlag) { $scope.riskEvent.temporary_close_merchant = temporaryFlag; - $http.put('/risk/business/partner/' + isValid, $scope.riskEvent).then(function () { - $state.reload('analysis_monitoring.riskEvent_detail'); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + commonDialog.confirm({ + title: 'Warning', + content: 'Are you sure?' + }).then(function () { + $http.put('/risk/business/partner/' + isValid, $scope.riskEvent).then(function () { + $state.reload('analysis_monitoring.riskEvent_detail'); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }) - }; - // 获取riskEvent详细信息 - $scope.loadRiskEventDetail = function(riskId) { - $http.get('/risk/business/events/' + riskId) - } $scope.resendUploadEmail = function () { commonDialog.confirm({ title: 'Warning', @@ -232,8 +220,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], // 一键下载功能 $scope.downloadAsZip = function () { - var url = '/risk/business/' + $scope.riskEvent.risk_id + '/download/materialsAsZIP'; - return url; + return '/risk/business/' + $scope.riskEvent.risk_id + '/download/materialsAsZIP'; }; // 加载提交材料 @@ -254,29 +241,21 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], // 材料审核 $scope.auditMaterial = function(auditType) { + + var url = '/risk/business/events'; + if (auditType == 4) { + url = '/risk/business/' + $scope.riskEvent.risk_id + '/refuse' + } $scope.riskEvent.result_type = auditType; - // 后面把url当做参数传递进去,删除重复的代码 - if (auditType == 3) { - $http.put('/risk/business/events', $scope.riskEvent).then(function (resp) { - $state.go('^', {}, {reload: true}); - }, function (resp) { - commonDialog.alert({ - title: 'Error', - content: resp.data.message, - type: 'error' - }); - }); - } else if (auditType == 4) { - $http.put('/risk/business/' + $scope.riskEvent.risk_id + '/refuse').then(function(resp) { - $state.go('^', {}, {reload: true}); - }, function (resp) { - commonDialog.alert({ - title: 'Error', - content: resp.data.message, - type: 'error' - }); + $http.put(url, $scope.riskEvent).then(function (resp) { + $state.go('^', {}, {reload: true}); + }, function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error' }); - } + }); } }