From 0bb6ad8e0888c67f8fc6e71f11a8826193675d1e Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Wed, 10 Oct 2018 09:07:08 +0800 Subject: [PATCH 01/65] =?UTF-8?q?[feat]=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E9=A3=8E=E6=8E=A7=E4=B8=9A=E5=8A=A1=E6=B5=81=E7=A8=8B=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../riskbusiness/RiskBusinessController.java | 22 +++++++++++++++++++ .../templates/analysis_monitoring.html | 4 ++++ src/main/ui/static/analysis/risk_business.js | 22 +++++++++++++++++++ .../analysis/templates/risk_business.html | 10 +++++++++ 4 files changed, 58 insertions(+) create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/RiskBusinessController.java create mode 100644 src/main/ui/static/analysis/risk_business.js create mode 100644 src/main/ui/static/analysis/templates/risk_business.html diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/RiskBusinessController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/RiskBusinessController.java new file mode 100644 index 000000000..4eed4d1f4 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/RiskBusinessController.java @@ -0,0 +1,22 @@ +package au.com.royalpay.payment.manage.riskbusiness; + +import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author lvjian + * @Date 2018/10/10 1:12 + */ +@RestController +@RequestMapping("/risk/business/") +public class RiskBusinessController { + + @ManagerMapping(value = "registration", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) + public String testHello() { + return "Hello"; + } +} + diff --git a/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html b/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html index 7ebb4c4ff..69b0c0df7 100644 --- a/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html +++ b/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html @@ -23,6 +23,10 @@ 风控记录|Risk Records +
  • + 风控业务 +
  • + diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js new file mode 100644 index 000000000..f11c881f2 --- /dev/null +++ b/src/main/ui/static/analysis/risk_business.js @@ -0,0 +1,22 @@ +/** + * Created by lvjian on 2018/10/9. + */ +define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], + function (angular, $) { + 'use strict'; + var app = angular.module('riskBusinessApp', ['ui.router']); + app.config(['$stateProvider', function ($stateProvider) { + $stateProvider.state('analysis_monitoring.risk_business', { + url: '/risk_business', + templateUrl: '/static/analysis/templates/risk_business.html', + controller: 'riskBusinessCtrl' + }) + }]); + + app.controller('riskBusinessCtrl', ['$scope', '$http','$filter','chartParser', function ($scope, $http,$filter,chartParser) { + + }]); + + + return app; + }); diff --git a/src/main/ui/static/analysis/templates/risk_business.html b/src/main/ui/static/analysis/templates/risk_business.html new file mode 100644 index 000000000..36897ee87 --- /dev/null +++ b/src/main/ui/static/analysis/templates/risk_business.html @@ -0,0 +1,10 @@ + + + + + Title + + +欢迎来到风控业务流程页面 + + \ No newline at end of file From c6aafed53690b7e1ed4459f2b6bbfd050d1beb4d Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Wed, 10 Oct 2018 10:35:02 +0800 Subject: [PATCH 02/65] =?UTF-8?q?[fix]=E9=A3=8E=E6=8E=A7=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mappers/riskbusiness/RiskEventMapper.java | 25 +++++ .../core/RiskBusinessService.java | 10 ++ .../core/impl/RiskBusinessServiceImpl.java | 12 +++ .../{ => web}/RiskBusinessController.java | 10 +- src/main/ui/static/analysis/risk_business.js | 10 ++ .../analysis/templates/riskEvent_detail.html | 10 ++ .../analysis/templates/risk_business.html | 98 +++++++++++++++++-- 7 files changed, 163 insertions(+), 12 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java rename src/main/java/au/com/royalpay/payment/manage/riskbusiness/{ => web}/RiskBusinessController.java (56%) create mode 100644 src/main/ui/static/analysis/templates/riskEvent_detail.html 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 new file mode 100644 index 000000000..62c23ea2c --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskEventMapper.java @@ -0,0 +1,25 @@ +package au.com.royalpay.payment.manage.mappers.riskbusiness; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + +/** + * @Author lvjian + * @Date 2018/10/10 10:25 + */ +@AutoMapper(tablename = "risk_event", pkName = "risk_id") +public interface RiskEventMapper { + + @AutoSql(type = SqlType.INSERT) + void save(JSONObject riskEvent); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject riskEvent); + + @AutoSql(type = SqlType.SELECT) + JSONObject findById(@Param("risk_id") String riskId); + +} 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 new file mode 100644 index 000000000..f882a2a20 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java @@ -0,0 +1,10 @@ +package au.com.royalpay.payment.manage.riskbusiness.core; + +/** + * @Author lvjian + * @Date 2018/10/10 10:29 + */ +public interface RiskBusinessService { + + +} 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 new file mode 100644 index 000000000..9b071836e --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java @@ -0,0 +1,12 @@ +package au.com.royalpay.payment.manage.riskbusiness.core.impl; + +import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; +import org.springframework.stereotype.Service; + +/** + * @Author lvjian + * @Date 2018/10/10 10:30 + */ +@Service +public class RiskBusinessServiceImpl implements RiskBusinessService { +} diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/RiskBusinessController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java similarity index 56% rename from src/main/java/au/com/royalpay/payment/manage/riskbusiness/RiskBusinessController.java rename to src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java index 4eed4d1f4..3b2d5f08e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/RiskBusinessController.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java @@ -1,7 +1,8 @@ -package au.com.royalpay.payment.manage.riskbusiness; +package au.com.royalpay.payment.manage.riskbusiness.web; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import com.alibaba.fastjson.JSONObject; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -14,9 +15,14 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("/risk/business/") public class RiskBusinessController { - @ManagerMapping(value = "registration", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) + @ManagerMapping(value = "event", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) public String testHello() { return "Hello"; } + + @ManagerMapping(value = "event/{risk_id}", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) + public JSONObject getRiskEventDetail() { + return null; + } } diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index f11c881f2..808a4bccb 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -10,7 +10,17 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], url: '/risk_business', templateUrl: '/static/analysis/templates/risk_business.html', controller: 'riskBusinessCtrl' + }).state('analysis_monitoring.risk_business.detail', { + url: '/{risk_id}/detail', + templateUrl: '/static/analysis/templates/riskEvent_detail.html', + controller: 'riskEventDetailCtrl', + resolve: { + partner: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/risk/business/event' + $stateParams.risk_id); + }] + } }) + }]); app.controller('riskBusinessCtrl', ['$scope', '$http','$filter','chartParser', function ($scope, $http,$filter,chartParser) { diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html new file mode 100644 index 000000000..7f23e9322 --- /dev/null +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -0,0 +1,10 @@ + + + + + Title + + +欢迎来到riskDetail页面 + + \ No newline at end of file diff --git a/src/main/ui/static/analysis/templates/risk_business.html b/src/main/ui/static/analysis/templates/risk_business.html index 36897ee87..212297aca 100644 --- a/src/main/ui/static/analysis/templates/risk_business.html +++ b/src/main/ui/static/analysis/templates/risk_business.html @@ -1,10 +1,88 @@ - - - - - Title - - -欢迎来到风控业务流程页面 - - \ No newline at end of file +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + +
    +
    +
    + +
    +
    +
    +

    RiskEvent List

    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Partner Codeorder_typeSub Merchant IDEmail StatusFillIn PersonDescriptionCreate TimeOperation
    + 未发送 + 已发送 + + + Detail + +
    + +
    + +
    + + +
    + +
    +
    +
    + \ No newline at end of file From 8502b52c3f524f2e0fe2cd701e8e6a4209c1cea7 Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Thu, 11 Oct 2018 16:07:07 +0800 Subject: [PATCH 03/65] =?UTF-8?q?[fix]=E9=A3=8E=E6=8E=A7=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mappers/riskbusiness/RiskEventMapper.java | 10 + .../riskbusiness/bean/RiskEventQuery.java | 92 +++++++ .../core/RiskBusinessService.java | 36 +++ .../core/impl/RiskBusinessServiceImpl.java | 39 +++ .../web/RiskBusinessController.java | 45 +++- src/main/ui/static/analysis/risk_business.js | 117 ++++++++- .../analysis/templates/new_riskEvent.html | 95 +++++++ .../analysis/templates/riskEvent_detail.html | 240 +++++++++++++++++- .../analysis/templates/risk_business.html | 52 +++- 9 files changed, 694 insertions(+), 32 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java create mode 100644 src/main/ui/static/analysis/templates/new_riskEvent.html 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 62c23ea2c..f50922022 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 @@ -4,8 +4,12 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * @Author lvjian * @Date 2018/10/10 10:25 @@ -19,6 +23,12 @@ public interface RiskEventMapper { @AutoSql(type = SqlType.UPDATE) void update(JSONObject riskEvent); + @AutoSql(type = SqlType.SELECT) + List findAll(JSONObject params); + + @AutoSql(type = SqlType.SELECT) + PageList listRisksByPage(JSONObject params, PageBounds pageBounds); + @AutoSql(type = SqlType.SELECT) JSONObject findById(@Param("risk_id") String riskId); diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java new file mode 100644 index 000000000..d9121b1db --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java @@ -0,0 +1,92 @@ +package au.com.royalpay.payment.manage.riskbusiness.bean; + +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; + +/** + * @Author lvjian + * @Date 2018/10/10 11:27 + */ +public class RiskEventQuery { + + // 调单类型 + private Integer orderType; + + // 商户编码 + private String clientMoniker; + + // 子商户号 + private String subMerchantId; + + // 订单号(多个,以逗号分隔) + private String orderIds; + + // 邮件发送状态 + private Integer emailStatus; + + // 处理结果 + private Integer resultType; + + public Integer getOrderType() { + return orderType; + } + + public void setOrderType(Integer orderType) { + this.orderType = orderType; + } + + public String getClientMoniker() { + return clientMoniker; + } + + public void setClientMoniker(String clientMoniker) { + this.clientMoniker = clientMoniker; + } + + public String getSubMerchantId() { + return subMerchantId; + } + + public void setSubMerchantId(String subMerchantId) { + this.subMerchantId = subMerchantId; + } + + public String getOrderIds() { + return orderIds; + } + + public void setOrderIds(String orderIds) { + this.orderIds = orderIds; + } + + public JSONObject toJSON() { + + JSONObject params = new JSONObject(); + + if (orderType != null && orderType >= 1) { + params.put("order_type", orderType); + } + + if (StringUtils.isNotBlank(clientMoniker)) { + params.put("client_moniker", clientMoniker); + } + + if (StringUtils.isNotBlank(subMerchantId)) { + params.put("sub_merchant_id", subMerchantId); + } + + if (StringUtils.isNotBlank(orderIds)) { + params.put("order_ids", orderIds); + } + + if (emailStatus != null && emailStatus >= 0) { + params.put("email_status", emailStatus); + } + + if (resultType != null && resultType >= 0) { + params.put("result_type", resultType); + } + + return params; + } +} 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 f882a2a20..78588077a 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 @@ -1,10 +1,46 @@ package au.com.royalpay.payment.manage.riskbusiness.core; +import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; + +import java.util.List; + /** * @Author lvjian * @Date 2018/10/10 10:29 */ public interface RiskBusinessService { + /** + * 风险事件列表 + * @param params + * @return + */ + List getRiskEvents(JSONObject params); + + /** + * 分页查询风险事件 + * @param params + * @return + */ + JSONObject getRiskEventsByPage(JSONObject params); + + /** + * 风险事件详情 + * @param riskId + * @return + */ + JSONObject getRiskEventDetail(String riskId); + + /** + * 新增风险事件 + * @param params + */ + void addRiskEvent(JSONObject params); + /** + * 更新事件 + * @param params + */ + void updateRiskEvent(JSONObject 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 9b071836e..d87f93bb5 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,12 +1,51 @@ package au.com.royalpay.payment.manage.riskbusiness.core.impl; +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; +import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.Order; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * @Author lvjian * @Date 2018/10/10 10:30 */ @Service public class RiskBusinessServiceImpl implements RiskBusinessService { + + @Autowired + private RiskEventMapper riskEventMapper; + + @Override + public List getRiskEvents(JSONObject params) { + return riskEventMapper.findAll(params); + } + + @Override + public JSONObject getRiskEventsByPage(JSONObject params) { + + PageList riskEvents = riskEventMapper.listRisksByPage(params, new PageBounds(1, 10, Order.formString("create_time.desc"))); + return PageListUtils.buildPageListResult(riskEvents); + } + + @Override + public JSONObject getRiskEventDetail(String riskId) { + return riskEventMapper.findById(riskId); + } + + @Override + public void addRiskEvent(JSONObject params) { + riskEventMapper.save(params); + } + + @Override + public void updateRiskEvent(JSONObject params) { + riskEventMapper.update(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 3b2d5f08e..ad3859114 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 @@ -1,28 +1,53 @@ package au.com.royalpay.payment.manage.riskbusiness.web; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.manage.riskbusiness.bean.RiskEventQuery; +import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; +import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONObject; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +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; /** + * 风控业务 * @Author lvjian * @Date 2018/10/10 1:12 */ @RestController -@RequestMapping("/risk/business/") +@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) public class RiskBusinessController { - @ManagerMapping(value = "event", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public String testHello() { - return "Hello"; + @Autowired + private RiskBusinessService riskBusinessService; + + @GetMapping(value = "events") + public JSONObject getRiskEvents(RiskEventQuery riskEventQuery) { + JSONObject params = riskEventQuery.toJSON(); + return riskBusinessService.getRiskEventsByPage(params); + } + + @GetMapping(value = "events/{risk_id}") + public JSONObject getRiskEventDetail(@PathVariable("risk_id") String riskId) { + return riskBusinessService.getRiskEventDetail(riskId); + } + + @PostMapping(value = "events") + public void RegisterRiskEvent(@RequestBody JSONObject params, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + params.put("fillin_person", manager.getString("display_name")); + riskBusinessService.addRiskEvent(params); } - @ManagerMapping(value = "event/{risk_id}", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public JSONObject getRiskEventDetail() { - return null; + @PutMapping(value = "events") + public void UpdateRiskEvent(@RequestBody JSONObject params) { + riskBusinessService.updateRiskEvent(params); } } diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index 808a4bccb..ffb178b8e 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -4,29 +4,134 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], function (angular, $) { 'use strict'; + var orderTypes = { + "1": "微信调单", + "2": "支付宝调单", + "3": "RoyalPay调单", + "4": "警告", + "5": "通用号调单" + }; var app = angular.module('riskBusinessApp', ['ui.router']); app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('analysis_monitoring.risk_business', { url: '/risk_business', templateUrl: '/static/analysis/templates/risk_business.html', + cache: false, controller: 'riskBusinessCtrl' - }).state('analysis_monitoring.risk_business.detail', { + }).state('analysis_monitoring.riskEvent_detail', { url: '/{risk_id}/detail', templateUrl: '/static/analysis/templates/riskEvent_detail.html', controller: 'riskEventDetailCtrl', resolve: { - partner: ['$http', '$stateParams', function ($http, $stateParams) { - return $http.get('/risk/business/event' + $stateParams.risk_id); + riskEvent: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/risk/business/events/' + $stateParams.risk_id); }] } - }) + }).state('analysis_monitoring.risk_business.new_riskEvent', { + url: '/new_riskEvent', + templateUrl: '/static/analysis/templates/new_riskEvent.html', + controller: 'newRiskEventCtrl' + }); }]); - app.controller('riskBusinessCtrl', ['$scope', '$http','$filter','chartParser', function ($scope, $http,$filter,chartParser) { + app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', + function ($scope, $state, $http, $uibModal, commonDialog) { + $scope.orderTypes = orderTypes; + $scope.pagination = {}; + $scope.params = {}; - }]); + $scope.loadRiskEvents = function (page) { + var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; + $http.get('/risk/business/events', {params: params}).then(function (resp) { + $scope.riskEvents = resp.data.data; + $scope.pagination = resp.data.pagination; + }); + }; + + $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.editFlag = false; + $scope.changeEditFlag = function(editFlag) { + $scope.editFlag = !editFlag; + if ($scope.editFlag) { + $scope.riskEvent.reply_email_date = new Date($scope.riskEvent.reply_email_date.replace(/-/g, "/")); + } else { + $scope.riskEvent.reply_email_date = $filter('date')($scope.riskEvent.reply_email_date, 'yyyy-MM-dd'); + } + }; + + $scope.save = function(form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + 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) { + commonDialog.alert({ + title: 'Success', + content: 'Update riskEvent successfully', + type: 'success' + }); + $state.reload('analysis_monitoring.riskEvent_detail'); + }, function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error' + }); + }); + } + } + ]); + + app.controller('newRiskEventCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', + function ($scope, $state, $http, $uibModal, $filter, commonDialog) { + $scope.orderTypes = orderTypes; + + $scope.save = function(form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + + var replyDeadline = new Date(); + replyDeadline.setDate(replyDeadline.getDate() + 7); + $scope.riskEvent.reply_email_date = $filter('date')(replyDeadline, 'yyyy-MM-dd'); + + $http.post('/risk/business/events', $scope.riskEvent).then(function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Register new riskEvent successfully', + type: 'success' + }); + $state.go('^',{}, {reload: true}); + }, function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error' + }); + }); + } + } + ]); return app; }); diff --git a/src/main/ui/static/analysis/templates/new_riskEvent.html b/src/main/ui/static/analysis/templates/new_riskEvent.html new file mode 100644 index 000000000..33d45128d --- /dev/null +++ b/src/main/ui/static/analysis/templates/new_riskEvent.html @@ -0,0 +1,95 @@ +
    +

    New RiskEvent

    +
    + +
    +
    +
    +
    +
    +
    RiskEvent Basic Information
    +
    +
    +
    + +
    + +
    +

    Required + Field

    +

    Less + Than 6 Letters

    +

    Only + Uppercase Letters and + Numbers are allowed

    +
    +
    +
    + +
    + +
    + +
    +

    + required field +

    +
    +
    +
    + +
    + +
    + +
    +

    + required field +

    +
    +
    +
    + +
    + +
    + +
    +
    + +
    +
    +
    + +
    + +
    + +
    + +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index 7f23e9322..21490a250 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -1,10 +1,230 @@ - - - - - Title - - -欢迎来到riskDetail页面 - - \ No newline at end of file +
    +
    +

    Risk Event

    +
    +
    +
    +
    + + +
    +
    + +
    +
    +
    +
    +
    RiskEvent Basic Information
    +
    +
    +
    + +
    + +
    +

    Required + Field

    +

    Less + Than 6 Letters

    +

    Only + Uppercase Letters and + Numbers are allowed

    +
    +
    +
    + +
    + +
    + +
    +

    + required field +

    +
    +
    +
    + +
    + +
    + +
    +

    + required field +

    +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + +
    + +
    + +
    +
    + +
    +
    +
    + +
    + +
    + +
    + + +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/analysis/templates/risk_business.html b/src/main/ui/static/analysis/templates/risk_business.html index 212297aca..41c1624d9 100644 --- a/src/main/ui/static/analysis/templates/risk_business.html +++ b/src/main/ui/static/analysis/templates/risk_business.html @@ -1,4 +1,4 @@ -
    +
    @@ -10,10 +10,38 @@
    + +
    + + +
    +
    + +
    + +
    + +
    +
    + + + + New Event +
    @@ -29,7 +57,8 @@ Partner Code - order_type + Order Type + Result Type Sub Merchant ID Email Status FillIn Person @@ -41,7 +70,18 @@ - + + 微信调单 + 支付宝调单 + RoyalPay调单 + 警告 + 通用号调单 + + + 未处理 + 处理中 + 已处理 + 未发送 @@ -52,7 +92,7 @@ + ui-sref="analysis_monitoring.riskEvent_detail({risk_id:riskEvent.risk_id})"> Detail @@ -61,14 +101,14 @@
    - -
    -
    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 From f99a5a6ff5cbc14bab4d6e9c84eb87e674bea15d Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Sun, 14 Oct 2018 21:34:13 +0800 Subject: [PATCH 05/65] update --- .../core/RiskBusinessService.java | 7 + .../core/impl/RiskBusinessServiceImpl.java | 55 +- .../web/RiskBusinessController.java | 6 + src/main/ui/static/analysis/risk_business.js | 67 ++- .../analysis/templates/audit_material.html | 35 ++ .../analysis/templates/riskEvent_detail.html | 511 ++++++++++-------- 6 files changed, 439 insertions(+), 242 deletions(-) create mode 100644 src/main/ui/static/analysis/templates/audit_material.html 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 b457bc798..63c011a69 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 @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.riskbusiness.core; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -50,4 +51,10 @@ public interface RiskBusinessService { * @param params */ void updateRiskEvent(JSONObject params); + + /** + * 下载审核材料(zip) + * @param riskId + */ + void downloadAuditMaterialZiP(String riskId, HttpServletResponse response); } 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 203729319..c88d23c00 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,18 +1,28 @@ package au.com.royalpay.payment.manage.riskbusiness.core.impl; +import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import org.apache.commons.lang3.time.DateFormatUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * @Author lvjian @@ -27,6 +37,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Autowired private OrderMapper orderMapper; + @Autowired + private ClientMapper clientMapper; + @Override public List getRiskEvents(JSONObject params) { return riskEventMapper.findAll(params); @@ -41,7 +54,18 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Override public JSONObject getRiskEventDetail(String riskId) { - return riskEventMapper.findById(riskId); + JSONObject riskEventDetail = riskEventMapper.findById(riskId); + + // 获取商户信息 + String clientMoniker = riskEventDetail.getString("client_moniker"); + JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } else { + riskEventDetail.put("clientInfo", client); + } + + return riskEventDetail; } @Override @@ -70,4 +94,33 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { public void updateRiskEvent(JSONObject params) { riskEventMapper.update(params); } + + @Override + public void downloadAuditMaterialZiP(String riskId, HttpServletResponse response) { + + JSONObject riskEvent = riskEventMapper.findById(riskId); + String clientMoniker = riskEvent.getString("client_moniker"); + try { + 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()); + String filePath = "https://file.royalpay.com.au/open/2018/09/20/1537438083143_tqIYPEDYPr40Y9Cyj4Ps1xgSRrDrVb.jpg"; + zos.putNextEntry(new ZipEntry(filePath.substring(filePath.lastIndexOf("/")))); + InputStream inputStream = new URL(filePath).openConnection().getInputStream(); + byte[] buffer = new byte[1024]; + int result = 0; + while ((result = inputStream.read(buffer)) != -1) { + zos.write(buffer, 0, result); + } + inputStream.close(); + zos.flush(); + zos.close(); + + zos.flush(); + zos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } 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 3050cf89e..8ed299654 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,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -49,5 +50,10 @@ public class RiskBusinessController { public void UpdateRiskEvent(@RequestBody JSONObject params) { riskBusinessService.updateRiskEvent(params); } + + @GetMapping(value = "/{risk_id}/download/materialsAsZIP") + public void downloadComplianceZip(@PathVariable("risk_id") String riskId, HttpServletResponse response) throws Exception { + riskBusinessService.downloadAuditMaterialZiP(riskId, response); + } } diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index a3ea20383..b09684270 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -14,8 +14,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], var resultTypesMap = { "0": "未处理", - "1": "处理中", - "2": "已处理" + "1": "已发送邮件至BD", + "2": "BD已提交材料,等待审核", + "3": "材料审核通过", + "4": "材料审核不通过,已打回", + "5": "已处理()", }; var emailStatusMap = { @@ -43,6 +46,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], url: '/new_riskEvent', templateUrl: '/static/analysis/templates/new_riskEvent.html', controller: 'newRiskEventCtrl' + }).state('analysis_monitoring.riskEvent_detail.audit_material', { + url: '/audit_material', + templateUrl: '/static/analysis/templates/audit_material.html', + controller: 'auditMaterialCtrl' }); }]); @@ -69,6 +76,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], app.controller('riskEventDetailCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', 'riskEvent', function ($scope, $state, $http, $uibModal, $filter, commonDialog, riskEvent) { + $scope.orderTypes = orderTypesMap; + $scope.riskEvent = riskEvent.data; // 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图 @@ -79,7 +88,9 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], // 调单信息 $scope.tradeLogs = $scope.riskEvent.tradeLogs; - $scope.orderTypes = orderTypesMap; + + // 商户信息 + $scope.clientInfo = $scope.riskEvent.clientInfo; // 控制编辑表格的显示 $scope.editFlag = false; @@ -121,6 +132,56 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], }); }); }; + + // 关停渠道 + $scope.updateChannel = function (orderType) { + 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: $scope.clientInfo['enable_' + channel]}).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) { + if (isValid) { + $http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/revert').then(function () { + $state.reload('analysis_monitoring.riskEvent_detail'); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } else { + $http.delete('/sys/partners/' + $scope.riskEvent.client_moniker).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) + } + } + ]); + + app.controller('auditMaterialCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', + function ($scope, $state, $http, $uibModal, $filter, commonDialog) { + $scope.downloadAsZip = function () { + var url = '/risk/business/' + $scope.riskEvent.risk_id + '/download/materialsAsZIP'; + return url; + }; } ]); diff --git a/src/main/ui/static/analysis/templates/audit_material.html b/src/main/ui/static/analysis/templates/audit_material.html new file mode 100644 index 000000000..028c8b6e4 --- /dev/null +++ b/src/main/ui/static/analysis/templates/audit_material.html @@ -0,0 +1,35 @@ +
    +
    Audit Files     + + + 一键下载 + +
    +
    +
    +
    + +
    +
    + + + +
    +
    +
    +

    Example:请保证图片信息清晰可见,如下图

    + +
    +
    +
    +
    +
    +
    + check +
    +
    + + + + \ No newline at end of file diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index a2209e208..5461723fc 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -1,271 +1,306 @@ -
    +
    + +
    +
    + -
    -
    -
    -
    -
    -
    -
    RiskEvent Basic Information
    -
    -
    -
    - -
    - -
    -

    Required Field -

    -

    Less Than 6 Letters -

    -

    - Only Uppercase Letters and Numbers are allowed -

    -
    -
    -
    + +
    +
    +
    +
    RiskEvent Basic Information
    +
    +
    +
    + +
    + +
    +

    Required Field +

    +

    Less Than 6 Letters +

    +

    + Only Uppercase Letters and Numbers are allowed +

    +
    +
    +
    -
    - -
    - +
    + +
    + -
    -

    required field -

    -
    -
    -
    +
    +

    required field +

    +
    +
    +
    -
    - -
    - -
    -

    required field -

    -
    -
    -
    +
    + +
    + +
    +

    required field +

    +
    +
    +
    -
    - -
    -
    - -
    -
    -
    +
    + +
    +
    + +
    +
    +
    -
    - -
    - +
    + +
    + +
    +
    +
    -
    -
    -
    -
    - - +
    + + +
    + +
    - +
    \ No newline at end of file From f61cd5be0b14668856be132adde7d294757dec83 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Mon, 15 Oct 2018 09:10:26 +0800 Subject: [PATCH 06/65] update --- .../mappers/riskbusiness/RiskMaterialMapper.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java new file mode 100644 index 000000000..90080f13d --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java @@ -0,0 +1,12 @@ +package au.com.royalpay.payment.manage.mappers.riskbusiness; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; + +@AutoMapper(tablename = "risk_material", pkName = "material_id") +public interface RiskMaterialMapper { + @AutoSql(type = SqlType.INSERT) + void save(JSONObject material); +} From ccbd5a9c3ab605d26c52d981fd23cd9065c69f9a Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Mon, 15 Oct 2018 17:39:06 +0800 Subject: [PATCH 07/65] =?UTF-8?q?=E9=A3=8E=E6=8E=A7=E9=82=AE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/mappers/payment/OrderMapper.java | 2 + .../riskbusiness/RiskMaterialMapper.java | 3 + .../manage/notice/core/MailService.java | 2 + .../notice/core/impls/MailServiceImp.java | 34 ++ .../core/RiskBusinessService.java | 13 + .../riskbusiness/core/RiskUploadService.java | 24 + .../core/impl/RiskBusinessServiceImpl.java | 133 +++++- .../core/impl/RiskUploadServiceIpml.java | 95 ++++ .../web/RiskBusinessController.java | 19 +- .../web/RiskFileUploadController.java | 42 ++ .../attachment/web/AttachmentController.java | 4 + .../manage/mappers/payment/OrderMapper.xml | 77 +++- .../riskbusiness/RiskMaterialMapper.xml | 14 + .../templates/mail/risk_operator_notice.html | 24 + .../resources/templates/mail/risk_upload.html | 434 ++++++++++++++++++ .../templates/mail/risk_upload_mail.html | 53 +++ src/main/ui/risk_upload_success.html | 190 ++++++++ src/main/ui/static/analysis/risk_business.js | 15 +- .../analysis/templates/riskEvent_detail.html | 4 +- src/main/ui/static/riskupload/risk_upload.js | 201 ++++++++ 20 files changed, 1372 insertions(+), 11 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java create mode 100644 src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml create mode 100644 src/main/resources/templates/mail/risk_operator_notice.html create mode 100644 src/main/resources/templates/mail/risk_upload.html create mode 100644 src/main/resources/templates/mail/risk_upload_mail.html create mode 100644 src/main/ui/risk_upload_success.html create mode 100644 src/main/ui/static/riskupload/risk_upload.js diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java index 7c351ef10..085df36ac 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java @@ -79,4 +79,6 @@ public interface OrderMapper { List listAnalysisClientCustomer(JSONObject params); PageList listTransactionsForApp(JSONObject params, PageBounds pageBounds); + + JSONObject findOrderById(@Param("order_id") String orderId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java index 90080f13d..4fed8604f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java @@ -4,9 +4,12 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; @AutoMapper(tablename = "risk_material", pkName = "material_id") public interface RiskMaterialMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject material); + + JSONObject findOperatorById(@Param("risk_id") String risk_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java index 3044b09fc..8291074da 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java @@ -17,6 +17,8 @@ public interface MailService { String sendEmail(String title, String mailTos, String mailCcs, String content, List attachFiles) throws URISyntaxException, IOException; + String sendRiskEmail(String title, String mailTos, String mailCcs, String content, int order_type) throws URISyntaxException, IOException; + List checkEmailStatus(String emailId); void removeUnsub(Long id); diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java index 63a1ed1db..2892391de 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java @@ -266,4 +266,38 @@ public class MailServiceImp implements MailService { } } + @Override + public String sendRiskEmail(String title, String mailTos, String mailCcs, String content, int order_type) throws URISyntaxException, IOException { + NoticeBean noticeBean = new NoticeBean(); + noticeBean.setTitle(title); + List mailClients = new ArrayList<>(); + JSONObject mailClient = new JSONObject(); + mailClient.put("mailto", mailTos); + mailClient.put("mailcc", mailCcs); + mailClients.add(mailClient); + noticeBean.setMailClients(mailClients); + noticeBean.setContent(content); + noticeBean.setSenderAddress("riskcontrol@royalpay.com.au"); + noticeBean.setPassword("RPrisk123"); + if(order_type == 1 || order_type == 2){ + noticeBean.setSenderAddress("risk@royalpay.com.au"); + noticeBean.setPassword("Tunnelrisk123"); + } + String postUrl = mailHost + "/mail/single?" + generateMailSignParam(); + HttpRequestResult result = null; + try { + logger.info("===sendEmail===noticeBean:" + JSON.toJSON(noticeBean)); + result = new HttpRequestGenerator(postUrl, RequestMethod.POST).setJSONEntity(noticeBean).setTimeout(60_000).execute(); + if (result.isSuccess()) { + String mail_id = result.getResponseContentJSONObj().getString("mail_id"); + return mail_id; + //System.out.println("send Mail=============="+mail_id); + } else { + throw new ServerErrorException("Error Connection"); + } + } catch (URISyntaxException e) { + throw new ServerErrorException("Error Connection"); + } + } + } 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 63c011a69..898aa9dee 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 @@ -57,4 +57,17 @@ public interface RiskBusinessService { * @param riskId */ void downloadAuditMaterialZiP(String riskId, HttpServletResponse response); + + /** + * 发送上传材料的邮件 + * @param riskId + */ + void sendUploadEmail(String riskId); + + /** + * 发送拒绝邮件 + * @param riskId + */ + void sendRefuseEmail(String riskId); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java new file mode 100644 index 000000000..33cc158b2 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java @@ -0,0 +1,24 @@ +package au.com.royalpay.payment.manage.riskbusiness.core; + +import com.alibaba.fastjson.JSONObject; + +public interface RiskUploadService { + /** + * 上传材料 + * @param material + */ + void submitMaterial(JSONObject material); + + /** + * 删除缓存 + * @param codeKey + */ + void deleteUploadMailKey(String codeKey); + + /** + * + * @param codeKey + * @param risk_id + */ + void checkUploadMailKey(String codeKey,String risk_id); +} 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 c88d23c00..739b70d2f 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,18 +1,30 @@ package au.com.royalpay.payment.manage.riskbusiness.core.impl; +import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; +import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; +import au.com.royalpay.payment.tools.env.PlatformEnvironment; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring4.SpringTemplateEngine; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -20,9 +32,13 @@ import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Date; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import java.util.concurrent.TimeUnit; /** * @Author lvjian @@ -31,14 +47,23 @@ import java.util.zip.ZipOutputStream; @Service public class RiskBusinessServiceImpl implements RiskBusinessService { - @Autowired + @Resource private RiskEventMapper riskEventMapper; - - @Autowired - private OrderMapper orderMapper; - - @Autowired + @Resource private ClientMapper clientMapper; + @Resource + private ClientBDMapper clientBDMapper; + @Resource + private OrderMapper orderMapper; + @Resource + private StringRedisTemplate stringRedisTemplate; + @Resource + private SpringTemplateEngine thymeleaf; + @Resource + private MailService mailService; + @Resource + private RoyalThreadPoolExecutor royalThreadPoolExecutor; + private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL"; @Override public List getRiskEvents(JSONObject params) { @@ -87,6 +112,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Override public void addRiskEvent(JSONObject params) { + JSONObject client = clientMapper.findClientByMoniker(params.getString("client_moniker")); + if(client == null){ + throw new InvalidShortIdException(); + } + if(client.containsKey("sub_merchant_id")){ + params.put("sub_merchant_id",client.getString("sub_merchant_id")); + } riskEventMapper.save(params); } @@ -123,4 +155,93 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { e.printStackTrace(); } } + + @Override + public void sendUploadEmail(String riskId) { + JSONObject event = getRiskEventDetail(riskId); + Context ctx = getMailContext(event); + final List emails = (List)ctx.getVariable("emails"); + final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); + royalThreadPoolExecutor.execute(() -> { + try { + String emailId = mailService.sendRiskEmail("Your merchants needs to submit risk materials", emails.isEmpty() ? "" : StringUtils.join(emails, ","), + "", content, event.getIntValue("order_type")); + event.put("email_status",1); + event.put("result_type",1); + riskEventMapper.update(event); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } + }); + } + + @Override + public void sendRefuseEmail(String riskId) { + JSONObject event = getRiskEventDetail(riskId); + Context ctx = getMailContext(event); + ctx.setVariable("refuse",true); + final List emails = (List)ctx.getVariable("emails"); + final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); + royalThreadPoolExecutor.execute(() -> { + try { + String emailId = mailService.sendRiskEmail("Your merchants needs to resubmit risk materials", emails.isEmpty() ? "" : StringUtils.join(emails, ","), + "", content, event.getIntValue("order_type")); + event.put("email_status",2); + event.put("result_type",4); + riskEventMapper.update(event); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } + }); + } + + private Context getMailContext(JSONObject event){ + JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker")); + if (client == null) { + throw new InvalidShortIdException(); + } + String codeKey = RandomStringUtils.random(20, true, true); + while(stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).get()!=null ){ + codeKey = RandomStringUtils.random(20, true, true); + } + String codeKeyValue = RandomStringUtils.random(10, true, true); + String expireDay = "7"; + stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS); + String uploadUrl = PlatformEnvironment.getEnv().concatUrl("/risk/upload/") + event.getString("risk_id") + "/" + codeKey; + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + List bdNames = new ArrayList<>(); + List emails = new ArrayList<>(); + for (JSONObject bd : bds) { + String bdName = bd.getString("display_name"); + if (StringUtils.isNotEmpty(bdName)) { + bdNames.add(bdName); + } + String email = bd.getString("email"); + if (StringUtils.isNotEmpty(email)) { + emails.add(email); + } + } + String bdNamesStr = bdNames.isEmpty() ? "" : StringUtils.join(bdNames, ","); + String reply_date = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy年MM月dd日"); + String[] orderIds = event.getString("order_ids").split(","); + List orders = new ArrayList(); + for(String orderId : orderIds){ + JSONObject order = orderMapper.findOrderById(orderId); + if(order==null){ + throw new BadRequestException("Order: "+orderId+" not exists"); + } + orders.add(order); + } + Context ctx = new Context(); + ctx.setVariable("bdNamesStr", bdNamesStr); + ctx.setVariable("reply_date", reply_date); + ctx.setVariable("orders", orders); + ctx.setVariable("client", client); + ctx.setVariable("uploadUrl", uploadUrl); + ctx.setVariable("emails", emails); + return ctx; + } + private String getRiskUploadKey(String codeKey){ + return UPLOAD_MAIL_PREFIX + codeKey; + } } 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 new file mode 100644 index 000000000..b5aaa04a0 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java @@ -0,0 +1,95 @@ +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.RiskMaterialMapper; +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.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; +import java.util.Date; + +@Service +public class RiskUploadServiceIpml implements RiskUploadService { + @Resource + private RiskMaterialMapper riskMaterialMapper; + @Resource + private RiskEventMapper riskEventMapper; + @Resource + private StringRedisTemplate stringRedisTemplate; + @Resource + private MailService mailService; + @Resource + private RoyalThreadPoolExecutor royalThreadPoolExecutor; + @Resource + private SpringTemplateEngine thymeleaf; + private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL"; + + @Override + public void submitMaterial(JSONObject material) { + riskMaterialMapper.save(material); + JSONObject event = riskEventMapper.findById(material.getString("risk_id")); + event.put("result_type",2); + riskEventMapper.update(event); + JSONObject operator = riskMaterialMapper.findOperatorById(material.getString("risk_id")); + if(operator.containsKey("email")){ + Context ctx = new Context(); + ctx.setVariable("client_moniker", event.getString("client_moniker")); + ctx.setVariable("short_name", event.getString("short_name")); + ctx.setVariable("create_time", DateFormatUtils.format(event.getDate("create_time"),"yyyy-MM-dd HH:mm:ss")); + ctx.setVariable("operator", operator.getString("display_name")); + final String content = thymeleaf.process("mail/risk_operator_notice", ctx); + royalThreadPoolExecutor.execute(() -> { + try { + String emailId = mailService.sendRiskEmail(event.getString("client_moniker")+" has submitted the material",operator.getString("email") , + "", content, event.getIntValue("order_type")); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } + }); + } + + } + + @Override + public void deleteUploadMailKey(String codeKey) { + stringRedisTemplate.delete(getRiskUploadKey(codeKey)); + } + + @Override + public void checkUploadMailKey(String codeKey,String risk_id) { + JSONObject event = riskEventMapper.findById(risk_id); + //到期日前一天的下午6点前url可用 + try { + String reply = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy-MM-dd 18:00:00"); + if(new Date().after( DateUtils.parseDate(reply,new String[]{"yyyy-MM-dd HH:mm:ss"}))){ + deleteUploadMailKey(codeKey); + throw new BadRequestException("Url expired"); + } + } catch (ParseException e) { + e.printStackTrace(); + } + + if (StringUtils.isNotEmpty(codeKey)) { + String redisUpload = stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).get(); + if (redisUpload == null) { + throw new BadRequestException("Url expired"); + } + } + } + private String getRiskUploadKey(String codeKey){ + return UPLOAD_MAIL_PREFIX + codeKey; + } +} 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 8ed299654..90c03da5f 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 @@ -10,6 +10,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; /** @@ -18,7 +22,8 @@ import java.util.List; * @Date 2018/10/10 1:12 */ @RestController -@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) +//@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) +@RequestMapping(value = "/risk/business/") public class RiskBusinessController { @Autowired @@ -42,6 +47,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")); riskBusinessService.addRiskEvent(params); } @@ -55,5 +61,16 @@ public class RiskBusinessController { public void downloadComplianceZip(@PathVariable("risk_id") String riskId, HttpServletResponse response) throws Exception { riskBusinessService.downloadAuditMaterialZiP(riskId, response); } + + + @RequestMapping(value = "/{risk_id}/upload_mail",method = RequestMethod.PUT) + public void uploadEmail(@PathVariable String risk_id) { + riskBusinessService.sendUploadEmail(risk_id); + } + + @RequestMapping(value = "/{risk_id}/refuse",method = RequestMethod.PUT) + public void refuseEmail(@PathVariable String risk_id) { + riskBusinessService.sendRefuseEmail(risk_id); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java new file mode 100644 index 000000000..b60ab662f --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java @@ -0,0 +1,42 @@ +package au.com.royalpay.payment.manage.riskbusiness.web; + +import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService; +import com.alibaba.fastjson.JSONObject; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("/risk/upload") +public class RiskFileUploadController { + @Resource + private RiskUploadService riskUploadService; + + /** + * 上传材料的链接 + * @param codeKey + * @param risk_id + * @return + */ + @RequestMapping(value = "/{risk_id}/{codeKey}", method = RequestMethod.GET) + public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String risk_id) { + //检查codekey是否有效 + riskUploadService.checkUploadMailKey(codeKey,risk_id); + ModelAndView view = new ModelAndView("mail/risk_upload"); + view.addObject("codeKey", codeKey); + view.addObject("risk_id",risk_id); + return view; + } + + /** + * 上传调单材料 + * @param codeKey + * @param material + */ + @RequestMapping(value = "/{codeKey}", method = RequestMethod.POST) + public void upload(@PathVariable String codeKey, @RequestBody JSONObject material) { + riskUploadService.submitMaterial(material); + riskUploadService.deleteUploadMailKey(codeKey); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java index 34a8f2907..bccc665f9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java @@ -27,6 +27,10 @@ public class AttachmentController { public JSONObject uploadImage(@RequestParam MultipartFile file) throws IOException { return attachmentClient.uploadFile(file,false); } + @RequestMapping(value = "/riskFiles", method = RequestMethod.POST) + public JSONObject uploadRiskImage(@RequestParam MultipartFile file) throws IOException { + return attachmentClient.uploadFile(file,false); + } @RequestMapping(value = "/secret_files", method = RequestMethod.POST) @RequirePartner diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index 2b0482c19..0ac8982e1 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -738,5 +738,80 @@ and t.clearing_status=#{clearing_status} + - \ No newline at end of file + diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml new file mode 100644 index 000000000..5179b5180 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/src/main/resources/templates/mail/risk_operator_notice.html b/src/main/resources/templates/mail/risk_operator_notice.html new file mode 100644 index 000000000..d38f3b17f --- /dev/null +++ b/src/main/resources/templates/mail/risk_operator_notice.html @@ -0,0 +1,24 @@ + +

    Dear :

    +

    您好,您于创建的风控事件单已经接收到了商户()的风控材料,请及时审核。

    +

    Best Regards

    +

    +
    + Contact Us
    + Email:
    + info@royalpay.com.au
    + Tel:
    + 1300 10 77 50
    +
    + Service WeChat Account:
    +
    + Level 14, 383 Kent Street, Sydney NSW 2000
    +
    + Level 11, 15 William Street, Melbourne VIC 3000 +

    +

    Tunnel Show Pty Ltd trading as RoyalPay
    + Representative of AFSL licensee 448066 +

    + diff --git a/src/main/resources/templates/mail/risk_upload.html b/src/main/resources/templates/mail/risk_upload.html new file mode 100644 index 000000000..82ecf6c13 --- /dev/null +++ b/src/main/resources/templates/mail/risk_upload.html @@ -0,0 +1,434 @@ + + + + + + + RoyalPay | Risk Materials + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + +

    Image size should not exceed 3MB

    +
    +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    +
    + +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    +
    + +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    +
    + +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    +
    + +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    +
    +
    + +
    + + + +
    + +
    +
    +
    +
    + +
    + Submit +
    + +
    +
    + + +
    + +
    +
    +
    + +
    +
    + + diff --git a/src/main/resources/templates/mail/risk_upload_mail.html b/src/main/resources/templates/mail/risk_upload_mail.html new file mode 100644 index 000000000..3939e6cc5 --- /dev/null +++ b/src/main/resources/templates/mail/risk_upload_mail.html @@ -0,0 +1,53 @@ + +

    Dear :

    +

    您好,您提交的风控材料已被拒绝。请于下午6:00(悉尼时间)前提供被查商户 ()的以下材料

    +

    请提供以下被查单号的小票, 物流单据(如有邮寄产品的情况), 以及消费者与买家的聊天记录等来佐证被查交易单号。 被查交易单号如下:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Order IDAmountInput AmountAUD AmountExchange RateStatusCreate TimeGateway
    +

    请点击此链接上传所需材料

    +

    如果提交的材料不齐, 则有关停支付的风险。还请按时提供商户材料并直接回复该邮件, 感谢,辛苦。

    +

    Best Regards

    +

    +
    + Contact Us
    + Email:
    + info@royalpay.com.au
    + Tel:
    + 1300 10 77 50
    +
    + Service WeChat Account:
    +
    + Level 14, 383 Kent Street, Sydney NSW 2000
    +
    + Level 11, 15 William Street, Melbourne VIC 3000 +

    +

    Tunnel Show Pty Ltd trading as RoyalPay
    + Representative of AFSL licensee 448066 +

    + diff --git a/src/main/ui/risk_upload_success.html b/src/main/ui/risk_upload_success.html new file mode 100644 index 000000000..c596999f8 --- /dev/null +++ b/src/main/ui/risk_upload_success.html @@ -0,0 +1,190 @@ + + + + + + + + Risk Materials | Success + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + + + +
    + +

    We have received your materials, our risk manager will review soon,

    +

    please wait for result.

    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + + diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index b09684270..24e7de473 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -23,7 +23,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], var emailStatusMap = { "0": "未发送", - "1": "已发送" + "1": "已发送", + "2": "打回并已发送" }; var app = angular.module('riskBusinessApp', ['ui.router']); @@ -173,6 +174,18 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.loadRiskEventDetail = function(riskId) { $http.get('/risk/business/events/' + riskId) } + $scope.resendUploadEmail = function () { + commonDialog.confirm({ + title: 'Warning', + content: 'Please confirm sending mail.' + }).then(function () { + $http.put('/risk/business/' + $scope.riskEvent.risk_id + '/upload_mail').then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; } ]); diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index 5461723fc..4ee3fefb2 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -160,7 +160,7 @@
    Send Email + class="btn btn-info" ng-click="resendUploadEmail()">Send Email
    @@ -303,4 +303,4 @@ - \ No newline at end of file + diff --git a/src/main/ui/static/riskupload/risk_upload.js b/src/main/ui/static/riskupload/risk_upload.js new file mode 100644 index 000000000..8398b10e9 --- /dev/null +++ b/src/main/ui/static/riskupload/risk_upload.js @@ -0,0 +1,201 @@ +// define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) { +// 'use strict'; + var app = angular.module('riskUploadApp',['ngFileUpload']); + app.controller('riskUploadCtrl', ['$scope','$http','Upload','$filter',function ($scope,$http,Upload,$filter) { + $scope.material={}; + $scope.codeKey=document.getElementById('codeKey').value; + $scope.material.risk_id=document.getElementById('risk_id').value; + $scope.material.update_time=$filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss'); + $scope.uploadFile1 = function (file) { + if (file != null) { + $scope.file1Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file1Progress; + $scope.material.file1_url = resp.data.url; + }, function (resp) { + delete $scope.file1Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file1Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + $scope.uploadFile2 = function (file) { + if (file != null) { + $scope.file2Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file2Progress; + $scope.material.file2_url = resp.data.url; + }, function (resp) { + delete $scope.file2Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file2Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + $scope.uploadFile3 = function (file) { + if (file != null) { + $scope.file3Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file3Progress; + $scope.material.file3_url = resp.data.url; + }, function (resp) { + delete $scope.file3Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file3Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + $scope.uploadFile4 = function (file) { + if (file != null) { + $scope.file4Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file4Progress; + $scope.material.file4_url = resp.data.url; + }, function (resp) { + delete $scope.file4Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file4Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + + $scope.uploadFile5 = function (file) { + if (file != null) { + $scope.file5Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file5Progress; + $scope.material.file5_url = resp.data.url; + }, function (resp) { + delete $scope.file5Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file5Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + + $scope.uploadFile6 = function (file) { + if (file != null) { + $scope.file6Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file6Progress; + $scope.material.file6_url = resp.data.url; + }, function (resp) { + delete $scope.file6Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file6Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + + $scope.uploadFile7 = function (file) { + if (file != null) { + $scope.file7Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file7Progress; + $scope.material.file7_url = resp.data.url; + }, function (resp) { + delete $scope.file7Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file7Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + $scope.uploadFile8 = function (file) { + if (file != null) { + $scope.file8Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file8Progress; + $scope.material.file8_url = resp.data.url; + }, function (resp) { + delete $scope.file8Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file8Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + $scope.uploadFile9 = function (file) { + if (file != null) { + $scope.file9Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file9Progress; + $scope.material.file9_url = resp.data.url; + }, function (resp) { + delete $scope.file9Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file9Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + $scope.uploadFile10 = function (file) { + if (file != null) { + $scope.file10Progress = {value: 0}; + Upload.upload({ + url: '/attachment/riskFiles', + data: {file: file} + }).then(function (resp) { + delete $scope.file10Progress; + $scope.material.file10_url = resp.data.url; + }, function (resp) { + delete $scope.file10Progress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.file10Progress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + }; + $scope.submit = function (form) { + $http.post('/risk/upload/'+$scope.codeKey, $scope.material).then(function (resp) { + // commonDialog.alert({title: 'Success', content: 'Submit successfully', type: 'success'}); + alert('Submit successfully'); + window.location.href="/risk_upload_success.html"; + }, function (resp) { + alert('Submit failed'); + // commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + } + + }]) + + + +// return app; +// +// }) + + From 671c27649f2d75cc19af714b4583107b2c39a312 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Mon, 15 Oct 2018 18:00:53 +0800 Subject: [PATCH 08/65] update --- .../riskbusiness/core/impl/RiskUploadServiceIpml.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 b5aaa04a0..1b3087c3b 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 @@ -3,6 +3,7 @@ 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.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; @@ -28,6 +29,8 @@ public class RiskUploadServiceIpml implements RiskUploadService { @Resource private RiskEventMapper riskEventMapper; @Resource + private ClientMapper clientMapper; + @Resource private StringRedisTemplate stringRedisTemplate; @Resource private MailService mailService; @@ -45,9 +48,10 @@ public class RiskUploadServiceIpml implements RiskUploadService { riskEventMapper.update(event); JSONObject operator = riskMaterialMapper.findOperatorById(material.getString("risk_id")); if(operator.containsKey("email")){ + JSONObject client = clientMapper.findClientByMoniker(event.getString("client_moniker")); Context ctx = new Context(); ctx.setVariable("client_moniker", event.getString("client_moniker")); - ctx.setVariable("short_name", event.getString("short_name")); + ctx.setVariable("short_name", client.getString("short_name")); ctx.setVariable("create_time", DateFormatUtils.format(event.getDate("create_time"),"yyyy-MM-dd HH:mm:ss")); ctx.setVariable("operator", operator.getString("display_name")); final String content = thymeleaf.process("mail/risk_operator_notice", ctx); From 1eb28115034c5f1d780a44de7c3bd05e17beca0a Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Tue, 16 Oct 2018 20:22:59 +0800 Subject: [PATCH 09/65] =?UTF-8?q?=E9=A3=8E=E6=8E=A7=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/notice/core/MailService.java | 2 +- .../notice/core/impls/MailServiceImp.java | 3 +- .../core/RiskBusinessService.java | 5 +- .../core/impl/RiskBusinessServiceImpl.java | 204 ++++++++++++++++-- .../core/impl/RiskUploadServiceIpml.java | 2 +- .../web/RiskBusinessController.java | 7 +- .../templates/mail/risk_upload_mail.html | 103 ++++++--- 7 files changed, 264 insertions(+), 62 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java index 8291074da..d03ea0cbe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java @@ -17,7 +17,7 @@ public interface MailService { String sendEmail(String title, String mailTos, String mailCcs, String content, List attachFiles) throws URISyntaxException, IOException; - String sendRiskEmail(String title, String mailTos, String mailCcs, String content, int order_type) throws URISyntaxException, IOException; + String sendRiskEmail(String title, String mailTos, String mailCcs, String content, List attachFiles, int order_type) throws URISyntaxException, IOException; List checkEmailStatus(String emailId); diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java index 2892391de..a44a49cab 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java @@ -267,7 +267,7 @@ public class MailServiceImp implements MailService { } @Override - public String sendRiskEmail(String title, String mailTos, String mailCcs, String content, int order_type) throws URISyntaxException, IOException { + public String sendRiskEmail(String title, String mailTos, String mailCcs, String content, List attachFiles, int order_type) throws URISyntaxException, IOException { NoticeBean noticeBean = new NoticeBean(); noticeBean.setTitle(title); List mailClients = new ArrayList<>(); @@ -277,6 +277,7 @@ public class MailServiceImp implements MailService { mailClients.add(mailClient); noticeBean.setMailClients(mailClients); noticeBean.setContent(content); + noticeBean.setAttachFiles(attachFiles); noticeBean.setSenderAddress("riskcontrol@royalpay.com.au"); noticeBean.setPassword("RPrisk123"); if(order_type == 1 || order_type == 2){ 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 898aa9dee..77b63ec15 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 @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; /** @@ -62,12 +63,12 @@ public interface RiskBusinessService { * 发送上传材料的邮件 * @param riskId */ - void sendUploadEmail(String riskId); + void sendUploadEmail(String riskId) throws IOException; /** * 发送拒绝邮件 * @param riskId */ - void sendRefuseEmail(String riskId); + void sendRefuseEmail(String riskId) throws IOException; } 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 739b70d2f..7a181ea24 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 @@ -8,6 +8,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; +import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; @@ -16,10 +17,13 @@ import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -27,8 +31,10 @@ import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.math.BigDecimal; import java.net.URL; import java.util.ArrayList; import java.util.Date; @@ -62,6 +68,8 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Resource private MailService mailService; @Resource + private TradeLogService tradeLogService; + @Resource private RoyalThreadPoolExecutor royalThreadPoolExecutor; private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL"; @@ -80,7 +88,6 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Override public JSONObject getRiskEventDetail(String riskId) { JSONObject riskEventDetail = riskEventMapper.findById(riskId); - // 获取商户信息 String clientMoniker = riskEventDetail.getString("client_moniker"); JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker); @@ -157,15 +164,17 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { } @Override - public void sendUploadEmail(String riskId) { + public void sendUploadEmail(String riskId) throws IOException { JSONObject event = getRiskEventDetail(riskId); Context ctx = getMailContext(event); - final List emails = (List)ctx.getVariable("emails"); + final List emailsTos = (List)ctx.getVariable("emailsTos"); + final List emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List)ctx.getVariable("emailsCcs"); + final String title = (String)ctx.getVariable("title"); final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); royalThreadPoolExecutor.execute(() -> { try { - String emailId = mailService.sendRiskEmail("Your merchants needs to submit risk materials", emails.isEmpty() ? "" : StringUtils.join(emails, ","), - "", content, event.getIntValue("order_type")); + String emailId = mailService.sendRiskEmail(title, emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), + emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List)ctx.getVariable("files"):null,event.getIntValue("order_type")); event.put("email_status",1); event.put("result_type",1); riskEventMapper.update(event); @@ -176,16 +185,17 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { } @Override - public void sendRefuseEmail(String riskId) { + public void sendRefuseEmail(String riskId) throws IOException { JSONObject event = getRiskEventDetail(riskId); Context ctx = getMailContext(event); ctx.setVariable("refuse",true); - final List emails = (List)ctx.getVariable("emails"); + final List emailsTos = (List)ctx.getVariable("emailsTos"); + final List emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List)ctx.getVariable("emailsCcs"); final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); royalThreadPoolExecutor.execute(() -> { try { - String emailId = mailService.sendRiskEmail("Your merchants needs to resubmit risk materials", emails.isEmpty() ? "" : StringUtils.join(emails, ","), - "", content, event.getIntValue("order_type")); + String emailId = mailService.sendRiskEmail("You need to resubmit risk materials", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), + emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List)ctx.getVariable("files"):null,event.getIntValue("order_type")); event.put("email_status",2); event.put("result_type",4); riskEventMapper.update(event); @@ -195,7 +205,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { }); } - private Context getMailContext(JSONObject event){ + private Context getMailContext(JSONObject event) throws IOException { JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker")); if (client == null) { throw new InvalidShortIdException(); @@ -206,11 +216,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { } String codeKeyValue = RandomStringUtils.random(10, true, true); String expireDay = "7"; + if(event.getIntValue("order_type")>2){ + expireDay = "3"; + } stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS); String uploadUrl = PlatformEnvironment.getEnv().concatUrl("/risk/upload/") + event.getString("risk_id") + "/" + codeKey; List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); List bdNames = new ArrayList<>(); - List emails = new ArrayList<>(); + List bdEmails = new ArrayList<>(); for (JSONObject bd : bds) { String bdName = bd.getString("display_name"); if (StringUtils.isNotEmpty(bdName)) { @@ -218,30 +231,175 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { } String email = bd.getString("email"); if (StringUtils.isNotEmpty(email)) { - emails.add(email); + bdEmails.add(email); } } + List clientEmails = new ArrayList<>(); + clientEmails.add(client.getString("contact_email")); String bdNamesStr = bdNames.isEmpty() ? "" : StringUtils.join(bdNames, ","); String reply_date = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy年MM月dd日"); - String[] orderIds = event.getString("order_ids").split(","); - List orders = new ArrayList(); - for(String orderId : orderIds){ - JSONObject order = orderMapper.findOrderById(orderId); - if(order==null){ - throw new BadRequestException("Order: "+orderId+" not exists"); - } - orders.add(order); - } + String reply_date_english = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"dd/MM/yyyy"); + Context ctx = new Context(); + ctx.setVariable("order_type", event.getIntValue("order_type")); ctx.setVariable("bdNamesStr", bdNamesStr); ctx.setVariable("reply_date", reply_date); - ctx.setVariable("orders", orders); + ctx.setVariable("reply_date_english", reply_date_english); ctx.setVariable("client", client); ctx.setVariable("uploadUrl", uploadUrl); - ctx.setVariable("emails", emails); + ctx.setVariable("royalpay_order_type", event.getIntValue("royalpay_order_type")); + ctx.setVariable("warning_order_type", event.getIntValue("warning_order_type")); + switch (event.getIntValue("order_type")){ + case 1: + case 2: + String[] orderIds = event.getString("order_ids").split(","); + List orders = new ArrayList(); + for(String orderId : orderIds){ + JSONObject order = orderMapper.findOrderById(orderId); + if(order==null){ + throw new BadRequestException("Order: "+orderId+" not exists"); + } + orders.add(order); + } + ctx.setVariable("orders", orders); + ctx.setVariable("title","Your merchants needs to submit risk materials"); + ctx.setVariable("emailsTos", bdEmails); + break; + case 3: + List attachList = new ArrayList<>(); + JSONObject file = new JSONObject(); + file.put("name", client.getString("short_name")+ "被查单号相关信息.xlsx"); + file.put("content", Base64.encodeBase64String(generateRiskOrders(event))); + attachList.add(file); + ctx.setVariable("files",attachList); + case 4: + ctx.setVariable("title","RoyalPay风控调查 — " + client.getString("short_name")); + ctx.setVariable("emailsCcs", bdEmails); + ctx.setVariable("emailsTos", clientEmails); + break; + } return ctx; } private String getRiskUploadKey(String codeKey){ return UPLOAD_MAIL_PREFIX + codeKey; } + + private byte[] generateRiskOrders(JSONObject event) throws IOException { + String[] orderIds = event.getString("order_ids").split(","); + Workbook wb = new XSSFWorkbook(); + for(String orderId : orderIds){ + JSONObject orderDetail = tradeLogService.getOrderDetail(new JSONObject(), event.getString("client_moniker"), orderId, null); + Sheet sheet = wb.createSheet(orderId); + sheet.setDefaultColumnWidth((short) 40); + Row row0 = sheet.createRow(0); + Row row1 = sheet.createRow(1); + Row row2 = sheet.createRow(2); + Row row3 = sheet.createRow(3); + Row row4 = sheet.createRow(4); + Row row5 = sheet.createRow(5); + Row row6 = sheet.createRow(6); + Row row7 = sheet.createRow(7); + Row row8 = sheet.createRow(8); + Row row9 = sheet.createRow(9); + Row row10 = sheet.createRow(10); + Row row11 = sheet.createRow(11); + Row row12 = sheet.createRow(12); + Row row13 = sheet.createRow(13); + Row row14 = sheet.createRow(14); + Row row15 = sheet.createRow(15); + row0.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Partner"); + row0.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getJSONObject("client").getString("short_name")+"("+orderDetail.getJSONObject("client").getString("client_moniker")+")"); + row1.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Order ID"); + row1.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("order_id")); + row2.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Platform Transaction ID"); + row2.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("system_transaction_id")); + row3.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Order Description"); + row3.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(orderDetail.getString("order_description"))); + row4.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Customer ID"); + row4.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("customer_id")); + row5.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("IP"); + row5.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("customer_ip")); + row6.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Total Amount"); + row6.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency")+" "+orderDetail.getString("total_amount")); + row7.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Input Amount"); + row7.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency")+" "+orderDetail.getString("display_amount")); + row8.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Pay Amount"); + row8.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency")+" "+orderDetail.getString("customer_payment_amount")); + row9.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Exchange Rate"); + row9.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("exchange_rate")); + row10.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Clearing Amount"); + row10.createCell(1,Cell.CELL_TYPE_STRING).setCellValue("AUD "+ orderDetail.getString("clearing_amount")); + row11.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Gateway"); + row11.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(getGateWay(orderDetail.getIntValue("gateway"))); + row12.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Create Time"); + row12.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("create_time")); + row13.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Status"); + row13.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(getStatus(orderDetail.getIntValue("status"))); + row14.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Pay Time"); + row14.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("transaction_time")); + row15.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Order Detail"); + row15.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(orderDetail.getString("order_detail"))); + } + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + wb.write(bos); + bos.flush(); + return bos.toByteArray(); + } + private String getGateWay(int gateWay){ + switch (gateWay) { + case 0: + return "线下扫码"; + case 1: + return "线下扫码"; + case 2: + return "商户静态码"; + case 3: + return "线上网关"; + case 4: + return "JSAPI网关"; + case 5: + return "线下网关"; + case 6: + return "线下网关"; + case 7: + return "商户静态码"; + case 8: + return "Mobile H5"; + case 9: + return "第三方网关"; + case 10: + return "APP网关"; + case 11: + return "账单码"; + case 12: + return "小程序"; + case 13: + return "原生二维码"; + case 14: + return "账单链接"; + } + return ""; + } + + private String getStatus(int status){ + switch (status) { + case 0: + return "Creating"; + case 1: + return "Failed Create Order"; + case 2: + return "Wait For Payment"; + case 3: + return "Closed"; + case 4: + return "Payment Failed"; + case 5: + return "Payment Success"; + case 6: + return "Partial Refund"; + case 7: + return "Full Refund"; + } + return ""; + } } 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 1b3087c3b..cf475bceb 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 @@ -58,7 +58,7 @@ public class RiskUploadServiceIpml implements RiskUploadService { royalThreadPoolExecutor.execute(() -> { try { String emailId = mailService.sendRiskEmail(event.getString("client_moniker")+" has submitted the material",operator.getString("email") , - "", content, event.getIntValue("order_type")); + "", content, null,event.getIntValue("order_type")); } catch (Exception e) { throw new EmailException("Email Sending Failed", e); } 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 90c03da5f..1614e94be 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 @@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -64,13 +65,15 @@ public class RiskBusinessController { @RequestMapping(value = "/{risk_id}/upload_mail",method = RequestMethod.PUT) - public void uploadEmail(@PathVariable String risk_id) { + public void uploadEmail(@PathVariable String risk_id) throws IOException { riskBusinessService.sendUploadEmail(risk_id); } @RequestMapping(value = "/{risk_id}/refuse",method = RequestMethod.PUT) - public void refuseEmail(@PathVariable String risk_id) { + public void refuseEmail(@PathVariable String risk_id) throws IOException { riskBusinessService.sendRefuseEmail(risk_id); } + + } diff --git a/src/main/resources/templates/mail/risk_upload_mail.html b/src/main/resources/templates/mail/risk_upload_mail.html index 3939e6cc5..f6145a1a2 100644 --- a/src/main/resources/templates/mail/risk_upload_mail.html +++ b/src/main/resources/templates/mail/risk_upload_mail.html @@ -1,36 +1,75 @@ -

    Dear :

    -

    您好,您提交的风控材料已被拒绝。请于下午6:00(悉尼时间)前提供被查商户 ()的以下材料

    -

    请提供以下被查单号的小票, 物流单据(如有邮寄产品的情况), 以及消费者与买家的聊天记录等来佐证被查交易单号。 被查交易单号如下:

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Order IDAmountInput AmountAUD AmountExchange RateStatusCreate TimeGateway
    -

    请点击此链接上传所需材料

    -

    如果提交的材料不齐, 则有关停支付的风险。还请按时提供商户材料并直接回复该邮件, 感谢,辛苦。

    -

    Best Regards

    +
    + Dear : +

    您好,您提交的风控材料已被拒绝。请于下午6:00(悉尼时间)前提供被查商户 ()的以下材料

    +

    请提供以下被查单号的小票, 物流单据(如有邮寄产品的情况), 以及消费者与买家的聊天记录等来佐证被查交易单号。 被查交易单号如下:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Order IDAmountInput AmountAUD AmountExchange RateStatusCreate TimeGateway
    +

    请点击此链接上传所需材料

    +

    如果提交的材料不齐, 则有关停支付的风险。还请按时提供商户材料并直接回复该邮件, 感谢,辛苦。

    +
    +
    + 尊敬的RoyalPay商户 :
    + Dear RoyalPay merchant :
    +

    您提交的风控材料已被拒绝。
    + The risk materials you submitted has been rejected +

    +

    近期由于我们的风控系统检测到您的交易异常,已暂时将您的清算周期调整为T+,还请您提供以下材料,还原附件中列明的交易的真实背景:
    + RoyalPay's risk management system recently has identified abnormal transactions from your records, clean days has been adjusted to T+.so please provide us with following materials to assist in verifying the real scenario of the transactions attached:

    +

    1.请解释相应的消费场景/业务模式,例如网站商城,扫码支付, 消费者到店支付等;
    +   Please explain the relative payment scenario/business activities, for example, online store, QR code payment, payment at the store, etc;

    +

    2.提供相应购物清单,订单小票(请提供与被查交易订单号相匹配的交易时间及金额的发票);
      +   Provide related shopping lists, invoices. (Please provide the invoices, amount of which matches that of the abnormal transaction);

    +

    3.提供相应的发货证明,报关单(若有消费者在国内购买,请提供物流单据或报关单);
    +   Relative proof of delivery, customs declaration (If the consumer purchased from China, please provide shipping receipt or customs declaration);

    +

    4.提供您的门店照片(门店照及店铺内的照片各一张, 一张可以看到商户名的门头照,一张可以看到相关商品或服务的店内照片);
    +     Photos of the store ( one of each front-store and in-store);

    +

    5.其他可以还原交易背景的资料,如和消费者的聊天记录等,来佐证被查单号交易的真实性;
    +   Other materials that can verify the payment scenario, for example, chatting history, to prove the truth of the transactions;

    +

    注:以上证件需原件扫描件/数码拍摄件,且照片内容需真实有效,不得做任何修改。

    +

    请查收附件中关于被抽查的订单交易的相关信息,并在下午6:00 (悉尼时间)前将所需材料直接回复该邮件,未能按时提交完整证明材料,支付渠道将被关停,请您务必配合调查。感谢。
    + Please find sampled transactions in attachment, and reply required materials to this email before 6:00 pm (AEST). If you can not provide qualified materials on time, the payment channels would be suspended or restricted with amount limit. Please be sure to assist the investigation. Thanks.

    +

    请点击此链接上传所需材料。
    + Please click on this link to upload the required materials. +

    +
    +
    + 尊敬的RoyalPay商户 :
    + Dear RoyalPay merchant :
    +

    我司风控系统检测到您短期内后台交易存在异常行为(单人多次大金额交易退款频繁),触发平台风控预警,特此提醒:请勿使用平台进行违规交易,一经核查将关闭支付权限。请知悉。
    + RoyalPay's risk management system has identified abnormal transactions from your records in a short time(Single person pays large sums several timesfrequent refund transactions),which triggered the platform risk control warning. Here reminds: Do not use the platform for illegal transactions. Once verified, the payment authority will be closed.

    +
    +

    顺颂商祺
    + Sincerely +

    +

    + RoyalPay 风控团队
    + RoyalPay Risk Management Team +


    From a92f4876f14cab984a7bb0f10bdaccd7ffef8a61 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Tue, 16 Oct 2018 20:51:47 +0800 Subject: [PATCH 10/65] =?UTF-8?q?=E6=8F=90=E9=86=92=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E9=A3=8E=E6=8E=A7=E6=9D=90=E6=96=99=E7=9A=84=E9=82=AE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/RiskBusinessService.java | 6 +++++ .../core/impl/RiskBusinessServiceImpl.java | 19 ++++++++++++++ .../web/RiskBusinessController.java | 5 +++- .../templates/mail/risk_urge_mail.html | 25 +++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/templates/mail/risk_urge_mail.html 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 77b63ec15..61cb7fdbb 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 @@ -71,4 +71,10 @@ public interface RiskBusinessService { */ void sendRefuseEmail(String riskId) throws IOException; + /** + * 发送提醒邮件 + * @param riskId + */ + void sendUrgeEmail(String riskId) throws IOException; + } 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 7a181ea24..1bc2ecaf2 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 @@ -205,6 +205,25 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { }); } + @Override + public void sendUrgeEmail(String riskId) throws IOException { + JSONObject event = getRiskEventDetail(riskId); + Context ctx = getMailContext(event); + final List emailsTos = (List)ctx.getVariable("emailsTos"); + final List emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List)ctx.getVariable("emailsCcs"); + final String content = thymeleaf.process("mail/risk_urge_mail.html", ctx); + royalThreadPoolExecutor.execute(() -> { + try { + String emailId = mailService.sendRiskEmail("Please submit risk materials as soon as possible", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), + emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List)ctx.getVariable("files"):null,event.getIntValue("order_type")); + event.put("email_status",3); + riskEventMapper.update(event); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } + }); + } + private Context getMailContext(JSONObject event) throws IOException { JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker")); if (client == null) { 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 1614e94be..6eea345c9 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 @@ -74,6 +74,9 @@ public class RiskBusinessController { riskBusinessService.sendRefuseEmail(risk_id); } - + @RequestMapping(value = "/{risk_id}/urge",method = RequestMethod.PUT) + public void urgeEmail(@PathVariable String risk_id) throws IOException { + riskBusinessService.sendUrgeEmail(risk_id); + } } diff --git a/src/main/resources/templates/mail/risk_urge_mail.html b/src/main/resources/templates/mail/risk_urge_mail.html new file mode 100644 index 000000000..00d0b1fab --- /dev/null +++ b/src/main/resources/templates/mail/risk_urge_mail.html @@ -0,0 +1,25 @@ + +Dear RoyalPay Merchant/BD : +

    您好,您的风控材料链接即将过期,请及时提交风控材料。未能按时提交完整证明材料,支付渠道将被关停,请您务必配合调查。感谢。

    +

    Your link to the risk materials is about to expire, please submit the risk materials in time.If you can not provide qualified materials on time, the payment channels would be suspended or restricted with amount limit. Please be sure to assist the investigation. Thanks.

    +

    Best Regards

    +

    +
    + Contact Us
    + Email:
    + info@royalpay.com.au
    + Tel:
    + 1300 10 77 50
    +
    + Service WeChat Account:
    +
    + Level 14, 383 Kent Street, Sydney NSW 2000
    +
    + Level 11, 15 William Street, Melbourne VIC 3000 +

    +

    Tunnel Show Pty Ltd trading as RoyalPay
    + Representative of AFSL licensee 448066 +

    + From 336ba5070b7d46962fa0d2c57eb4ef4bbf5a443f Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Tue, 16 Oct 2018 20:59:55 +0800 Subject: [PATCH 11/65] Merge branch 'develop_risk' of E:\globalPay\manage_develop_9009\royalpay.manage with conflicts. --- .../riskbusiness/RiskMaterialMapper.java | 7 + .../riskbusiness/bean/RiskEventQuery.java | 67 +++++++ .../core/RiskBusinessService.java | 7 + .../core/impl/RiskBusinessServiceImpl.java | 88 +++++---- .../riskbusiness/enums/RiskOrderTypeEnum.java | 27 +++ .../enums/RiskResultTypeEnum.java | 29 +++ .../web/RiskBusinessController.java | 43 ++++- src/main/resources/application-dev.properties | 2 +- .../mappers/riskbusiness/RiskEventMapper.xml | 54 +++++- .../riskbusiness/RiskMaterialMapper.xml | 34 +++- .../templates/analysis_monitoring.html | 2 +- src/main/ui/static/analysis/risk_business.js | 131 ++++++++++--- .../analysis/templates/audit_material.html | 42 ++-- .../analysis/templates/new_riskEvent.html | 78 ++++++-- .../analysis/templates/riskEvent_detail.html | 180 +++++++++++++++++- .../analysis/templates/risk_business.html | 175 ++++++++++++++++- 16 files changed, 841 insertions(+), 125 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskResultTypeEnum.java diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java index 4fed8604f..0c4731b95 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java @@ -1,10 +1,14 @@ package au.com.royalpay.payment.manage.mappers.riskbusiness; +import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect; import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; import org.apache.ibatis.annotations.Param; +import org.apache.catalina.LifecycleState; + +import java.util.List; @AutoMapper(tablename = "risk_material", pkName = "material_id") public interface RiskMaterialMapper { @@ -12,4 +16,7 @@ public interface RiskMaterialMapper { void save(JSONObject material); JSONObject findOperatorById(@Param("risk_id") String risk_id); + + List getRiskMaterial(JSONObject param); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java index d9121b1db..255f873d9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/bean/RiskEventQuery.java @@ -1,8 +1,13 @@ package au.com.royalpay.payment.manage.riskbusiness.bean; +import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; + /** * @Author lvjian * @Date 2018/10/10 11:27 @@ -24,9 +29,18 @@ public class RiskEventQuery { // 邮件发送状态 private Integer emailStatus; + // 行业 + private String industry; + // 处理结果 private Integer resultType; + // 收到调单邮件日期 + private String receiveEmailDate; + + // 邮件回复截止日期 + private String replyEmailDate; + public Integer getOrderType() { return orderType; } @@ -59,6 +73,46 @@ public class RiskEventQuery { this.orderIds = orderIds; } + public Integer getEmailStatus() { + return emailStatus; + } + + public void setEmailStatus(Integer emailStatus) { + this.emailStatus = emailStatus; + } + + public String getIndustry() { + return industry; + } + + public void setIndustry(String industry) { + this.industry = industry; + } + + public Integer getResultType() { + return resultType; + } + + public void setResultType(Integer resultType) { + this.resultType = resultType; + } + + public String getReceiveEmailDate() { + return receiveEmailDate; + } + + public void setReceiveEmailDate(String receiveEmailDate) { + this.receiveEmailDate = receiveEmailDate; + } + + public String getReplyEmailDate() { + return replyEmailDate; + } + + public void setReplyEmailDate(String replyEmailDate) { + this.replyEmailDate = replyEmailDate; + } + public JSONObject toJSON() { JSONObject params = new JSONObject(); @@ -76,6 +130,7 @@ public class RiskEventQuery { } if (StringUtils.isNotBlank(orderIds)) { + orderIds = orderIds.trim().replace(",", ","); params.put("order_ids", orderIds); } @@ -87,6 +142,18 @@ public class RiskEventQuery { params.put("result_type", resultType); } + if (StringUtils.isNotBlank(industry)) { + params.put("industry", industry); + } + + if (receiveEmailDate != null) { + params.put("receive_email_date", receiveEmailDate); + } + + if (replyEmailDate != null) { + params.put("reply_email_date", replyEmailDate); + } + return params; } } 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 77b63ec15..fbac2cb82 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 @@ -71,4 +71,11 @@ public interface RiskBusinessService { */ void sendRefuseEmail(String riskId) throws IOException; + + /** + * 获取最新上传的审核材料 + * @param param + * @return + */ + JSONObject getRiskMaterial(JSONObject param); } 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 7a181ea24..0894aa819 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 @@ -4,11 +4,13 @@ import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper; +import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; +import au.com.royalpay.payment.manage.riskbusiness.enums.RiskOrderTypeEnum; import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; @@ -73,6 +75,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { private RoyalThreadPoolExecutor royalThreadPoolExecutor; private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL"; + @Autowired + private RiskMaterialMapper riskMaterialMapper; + @Override public List getRiskEvents(JSONObject params) { return riskEventMapper.findAll(params); @@ -87,31 +92,34 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Override public JSONObject getRiskEventDetail(String riskId) { + JSONObject riskEventDetail = riskEventMapper.findById(riskId); // 获取商户信息 + JSONObject client = null; String clientMoniker = riskEventDetail.getString("client_moniker"); - JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } else { - riskEventDetail.put("clientInfo", client); + if (clientMoniker != null) { + client = clientMapper.findClientByMonikerAll(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } } - + riskEventDetail.put("clientInfo", client); return riskEventDetail; } @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)); + if (StringUtils.isNotBlank(orderIds)) { + String[] orderIdArray = orderIds.trim().split(","); + JSONObject query = new JSONObject(); + // 获取每笔订单的信息 + 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; @@ -119,12 +127,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Override public void addRiskEvent(JSONObject params) { - JSONObject client = clientMapper.findClientByMoniker(params.getString("client_moniker")); - if(client == null){ - throw new InvalidShortIdException(); - } - if(client.containsKey("sub_merchant_id")){ - params.put("sub_merchant_id",client.getString("sub_merchant_id")); + // 通用号调单不需要填写client_moniker + JSONObject client = null; + String clientMoniker = params.getString("client_moniker"); + if (clientMoniker != null) { + client = clientMapper.findClientByMoniker(clientMoniker); + if(client == null){ + throw new InvalidShortIdException(); + } } riskEventMapper.save(params); } @@ -139,23 +149,29 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { JSONObject riskEvent = riskEventMapper.findById(riskId); String clientMoniker = riskEvent.getString("client_moniker"); + JSONObject param = new JSONObject(); + param.put("risk_id", riskId); + 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";// 文件的名称 response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename); ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); - String filePath = "https://file.royalpay.com.au/open/2018/09/20/1537438083143_tqIYPEDYPr40Y9Cyj4Ps1xgSRrDrVb.jpg"; - zos.putNextEntry(new ZipEntry(filePath.substring(filePath.lastIndexOf("/")))); - InputStream inputStream = new URL(filePath).openConnection().getInputStream(); - byte[] buffer = new byte[1024]; - int result = 0; - while ((result = inputStream.read(buffer)) != -1) { - zos.write(buffer, 0, result); + String filePath = null; + for (int i = 1; i <= 10; i++) { + filePath = riskMaterial.getString("file" + i + "_url"); + if (filePath != null) { + zos.putNextEntry(new ZipEntry(filePath.substring(filePath.lastIndexOf("/")))); + InputStream inputStream = new URL(filePath).openConnection().getInputStream(); + byte[] buffer = new byte[1024]; + int result = 0; + while ((result = inputStream.read(buffer)) != -1) { + zos.write(buffer, 0, result); + } + inputStream.close(); + } } - inputStream.close(); - zos.flush(); - zos.close(); - zos.flush(); zos.close(); } catch (IOException e) { @@ -284,6 +300,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { return UPLOAD_MAIL_PREFIX + codeKey; } + @Override + public JSONObject getRiskMaterial(JSONObject param) { + List riskMaterialList = riskMaterialMapper.getRiskMaterial(param); + if (riskMaterialList != null && riskMaterialList.size() > 0) + return riskMaterialList.get(0); + return null; + } + private byte[] generateRiskOrders(JSONObject event) throws IOException { String[] orderIds = event.getString("order_ids").split(","); Workbook wb = new XSSFWorkbook(); diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java new file mode 100644 index 000000000..c45c2358d --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java @@ -0,0 +1,27 @@ +package au.com.royalpay.payment.manage.riskbusiness.enums; + +/** + * @Author lvjian + * @Date 2018/10/16 20:18 + */ +public enum RiskOrderTypeEnum { + WECHAT_ORDER(1), + ALIPAY_ORDER(2), + ROYALPAY_ORDER(3), + WARNING_ORDER(4), + ALREADY_HANDLED(5); + + private Integer orderType; + + public Integer getOrderType() { + return orderType; + } + + public void setOrderType(Integer orderType) { + this.orderType = orderType; + } + + RiskOrderTypeEnum(Integer orderType) { + this.orderType = orderType; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskResultTypeEnum.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskResultTypeEnum.java new file mode 100644 index 000000000..f26606a8c --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskResultTypeEnum.java @@ -0,0 +1,29 @@ +package au.com.royalpay.payment.manage.riskbusiness.enums; + +/** + * @Author lvjian + * @Date 2018/10/16 20:40 + */ +public enum RiskResultTypeEnum { + + NOT_HANDLED(0), + SEND_EMAIL_TO_BD(1), + WAIT_FOR_AUDIT(2), + MATERIAL_AUDIT_PASS(3), + MATERIAL_NOT_PASS(4), + ALREADY_HANDLED(5); + + private Integer orderType; + + public Integer getOrderType() { + return orderType; + } + + public void setOrderType(Integer orderType) { + this.orderType = orderType; + } + + RiskResultTypeEnum(Integer orderType) { + this.orderType = orderType; + } +} 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 1614e94be..5575b5480 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 @@ -1,11 +1,15 @@ package au.com.royalpay.payment.manage.riskbusiness.web; +import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.riskbusiness.bean.RiskEventQuery; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONObject; +import com.sun.org.apache.xerces.internal.impl.dv.xs.BooleanDV; +import com.sun.org.apache.xpath.internal.operations.Bool; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -23,13 +27,15 @@ import java.util.List; * @Date 2018/10/10 1:12 */ @RestController -//@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) -@RequestMapping(value = "/risk/business/") +@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) public class RiskBusinessController { @Autowired private RiskBusinessService riskBusinessService; + @Autowired + private ClientManager clientManager; + @GetMapping(value = "events") public JSONObject getRiskEvents(RiskEventQuery riskEventQuery) { JSONObject params = riskEventQuery.toJSON(); @@ -50,6 +56,11 @@ public class RiskBusinessController { @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); } @@ -74,6 +85,34 @@ public class RiskBusinessController { riskBusinessService.sendRefuseEmail(risk_id); } + @GetMapping(value = "/{risk_id}/material") + public JSONObject getRiskMaterial(@PathVariable("risk_id") String riskId) { + JSONObject param = new JSONObject(); + param.put("risk_id", riskId); + param.put("orderby_type", "update_time"); + return riskBusinessService.getRiskMaterial(param); + } + @PutMapping(value = "/channel/{channel}/permission/{channelFlag}") + public void updateMerchantChannel(@RequestBody JSONObject params, + @PathVariable("channelFlag") Boolean channelFlag, + @PathVariable("channel") String channel, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.switchChannelPermission(manager, params.getString("client_moniker"), channel, channelFlag); + riskBusinessService.updateRiskEvent(params); + } + + @PutMapping(value = "/partner/{isValid}") + public void updateMerchantValid(@RequestBody JSONObject params, + @PathVariable("isValid") Boolean isValid, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + String clientMoniker = params.getString("client_moniker"); + if (isValid) + clientManager.disableClient(clientMoniker, manager); + else + clientManager.revertClient(clientMoniker, manager); + riskBusinessService.updateRiskEvent(params); + + } } diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 91173a856..51ea1ca57 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -1,6 +1,6 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.schema-name=royalpay_production -spring.datasource.host=192.168.0.49:3306 +spring.datasource.host=192.168.0.111:3306 spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false spring.datasource.username=root spring.datasource.password=root \ No newline at end of file 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 index 6f8274362..dab194f4f 100644 --- 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 @@ -2,18 +2,62 @@ \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml index 5179b5180..fffa7aa0a 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml @@ -11,4 +11,36 @@ WHERE r.risk_id = #{risk_id} LIMIT 1 - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html b/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html index 69b0c0df7..b5489a634 100644 --- a/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html +++ b/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html @@ -23,7 +23,7 @@ 风控记录|Risk Records -
  • +
  • 风控业务
  • diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index 24e7de473..f598240f4 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -18,7 +18,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], "2": "BD已提交材料,等待审核", "3": "材料审核通过", "4": "材料审核不通过,已打回", - "5": "已处理()", + "5": "已处理", }; var emailStatusMap = { @@ -55,15 +55,19 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], }]); - app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', - function ($scope, $state, $http, $uibModal, commonDialog) { + app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', 'industryMap', + function ($scope, $state, $http, $uibModal, $filter, commonDialog, industryMap) { $scope.orderTypes = orderTypesMap; + $scope.resultTypes = resultTypesMap; + $scope.industries = industryMap.configs(); $scope.pagination = {}; $scope.params = {}; $scope.loadRiskEvents = function (page) { var params = angular.copy($scope.params); params.page = page || $scope.pagination.page || 1; + params.replyEmailDate = $filter('date')(params.replyEmailDate, 'yyyy-MM-dd'); + params.receiveEmailDate = $filter('date')(params.receiveEmailDate, 'yyyy-MM-dd'); $http.get('/risk/business/events', {params: params}).then(function (resp) { $scope.riskEvents = resp.data.data; $scope.pagination = resp.data.pagination; @@ -80,7 +84,14 @@ 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'; + } else if ($scope.riskEvent.order_type == 2) { + orderChannel += 'alipay'; + } else { + orderChannel = null; + } // 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图 $scope.riskEventEdit = angular.copy(riskEvent.data); @@ -92,6 +103,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], // 商户信息 $scope.clientInfo = $scope.riskEvent.clientInfo; + if (orderChannel != null) + $scope.enableChannel = $scope.clientInfo[orderChannel]; // 控制编辑表格的显示 $scope.editFlag = false; @@ -100,8 +113,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], // 如果是在编辑状态,需要将日期转换为date类型(前端控件需要) // 如果是在非编辑状态,需要将日期转换为yyyy-MM-dd格式 if ($scope.editFlag) { + $scope.riskEventEdit.receive_email_date = new Date($scope.riskEventEdit.receive_email_date.replace(/-/g, "/")); $scope.riskEventEdit.reply_email_date = new Date($scope.riskEventEdit.reply_email_date.replace(/-/g, "/")); } else { + $scope.riskEvent.receive_email_date = $filter('date')($scope.riskEvent.receive_email_date, 'yyyy-MM-dd'); $scope.riskEvent.reply_email_date = $filter('date')($scope.riskEvent.reply_email_date, 'yyyy-MM-dd'); } }; @@ -118,6 +133,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], // 保存时需要重新将日期转换为yyyy-MM-dd格式传入后端 $scope.riskEventEdit.reply_email_date = $filter('date')($scope.riskEventEdit.reply_email_date, 'yyyy-MM-dd'); + $scope.riskEventEdit.receive_email_date = $filter('date')($scope.riskEventEdit.receive_email_date, 'yyyy-MM-dd'); $http.put('/risk/business/events', $scope.riskEventEdit).then(function (resp) { commonDialog.alert({ title: 'Success', @@ -134,14 +150,40 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], }); }; - // 关停渠道 - $scope.updateChannel = function (orderType) { + /** + * 关停渠道 + * @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' + }) + }); + };*/ + + + $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: $scope.clientInfo['enable_' + channel]}).then(function () { + $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({ @@ -153,20 +195,13 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], }; // 关停商户 - $scope.updateClient = function(isValid) { - if (isValid) { - $http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/revert').then(function () { - $state.reload('analysis_monitoring.riskEvent_detail'); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - } else { - $http.delete('/sys/partners/' + $scope.riskEvent.client_moniker).then(function () { - $state.reload('analysis_monitoring.riskEvent_detail'); - }, function (resp) { - commonDialog.alert({title: 'Error', 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'}); + }) }; @@ -191,16 +226,62 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], app.controller('auditMaterialCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', function ($scope, $state, $http, $uibModal, $filter, commonDialog) { + + // 一键下载功能 $scope.downloadAsZip = function () { var url = '/risk/business/' + $scope.riskEvent.risk_id + '/download/materialsAsZIP'; return url; }; + + // 加载提交材料 + $scope.fileObject = {}; + $scope.loadRiskMaterial = function() { + $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) { + var riskMaterial = resp.data; + for (var i = 1; i <= 10; i++) { + var key = "file" + i; + if (riskMaterial[key + '_url'] != null) + $scope.fileObject[key] = riskMaterial[key + '_url']; + } + $scope.fileLength = Object.keys($scope.fileObject).length; + }) + }; + $scope.loadRiskMaterial(); + + // 材料审核 + $scope.auditMaterial = function(auditType) { + $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' + }); + }); + } + + } } ]); app.controller('newRiskEventCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', function ($scope, $state, $http, $uibModal, $filter, commonDialog) { + $scope.today = new Date(); $scope.orderTypes = orderTypesMap; $scope.save = function(form) { @@ -213,11 +294,15 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], return; } - // 默认设置邮件回复截止日期为七天后 - var replyDeadline = new Date(); + if ($scope.riskEvent.receive_email_date == null) + $scope.riskEvent.receive_email_date = new Date(); + // 默认设置邮件回复截止日期为收到邮件的七天后 + var replyDeadline = angular.copy($scope.riskEvent.receive_email_date); replyDeadline.setDate(replyDeadline.getDate() + 7); $scope.riskEvent.reply_email_date = $filter('date')(replyDeadline, 'yyyy-MM-dd'); + $scope.riskEvent.receive_email_date = $filter('date')($scope.riskEvent.receive_email_date, 'yyyy-MM-dd'); + $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 028c8b6e4..58f5a2fe7 100644 --- a/src/main/ui/static/analysis/templates/audit_material.html +++ b/src/main/ui/static/analysis/templates/audit_material.html @@ -1,35 +1,31 @@ -
    +
    Audit Files     - - + 一键下载 + 通过 + + 打回 +
    -
    -
    - +
    +
    +
    - - - -
    -
    -
    -

    Example:请保证图片信息清晰可见,如下图

    - + +
    +
    -
    - check -
    -
    - - - - \ No newline at end of file +
    \ No newline at end of file diff --git a/src/main/ui/static/analysis/templates/new_riskEvent.html b/src/main/ui/static/analysis/templates/new_riskEvent.html index f5d337e82..9f665f80b 100644 --- a/src/main/ui/static/analysis/templates/new_riskEvent.html +++ b/src/main/ui/static/analysis/templates/new_riskEvent.html @@ -11,6 +11,29 @@
    + +
    + +
    +

    required field +

    +
    +
    +
    +
    + ng-if="riskEvent.order_type != 4" + ng-class="{'has-error':riskEventForm.order_ids.$invalid && riskEventForm.order_ids.$dirty}"> + for="order-ids-input">Order IDs
    - -
    + +

    required field

    @@ -64,18 +85,19 @@
    + ng-if="riskEvent.order_type == 5" + ng-class="{'has-error':riskEventForm.sub_merchant_id.$invalid && riskEventForm.sub_merchant_id.$dirty}"> + for="sub-merchant-id-input">Sub Merchant ID
    + ng-if="riskEventForm.sub_merchant_id.$dirty">

    required field

    @@ -83,6 +105,24 @@
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    diff --git a/src/main/ui/static/analysis/templates/risk_business.html b/src/main/ui/static/analysis/templates/risk_business.html index a9bb884fb..3cb5d0421 100644 --- a/src/main/ui/static/analysis/templates/risk_business.html +++ b/src/main/ui/static/analysis/templates/risk_business.html @@ -4,7 +4,9 @@
    + +
    + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + +
    + + New Event +
    - - - New Event -
    @@ -81,7 +222,21 @@ - + + + {{riskEvent.result_type | resultType}}( + 临时关停商户 + 临时关停渠道 + ) + + + {{riskEvent.result_type | resultType}}( + 加入商户黑名单 + 加入用户黑名单 + ) + + + From 01f94ad1df5ece804f987eb705152d8c9af4604f Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Tue, 16 Oct 2018 21:05:01 +0800 Subject: [PATCH 12/65] update --- .../payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java index c45c2358d..9df482c2f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/enums/RiskOrderTypeEnum.java @@ -9,7 +9,7 @@ public enum RiskOrderTypeEnum { ALIPAY_ORDER(2), ROYALPAY_ORDER(3), WARNING_ORDER(4), - ALREADY_HANDLED(5); + GENERAL_ORDER(5); private Integer orderType; From a7677a8ceeaf09c77d6b218ba7a87a75f0325236 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Wed, 17 Oct 2018 10:03:52 +0800 Subject: [PATCH 13/65] update --- .../com/royalpay/payment/manage/mappers/payment/OrderMapper.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index 0ac8982e1..f5233d39f 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -805,7 +805,6 @@ FROM pmt_orders o INNER JOIN sys_clients p ON p.client_id = o.client_id - AND p.is_valid = 1 LEFT JOIN pmt_transactions t ON t.order_id = o.order_id AND t.refund_id IS NULL From e96db3086457d4176127412a5a81dcad83869099 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Wed, 17 Oct 2018 10:09:33 +0800 Subject: [PATCH 14/65] fix --- src/main/resources/templates/mail/risk_upload_mail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/mail/risk_upload_mail.html b/src/main/resources/templates/mail/risk_upload_mail.html index f6145a1a2..e4208893f 100644 --- a/src/main/resources/templates/mail/risk_upload_mail.html +++ b/src/main/resources/templates/mail/risk_upload_mail.html @@ -1,5 +1,5 @@ -
    +
    Dear :

    您好,您提交的风控材料已被拒绝。请于下午6:00(悉尼时间)前提供被查商户 ()的以下材料

    请提供以下被查单号的小票, 物流单据(如有邮寄产品的情况), 以及消费者与买家的聊天记录等来佐证被查交易单号。 被查交易单号如下:

    From c29d18b0a424197cafa00a4d773f21fded6ba878 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Wed, 17 Oct 2018 10:43:44 +0800 Subject: [PATCH 15/65] =?UTF-8?q?=E6=9D=90=E6=96=99=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/ui/static/analysis/risk_business.js | 1 + .../ui/static/analysis/templates/audit_material.html | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index f598240f4..cb273e2fb 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -244,6 +244,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.fileObject[key] = riskMaterial[key + '_url']; } $scope.fileLength = Object.keys($scope.fileObject).length; + $scope.description = riskMaterial.description; }) }; $scope.loadRiskMaterial(); diff --git a/src/main/ui/static/analysis/templates/audit_material.html b/src/main/ui/static/analysis/templates/audit_material.html index 58f5a2fe7..b8092759b 100644 --- a/src/main/ui/static/analysis/templates/audit_material.html +++ b/src/main/ui/static/analysis/templates/audit_material.html @@ -24,8 +24,15 @@
    - +
    +
    + +
    +
    +

    +
    +
    -
    \ No newline at end of file +
    From c2397259e05f3852f7795284311928606991e9af Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Wed, 17 Oct 2018 11:03:07 +0800 Subject: [PATCH 16/65] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=89=8D=E7=AB=AF=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/mail/risk_upload.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/mail/risk_upload.html b/src/main/resources/templates/mail/risk_upload.html index 82ecf6c13..a80e0c1c8 100644 --- a/src/main/resources/templates/mail/risk_upload.html +++ b/src/main/resources/templates/mail/risk_upload.html @@ -325,7 +325,7 @@
    -
    +
    diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index 5217373e6..bda8cddc8 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -110,7 +110,9 @@
    - +

    {{riskEvent.receive_email_date | limitTo:10}} @@ -263,6 +265,10 @@ ng-click="resendUploadEmail()">Send Warning Email + 返回 +

    @@ -379,7 +385,8 @@
    @@ -389,7 +396,7 @@ ng-model="riskEventEdit.receive_email_date" uib-datepicker-popup size="10" - placeholder="Receive Date" + placeholder="{{(riskEvent.order_type == 1 || riskEvent.order_type ==2) ? 'Receive Date' : 'Create Date'}}" is-open="receiveDate.open" ng-click="receiveDate.open=true" datepicker-options="{maxDate:today}"> @@ -421,11 +428,12 @@ for="description-input">Description
    - +
    diff --git a/src/main/ui/static/analysis/templates/risk_business.html b/src/main/ui/static/analysis/templates/risk_business.html index 6e145e0b6..0c14be900 100644 --- a/src/main/ui/static/analysis/templates/risk_business.html +++ b/src/main/ui/static/analysis/templates/risk_business.html @@ -168,14 +168,14 @@
    -
    + for="payment-select">Amount Section
    -
    From 44fdc278ba22b3d78d76421b4dfc4730c60d88f3 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Fri, 19 Oct 2018 15:33:46 +0800 Subject: [PATCH 30/65] =?UTF-8?q?=E9=A3=8E=E6=8E=A7=E6=9D=90=E6=96=99?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=B0=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mappers/riskbusiness/RiskFileMapper.java | 18 ++ .../riskbusiness/RiskMaterialMapper.java | 8 +- .../core/impl/RiskBusinessServiceImpl.java | 61 ++-- .../core/impl/RiskUploadServiceIpml.java | 46 ++- .../web/RiskBusinessController.java | 1 - .../web/RiskFileUploadController.java | 6 + .../riskbusiness/RiskMaterialMapper.xml | 34 +-- .../resources/templates/mail/risk_upload.html | 219 ++++++++------ .../templates/mail/risk_upload_mail.html | 10 +- src/main/ui/static/analysis/risk_business.js | 24 +- .../analysis/templates/audit_material.html | 145 ++++++++- src/main/ui/static/riskupload/risk_upload.js | 279 ++++++++---------- 12 files changed, 495 insertions(+), 356 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java new file mode 100644 index 000000000..6120db3cd --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java @@ -0,0 +1,18 @@ +package au.com.royalpay.payment.manage.mappers.riskbusiness; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@AutoMapper(tablename = "risk_file", pkName = "file_id") +public interface RiskFileMapper { + @AutoSql(type= SqlType.INSERT) + void save(JSONObject file); + + @AutoSql(type= SqlType.SELECT) + List findAllFiles(@Param("material_id") String material_id); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java index 0c4731b95..f5e9f5b9f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.java @@ -1,12 +1,12 @@ package au.com.royalpay.payment.manage.mappers.riskbusiness; -import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect; + import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; import org.apache.ibatis.annotations.Param; -import org.apache.catalina.LifecycleState; + import java.util.List; @@ -15,8 +15,6 @@ public interface RiskMaterialMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject material); - JSONObject findOperatorById(@Param("risk_id") String risk_id); - - List getRiskMaterial(JSONObject param); + List findAllMaterials(@Param("risk_id") String risk_id); } 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 a84fca14d..7aca9ccf3 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 @@ -4,6 +4,7 @@ import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; 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.mappers.system.ClientBDMapper; @@ -34,16 +35,11 @@ import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; +import java.io.*; import java.net.URL; import java.util.ArrayList; import java.util.Date; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -78,6 +74,8 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Autowired private RiskMaterialMapper riskMaterialMapper; + @Resource + private RiskFileMapper riskFileMapper; @Override public List getRiskEvents(JSONObject params) { @@ -171,19 +169,19 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename); ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); - String filePath = null; - for (int i = 1; i <= 10; i++) { - filePath = riskMaterial.getString("file" + i + "_url"); - if (filePath != null) { - // 文件名前添加'file' + i是为了防止文件名一样 - zos.putNextEntry(new ZipEntry("file" + i + filePath.substring(filePath.lastIndexOf("/")))); - InputStream inputStream = new URL(filePath).openConnection().getInputStream(); - byte[] buffer = new byte[1024]; - int result = 0; - while ((result = inputStream.read(buffer)) != -1) { - zos.write(buffer, 0, result); + for(int i=1;i<=6;i++){ + if(riskMaterial.containsKey("file"+i)){ + List fileList= (List)riskMaterial.get("file"+i); + for(String fileUrl : fileList){ + zos.putNextEntry(new ZipEntry("file" + i+fileUrl.substring(fileUrl.lastIndexOf("/")))); + InputStream inputStream = new URL(fileUrl).openConnection().getInputStream(); + byte[] buffer = new byte[1024]; + int result = 0; + while ((result = inputStream.read(buffer)) != -1) { + zos.write(buffer, 0, result); + } + inputStream.close(); } - inputStream.close(); } } zos.flush(); @@ -201,12 +199,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { final List emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List)ctx.getVariable("emailsCcs"); final String title = (String)ctx.getVariable("title"); final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); + final String uploadUrl = (String)ctx.getVariable("uploadUrl"); royalThreadPoolExecutor.execute(() -> { try { String emailId = mailService.sendRiskEmail(title, emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List)ctx.getVariable("files"):null,event.getIntValue("order_type")); event.put("email_status",1); event.put("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()); + event.put("submit_url",uploadUrl); Integer orderType = event.getInteger("order_type"); if (orderType == RiskOrderTypeEnum.WARNING_ORDER.getOrderType()) { event.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); @@ -225,6 +225,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { ctx.setVariable("refuse",true); final List emailsTos = (List)ctx.getVariable("emailsTos"); final List emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List)ctx.getVariable("emailsCcs"); + final String uploadUrl = (String)ctx.getVariable("uploadUrl"); final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); royalThreadPoolExecutor.execute(() -> { try { @@ -232,6 +233,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List)ctx.getVariable("files"):null,event.getIntValue("order_type")); event.put("email_status",2); event.put("result_type",RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType()); + event.put("submit_url",uploadUrl); riskEventMapper.update(event); } catch (Exception e) { throw new EmailException("Email Sending Failed", e); @@ -339,9 +341,26 @@ public class RiskBusinessServiceImpl implements RiskBusinessService { @Override public JSONObject getRiskMaterial(JSONObject param) { - List riskMaterialList = riskMaterialMapper.getRiskMaterial(param); - if (riskMaterialList != null && riskMaterialList.size() > 0) - return riskMaterialList.get(0); + List riskMaterialList = riskMaterialMapper.findAllMaterials(param.getString("risk_id")); + if (riskMaterialList != null && riskMaterialList.size() > 0){ + List files = riskFileMapper.findAllFiles(riskMaterialList.get(0).getString("material_id")); + JSONObject fileNew = new JSONObject(); + fileNew.put("description",riskMaterialList.get(0).getString("description")); + for(JSONObject file : files){ + int fileType = file.getIntValue("file_type"); + if(!fileNew.containsKey("file"+fileType)){ + List fileList = new ArrayList<>(); + fileList.add(file.getString("file_url")); + fileNew.put("file"+fileType,fileList); + }else{ + List fileList = (List)fileNew.get("file"+fileType); + fileList.add(file.getString("file_url")); + fileNew.put("file"+fileType,fileList); + } + } + return fileNew; + } + return null; } 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 1d0f4e945..17133ae4a 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 @@ -2,6 +2,7 @@ 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; @@ -22,50 +23,39 @@ import org.thymeleaf.spring4.SpringTemplateEngine; import javax.annotation.Resource; import java.text.ParseException; import java.util.Date; +import java.util.List; @Service public class RiskUploadServiceIpml implements RiskUploadService { @Resource private RiskMaterialMapper riskMaterialMapper; @Resource - private RiskEventMapper riskEventMapper; + private RiskFileMapper riskFileMapper; @Resource - private ClientMapper clientMapper; + private RiskEventMapper riskEventMapper; @Resource private StringRedisTemplate stringRedisTemplate; - @Resource - private MailService mailService; - @Resource - private RoyalThreadPoolExecutor royalThreadPoolExecutor; - @Resource - private SpringTemplateEngine thymeleaf; private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL"; @Override public void submitMaterial(JSONObject material) { - riskMaterialMapper.save(material); JSONObject event = riskEventMapper.findById(material.getString("risk_id")); + 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++){ + if(material.containsKey("file"+i+"_url")){ + List urls = (List)material.get("file"+i+"_url"); + for(String url:urls){ + JSONObject file = new JSONObject(); + file.put("file_url",url); + file.put("file_type",i); + file.put("material_id",material.getString("material_id")); + riskFileMapper.save(file); + } + } + } event.put("result_type", RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType()); riskEventMapper.update(event); - JSONObject operator = riskMaterialMapper.findOperatorById(material.getString("risk_id")); - if(operator.containsKey("email")){ - JSONObject client = clientMapper.findClientByMoniker(event.getString("client_moniker")); - Context ctx = new Context(); - ctx.setVariable("client_moniker", event.getString("client_moniker")); - ctx.setVariable("short_name", client.getString("short_name")); - ctx.setVariable("create_time", DateFormatUtils.format(event.getDate("create_time"),"yyyy-MM-dd HH:mm:ss")); - ctx.setVariable("operator", operator.getString("display_name")); - final String content = thymeleaf.process("mail/risk_operator_notice", ctx); - royalThreadPoolExecutor.execute(() -> { - try { - String emailId = mailService.sendRiskEmail(event.getString("client_moniker")+" has submitted the material",operator.getString("email") , - "", content, null,event.getIntValue("order_type")); - } catch (Exception e) { - throw new EmailException("Email Sending Failed", e); - } - }); - } - } @Override 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 3ebc945a5..1b635203e 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 @@ -84,7 +84,6 @@ public class RiskBusinessController { public JSONObject getRiskMaterial(@PathVariable("risk_id") String riskId) { JSONObject param = new JSONObject(); param.put("risk_id", riskId); - param.put("orderby_type", "update_time"); return riskBusinessService.getRiskMaterial(param); } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java index b60ab662f..87099d74a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.riskbusiness.web; +import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService; import com.alibaba.fastjson.JSONObject; import org.springframework.web.bind.annotation.*; @@ -12,6 +13,8 @@ import javax.annotation.Resource; public class RiskFileUploadController { @Resource private RiskUploadService riskUploadService; + @Resource + private RiskBusinessService riskBusinessService; /** * 上传材料的链接 @@ -23,9 +26,12 @@ public class RiskFileUploadController { public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String risk_id) { //检查codekey是否有效 riskUploadService.checkUploadMailKey(codeKey,risk_id); + JSONObject event = riskBusinessService.getRiskEventDetail(risk_id); ModelAndView view = new ModelAndView("mail/risk_upload"); view.addObject("codeKey", codeKey); view.addObject("risk_id",risk_id); + view.addObject("order_type",event.getIntValue("order_type")); + view.addObject("short_name",event.getJSONObject("clientInfo").getString("short_name")); return view; } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml index fffa7aa0a..9a46cbd81 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml @@ -12,35 +12,9 @@ LIMIT 1 - - - - - - - - - - - - - - - - - SELECT * - from risk_material - - - AND material_id = #{material_id} - - - AND risk_id = #{risk_id} - - - - ORDER BY ${orderby_type} DESC - + FROM risk_material + ORDER BY update_time DESC - \ No newline at end of file + diff --git a/src/main/resources/templates/mail/risk_upload.html b/src/main/resources/templates/mail/risk_upload.html index a80e0c1c8..87b76bbe3 100644 --- a/src/main/resources/templates/mail/risk_upload.html +++ b/src/main/resources/templates/mail/risk_upload.html @@ -32,6 +32,7 @@ +
    Audit Files     Description:
    -

    +

    +
    +
    +
    + +
    +
    +

    2、用户购买虚拟物品需要提供聊天记录、订单信息、发货凭证截图、虚拟物品最终消费场景(例如何种游戏、软件)、提供消费场景网址/下载链接 + 要求:每笔交易对应的截图必须清晰可见
    + Users need to provide chat records, order information, screenshots of delivery documents, final consumption scenarios of virtual goods (such as games, software); provide consumer scene URL / download link. + Requirement: The screenshot corresponding to each transaction must be clearly visible. +

    +

    2.提供相应购物清单,订单小票(请提供与被查交易订单号相匹配的交易时间及金额的发票);
    + Provide related shopping lists, invoices. (Please provide the invoices, amount of which matches that of the abnormal transaction); +

    +
    +
    +   
    +
    + + + +
    +
    + +
    +
    +
    +

    3、购物小票/发票存根照片 + 照片应清晰,必须显示商户名称、商户地址、购物时间、物品名称 + 购物金额等
    + Photos of shopping receipts/ invoice stubs + Requirement: The photos should be clear and must show Merchant name, Business address, Transaction time, Product information, Quantity purchased, etc. +

    +

    3.提供相应的发货证明,报关单(若有消费者在国内购买,请提供物流单据或报关单);
    + Relative proof of delivery, customs declaration (If the consumer purchased from China, please provide shipping receipt or customs declaration); +

    +
    +
    +   
    +
    -
    +
    +
    +

    4、显示商户门牌号码和店头名称的照片 + 要求:清晰可见,至少一张
    + Photos of Merchant Street number & Merchant name + Requirement: At least one visible photo +

    +

    4.提供您的门店照片(门店照及店铺内的照片各一张, 一张可以看到商户名的门头照,一张可以看到相关商品或服务的店内照片);
    + Photos of the store ( one of each front-store and in-store); +

    +
    - -
    -
    - - -
    +   
    +
    + +
    +
    +
    +

    5、显示商户营业场景所场内部情况(如店内商品陈列、收银台等)的照片 + 要求:照片清晰,且能清楚显示商户实际售卖物品或服务,至少三张
    + Photos of internal environment of merchant business (such as in-store merchandise display, checkout counter, etc.) + Requirements: The photos (at least three) showing merchant activities including actual selling-goods or services obviously +

    +

    5.其他可以还原交易背景的资料,如和消费者的聊天记录等,来佐证被查单号交易的真实性;
    + Other materials that can verify the payment scenario, for example, chatting history, to prove the truth of the transactions; +

    +
    +
    +   
    +
    + + + +
    +
    + +
    +
    +
    +

    6、其他图片
    + Other pictures +

    +
    +
    +   
    +
    + + + +
    +
    +
    + + + + + + + + + + +
    diff --git a/src/main/ui/static/riskupload/risk_upload.js b/src/main/ui/static/riskupload/risk_upload.js index 8398b10e9..ed756391a 100644 --- a/src/main/ui/static/riskupload/risk_upload.js +++ b/src/main/ui/static/riskupload/risk_upload.js @@ -1,182 +1,150 @@ // define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) { // 'use strict'; - var app = angular.module('riskUploadApp',['ngFileUpload']); + var app = angular.module('riskUploadApp',['ngFileUpload','ui.bootstrap']); app.controller('riskUploadCtrl', ['$scope','$http','Upload','$filter',function ($scope,$http,Upload,$filter) { $scope.material={}; $scope.codeKey=document.getElementById('codeKey').value; $scope.material.risk_id=document.getElementById('risk_id').value; + $scope.order_type=document.getElementById('order_type').value; $scope.material.update_time=$filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss'); - $scope.uploadFile1 = function (file) { - if (file != null) { + $scope.uploadFile1 = function (files) { + if (files && files.length) { + var urls = new Array(); + var value = 0; $scope.file1Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file1Progress; - $scope.material.file1_url = resp.data.url; - }, function (resp) { - delete $scope.file1Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file1Progress.value = parseInt(100 * evt.loaded / evt.total); - }) + 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.file1Progress; + alert('Upload Failed'); + }, function (evt) { + value += parseInt(100 * evt.loaded / evt.total ); + $scope.file1Progress.value = value/(files.length*2); + }) + } + $scope.material.file1_url = urls; } }; - $scope.uploadFile2 = function (file) { - if (file != null) { + $scope.uploadFile2 = function (files) { + if (files && files.length) { + var urls = new Array(); + var value = 0; $scope.file2Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file2Progress; - $scope.material.file2_url = resp.data.url; - }, function (resp) { - delete $scope.file2Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file2Progress.value = parseInt(100 * evt.loaded / evt.total); - }) + 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.file2Progress; + alert('Upload Failed'); + }, function (evt) { + value += parseInt(100 * evt.loaded / evt.total ); + $scope.file2Progress.value = value/(files.length*2); + }) + } + $scope.material.file2_url = urls; } }; - $scope.uploadFile3 = function (file) { - if (file != null) { + $scope.uploadFile3 = function (files) { + if (files && files.length) { + var urls = new Array(); + var value = 0; $scope.file3Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file3Progress; - $scope.material.file3_url = resp.data.url; - }, function (resp) { - delete $scope.file3Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file3Progress.value = parseInt(100 * evt.loaded / evt.total); - }) + 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.file3Progress; + alert('Upload Failed'); + }, function (evt) { + value += parseInt(100 * evt.loaded / evt.total ); + $scope.file3Progress.value = value/(files.length*2); + }) + } + $scope.material.file3_url = urls; } }; - $scope.uploadFile4 = function (file) { - if (file != null) { + $scope.uploadFile4 = function (files) { + if (files && files.length) { + var urls = new Array(); + var value = 0; $scope.file4Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file4Progress; - $scope.material.file4_url = resp.data.url; - }, function (resp) { - delete $scope.file4Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file4Progress.value = parseInt(100 * evt.loaded / evt.total); - }) + 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.file4Progress; + alert('Upload Failed'); + }, function (evt) { + value += parseInt(100 * evt.loaded / evt.total ); + $scope.file4Progress.value = value/(files.length*2); + }) + } + $scope.material.file4_url = urls; } }; - $scope.uploadFile5 = function (file) { - if (file != null) { + $scope.uploadFile5 = function (files) { + if (files && files.length) { + var urls = new Array(); + var value = 0; $scope.file5Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file5Progress; - $scope.material.file5_url = resp.data.url; - }, function (resp) { - delete $scope.file5Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file5Progress.value = parseInt(100 * evt.loaded / evt.total); - }) + 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.file5Progress; + alert('Upload Failed'); + }, function (evt) { + value += parseInt(100 * evt.loaded / evt.total ); + $scope.file5Progress.value = value/(files.length*2); + }) + } + $scope.material.file5_url = urls; } }; - $scope.uploadFile6 = function (file) { - if (file != null) { + $scope.uploadFile6 = function (files) { + if (files && files.length) { + var urls = new Array(); + var value = 0; $scope.file6Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file6Progress; - $scope.material.file6_url = resp.data.url; - }, function (resp) { - delete $scope.file6Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file6Progress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - }; - - $scope.uploadFile7 = function (file) { - if (file != null) { - $scope.file7Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file7Progress; - $scope.material.file7_url = resp.data.url; - }, function (resp) { - delete $scope.file7Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file7Progress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - }; - $scope.uploadFile8 = function (file) { - if (file != null) { - $scope.file8Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file8Progress; - $scope.material.file8_url = resp.data.url; - }, function (resp) { - delete $scope.file8Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file8Progress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - }; - $scope.uploadFile9 = function (file) { - if (file != null) { - $scope.file9Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file9Progress; - $scope.material.file9_url = resp.data.url; - }, function (resp) { - delete $scope.file9Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file9Progress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - }; - $scope.uploadFile10 = function (file) { - if (file != null) { - $scope.file10Progress = {value: 0}; - Upload.upload({ - url: '/attachment/riskFiles', - data: {file: file} - }).then(function (resp) { - delete $scope.file10Progress; - $scope.material.file10_url = resp.data.url; - }, function (resp) { - delete $scope.file10Progress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.file10Progress.value = parseInt(100 * evt.loaded / evt.total); - }) + 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.file6Progress; + alert('Upload Failed'); + }, function (evt) { + value += parseInt(100 * evt.loaded / evt.total ); + $scope.file6Progress.value = value/(files.length*2); + }) + } + $scope.material.file6_url = urls; } }; $scope.submit = function (form) { @@ -190,7 +158,8 @@ }); } - }]) + }]); + From 99f74b1ee85c4059b04a5ad31bf70171fc444350 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Fri, 19 Oct 2018 16:14:03 +0800 Subject: [PATCH 31/65] update --- .../payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml | 1 + src/main/ui/static/analysis/templates/audit_material.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml index 9a46cbd81..5db6ff17c 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskMaterialMapper.xml @@ -15,6 +15,7 @@ diff --git a/src/main/ui/static/analysis/templates/audit_material.html b/src/main/ui/static/analysis/templates/audit_material.html index 41336561d..16c92636e 100644 --- a/src/main/ui/static/analysis/templates/audit_material.html +++ b/src/main/ui/static/analysis/templates/audit_material.html @@ -139,7 +139,7 @@
    -

    6、其他图片
    +

    6、其他图片
    Other pictures

    From 0abda9f48a3d10921ea3f2b81529c64efbb235ae Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Fri, 19 Oct 2018 18:34:38 +0800 Subject: [PATCH 32/65] [fix] --- .../analysis/monitoring/templates/analysis_monitoring.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html b/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html index b5489a634..c170892ee 100644 --- a/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html +++ b/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html @@ -23,8 +23,8 @@ 风控记录|Risk Records -
  • - 风控业务 +
  • + 风控业务|Risk Business
  • From b069c37ea9f51797cd5b7b7d535805334d90731f Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Fri, 19 Oct 2018 18:35:25 +0800 Subject: [PATCH 33/65] [fix] --- .../manage/mappers/system/ClientBDMapper.java | 2 + .../core/RiskBusinessService.java | 2 +- .../web/RiskBusinessController.java | 6 +- .../web/RiskFileUploadController.java | 1 + .../mappers/riskbusiness/RiskEventMapper.xml | 7 + .../manage/mappers/system/ClientBDMapper.xml | 24 ++- src/main/resources/i18n/msg_en.properties | 1 + src/main/resources/i18n/msg_zh.properties | 1 + src/main/ui/static/analysis/risk_business.js | 161 ++++++++++++++ .../templates/bd_upload_material.html | 203 ++++++++++++++++++ .../analysis/templates/riskEvent_detail.html | 34 +-- .../analysis/templates/risk_business.html | 22 +- 12 files changed, 433 insertions(+), 31 deletions(-) create mode 100644 src/main/ui/static/analysis/templates/bd_upload_material.html diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.java index 09bc51de0..b8e390f0b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.java @@ -25,6 +25,8 @@ public interface ClientBDMapper { List listClientBDInfoAvailable(@Param("client_id") int clientId, @Param("date") Date date); + List listBDClientInfo(JSONObject param); + void updateClientDB(JSONObject jsonObject); @AutoSql(type = SqlType.UPDATE) 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 e5b695785..94ac8396b 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 @@ -25,7 +25,7 @@ public interface RiskBusinessService { * @param params * @return */ - JSONObject getRiskEventsByPage(JSONObject params); + JSONObject getRiskEventsByPage(JSONObject params, JSONObject manager); /** * 风险事件详情 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 1b635203e..ba33b0ab9 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 @@ -29,7 +29,7 @@ import java.util.List; * @Date 2018/10/10 1:12 */ @RestController -@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) +@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.RISK_MANAGER}) public class RiskBusinessController { @Autowired @@ -39,9 +39,9 @@ public class RiskBusinessController { private ClientManager clientManager; @GetMapping(value = "events") - public JSONObject getRiskEvents(RiskEventQuery riskEventQuery) { + public JSONObject getRiskEvents(RiskEventQuery riskEventQuery, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { JSONObject params = riskEventQuery.toJSON(); - return riskBusinessService.getRiskEventsByPage(params); + return riskBusinessService.getRiskEventsByPage(params, manager); } @GetMapping(value = "events/{risk_id}") diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java index 87099d74a..50a7c8500 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskFileUploadController.java @@ -45,4 +45,5 @@ public class RiskFileUploadController { riskUploadService.submitMaterial(material); riskUploadService.deleteUploadMailKey(codeKey); } + } 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 index b1d3109a3..e0c574170 100644 --- 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 @@ -50,6 +50,10 @@ on re.risk_id = temp.risk_id + + LEFT JOIN sys_client_bd scb + ON sc.client_id = scb.client_id + AND re.risk_id = #{risk_id} @@ -78,6 +82,9 @@ AND re.reply_email_date = #{reply_email_date} + + AND scb.bd_id = #{bd_id} + diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml index d525812a4..a80c8423e 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml @@ -41,11 +41,29 @@ #{date} OR end_date IS NULL) AND - b.is_valid = 1 + INNER JOIN sys_client_bd b + ON b.bd_id = m.manager_id + WHERE client_id = #{client_id} + AND start_date <= #{date} + AND (end_date > #{date} OR end_date IS NULL) + AND b.is_valid = 1 + ]]> + + + + + +
    + +
    + + + + +
    + Submit +
    + + \ No newline at end of file diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index bda8cddc8..78c510c4b 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -1,8 +1,4 @@
    -