diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.java index f50922022..d27b4351b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.java @@ -26,7 +26,6 @@ public interface RiskEventMapper { @AutoSql(type = SqlType.SELECT) List findAll(JSONObject params); - @AutoSql(type = SqlType.SELECT) PageList listRisksByPage(JSONObject params, PageBounds pageBounds); @AutoSql(type = SqlType.SELECT) 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 78588077a..b457bc798 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 @@ -32,6 +32,13 @@ public interface RiskBusinessService { */ JSONObject getRiskEventDetail(String riskId); + /** + * 获取风险事件的调单信息 + * @param orderIds + * @return + */ + List getRiskEventOrderList(String orderIds); + /** * 新增风险事件 * @param params 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 d87f93bb5..203729319 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 @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.riskbusiness.core.impl; +import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; import au.com.royalpay.payment.tools.utils.PageListUtils; @@ -10,6 +11,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -22,6 +24,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Autowired private RiskEventMapper riskEventMapper; + @Autowired + private OrderMapper orderMapper; + @Override public List getRiskEvents(JSONObject params) { return riskEventMapper.findAll(params); @@ -39,6 +44,23 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { return riskEventMapper.findById(riskId); } + @Override + public List getRiskEventOrderList(String orderIds) { + String[] orderIdArray = orderIds.trim().split(","); + JSONObject query = new JSONObject(); + List tradeLogs = new ArrayList<>(); + + // 获取每笔订单的信息 + for (int i = 0; i < orderIdArray.length; i++) { + query.put("order_id", orderIdArray[i]); + PageList logs = orderMapper.listOrders(query, new PageBounds()); + if (logs != null && logs.size() != 0) { + tradeLogs.add(logs.get(0)); + } + } + return tradeLogs; + } + @Override public void addRiskEvent(JSONObject params) { riskEventMapper.save(params); 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 ad3859114..3050cf89e 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 @@ -9,10 +9,6 @@ import com.alibaba.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; import java.util.List; /** @@ -34,8 +30,12 @@ public class RiskBusinessController { } @GetMapping(value = "events/{risk_id}") - public JSONObject getRiskEventDetail(@PathVariable("risk_id") String riskId) { - return riskBusinessService.getRiskEventDetail(riskId); + public JSONObject getRiskEventDetail(@PathVariable("risk_id") String riskId, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + JSONObject riskEvent = riskBusinessService.getRiskEventDetail(riskId); + List tradeLogs = riskBusinessService.getRiskEventOrderList(riskEvent.getString("order_ids")); + riskEvent.put("tradeLogs", tradeLogs); + return riskEvent; } @PostMapping(value = "events") diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.xml new file mode 100644 index 000000000..6f8274362 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.xml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index ffb178b8e..a3ea20383 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -4,13 +4,25 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], function (angular, $) { 'use strict'; - var orderTypes = { + var orderTypesMap = { "1": "微信调单", "2": "支付宝调单", "3": "RoyalPay调单", "4": "警告", "5": "通用号调单" }; + + var resultTypesMap = { + "0": "未处理", + "1": "处理中", + "2": "已处理" + }; + + var emailStatusMap = { + "0": "未发送", + "1": "已发送" + }; + var app = angular.module('riskBusinessApp', ['ui.router']); app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('analysis_monitoring.risk_business', { @@ -37,7 +49,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', function ($scope, $state, $http, $uibModal, commonDialog) { - $scope.orderTypes = orderTypes; + $scope.orderTypes = orderTypesMap; $scope.pagination = {}; $scope.params = {}; @@ -51,18 +63,32 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], }; $scope.loadRiskEvents(1); - } ]); app.controller('riskEventDetailCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', 'riskEvent', function ($scope, $state, $http, $uibModal, $filter, commonDialog, riskEvent) { + $scope.riskEvent = riskEvent.data; + + // 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图 + $scope.riskEventEdit = angular.copy(riskEvent.data); + + // order_type转换为string类型是因为前端select控件这样才会显示初值 + $scope.riskEventEdit.order_type += ""; + + // 调单信息 + $scope.tradeLogs = $scope.riskEvent.tradeLogs; + $scope.orderTypes = orderTypesMap; + + // 控制编辑表格的显示 $scope.editFlag = false; $scope.changeEditFlag = function(editFlag) { $scope.editFlag = !editFlag; + // 如果是在编辑状态,需要将日期转换为date类型(前端控件需要) + // 如果是在非编辑状态,需要将日期转换为yyyy-MM-dd格式 if ($scope.editFlag) { - $scope.riskEvent.reply_email_date = new Date($scope.riskEvent.reply_email_date.replace(/-/g, "/")); + $scope.riskEventEdit.reply_email_date = new Date($scope.riskEventEdit.reply_email_date.replace(/-/g, "/")); } else { $scope.riskEvent.reply_email_date = $filter('date')($scope.riskEvent.reply_email_date, 'yyyy-MM-dd'); } @@ -78,8 +104,9 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], return; } - $scope.riskEvent.reply_email_date = $filter('date')($scope.riskEvent.reply_email_date, 'yyyy-MM-dd'); - $http.put('/risk/business/events', $scope.riskEvent).then(function (resp) { + // 保存时需要重新将日期转换为yyyy-MM-dd格式传入后端 + $scope.riskEventEdit.reply_email_date = $filter('date')($scope.riskEventEdit.reply_email_date, 'yyyy-MM-dd'); + $http.put('/risk/business/events', $scope.riskEventEdit).then(function (resp) { commonDialog.alert({ title: 'Success', content: 'Update riskEvent successfully', @@ -93,13 +120,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], type: 'error' }); }); - } + }; } ]); app.controller('newRiskEventCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', function ($scope, $state, $http, $uibModal, $filter, commonDialog) { - $scope.orderTypes = orderTypes; + + $scope.orderTypes = orderTypesMap; $scope.save = function(form) { if (form.$invalid) { @@ -111,6 +139,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], return; } + // 默认设置邮件回复截止日期为七天后 var replyDeadline = new Date(); replyDeadline.setDate(replyDeadline.getDate() + 7); $scope.riskEvent.reply_email_date = $filter('date')(replyDeadline, 'yyyy-MM-dd'); @@ -133,5 +162,26 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], } ]); + // 调单类型过滤器 + app.filter('orderType', function() { + return function(type) { + return orderTypesMap[type]; + } + }); + + // 处理结果过滤器 + app.filter('resultType', function() { + return function(type) { + return resultTypesMap[type]; + } + }); + + // 邮件发送状态过滤器 + app.filter('emailStatus', function() { + return function(status) { + return emailStatusMap[status]; + } + }); + return app; }); diff --git a/src/main/ui/static/analysis/templates/new_riskEvent.html b/src/main/ui/static/analysis/templates/new_riskEvent.html index 33d45128d..f5d337e82 100644 --- a/src/main/ui/static/analysis/templates/new_riskEvent.html +++ b/src/main/ui/static/analysis/templates/new_riskEvent.html @@ -12,23 +12,30 @@
- +
-
-

Required - Field

-

Less - Than 6 Letters

-

Only - Uppercase Letters and - Numbers are allowed

+

Required Field +

+

Less Than 6 Letters +

+

+ Only Uppercase Letters and Numbers are allowed +

@@ -36,18 +43,21 @@
+ for="order-type-input">Order Type +
-
-

- required field +

required field

@@ -55,40 +65,46 @@
- +
-
-

- required field +

required field

- +
-
-
- -
-
diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index 21490a250..a2209e208 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -10,36 +10,55 @@
RiskEvent Basic Information - Edit
+
-

+

+
+
+ +
+ +
+

+

+
-

+

+

+
-

+

+ {{riskEvent.result_type | resultType}} +

-

+

@@ -55,13 +74,15 @@
-

+

+

-
+
@@ -69,47 +90,48 @@ Orders Information
+
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + +
Order IDAmountInput AmountAUD AmountExchange RateStatusCreate TimeGateway
Order IDAmountInput AmountAUD AmountExchange RateStatusCreate TimeGateway
{{trade.order_id}}{{trade.total_amount|currency:trade.currency}} - - - -
{{trade.order_id}}{{trade.total_amount | currency: trade.currency}} + + + - +
-
- - Send Email + Send Email - @@ -122,23 +144,30 @@
- +
-

Required - Field

-

Less - Than 6 Letters

-

Only - Uppercase Letters and - Numbers are allowed

+

Required Field +

+

Less Than 6 Letters +

+

+ Only Uppercase Letters and Numbers are allowed +

@@ -146,18 +175,22 @@
+ for="order-type-input">Order Type +
- +
-

- required field +

required field

@@ -165,29 +198,38 @@
- +
-
-

- required field +

required field

- +
- @@ -196,33 +238,32 @@
- +
-
-
-
-
diff --git a/src/main/ui/static/analysis/templates/risk_business.html b/src/main/ui/static/analysis/templates/risk_business.html index 41c1624d9..a9bb884fb 100644 --- a/src/main/ui/static/analysis/templates/risk_business.html +++ b/src/main/ui/static/analysis/templates/risk_business.html @@ -6,17 +6,22 @@
- - + +
-
- -
- -
+
- - - New Event + + New Event
- +

RiskEvent List

@@ -54,54 +65,43 @@
- - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + +
Partner CodeOrder TypeResult TypeSub Merchant IDEmail StatusFillIn PersonDescriptionCreate TimeOperation
Partner CodeOrder TypeResult TypeSub Merchant IDEmail StatusFillIn PersonDescriptionCreate TimeOperation
- 微信调单 - 支付宝调单 - RoyalPay调单 - 警告 - 通用号调单 - - 未处理 - 处理中 - 已处理 - - 未发送 - 已发送 - - - Detail - -
+ + Detail + +
-
- - -
-
- \ No newline at end of file