From 7ac0a012d6d24366873e87ec51e4150cc4e690b8 Mon Sep 17 00:00:00 2001 From: lujian Date: Mon, 19 Nov 2018 14:11:52 +0800 Subject: [PATCH] update --- .../core/impl/RiskBusinessServiceImpl.java | 33 ++++++++++++++-- .../core/impl/RiskUploadServiceIpml.java | 9 ++++- src/main/ui/static/analysis/risk_business.js | 39 ++++++++++++++++--- .../analysis/templates/audit_material.html | 6 +++ .../analysis/templates/new_riskEvent.html | 9 +++++ .../analysis/templates/riskEvent_detail.html | 22 ++++++++++- .../analysis/templates/risk_business.html | 13 ++++++- 7 files changed, 117 insertions(+), 14 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 46f665e31..7d7279375 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 @@ -17,6 +17,7 @@ import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.pushMessage.APNSMessageHelper; import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; +import au.com.royalpay.payment.manage.riskbusiness.enums.RiskEmailStatusEnum; import au.com.royalpay.payment.manage.riskbusiness.enums.RiskResultTypeEnum; import au.com.royalpay.payment.manage.signin.beans.TodoNotice; import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider; @@ -55,6 +56,7 @@ import org.thymeleaf.spring4.SpringTemplateEngine; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URL; +import java.text.ParseException; import java.util.*; import javax.annotation.Resource; import java.util.concurrent.LinkedBlockingQueue; @@ -138,6 +140,31 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo } PageList riskEvents = riskEventMapper.listRisksByPage(params, new PageBounds(params.getInteger("page"), 10, Order.formString("create_time.desc"))); + + /** + * 以下为判断调单事件是否过期 + * 微信调单、支付宝调单、royalpay调单 + * 未处理、已发送、待审核、打回 + */ + Date currentDate = new Date(), replyDate; + Integer resultType, orderType; + boolean isPassTimeout = false; + for (JSONObject riskEvent : riskEvents) { + try { + replyDate = DateUtils.parseDate(riskEvent.getString("reply_email_date"), "yyyy-MM-dd"); + } catch (ParseException e) { + replyDate = currentDate; + e.printStackTrace(); + } + resultType = riskEvent.getInteger("result_type"); + orderType = riskEvent.getInteger("order_type"); + isPassTimeout = (currentDate.after(replyDate)) && + (!resultType.equals(RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType())) && + (!resultType.equals(RiskResultTypeEnum.ALREADY_HANDLED.getResultType())) && + (!orderType.equals(RiskOrderTypeEnum.WARNING_ORDER.getOrderType())) && + (!orderType.equals(RiskOrderTypeEnum.GENERAL_ORDER.getOrderType())); + riskEvent.put("pass_timeout", isPassTimeout); + } return PageListUtils.buildPageListResult(riskEvents); } @@ -164,9 +191,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo String realOrderIds = riskEvent.getString("real_order_ids"); JSONObject client = clientMapper.findClientByMonikerAll(riskEvent.getString("client_moniker")); List tradeLogs = new ArrayList<>(); - /** - * 通用号调单会有client为空的情况,所以无法查到订单信息 - */ + // 通用号调单会有client为空的情况,所以无法查到订单信息 if (client != null && StringUtils.isNotBlank(realOrderIds)) { String[] orderIdArray = realOrderIds.trim().split(","); JSONObject orderInfo = new JSONObject(); @@ -299,7 +324,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo try { String emailId = mailService.sendRiskEmail(title, emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), "",content, null,event.getIntValue("order_type")); - event.put("email_status",1); + event.put("email_status", RiskEmailStatusEnum.ALREADY_SEND.getEmailStatus()); event.put("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()); event.put("submit_url",uploadUrl); Integer orderType = event.getInteger("order_type"); 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 6dae1717d..1bd58955b 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 @@ -1,17 +1,24 @@ package au.com.royalpay.payment.manage.riskbusiness.core.impl; +import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskFileMapper; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.manage.notice.core.MailService; +import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService; import au.com.royalpay.payment.manage.riskbusiness.enums.RiskResultTypeEnum; import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring4.SpringTemplateEngine; import javax.annotation.Resource; import java.text.ParseException; @@ -33,7 +40,7 @@ public class RiskUploadServiceIpml implements RiskUploadService { @Override public void submitMaterial(JSONObject material) { JSONObject event = riskEventMapper.findById(material.getString("risk_id")); - material.putIfAbsent("update_time", DateFormatUtils.format(new Date(), "yyyy-MM-dd hh:mm:ss")); + material.put("update_time", DateFormatUtils.format(new Date(), "yyyy-MM-dd hh:mm:ss")); riskMaterialMapper.save(material); material.put("material_id",riskMaterialMapper.findAllMaterials(material.getString("risk_id")).get(0).getString("material_id")); for(int i=1;i<=10;i++){ diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index 113e07cc1..7bdc9f72d 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -167,7 +167,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.orderTypes = orderTypesMap; $scope.resultTypes = resultTypesMap; $scope.channelResults = channelResultArray; + if (riskEvent.data.is_send_client == 1) + riskEvent.data.is_send_client = true; $scope.riskEvent = riskEvent.data; + // 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图 + $scope.riskEventEdit = angular.copy(riskEvent.data); //var index = $scope.riskEvent.order_ids.lastIndexOf(","); //$scope.riskEvent.order_ids = $scope.riskEvent.order_ids.substring(0, index) + "," + $scope.riskEvent.order_ids.substring(index + 1); // 获取数据库中对应的渠道字段 @@ -179,8 +183,28 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], } else { orderChannel = null; } - // 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图 - $scope.riskEventEdit = angular.copy(riskEvent.data); + + /** + * order_ids在指定位置换行 + * @param str + * @param position + * @returns {*} + */ + $scope.splitStr = function (str, position) { + var strArr = str.split(","); + var resultStr = ''; + for (var i = 0; i < strArr.length; i++) { + resultStr += strArr[i]; + if (i == (strArr.length - 1)) + break; + if ((i + 1) % position == 0) + resultStr += ", "; + else + resultStr += ","; + } + return resultStr; + }; + $scope.riskEvent.order_ids = $scope.splitStr($scope.riskEvent.order_ids, 3); // order_type转换为string类型是因为前端select控件这样才会显示初值 $scope.riskEventEdit.order_type += ""; @@ -531,7 +555,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], }); }); }); - } + }; } ]); @@ -550,7 +574,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], {key: new Date().getTime(), value: ""}); // 用时间戳作为每个item的key // 增加新的input后允许删除 $scope.canMinus = true; - } + }; $scope.decrease = function($index) { // 如果input大于1,删除 @@ -561,7 +585,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], if ($scope.materials.length == 1) { $scope.canMinus = false; } - } + }; var array=new Array(); $scope.combineMaterials = function() { for (var i = 0; i < $scope.materials.length; i++) { @@ -571,8 +595,9 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], } console.log(JSON.stringify(array)); return JSON.stringify(array); - } + }; + $scope.is_send_client = false; $scope.save = function(form) { if (form.$invalid) { angular.forEach(form, function (item, key) { @@ -597,6 +622,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.riskEvent.alipay_materials = $scope.combineMaterials(); + $scope.riskEvent.is_send_client = $scope.is_send_client; + $http.post('/risk/business/events', $scope.riskEvent).then(function (resp) { commonDialog.alert({ title: 'Success', diff --git a/src/main/ui/static/analysis/templates/audit_material.html b/src/main/ui/static/analysis/templates/audit_material.html index b62e28732..d4e157704 100644 --- a/src/main/ui/static/analysis/templates/audit_material.html +++ b/src/main/ui/static/analysis/templates/audit_material.html @@ -156,4 +156,10 @@ + diff --git a/src/main/ui/static/analysis/templates/new_riskEvent.html b/src/main/ui/static/analysis/templates/new_riskEvent.html index d1308f634..2376af142 100644 --- a/src/main/ui/static/analysis/templates/new_riskEvent.html +++ b/src/main/ui/static/analysis/templates/new_riskEvent.html @@ -233,6 +233,15 @@ +
+ +
+ +
+
+ diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index cf87f3394..a95d9b951 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -142,6 +142,16 @@ +
+ +
+ +
+
+
@@ -408,12 +418,13 @@ for="order-ids-input">Platform Transaction IDs
- +

+
+ +
+ +
+
+