From 817e18e57adc3bbc56cca9bfd2fb2140710ce88d Mon Sep 17 00:00:00 2001 From: lujian Date: Fri, 7 Dec 2018 14:42:45 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E9=A3=8E=E6=8E=A7=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/impl/RiskBusinessServiceImpl.java | 13 ++- .../core/impl/RiskUploadServiceIpml.java | 3 + src/main/ui/static/analysis/risk_business.js | 63 ++++++++++++++- .../analysis/templates/audit_material.html | 79 +++++++++++++------ .../templates/riskEvent_detail_bd.html | 4 +- .../analysis/templates/risk_business.html | 3 + .../analysis/templates/risk_business_bd.html | 4 +- 7 files changed, 135 insertions(+), 34 deletions(-) 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 8d04c9cd9..22f4494ac 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 @@ -494,8 +494,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo @Override public void sendRefuseEmail(String riskId, String refuseDescription) throws IOException { JSONObject event = getRiskEventDetail(riskId); - if (RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType().intValue() == event.getIntValue("result_type")) { + int resultType = event.getIntValue("result_type"); + if (RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType().intValue() == resultType) { throw new BadRequestException("Refused Already!"); + } else if (RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType().intValue() == resultType) { + throw new BadRequestException("Passed Already!"); + } else if (RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType().intValue() != resultType){ + throw new BadRequestException(); } riskMaterialService.updateRiskMaterial(riskId, refuseDescription); Context ctx = getMailContext(event); @@ -975,8 +980,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo return result; } + @Transactional @Override public JSONObject riskEventMaterialPass(JSONObject params, JSONObject manager) { + Integer resultType = params.getInteger("result_type"); + if (!resultType.equals(RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType())) { + throw new BadRequestException("Can't Pass"); + } + params.put("result_type", RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType()); riskEventMapper.update(params); riskProcessLogService.addRiskProcessLog(params.getString("risk_id"), manager.getString("manager_id"), diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java index e53ecf4d0..ca22c42af 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java @@ -41,6 +41,7 @@ public class RiskUploadServiceIpml implements RiskUploadService { private StringRedisTemplate stringRedisTemplate; private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL"; + @Transactional @Override public void submitMaterial(JSONObject material) { String riskId = material.getString("risk_id"); @@ -55,6 +56,8 @@ public class RiskUploadServiceIpml implements RiskUploadService { for(int i=1;i<=10;i++){ if(material.containsKey("file"+i+"_url")){ List urls = (List)material.get("file"+i+"_url"); + if (urls == null || urls.isEmpty()) + continue; for(String url:urls){ JSONObject file = new JSONObject(); file.put("file_url",url); diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index bfeeba04d..29aa25c7c 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -144,7 +144,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], industries.push(industry.label); }); industries.push('未知行业'); - console.log(industries); + // console.log(industries); // 加载风险注册事件 $scope.loadRiskEvents = function (page) { var params = angular.copy($scope.params); @@ -509,8 +509,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], } ]); - app.controller('auditMaterialCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', '$sce', 'commonDialog', - function ($scope, $state, $http, $uibModal, $filter, $sce, commonDialog) { + app.controller('auditMaterialCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', '$sce', 'commonDialog', 'Upload', + function ($scope, $state, $http, $uibModal, $filter, $sce, commonDialog, Upload) { // 一键下载功能 $scope.downloadAsZip = function () { @@ -543,6 +543,61 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], }; $scope.loadRiskMaterial(); + $scope.uploadShowFlag = ($scope.riskEvent.result_type == 1 || $scope.riskEvent.result_type == 4) ? true : false; + + // 材料上传 + $scope.uploadFile = function(files, index) { + if (files && files.length) { + var urls = new Array(); + var value = 0; + $scope.riskMaterial.material[index].fileProgressValue = 0; + for (var i = 0; i < files.length; i++) { + var file = files[i]; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + urls.push(resp.data.url); + }, function (resp) { + delete $scope.riskMaterial.material[index].fileProgressValue; + alert('Upload Failed'); + }, function (evt) { + value += parseInt(100 * evt.loaded / evt.total ); + $scope.riskMaterial.material[index].fileProgressValue = value/(files.length*2); + }) + } + $scope.riskMaterial.material[index].file = urls; + } + }; + + $scope.submit = function (form) { + var index = $scope.riskEvent.submit_url.lastIndexOf('='); + if (index < 0) + index = $scope.riskEvent.submit_url.lastIndexOf('/'); + var codeKey = $scope.riskEvent.submit_url.substring(index + 1); + $scope.material.update_time=$filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss'); + $scope.material.risk_id = $scope.riskEvent.risk_id; + for (var i = 0; i < $scope.riskMaterial.material.length; i++) { + var key = 'file' + (i + 1) + "_url"; + $scope.material[key] = $scope.riskMaterial.material[i].file; + } + $scope.material.description = $scope.riskMaterial.description; + $http.post('/risk/upload/' + codeKey, $scope.material).then(function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Submit successfully', + type: 'success' + }); + $state.go('analysis_monitoring.risk_business'); + }, function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error' + }); + }); + }; + // 材料审核 $scope.auditMaterial = function(auditType) { @@ -553,7 +608,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], title: 'Warning', contentHtml: $sce.trustAsHtml(warningMessageHTML) }).then(function () { - $scope.riskEvent.result_type = auditType; + // $scope.riskEvent.result_type = auditType; $http.put(url, $scope.riskEvent).then(function (resp) { commonDialog.alert({title: 'Success', content: "材料已通过!"}); $state.go('^', {}, {reload: true}); diff --git a/src/main/ui/static/analysis/templates/audit_material.html b/src/main/ui/static/analysis/templates/audit_material.html index 5f76d3952..4ce1dab56 100644 --- a/src/main/ui/static/analysis/templates/audit_material.html +++ b/src/main/ui/static/analysis/templates/audit_material.html @@ -24,45 +24,74 @@
-
-
- -
-
-

+
+
+
+ +
+
+

+
-
-
- -
-
-

+
+ +
+

{{item.question}}

-
-
+
+
+ +
+   
+
+ {{item.fileProgressValue}}% -
-
-

+ +
+
-
-   
-
- - - + +
+ +
+
-
-
+
+
diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html b/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html index eebc8afcf..875f12c63 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html @@ -113,8 +113,8 @@
- Submit +
diff --git a/src/main/ui/static/analysis/templates/risk_business.html b/src/main/ui/static/analysis/templates/risk_business.html index 8c06c882d..d5e6826cf 100644 --- a/src/main/ui/static/analysis/templates/risk_business.html +++ b/src/main/ui/static/analysis/templates/risk_business.html @@ -27,6 +27,7 @@
@@ -41,6 +42,7 @@ class="form-control" id="sub-merchant-id-search" placeholder="子商户号" + ng-enter="loadRiskEvents(1)" ng-model="params.subMerchantId">
@@ -72,6 +74,7 @@ type="text" name="order_ids" placeholder="多个订单请用逗号分隔" + ng-enter="loadRiskEvents(1)" id="order-ids-input"> diff --git a/src/main/ui/static/analysis/templates/risk_business_bd.html b/src/main/ui/static/analysis/templates/risk_business_bd.html index 994ccd548..46b940f68 100644 --- a/src/main/ui/static/analysis/templates/risk_business_bd.html +++ b/src/main/ui/static/analysis/templates/risk_business_bd.html @@ -126,7 +126,7 @@ Result Type Sub Merchant ID Description - Channel Result + Risk Manager Create Time Operation @@ -145,7 +145,7 @@ - +