From 9b6b36685a064c493d2fcffc38ab506ecb29e44c Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Thu, 26 Apr 2018 19:16:53 +0800 Subject: [PATCH 01/11] add risk interface --- .../risk/RiskMerchantDetalLogMapper.java | 20 +++ .../risk/RiskMerchantRecordMapper.java | 26 ++++ .../risk/RiskTransactionLogMapper.java | 24 +++ .../mappers/risk/RiskWhiteListMapper.java | 26 ++++ .../manage/risk/bean/AddRiskDetailLog.java | 55 +++++++ .../manage/risk/bean/DealRiskRecord.java | 37 +++++ .../manage/risk/bean/QueryRIskRecord.java | 41 +++++ .../manage/risk/core/RiskMerchantService.java | 31 ++++ .../core/impl/RiskMerchantServiceImpl.java | 146 ++++++++++++++++++ .../manage/risk/web/RiskController.java | 74 +++++++++ .../mappers/risk/RiskMerchantRecordMapper.xml | 19 +++ 11 files changed, 499 insertions(+) create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetalLogMapper.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskWhiteListMapper.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/bean/DealRiskRecord.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java create mode 100644 src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetalLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetalLogMapper.java new file mode 100644 index 000000000..b421b0d89 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetalLogMapper.java @@ -0,0 +1,20 @@ +package au.com.royalpay.payment.manage.mappers.risk; + +import com.alibaba.fastjson.JSONObject; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; + +/** + * Create by yixian at 2017-12-21 11:45 + */ +@AutoMapper(tablename = "risk_merchant_detail_log", pkName = "id") +public interface RiskMerchantDetalLogMapper { + @AutoSql(type = SqlType.INSERT) + void save(JSONObject record); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject record); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java new file mode 100644 index 000000000..998a95695 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java @@ -0,0 +1,26 @@ +package au.com.royalpay.payment.manage.mappers.risk; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.alibaba.fastjson.JSONObject; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; + +/** + * Create by yixian at 2017-12-21 11:45 + */ +@AutoMapper(tablename = "risk_merchant_record", pkName = "id") +public interface RiskMerchantRecordMapper { + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject record); + + List query(JSONObject params); + + @AutoSql(type = SqlType.SELECT) + JSONObject findById(@Param("id") String id); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java new file mode 100644 index 000000000..17f2aa4d2 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java @@ -0,0 +1,24 @@ +package au.com.royalpay.payment.manage.mappers.risk; + +import com.alibaba.fastjson.JSONObject; + +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; + +/** + * Create by yixian at 2017-12-21 11:45 + */ +@AutoMapper(tablename = "risk_transaction_log", pkName = "id") +public interface RiskTransactionLogMapper { + @AutoSql(type = SqlType.SELECT) + JSONObject findByOrderId(@Param("order_id") String order_id); + + @AutoSql(type = SqlType.SELECT) + List findByRecordId(@Param("record_id") String record_id); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskWhiteListMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskWhiteListMapper.java new file mode 100644 index 000000000..20b8a13bb --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskWhiteListMapper.java @@ -0,0 +1,26 @@ +package au.com.royalpay.payment.manage.mappers.risk; + +import com.alibaba.fastjson.JSONObject; + +import org.apache.ibatis.annotations.Param; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; + +/** + * Create by yixian at 2017-12-21 11:45 + */ +@AutoMapper(tablename = "risk_white_list", pkName = "client_id") +public interface RiskWhiteListMapper { + @AutoSql(type = SqlType.SELECT) + JSONObject findByClientMoniker(@Param("client_moniker") String client_moniker); + + @AutoSql(type = SqlType.INSERT) + void save(JSONObject record); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject record); + + +} \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java new file mode 100644 index 000000000..8b4f44e4a --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java @@ -0,0 +1,55 @@ +package au.com.royalpay.payment.manage.risk.bean; + +import com.alibaba.fastjson.JSONObject; + +public class AddRiskDetailLog { + + private String record_id; + + private int client_id; + + private String files; + + private String operation; + + public JSONObject params(){ + JSONObject params = new JSONObject(); + params.put("record_id",this.record_id); + params.put("client_id",this.client_id); + params.put("files",this.files); + params.put("operation",this.operation); + return params; + + } + public String getRecord_id() { + return record_id; + } + + public void setRecord_id(String record_id) { + this.record_id = record_id; + } + + public int getClient_id() { + return client_id; + } + + public void setClient_id(int client_id) { + this.client_id = client_id; + } + + public String getFiles() { + return files; + } + + public void setFiles(String files) { + this.files = files; + } + + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/DealRiskRecord.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/DealRiskRecord.java new file mode 100644 index 000000000..a1976e3f6 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/DealRiskRecord.java @@ -0,0 +1,37 @@ +package au.com.royalpay.payment.manage.risk.bean; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.math.BigDecimal; + +public class DealRiskRecord { + +private String recordId; + private BigDecimal limitAmount; + @JsonProperty(defaultValue = "false") + private boolean disableMerchat; + + public String getRecordId() { + return recordId; + } + + public void setRecordId(String recordId) { + this.recordId = recordId; + } + + public BigDecimal getLimitAmount() { + return limitAmount; + } + + public void setLimitAmount(BigDecimal limitAmount) { + this.limitAmount = limitAmount; + } + + public Boolean getDisableMerchat() { + return disableMerchat; + } + + public void setDisableMerchat(Boolean disableMerchat) { + this.disableMerchat = disableMerchat; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java new file mode 100644 index 000000000..2ec955f23 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java @@ -0,0 +1,41 @@ +package au.com.royalpay.payment.manage.risk.bean; + +import com.alibaba.fastjson.JSONObject; + +public class QueryRIskRecord { + + private String status; + private String client_moniker; + private String record_id; + + public JSONObject toParams(){ + JSONObject params = new JSONObject(); + params.put("status",this.status); + params.put("client_moniker",this.client_moniker); + params.put("record_id",this.record_id); + return params; + } + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRecord_id() { + return record_id; + } + + public void setRecord_id(String record_id) { + this.record_id = record_id; + } + + public String getClient_moniker() { + return client_moniker; + } + + public void setClient_moniker(String client_moniker) { + this.client_moniker = client_moniker; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java new file mode 100644 index 000000000..d6af1b689 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java @@ -0,0 +1,31 @@ +package au.com.royalpay.payment.manage.risk.core; + +import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; +import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRIskRecord; + +import com.alibaba.fastjson.JSONObject; + +import java.util.List; + +public interface RiskMerchantService { + + void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account); + + void DropOrderRiskRecord(JSONObject account,String recordId); + + void noopRiskRecord(JSONObject account,String recordId); + + void dealRiskRecord(JSONObject account,DealRiskRecord dealRiskRecord); + + List getRiskOrders(String recordId); + + List getRiskRecords(QueryRIskRecord queryRIskRecord); + + void addWhiteList(String client_moinker); + + void disableWhiteList(String client_moinker); + + + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java new file mode 100644 index 000000000..631562e43 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java @@ -0,0 +1,146 @@ +package au.com.royalpay.payment.manage.risk.core.impl; + +import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantDetalLogMapper; +import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantRecordMapper; +import au.com.royalpay.payment.manage.mappers.risk.RiskTransactionLogMapper; +import au.com.royalpay.payment.manage.mappers.risk.RiskWhiteListMapper; +import au.com.royalpay.payment.manage.merchants.core.ClientManager; +import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; +import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRIskRecord; +import au.com.royalpay.payment.manage.risk.core.RiskMerchantService; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.exceptions.NotFoundException; + +import com.alibaba.fastjson.JSONObject; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +@Service +public class RiskMerchantServiceImpl implements RiskMerchantService { + + @Resource + private RiskMerchantRecordMapper riskMerchantRecordMapper; + @Resource + private RiskMerchantDetalLogMapper riskMerchantDetalLogMapper; + @Resource + private RiskTransactionLogMapper riskTransactionLogMapper; + @Resource + private RiskWhiteListMapper riskWhiteListMapper; + @Resource + private ClientManager clientManager; + + @Override + public void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account) { + JSONObject record = addRiskDetailLog.params(); + record.put("auditor",account.getString("display_name")); + record.put("create_time",new Date()); + riskMerchantDetalLogMapper.save(record); + } + + @Override + @Transactional + public void DropOrderRiskRecord(JSONObject account, String recordId) { + JSONObject riskRecord = riskMerchantRecordMapper.findById(recordId); + if (riskRecord == null) { + throw new NotFoundException("Risk Record Not Found"); + } + if (riskRecord.getIntValue("status") != 0) { + throw new BadRequestException("The Record Has Been Handled"); + } + JSONObject record = new JSONObject(); + record.put("id", recordId); + record.put("status", "2"); + riskMerchantRecordMapper.update(record); + JSONObject detail = new JSONObject(); + detail.put("record_id", recordId); + detail.put("client_id", riskRecord.getIntValue("client_id")); + detail.put("auditor", account.getString("display_name")); + detail.put("operation", "进行掉单处理"); + detail.put("create_time", new Date()); + riskMerchantDetalLogMapper.save(detail); + } + + @Override + @Transactional + public void noopRiskRecord(JSONObject account, String recordId) { + JSONObject riskRecord = riskMerchantRecordMapper.findById(recordId); + if (riskRecord == null) { + throw new NotFoundException("Risk Record Not Found"); + } + if (riskRecord.getIntValue("status") != 0) { + throw new BadRequestException("The Record Has Been Handled"); + } + JSONObject record = new JSONObject(); + record.put("id", recordId); + record.put("status", "1"); + riskMerchantRecordMapper.update(record); + JSONObject detail = new JSONObject(); + detail.put("record_id", recordId); + detail.put("client_id", riskRecord.getIntValue("client_id")); + detail.put("auditor", account.getString("display_name")); + detail.put("operation", "不做处理"); + detail.put("create_time", new Date()); + riskMerchantDetalLogMapper.save(detail); + } + + @Override + public void dealRiskRecord(JSONObject account,DealRiskRecord dealRiskRecord) { + JSONObject record = riskMerchantRecordMapper.findById(dealRiskRecord.getRecordId()); + if(record==null){ + throw new NotFoundException("Risk Record Not Found Please Check"); + } + if(dealRiskRecord.getLimitAmount()!=null){ + clientManager.setMaxOrderAmount(record.getString("client_moniker"),dealRiskRecord.getLimitAmount()); + } + if(dealRiskRecord.getDisableMerchat()){ + clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Wechat", false); + clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Alipay", false); + } + } + + @Override + public List getRiskOrders(String recordId) { + return riskTransactionLogMapper.findByRecordId(recordId); + } + + @Override + public List getRiskRecords(QueryRIskRecord queryRIskRecord) { + return riskMerchantRecordMapper.query(queryRIskRecord.toParams()); + } + + @Override + public void addWhiteList(String client_moinker) { + JSONObject white = riskWhiteListMapper.findByClientMoniker(client_moinker); + if (white != null) { + white.put("is_valid", true); + riskWhiteListMapper.update(white); + return; + } + JSONObject client = clientManager.getClientInfoByMoniker(client_moinker); + if (client == null) { + throw new NotFoundException("Merchant Not Found Please Check"); + } + JSONObject record = new JSONObject(); + record.put("client_id", client.getIntValue("client_id")); + record.put("client_moniker", client.getString("client_moinker")); + record.put("create_time", new Date()); + riskWhiteListMapper.save(record); + } + + @Override + public void disableWhiteList(String client_moinker) { + JSONObject white = riskWhiteListMapper.findByClientMoniker(client_moinker); + if (white == null) { + throw new NotFoundException("White List Not Found Please Check"); + } + white.put("is_valid", false); + riskWhiteListMapper.update(white); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java new file mode 100644 index 000000000..016dc1fc7 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java @@ -0,0 +1,74 @@ +package au.com.royalpay.payment.manage.risk.web; + +import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; +import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRIskRecord; +import au.com.royalpay.payment.manage.risk.core.RiskMerchantService; +import au.com.royalpay.payment.tools.CommonConsts; + +import com.alibaba.fastjson.JSONObject; + +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +import javax.annotation.Resource; + +/** + * Created by wangning on 08/12/2016. + */ +@RestController +@ManagerMapping(value = "/sys/risk") +public class RiskController { + + @Resource + private RiskMerchantService riskMerchantService; + + @RequestMapping(value = "/records", method = RequestMethod.GET) + public List list(QueryRIskRecord recordQuery) { + return riskMerchantService.getRiskRecords(recordQuery); + } + + @RequestMapping(value = "/records/{record_id}/dropOrder", method = RequestMethod.PUT) + public void dropOrder(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) { + riskMerchantService.DropOrderRiskRecord(manager, record_id); + } + + @RequestMapping(value = "/records/{record_id}/noop", method = RequestMethod.PUT) + public void noop(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) { + riskMerchantService.noopRiskRecord(manager, record_id); + } + + @RequestMapping(value = "/records/{record_id}/deal",method = RequestMethod.PUT) + public void dealRecord(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id, @RequestBody DealRiskRecord dealRiskRecord){ + dealRiskRecord.setRecordId(record_id); + riskMerchantService.dealRiskRecord(manager,dealRiskRecord); + } + + @RequestMapping(value = "/orders/{record_id}", method = RequestMethod.GET) + public List getRiskOrders(@PathVariable String record_id) { + return riskMerchantService.getRiskOrders(record_id); + } + + @RequestMapping(value = "/white/{client_moniker}", method = RequestMethod.POST) + public void addWhiteList(@PathVariable String client_moniker) { + riskMerchantService.addWhiteList(client_moniker); + } + + @RequestMapping(value = "/white/{client_moniker}/disable", method = RequestMethod.PUT) + public void disableWhiteList(@PathVariable String client_moniker) { + riskMerchantService.disableWhiteList(client_moniker); + } + + @RequestMapping(value = "/records/uploadFiles", method = RequestMethod.POST) + public void addRecordLog(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@RequestBody AddRiskDetailLog addRiskDetailLog) { + riskMerchantService.addDetailLog(addRiskDetailLog,manager); + } + +} diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml new file mode 100644 index 000000000..bd4fd0f27 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file From c82400165e053cadbe4d4483a9e1a668127d9428 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 27 Apr 2018 11:19:28 +0800 Subject: [PATCH 02/11] tmp --- .../templates/analysis_monitoring.html | 4 + src/main/ui/static/risk/risk.js | 102 ++++++++++++++++++ src/main/ui/static/risk/templates/risk.html | 42 ++++++++ .../ui/static/risk/templates/risk_detail.html | 40 +++++++ 4 files changed, 188 insertions(+) create mode 100644 src/main/ui/static/risk/risk.js create mode 100644 src/main/ui/static/risk/templates/risk.html create mode 100644 src/main/ui/static/risk/templates/risk_detail.html 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 84efe7cf9..c4dabdde7 100644 --- a/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html +++ b/src/main/ui/static/analysis/monitoring/templates/analysis_monitoring.html @@ -19,6 +19,10 @@
  • 欠款|Pre Refund
  • +
  • + 风控记录|Risk Records +
  • + diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js new file mode 100644 index 000000000..ebdf4ac39 --- /dev/null +++ b/src/main/ui/static/risk/risk.js @@ -0,0 +1,102 @@ +define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) { + 'use strict'; + var app = angular.module('RiskManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']); + app.config(['$stateProvider', function ($stateProvider) { + $stateProvider.state('analysis_monitoring.risk_manager', { + url: '/risk/manage', + templateUrl: '/static/risk/templates/risk.html', + controller: 'RiskManageCtrl', + }).state('analysis_monitoring.risk_detail', { + url: '/detail', + templateUrl: '/static/risk/templates/risk_detail.html', + controller: 'RiskDetailCtrl', + params : { + param:null + } + }).state('vipcustomers.detail', { + url: '/{vip_code}/detail', + templateUrl: '/static/payment/vipcustomer/templates/vipcustomer_detail.html', + controller: 'vipCustomerDetailCtrl', + }).state('vipcustomers.edit', { + url: '/{vip_code}/edit', + templateUrl: '/static/payment/vipcustomer/templates/vipcustomer_edit.html', + controller: 'vipCustomerEditCtrl', + resolve: { + vipcustomer: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/partner/vip/' + $stateParams.vip_code); + }] + } + }) + }]); + app.controller('RiskManageCtrl', ['$scope', '$http','$state', function ($scope, $http,$state){ + $scope.params = {}; + $scope.loadRecords = function () { + var params = angular.copy($scope.params); + $http.get('/sys/risk/records', {params: params}).then(function (resp) { + $scope.records = resp.data; + }); + }; + $scope.loadRecords(1); + $scope.jumpDetail = function (record_id,client_moniker) { + var param = {}; + param.client_moniker = client_moniker; + param.record_id = record_id; + $state.go('analysis_monitoring.risk_detail',{param:param}); + } + }]); + app.controller('RiskDetailCtrl', ['$scope', '$http', '$stateParams','Upload', 'commonDialog', function ($scope, $http,$stateParams, Upload, commonDialog) { + $scope.params = {}; + $scope.loadOrders = function () { + + $http.get('/sys/risk/orders/' + $stateParams.param.record_id).then(function (resp) { + $scope.orders = resp.data; + }); + }; + $scope.loadOrders(1); + + $scope.edit = function () { + + } + }]); + app.controller('vipCustomerDetailCtrl', ['$scope', '$http','$filter','$state', '$uibModal', 'commonDialog', 'vipcustomer', function ($scope, $http,$filter, $state, $uibModal, commonDialog, vipcustomer) { + $scope.vipcustomer = vipcustomer.data; + $scope.params = {vip_customer_id:$scope.vipcustomer.vip_customer_id}; + $scope.loadVipOrders = function () { + var params = angular.copy($scope.params); + $http.get('/partner/vip/payment/orders', {params: params}).then(function (resp) { + $scope.vip_orders = resp.data.data; + $scope.pagination = resp.data.pagination; + }); + }; + $scope.loadVipOrders(); + + }]); + app.controller('vipCustomerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'vipcustomer', + function ($scope, $http, $state, Upload, commonDialog, vipcustomer) { + $scope.vipcustomer = vipcustomer.data; + $scope.updateVipCustomer = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + $http.put('/partner/vip/' + $scope.vipcustomer.vip_code, $scope.vipcustomer).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Update vip customer information successfully', + type: 'success' + }); + $scope.loadVipCustomers(); + $state.go('^.detail', {vip_code: $scope.vipcustomer.vip_code}, {reload: true}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }); + }; + + }]); + + return app; +}); \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html new file mode 100644 index 000000000..9c760cf3a --- /dev/null +++ b/src/main/ui/static/risk/templates/risk.html @@ -0,0 +1,42 @@ +
    +
    +

    Risk Manager

    + +
    +
    +
    +
    Records
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Client MonikerCreate TimeExpiy TimeRisk TypesRisk CountsOperation
    {{record.client_moniker}}{{record.create_time}}{{record.expiry_date}}{{record.risk_types}}{{record.risk_counts}} + + + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk_detail.html b/src/main/ui/static/risk/templates/risk_detail.html new file mode 100644 index 000000000..3297b35d6 --- /dev/null +++ b/src/main/ui/static/risk/templates/risk_detail.html @@ -0,0 +1,40 @@ +
    +
    +

    Risk Record

    + +
    +
    +
    +
    Records Reference
    +
    + + + + + + + + + + + + + + + + + + +
    Order IdAmountChannelRisk Types
    {{order.order_id}}{{order.amount}}{{order.channel}}{{order.risk_types}} + + + +
    +
    +
    +
    +
    \ No newline at end of file From 97220886c53d9e41b3836075637459903b5607a7 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 27 Apr 2018 14:03:52 +0800 Subject: [PATCH 03/11] tmp --- src/main/ui/static/risk/templates/risk.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html index 9c760cf3a..6bdbbc444 100644 --- a/src/main/ui/static/risk/templates/risk.html +++ b/src/main/ui/static/risk/templates/risk.html @@ -15,17 +15,17 @@ Client Moniker Create Time - Expiy Time + Expiry Time Risk Types Risk Counts - Operation + Operationr {{record.client_moniker}} {{record.create_time}} - {{record.expiry_date}} + {{record.expiry_time}} {{record.risk_types}} {{record.risk_counts}} From 78688d7330dfdad99e8cb3b2074e8ebe28f8b881 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 27 Apr 2018 14:38:56 +0800 Subject: [PATCH 04/11] tmp --- src/main/ui/static/risk/risk.js | 3 ++- src/main/ui/static/risk/templates/risk.html | 2 +- src/main/ui/static/risk/templates/risk_detail.html | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js index ebdf4ac39..4b5e918ce 100644 --- a/src/main/ui/static/risk/risk.js +++ b/src/main/ui/static/risk/risk.js @@ -44,7 +44,8 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $state.go('analysis_monitoring.risk_detail',{param:param}); } }]); - app.controller('RiskDetailCtrl', ['$scope', '$http', '$stateParams','Upload', 'commonDialog', function ($scope, $http,$stateParams, Upload, commonDialog) { + app.controller('RiskDetailCtrl', ['$scope', '$http', '$stateParams','$uibModal', function ($scope, $http,$stateParams,$uibModal) { + $scope.client_moniker = $stateParams.param.client_moniker; $scope.params = {}; $scope.loadOrders = function () { diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html index 6bdbbc444..01c25d054 100644 --- a/src/main/ui/static/risk/templates/risk.html +++ b/src/main/ui/static/risk/templates/risk.html @@ -18,7 +18,7 @@ Expiry Time Risk Types Risk Counts - Operationr + Operation diff --git a/src/main/ui/static/risk/templates/risk_detail.html b/src/main/ui/static/risk/templates/risk_detail.html index 3297b35d6..07b092be1 100644 --- a/src/main/ui/static/risk/templates/risk_detail.html +++ b/src/main/ui/static/risk/templates/risk_detail.html @@ -1,6 +1,6 @@
    -

    Risk Record

    +

    Risk Manager

    -
    Records Reference
    +
    Records Orders(Partner Code:{{client_moniker}})
    @@ -27,8 +27,8 @@ From 51fdf932c1600bcf6d93e8537eeb50a87b874311 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 27 Apr 2018 14:59:36 +0800 Subject: [PATCH 05/11] tmp --- src/main/ui/static/risk/risk.js | 63 +++---- src/main/ui/static/risk/templates/risk.html | 3 + .../ui/static/risk/templates/risk_deit.html | 170 ++++++++++++++++++ .../ui/static/risk/templates/risk_detail.html | 5 - 4 files changed, 195 insertions(+), 46 deletions(-) create mode 100644 src/main/ui/static/risk/templates/risk_deit.html diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js index 4b5e918ce..c81b3d92c 100644 --- a/src/main/ui/static/risk/risk.js +++ b/src/main/ui/static/risk/risk.js @@ -37,6 +37,25 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }); }; $scope.loadRecords(1); + $scope.edit = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/partner_new_rate.html', + controller: 'RiskRecordEditCtrl', + resolve: { + rate: function () { + return {rate_name: name, clean_days: 3}; + }, + sys_common_rate: function () { + return $http.get('/sys/partners/sys_rates'); + }, + clientMoniker: function () { + return $scope.partner.client_moniker; + } + } + }).result.then(function () { + $scope.getRates(); + }); + }; $scope.jumpDetail = function (record_id,client_moniker) { var param = {}; param.client_moniker = client_moniker; @@ -55,49 +74,11 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; $scope.loadOrders(1); - $scope.edit = function () { - - } }]); - app.controller('vipCustomerDetailCtrl', ['$scope', '$http','$filter','$state', '$uibModal', 'commonDialog', 'vipcustomer', function ($scope, $http,$filter, $state, $uibModal, commonDialog, vipcustomer) { - $scope.vipcustomer = vipcustomer.data; - $scope.params = {vip_customer_id:$scope.vipcustomer.vip_customer_id}; - $scope.loadVipOrders = function () { - var params = angular.copy($scope.params); - $http.get('/partner/vip/payment/orders', {params: params}).then(function (resp) { - $scope.vip_orders = resp.data.data; - $scope.pagination = resp.data.pagination; - }); - }; - $scope.loadVipOrders(); - + + app.controller('RiskRecordEditCtrl', ['$scope', '$http', function ($scope, $http) { + }]); - app.controller('vipCustomerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'vipcustomer', - function ($scope, $http, $state, Upload, commonDialog, vipcustomer) { - $scope.vipcustomer = vipcustomer.data; - $scope.updateVipCustomer = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true; - } - }); - return; - } - $http.put('/partner/vip/' + $scope.vipcustomer.vip_code, $scope.vipcustomer).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Update vip customer information successfully', - type: 'success' - }); - $scope.loadVipCustomers(); - $state.go('^.detail', {vip_code: $scope.vipcustomer.vip_code}, {reload: true}); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) - }); - }; - - }]); return app; }); \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html index 01c25d054..f8cf7dfce 100644 --- a/src/main/ui/static/risk/templates/risk.html +++ b/src/main/ui/static/risk/templates/risk.html @@ -32,6 +32,9 @@ + + + diff --git a/src/main/ui/static/risk/templates/risk_deit.html b/src/main/ui/static/risk/templates/risk_deit.html new file mode 100644 index 000000000..1692b6e20 --- /dev/null +++ b/src/main/ui/static/risk/templates/risk_deit.html @@ -0,0 +1,170 @@ + + + \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk_detail.html b/src/main/ui/static/risk/templates/risk_detail.html index 07b092be1..89b79572b 100644 --- a/src/main/ui/static/risk/templates/risk_detail.html +++ b/src/main/ui/static/risk/templates/risk_detail.html @@ -26,11 +26,6 @@ -
    {{order.channel}} {{order.risk_types}} - - + +
    {{order.amount}} {{order.channel}} {{order.risk_types}} - - - -
    From 33db182dfbb8f20a35b7c772d6fd5f832ee6d410 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Sat, 28 Apr 2018 09:06:45 +0800 Subject: [PATCH 06/11] tmp --- .../risk/RiskMerchantRecordMapper.java | 6 +- .../risk/RiskTransactionLogMapper.java | 3 + .../manage/risk/bean/QueryRIskRecord.java | 41 ---- .../manage/risk/bean/QueryRiskOrder.java | 69 +++++++ .../manage/risk/bean/QueryRiskRecord.java | 83 ++++++++ .../manage/risk/core/RiskMerchantService.java | 11 +- .../core/impl/RiskMerchantServiceImpl.java | 56 ++++-- .../manage/risk/web/RiskController.java | 19 +- .../mappers/risk/RiskMerchantRecordMapper.xml | 6 + .../mappers/risk/RiskTransactionLogMapper.xml | 19 ++ src/main/ui/static/risk/risk.js | 181 +++++++++++++----- src/main/ui/static/risk/templates/risk.html | 25 ++- .../ui/static/risk/templates/risk_deit.html | 170 ---------------- .../ui/static/risk/templates/risk_detail.html | 35 ---- .../ui/static/risk/templates/risk_edit.html | 31 +++ .../static/risk/templates/risk_history.html | 115 +++++++++++ .../ui/static/risk/templates/risk_orders.html | 96 ++++++++++ 17 files changed, 632 insertions(+), 334 deletions(-) delete mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskOrder.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java create mode 100644 src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml delete mode 100644 src/main/ui/static/risk/templates/risk_deit.html delete mode 100644 src/main/ui/static/risk/templates/risk_detail.html create mode 100644 src/main/ui/static/risk/templates/risk_edit.html create mode 100644 src/main/ui/static/risk/templates/risk_history.html create mode 100644 src/main/ui/static/risk/templates/risk_orders.html diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java index 998a95695..1c14b9b0a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java @@ -1,10 +1,10 @@ package au.com.royalpay.payment.manage.mappers.risk; -import java.util.List; - import org.apache.ibatis.annotations.Param; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; @@ -18,7 +18,7 @@ public interface RiskMerchantRecordMapper { @AutoSql(type = SqlType.UPDATE) void update(JSONObject record); - List query(JSONObject params); + PageList query(JSONObject params, PageBounds pagination); @AutoSql(type = SqlType.SELECT) JSONObject findById(@Param("id") String id); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java index 17f2aa4d2..c3b4cbc41 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.java @@ -1,6 +1,8 @@ package au.com.royalpay.payment.manage.mappers.risk; 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; @@ -21,4 +23,5 @@ public interface RiskTransactionLogMapper { @AutoSql(type = SqlType.SELECT) List findByRecordId(@Param("record_id") String record_id); + PageList query(JSONObject params, PageBounds pagination); } diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java deleted file mode 100644 index 2ec955f23..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRIskRecord.java +++ /dev/null @@ -1,41 +0,0 @@ -package au.com.royalpay.payment.manage.risk.bean; - -import com.alibaba.fastjson.JSONObject; - -public class QueryRIskRecord { - - private String status; - private String client_moniker; - private String record_id; - - public JSONObject toParams(){ - JSONObject params = new JSONObject(); - params.put("status",this.status); - params.put("client_moniker",this.client_moniker); - params.put("record_id",this.record_id); - return params; - } - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getRecord_id() { - return record_id; - } - - public void setRecord_id(String record_id) { - this.record_id = record_id; - } - - public String getClient_moniker() { - return client_moniker; - } - - public void setClient_moniker(String client_moniker) { - this.client_moniker = client_moniker; - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskOrder.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskOrder.java new file mode 100644 index 000000000..96a9ecfab --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskOrder.java @@ -0,0 +1,69 @@ +package au.com.royalpay.payment.manage.risk.bean; + +import com.alibaba.fastjson.JSONObject; + +import org.apache.commons.lang3.time.DateUtils; + +import java.text.ParseException; + +public class QueryRiskOrder { + + private String record_id; + private String c_end_time; + private int client_id; + private int limit = 20; + private int page; + + public JSONObject toParams() { + JSONObject params = new JSONObject(); + params.put("record_id", this.record_id); + params.put("client_id", this.client_id); + try { + if (c_end_time != null) { + params.put("c_end_time", DateUtils.parseDate(this.c_end_time, new String[] { "yyyy-MM-dd HH:mm:ss" })); + } + } catch (ParseException e) { + } + return params; + } + + public String getRecord_id() { + return record_id; + } + + public void setRecord_id(String record_id) { + this.record_id = record_id; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public String getC_end_time() { + return c_end_time; + } + + public void setC_end_time(String c_end_time) { + this.c_end_time = c_end_time; + } + + public int getClient_id() { + return client_id; + } + + public void setClient_id(int client_id) { + this.client_id = client_id; + } +} \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java new file mode 100644 index 000000000..a1de31509 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java @@ -0,0 +1,83 @@ +package au.com.royalpay.payment.manage.risk.bean; + +import com.alibaba.fastjson.JSONObject; + +import org.apache.commons.lang3.time.DateUtils; + +import java.text.ParseException; + +public class QueryRiskRecord { + + private String status; + private String client_moniker; + private String record_id; + private String c_end_time; + private int client_id; + + private int limit = 20; + private int page; + + public JSONObject toParams() { + JSONObject params = new JSONObject(); + params.put("status", this.status); + params.put("client_moniker", this.client_moniker); + params.put("record_id", this.record_id); + params.put("client_id", this.client_id); + try { + if (c_end_time != null) { + params.put("c_end_time", DateUtils.parseDate(this.c_end_time, new String[] { "yyyy-MM-dd HH:mm:ss" })); + } + } catch (ParseException e) { + } + return params; + + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRecord_id() { + return record_id; + } + + public void setRecord_id(String record_id) { + this.record_id = record_id; + } + + public String getClient_moniker() { + return client_moniker; + } + + public void setClient_moniker(String client_moniker) { + this.client_moniker = client_moniker; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public String getC_end_time() { + return c_end_time; + } + + public void setC_end_time(String c_end_time) { + this.c_end_time = c_end_time; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java index d6af1b689..415dca96b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java @@ -2,12 +2,11 @@ package au.com.royalpay.payment.manage.risk.core; import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; -import au.com.royalpay.payment.manage.risk.bean.QueryRIskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord; import com.alibaba.fastjson.JSONObject; -import java.util.List; - public interface RiskMerchantService { void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account); @@ -18,14 +17,16 @@ public interface RiskMerchantService { void dealRiskRecord(JSONObject account,DealRiskRecord dealRiskRecord); - List getRiskOrders(String recordId); + JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder); - List getRiskRecords(QueryRIskRecord queryRIskRecord); + JSONObject getRiskRecords(QueryRiskRecord queryRiskRecord); void addWhiteList(String client_moinker); void disableWhiteList(String client_moinker); + JSONObject getRecordById(String record_id); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java index 631562e43..0c541847b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java @@ -7,18 +7,21 @@ import au.com.royalpay.payment.manage.mappers.risk.RiskWhiteListMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; -import au.com.royalpay.payment.manage.risk.bean.QueryRIskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; +import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; -import java.util.List; import javax.annotation.Resource; @@ -39,8 +42,8 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { @Override public void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account) { JSONObject record = addRiskDetailLog.params(); - record.put("auditor",account.getString("display_name")); - record.put("create_time",new Date()); + record.put("auditor", account.getString("display_name")); + record.put("create_time", new Date()); riskMerchantDetalLogMapper.save(record); } @@ -79,7 +82,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { } JSONObject record = new JSONObject(); record.put("id", recordId); - record.put("status", "1"); + record.put("status", "2"); riskMerchantRecordMapper.update(record); JSONObject detail = new JSONObject(); detail.put("record_id", recordId); @@ -91,28 +94,48 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { } @Override - public void dealRiskRecord(JSONObject account,DealRiskRecord dealRiskRecord) { + @Transactional + public void dealRiskRecord(JSONObject account, DealRiskRecord dealRiskRecord) { JSONObject record = riskMerchantRecordMapper.findById(dealRiskRecord.getRecordId()); - if(record==null){ + if (record == null) { throw new NotFoundException("Risk Record Not Found Please Check"); } - if(dealRiskRecord.getLimitAmount()!=null){ - clientManager.setMaxOrderAmount(record.getString("client_moniker"),dealRiskRecord.getLimitAmount()); + if (record.getIntValue("status") != 0) { + throw new BadRequestException("The Record Has Been Handled"); + } + String operation = ""; + if (dealRiskRecord.getLimitAmount() != null) { + clientManager.setMaxOrderAmount(record.getString("client_moniker"), dealRiskRecord.getLimitAmount()); + operation = operation + "限额" + dealRiskRecord.getLimitAmount(); + } - if(dealRiskRecord.getDisableMerchat()){ + if (dealRiskRecord.getDisableMerchat()) { clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Wechat", false); clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Alipay", false); + operation = operation + " 关闭支付通道"; } + JSONObject detail = new JSONObject(); + detail.put("record_id", dealRiskRecord.getRecordId()); + detail.put("client_id", record.getIntValue("client_id")); + detail.put("auditor", account.getString("display_name")); + detail.put("operation", StringUtils.isEmpty(operation) ? null : (operation = "处理结果:" + operation)); + detail.put("create_time", new Date()); + riskMerchantDetalLogMapper.save(detail); + record.put("status", 1); + riskMerchantRecordMapper.update(record); } @Override - public List getRiskOrders(String recordId) { - return riskTransactionLogMapper.findByRecordId(recordId); + public JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder) { + return PageListUtils.buildPageListResult( + riskTransactionLogMapper.query(queryRiskOrder.toParams(), new PageBounds(queryRiskOrder.getPage(), queryRiskOrder.getLimit()))); + } @Override - public List getRiskRecords(QueryRIskRecord queryRIskRecord) { - return riskMerchantRecordMapper.query(queryRIskRecord.toParams()); + public JSONObject getRiskRecords(QueryRiskRecord queryRiskRecord) { + return PageListUtils.buildPageListResult( + riskMerchantRecordMapper.query(queryRiskRecord.toParams(), new PageBounds(queryRiskRecord.getPage(), queryRiskRecord.getLimit()))); } @Override @@ -143,4 +166,9 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { white.put("is_valid", false); riskWhiteListMapper.update(white); } + + @Override + public JSONObject getRecordById(String record_id) { + return riskMerchantRecordMapper.findById(record_id); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java index 016dc1fc7..b857c3090 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java @@ -3,7 +3,8 @@ package au.com.royalpay.payment.manage.risk.web; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; -import au.com.royalpay.payment.manage.risk.bean.QueryRIskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService; import au.com.royalpay.payment.tools.CommonConsts; @@ -16,8 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import java.util.List; - import javax.annotation.Resource; /** @@ -31,10 +30,15 @@ public class RiskController { private RiskMerchantService riskMerchantService; @RequestMapping(value = "/records", method = RequestMethod.GET) - public List list(QueryRIskRecord recordQuery) { + public JSONObject list(QueryRiskRecord recordQuery) { return riskMerchantService.getRiskRecords(recordQuery); } + @RequestMapping(value = "/records/{record_id}", method = RequestMethod.GET) + public JSONObject getById(@PathVariable String record_id) { + return riskMerchantService.getRecordById(record_id); + } + @RequestMapping(value = "/records/{record_id}/dropOrder", method = RequestMethod.PUT) public void dropOrder(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) { riskMerchantService.DropOrderRiskRecord(manager, record_id); @@ -51,11 +55,12 @@ public class RiskController { riskMerchantService.dealRiskRecord(manager,dealRiskRecord); } - @RequestMapping(value = "/orders/{record_id}", method = RequestMethod.GET) - public List getRiskOrders(@PathVariable String record_id) { - return riskMerchantService.getRiskOrders(record_id); + @RequestMapping(value = "/orders", method = RequestMethod.GET) + public JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder) { + return riskMerchantService.getRiskOrders(queryRiskOrder); } + @RequestMapping(value = "/white/{client_moniker}", method = RequestMethod.POST) public void addWhiteList(@PathVariable String client_moniker) { riskMerchantService.addWhiteList(client_moniker); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml index bd4fd0f27..67dceb727 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml @@ -14,6 +14,12 @@ and client_moniker = #{client_moniker} + + and create_time < #{c_end_time} + + + and client_id = #{client_id} + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml new file mode 100644 index 000000000..d7f0bf1eb --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js index c81b3d92c..961565a57 100644 --- a/src/main/ui/static/risk/risk.js +++ b/src/main/ui/static/risk/risk.js @@ -1,84 +1,159 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) { 'use strict'; + + var riskType = [ + {code: 1, label: 'test1'}, + {code: 2, label: 'test2'}, + ]; + var app = angular.module('RiskManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']); app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('analysis_monitoring.risk_manager', { url: '/risk/manage', templateUrl: '/static/risk/templates/risk.html', controller: 'RiskManageCtrl', - }).state('analysis_monitoring.risk_detail', { - url: '/detail', - templateUrl: '/static/risk/templates/risk_detail.html', - controller: 'RiskDetailCtrl', - params : { - param:null + }).state('analysis_monitoring.risk_orders', { + url: '/risk/{record_id}/orders', + templateUrl: '/static/risk/templates/risk_orders.html', + controller: 'RiskOrderCtrl', + resolve:{ + record:['$http','$stateParams', function ($http,$stateParams) { + return $http.get('/sys/risk/records/'+$stateParams.record_id).then(function (res) { + return res.data; + }); + }] } - }).state('vipcustomers.detail', { - url: '/{vip_code}/detail', - templateUrl: '/static/payment/vipcustomer/templates/vipcustomer_detail.html', - controller: 'vipCustomerDetailCtrl', - }).state('vipcustomers.edit', { - url: '/{vip_code}/edit', - templateUrl: '/static/payment/vipcustomer/templates/vipcustomer_edit.html', - controller: 'vipCustomerEditCtrl', - resolve: { - vipcustomer: ['$http', '$stateParams', function ($http, $stateParams) { - return $http.get('/partner/vip/' + $stateParams.vip_code); + }).state('analysis_monitoring.risk_history', { + url: '/risk/{record_id}/history', + templateUrl: '/static/risk/templates/risk_history.html', + controller: 'RecordHistoryCtrl', + resolve:{ + record:['$http','$stateParams', function ($http,$stateParams) { + return $http.get('/sys/risk/records/'+$stateParams.record_id).then(function (res) { + return res.data; + }); }] } - }) + }); }]); - app.controller('RiskManageCtrl', ['$scope', '$http','$state', function ($scope, $http,$state){ + app.controller('RiskManageCtrl', ['$scope', '$http', function ($scope, $http){ $scope.params = {}; - $scope.loadRecords = function () { + $scope.pagination = {}; + $scope.loadRecords = function (page) { var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; $http.get('/sys/risk/records', {params: params}).then(function (resp) { - $scope.records = resp.data; + $scope.records = resp.data.data; + $scope.pagination = resp.data.pagination; }); }; $scope.loadRecords(1); - $scope.edit = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/partner_new_rate.html', - controller: 'RiskRecordEditCtrl', - resolve: { - rate: function () { - return {rate_name: name, clean_days: 3}; - }, - sys_common_rate: function () { - return $http.get('/sys/partners/sys_rates'); - }, - clientMoniker: function () { - return $scope.partner.client_moniker; - } - } - }).result.then(function () { - $scope.getRates(); - }); - }; - $scope.jumpDetail = function (record_id,client_moniker) { - var param = {}; - param.client_moniker = client_moniker; - param.record_id = record_id; - $state.go('analysis_monitoring.risk_detail',{param:param}); - } }]); - app.controller('RiskDetailCtrl', ['$scope', '$http', '$stateParams','$uibModal', function ($scope, $http,$stateParams,$uibModal) { - $scope.client_moniker = $stateParams.param.client_moniker; - $scope.params = {}; - $scope.loadOrders = function () { - $http.get('/sys/risk/orders/' + $stateParams.param.record_id).then(function (resp) { - $scope.orders = resp.data; + app.controller('RiskOrderCtrl', ['$scope', '$http', 'record', function ($scope, $http,record) { + $scope.params = {record_id: record.id}; + $scope.historyParams = {client_id:record.client_id}; + $scope.pagination = {}; + $scope.historyPagination = {}; + $scope.record = record; + $scope.loadOrders = function (page) { + var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; + $http.get('/sys/risk/orders',{params: params}).then(function (resp) { + $scope.orders = resp.data.data; + $scope.pagination = resp.data.pagination; + $scope.historyParams.c_end_time = $scope.orders.pop().create_time; + $scope.loadHistoryOrders(1); }); }; $scope.loadOrders(1); + + $scope.loadHistoryOrders = function (page) { + var historyParams = angular.copy($scope.historyParams); + historyParams.page = page || $scope.historyPagination.page || 1; + $http.get('/sys/risk/orders',{params: historyParams}).then(function (resp) { + $scope.historyOrders = resp.data.data; + $scope.historyPagination = resp.data.pagination; + }); + }; + }]); + + app.controller('RecordHistoryCtrl', ['$scope', '$http','$uibModal', 'commonDialog','record', function ($scope, $http,$uibModal,commonDialog,record) { + $scope.record = record; + $scope.pagination = {}; + $scope.params = {client_id:record.client_id,c_end_time:record.create_time}; + $scope.listHistory = function (page) { + var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; + $http.get('/sys/risk/records',{params:params}).then(function (res) { + $scope.histories = res.data.data; + $scope.pagination = res.data.pagination; + }) + }; + $scope.listHistory(1); + $scope.edit = function () { + $uibModal.open({ + templateUrl: '/static/risk/templates/risk_edit.html', + controller: 'RiskRecordHandleCtrl', + resolve:{record_id:function () { + return record.id; + }} + }).result.then(function () { + commonDialog.alert({ + title: 'Success', + type: 'success' + }); + }) + }; + + + $scope.noop = function () { + commonDialog.confirm({ + title: 'Confirm', + content: '确定放弃这次预警' + }).then(function () { + $http.put('/sys/risk/records/'+ record.id+'/noop', $scope.params).then(function () { + }).then(function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'Error' + }); + }) + }) + } }]); - app.controller('RiskRecordEditCtrl', ['$scope', '$http', function ($scope, $http) { + app.controller('RiskRecordHandleCtrl', ['$scope', '$http','record_id','commonDialog', function ($scope, $http,record_id,commonDialog) { + $scope.params= {}; + $scope.handle = function () { + $http.put('/sys/risk/records/'+ record_id+'/deal', $scope.params).then(function () { + $scope.$close(); + }).then(function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'Error' + }); + }) + } }]); + app.filter('risk_type', function (typeString) { + var sArr = typeString.split(","); + var result = ""; + angular.forEach(sArr, function (s) { + angular.forEach(riskType,function (type) { + if (type==s){ + result+=type; + result+=","; + } + }) + }); + result = result.substr(0,result.length-2); + return result; + }); return app; }); \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html index f8cf7dfce..7253a7a99 100644 --- a/src/main/ui/static/risk/templates/risk.html +++ b/src/main/ui/static/risk/templates/risk.html @@ -15,8 +15,9 @@ Client Moniker Create Time - Expiry Time + Waring Time Risk Types + Status Risk Counts Operation @@ -26,19 +27,31 @@ {{record.client_moniker}} {{record.create_time}} {{record.expiry_time}} - {{record.risk_types}} + {{record.status}} + {{record.risk_types|risk_type}} {{record.risk_counts}} - + - - - +
    diff --git a/src/main/ui/static/risk/templates/risk_deit.html b/src/main/ui/static/risk/templates/risk_deit.html deleted file mode 100644 index 1692b6e20..000000000 --- a/src/main/ui/static/risk/templates/risk_deit.html +++ /dev/null @@ -1,170 +0,0 @@ - - - \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk_detail.html b/src/main/ui/static/risk/templates/risk_detail.html deleted file mode 100644 index 89b79572b..000000000 --- a/src/main/ui/static/risk/templates/risk_detail.html +++ /dev/null @@ -1,35 +0,0 @@ -
    -
    -

    Risk Manager

    - -
    -
    -
    -
    Records Orders(Partner Code:{{client_moniker}})
    -
    - - - - - - - - - - - - - - - - - -
    Order IdAmountChannelRisk Types
    {{order.order_id}}{{order.amount}}{{order.channel}}{{order.risk_types}}
    -
    -
    -
    -
    \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk_edit.html b/src/main/ui/static/risk/templates/risk_edit.html new file mode 100644 index 000000000..14e2ce8c2 --- /dev/null +++ b/src/main/ui/static/risk/templates/risk_edit.html @@ -0,0 +1,31 @@ +
    +

    Phone Top Up

    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    diff --git a/src/main/ui/static/risk/templates/risk_history.html b/src/main/ui/static/risk/templates/risk_history.html new file mode 100644 index 000000000..87a2f2468 --- /dev/null +++ b/src/main/ui/static/risk/templates/risk_history.html @@ -0,0 +1,115 @@ +
    +
    +

    Risk Manager

    + +
    +
    + +
    +
    Record History
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    Client MonikerCreate TimeWaring TimeRisk TypesStatusRisk CountsOperation
    {{record.client_moniker}}{{record.create_time}}{{record.expiry_time}}{{record.status}}{{record.risk_types|risk_type}}{{record.risk_counts}} + + + + + + + +
    + +
    +
    + + +
    +
    Latest Record
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Client MonikerCreate TimeWaring TimeRisk TypesStatusRisk Counts
    {{record.client_moniker}}{{record.create_time}}{{record.expiry_time}}{{record.status}}{{record.risk_types|risk_type}}{{record.risk_counts}}
    + +
    +
    + +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk_orders.html b/src/main/ui/static/risk/templates/risk_orders.html new file mode 100644 index 000000000..e4399d1d2 --- /dev/null +++ b/src/main/ui/static/risk/templates/risk_orders.html @@ -0,0 +1,96 @@ +
    +
    +

    Risk Manager

    + +
    +
    + +
    +
    Reference Orders
    +
    + + + + + + + + + + + + + + + + + +
    Order IdAmountChannelRisk Types
    {{order.order_id}}{{order.amount}}{{order.channel}}{{order.risk_types|risk_type}}
    +
    + +
    + +
    +
    Waring Orders History
    +
    + + + + + + + + + + + + + + + + + +
    Order IdAmountChannelRisk Types
    {{order.order_id}}{{order.amount}}{{order.channel}}{{order.risk_types|risk_type}}
    +
    + +
    + +
    +
    \ No newline at end of file From 47df91b1c5a323c91df8d34476b2a28a6c692948 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Sat, 28 Apr 2018 15:04:32 +0800 Subject: [PATCH 07/11] add manage web --- ....java => RiskMerchantDetailLogMapper.java} | 6 +- .../risk/RiskMerchantRecordMapper.java | 4 +- .../manage/risk/bean/AddRiskDetailLog.java | 44 ++++--- .../manage/risk/bean/QueryRiskDetail.java | 70 +++++++++++ .../manage/risk/core/RiskMerchantService.java | 5 + .../core/impl/RiskMerchantServiceImpl.java | 66 ++++++++-- .../manage/risk/web/RiskController.java | 17 ++- .../risk/RiskMerchantDetailLogMapper.xml | 17 +++ .../mappers/risk/RiskMerchantRecordMapper.xml | 1 + .../mappers/risk/RiskTransactionLogMapper.xml | 1 + src/main/ui/static/risk/risk.js | 114 +++++++++++++++--- src/main/ui/static/risk/templates/risk.html | 6 +- .../ui/static/risk/templates/risk_detail.html | 63 ++++++++++ .../ui/static/risk/templates/risk_edit.html | 1 + .../static/risk/templates/risk_history.html | 72 ++--------- .../ui/static/risk/templates/risk_orders.html | 21 +++- .../ui/static/risk/templates/risk_remark.html | 25 ++++ 17 files changed, 420 insertions(+), 113 deletions(-) rename src/main/java/au/com/royalpay/payment/manage/mappers/risk/{RiskMerchantDetalLogMapper.java => RiskMerchantDetailLogMapper.java} (68%) create mode 100644 src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskDetail.java create mode 100644 src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetailLogMapper.xml create mode 100644 src/main/ui/static/risk/templates/risk_detail.html create mode 100644 src/main/ui/static/risk/templates/risk_remark.html diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetalLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetailLogMapper.java similarity index 68% rename from src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetalLogMapper.java rename to src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetailLogMapper.java index b421b0d89..4c0db3b16 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetalLogMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetailLogMapper.java @@ -1,6 +1,8 @@ package au.com.royalpay.payment.manage.mappers.risk; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; @@ -10,11 +12,13 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType; * Create by yixian at 2017-12-21 11:45 */ @AutoMapper(tablename = "risk_merchant_detail_log", pkName = "id") -public interface RiskMerchantDetalLogMapper { +public interface RiskMerchantDetailLogMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject record); @AutoSql(type = SqlType.UPDATE) void update(JSONObject record); + PageList query(JSONObject params, PageBounds pagination); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java index 1c14b9b0a..0aa2f7465 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.java @@ -18,9 +18,9 @@ public interface RiskMerchantRecordMapper { @AutoSql(type = SqlType.UPDATE) void update(JSONObject record); - PageList query(JSONObject params, PageBounds pagination); - @AutoSql(type = SqlType.SELECT) JSONObject findById(@Param("id") String id); + PageList query(JSONObject params, PageBounds pagination); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java index 8b4f44e4a..2f787efd4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/AddRiskDetailLog.java @@ -1,26 +1,40 @@ package au.com.royalpay.payment.manage.risk.bean; import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.annotation.JsonProperty; + +import org.apache.commons.lang3.StringUtils; public class AddRiskDetailLog { + @JsonProperty("record_id") private String record_id; - private int client_id; - + @JsonProperty("files") private String files; + @JsonProperty("operation") private String operation; - public JSONObject params(){ + @JsonProperty("remark") + private String remark; + + public JSONObject params() { JSONObject params = new JSONObject(); - params.put("record_id",this.record_id); - params.put("client_id",this.client_id); - params.put("files",this.files); - params.put("operation",this.operation); + params.put("record_id", this.record_id); + if (StringUtils.isNotEmpty(this.files)) { + params.put("files", this.files); + } + if (StringUtils.isNotEmpty(this.operation)) { + params.put("operation", this.operation); + } + if (StringUtils.isNotEmpty(this.remark)) { + params.put("remark", this.remark); + } return params; } + public String getRecord_id() { return record_id; } @@ -29,14 +43,6 @@ public class AddRiskDetailLog { this.record_id = record_id; } - public int getClient_id() { - return client_id; - } - - public void setClient_id(int client_id) { - this.client_id = client_id; - } - public String getFiles() { return files; } @@ -52,4 +58,12 @@ public class AddRiskDetailLog { public void setOperation(String operation) { this.operation = operation; } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskDetail.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskDetail.java new file mode 100644 index 000000000..1e4c07d57 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskDetail.java @@ -0,0 +1,70 @@ +package au.com.royalpay.payment.manage.risk.bean; + +import com.alibaba.fastjson.JSONObject; + +import org.apache.commons.lang3.time.DateUtils; + +import java.text.ParseException; + +public class QueryRiskDetail { + + private String record_id; + private String c_end_time; + private int client_id; + + private int limit = 20; + private int page; + + public JSONObject toParams() { + JSONObject params = new JSONObject(); + params.put("record_id", this.record_id); + params.put("client_id", this.client_id); + try { + if (c_end_time != null) { + params.put("c_end_time", DateUtils.parseDate(this.c_end_time, new String[] { "yyyy-MM-dd HH:mm:ss" })); + } + } catch (ParseException e) { + } + return params; + } + + public String getRecord_id() { + return record_id; + } + + public void setRecord_id(String record_id) { + this.record_id = record_id; + } + + public String getC_end_time() { + return c_end_time; + } + + public void setC_end_time(String c_end_time) { + this.c_end_time = c_end_time; + } + + public int getClient_id() { + return client_id; + } + + public void setClient_id(int client_id) { + this.client_id = client_id; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java index 415dca96b..a8a2109af 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.risk.core; import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail; import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder; import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord; @@ -17,6 +18,8 @@ public interface RiskMerchantService { void dealRiskRecord(JSONObject account,DealRiskRecord dealRiskRecord); + void dealRiskRecordDirectly(JSONObject account,String record_id); + JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder); JSONObject getRiskRecords(QueryRiskRecord queryRiskRecord); @@ -27,6 +30,8 @@ public interface RiskMerchantService { JSONObject getRecordById(String record_id); + JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java index 0c541847b..2243b8368 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java @@ -1,12 +1,13 @@ package au.com.royalpay.payment.manage.risk.core.impl; -import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantDetalLogMapper; +import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantDetailLogMapper; import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantRecordMapper; import au.com.royalpay.payment.manage.mappers.risk.RiskTransactionLogMapper; import au.com.royalpay.payment.manage.mappers.risk.RiskWhiteListMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail; import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder; import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService; @@ -31,7 +32,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { @Resource private RiskMerchantRecordMapper riskMerchantRecordMapper; @Resource - private RiskMerchantDetalLogMapper riskMerchantDetalLogMapper; + private RiskMerchantDetailLogMapper riskMerchantDetailLogMapper; @Resource private RiskTransactionLogMapper riskTransactionLogMapper; @Resource @@ -40,11 +41,23 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { private ClientManager clientManager; @Override + @Transactional public void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account) { - JSONObject record = addRiskDetailLog.params(); - record.put("auditor", account.getString("display_name")); - record.put("create_time", new Date()); - riskMerchantDetalLogMapper.save(record); + JSONObject record = riskMerchantRecordMapper.findById(addRiskDetailLog.getRecord_id()); + if (record == null) { + throw new NotFoundException("Risk Record Not Found Please Check"); + } + JSONObject detail = addRiskDetailLog.params(); + detail.put("auditor", account.getString("display_name")); + detail.put("client_id", record.getIntValue("client_id")); + detail.put("auditor_id", account.getString("manager_id")); + detail.put("create_time", new Date()); + riskMerchantDetailLogMapper.save(detail); + record.put("status", 2); + JSONObject recordUpdate = new JSONObject(); + recordUpdate.put("record_id", record.getString("record_id")); + recordUpdate.put("status", 2); + riskMerchantRecordMapper.update(recordUpdate); } @Override @@ -59,15 +72,16 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { } JSONObject record = new JSONObject(); record.put("id", recordId); - record.put("status", "2"); + record.put("status", "1"); riskMerchantRecordMapper.update(record); JSONObject detail = new JSONObject(); detail.put("record_id", recordId); detail.put("client_id", riskRecord.getIntValue("client_id")); detail.put("auditor", account.getString("display_name")); + detail.put("auditor_id", account.getString("manager_id")); detail.put("operation", "进行掉单处理"); detail.put("create_time", new Date()); - riskMerchantDetalLogMapper.save(detail); + riskMerchantDetailLogMapper.save(detail); } @Override @@ -90,7 +104,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { detail.put("auditor", account.getString("display_name")); detail.put("operation", "不做处理"); detail.put("create_time", new Date()); - riskMerchantDetalLogMapper.save(detail); + riskMerchantDetailLogMapper.save(detail); } @Override @@ -120,8 +134,31 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { detail.put("auditor", account.getString("display_name")); detail.put("operation", StringUtils.isEmpty(operation) ? null : (operation = "处理结果:" + operation)); detail.put("create_time", new Date()); - riskMerchantDetalLogMapper.save(detail); - record.put("status", 1); + riskMerchantDetailLogMapper.save(detail); + record.put("status", 2); + riskMerchantRecordMapper.update(record); + } + + @Override + public void dealRiskRecordDirectly(JSONObject account, String record_id) { + JSONObject record = riskMerchantRecordMapper.findById(record_id); + if (record == null) { + throw new NotFoundException("Risk Record Not Found Please Check"); + } + if (record.getIntValue("status") != 0) { + throw new BadRequestException("The Record Has Been Handled"); + } + JSONObject detail = new JSONObject(); + detail.put("record_id", record_id); + detail.put("client_id", record.getIntValue("client_id")); + detail.put("auditor", account.getString("display_name")); + detail.put("auditor_id", account.getString("manager_id")); + detail.put("operation", "关结"); + detail.put("create_time", new Date()); + riskMerchantDetailLogMapper.save(detail); + JSONObject recordUpdate = new JSONObject(); + recordUpdate.put("record_id",record_id); + recordUpdate.put("status", 1); riskMerchantRecordMapper.update(record); } @@ -171,4 +208,11 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { public JSONObject getRecordById(String record_id) { return riskMerchantRecordMapper.findById(record_id); } + + @Override + public JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail) { + return PageListUtils.buildPageListResult( + riskMerchantDetailLogMapper.query(queryRiskDetail.toParams(), new PageBounds(queryRiskDetail.getPage(), queryRiskDetail.getLimit()))); + + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java index b857c3090..9fd4be497 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.risk.web; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog; import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord; +import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail; import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder; import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService; @@ -49,6 +50,11 @@ public class RiskController { riskMerchantService.noopRiskRecord(manager, record_id); } + @RequestMapping(value = "/records/{record_id}/directly", method = RequestMethod.PUT) + public void directly(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) { + riskMerchantService.dealRiskRecordDirectly(manager, record_id); + } + @RequestMapping(value = "/records/{record_id}/deal",method = RequestMethod.PUT) public void dealRecord(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id, @RequestBody DealRiskRecord dealRiskRecord){ dealRiskRecord.setRecordId(record_id); @@ -60,7 +66,6 @@ public class RiskController { return riskMerchantService.getRiskOrders(queryRiskOrder); } - @RequestMapping(value = "/white/{client_moniker}", method = RequestMethod.POST) public void addWhiteList(@PathVariable String client_moniker) { riskMerchantService.addWhiteList(client_moniker); @@ -76,4 +81,14 @@ public class RiskController { riskMerchantService.addDetailLog(addRiskDetailLog,manager); } + @RequestMapping(value = "/details", method = RequestMethod.GET) + public JSONObject listDetails(QueryRiskDetail queryRiskDetail) { + return riskMerchantService.getRiskDetails(queryRiskDetail); + } + + @RequestMapping(value = "/details/remark", method = RequestMethod.POST) + public void addDetailRemark(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@RequestBody AddRiskDetailLog addRiskDetailLog ) { + riskMerchantService.addDetailLog(addRiskDetailLog,manager); + } + } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetailLogMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetailLogMapper.xml new file mode 100644 index 000000000..282f8690c --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantDetailLogMapper.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml index 67dceb727..2d8749648 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskMerchantRecordMapper.xml @@ -21,5 +21,6 @@ and client_id = #{client_id} + order by create_time desc \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml index d7f0bf1eb..b413d7bbd 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/risk/RiskTransactionLogMapper.xml @@ -15,5 +15,6 @@ and create_time < #{c_end_time} + order by create_time desc \ No newline at end of file diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js index 961565a57..c033d960e 100644 --- a/src/main/ui/static/risk/risk.js +++ b/src/main/ui/static/risk/risk.js @@ -2,8 +2,8 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS 'use strict'; var riskType = [ - {code: 1, label: 'test1'}, - {code: 2, label: 'test2'}, + {code: '1', label: 'test1'}, + {code: '2', label: 'test2'}, ]; var app = angular.module('RiskManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']); @@ -34,6 +34,17 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }); }] } + }).state('analysis_monitoring.risk_detail', { + url: '/risk/{record_id}/detail', + templateUrl: '/static/risk/templates/risk_detail.html', + controller: 'RecordDetailCtrl', + resolve:{ + record:['$http','$stateParams', function ($http,$stateParams) { + return $http.get('/sys/risk/records/'+$stateParams.record_id).then(function (res) { + return res.data; + }); + }] + } }); }]); app.controller('RiskManageCtrl', ['$scope', '$http', function ($scope, $http){ @@ -68,7 +79,6 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; $scope.loadOrders(1); - $scope.loadHistoryOrders = function (page) { var historyParams = angular.copy($scope.historyParams); historyParams.page = page || $scope.historyPagination.page || 1; @@ -125,6 +135,74 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS } }]); + app.controller('RecordDetailCtrl', ['$scope', '$http','$uibModal', 'commonDialog','record', function ($scope, $http,$uibModal,commonDialog,record) { + $scope.record = record; + $scope.pagination = {}; + $scope.params = {record_id:record.id}; + $scope.listDetail = function (page) { + var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; + $http.get('/sys/risk/details',{params:params}).then(function (res) { + $scope.details = res.data.data; + $scope.pagination = res.data.pagination; + }) + }; + $scope.listDetail(1); + + + $scope.addRemark = function () { + $uibModal.open({ + templateUrl: '/static/risk/templates/risk_remark.html', + controller: 'RiskDetailRemarkCtrl', + resolve:{record_id:function () { + return record.id; + }} + }).result.then(function () { + commonDialog.alert({ + title: 'Success', + type: 'success' + }); + }) + } + + $scope.dealDirectly = function () { + commonDialog.confirm({ + title: 'Confirm', + content: '确定关结这次预警?' + }).then(function () { + $http.put('/sys/risk/records/'+ record.id+'/directly').then(function () { + commonDialog.alert({ + title: 'Success', + type: 'Success' + }); + $scope.listDetail(1); + }).then(function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'Error' + }); + }) + }) + } + }]); + + app.controller('RiskDetailRemarkCtrl', ['$scope', '$http','record_id','commonDialog', function ($scope, $http,record_id,commonDialog) { + $scope.addRemarkParams = {record_id:record_id}; + $scope.addRemark = function () { + var params = angular.copy($scope.addRemarkParams); + $http.post('/sys/risk/details/remark',params).then(function (res) { + $scope.$close(); + }).then(function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'Error' + }); + }) + } + }]); + app.controller('RiskRecordHandleCtrl', ['$scope', '$http','record_id','commonDialog', function ($scope, $http,record_id,commonDialog) { $scope.params= {}; $scope.handle = function () { @@ -140,20 +218,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS } }]); - - app.filter('risk_type', function (typeString) { - var sArr = typeString.split(","); - var result = ""; - angular.forEach(sArr, function (s) { + app.filter('risk_type', function () { + return function (riskStr) { angular.forEach(riskType,function (type) { - if (type==s){ - result+=type; - result+=","; - } + riskStr = riskStr.replace(type.code,type.label); }) - }); - result = result.substr(0,result.length-2); - return result; + return riskStr; + }; }); + app.filter('status_type', function () { + return function (riskStr) { + var statusResult = ''; + switch (riskStr){ + case('0'): statusResult = '待处理';break; + case('1'): statusResult = '已处理';break; + case('2'): statusResult = '处理中';break; + default: statusResult = ''; + } + return statusResult; + }; + }); + return app; }); \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html index 7253a7a99..f5cd1f7da 100644 --- a/src/main/ui/static/risk/templates/risk.html +++ b/src/main/ui/static/risk/templates/risk.html @@ -14,10 +14,10 @@ Client Moniker - Create Time + Create Timer Waring Time - Risk Types Status + Risk Types Risk Counts Operation @@ -27,7 +27,7 @@ {{record.client_moniker}} {{record.create_time}} {{record.expiry_time}} - {{record.status}} + {{record.status|status_type}} {{record.risk_types|risk_type}} {{record.risk_counts}} diff --git a/src/main/ui/static/risk/templates/risk_detail.html b/src/main/ui/static/risk/templates/risk_detail.html new file mode 100644 index 000000000..03e8d87f5 --- /dev/null +++ b/src/main/ui/static/risk/templates/risk_detail.html @@ -0,0 +1,63 @@ +
    +
    +

    Risk Manager

    + +
    +
    + +
    +
    Risk Details
    +
    +
    +
    + + + + + + + + + + + + + + + + + +
    Create Timeauditoroperationremark
    {{record.create_time}}{{record.auditor}}{{record.operation}}{{record.remark}}
    + +
    +
    + +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk_edit.html b/src/main/ui/static/risk/templates/risk_edit.html index 14e2ce8c2..c6d99e4c3 100644 --- a/src/main/ui/static/risk/templates/risk_edit.html +++ b/src/main/ui/static/risk/templates/risk_edit.html @@ -19,6 +19,7 @@ Disable Merchant
    +
    diff --git a/src/main/ui/static/risk/templates/risk_history.html b/src/main/ui/static/risk/templates/risk_history.html index 87a2f2468..2959e53f9 100644 --- a/src/main/ui/static/risk/templates/risk_history.html +++ b/src/main/ui/static/risk/templates/risk_history.html @@ -9,68 +9,22 @@
    -
    Record History
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    Client MonikerCreate TimeWaring TimeRisk TypesStatusRisk CountsOperation
    {{record.client_moniker}}{{record.create_time}}{{record.expiry_time}}{{record.status}}{{record.risk_types|risk_type}}{{record.risk_counts}} - - - - - - - -
    - -
    -
    - - -
    +
    diff --git a/src/main/ui/static/risk/templates/risk_orders.html b/src/main/ui/static/risk/templates/risk_orders.html index e4399d1d2..3e07bb71f 100644 --- a/src/main/ui/static/risk/templates/risk_orders.html +++ b/src/main/ui/static/risk/templates/risk_orders.html @@ -9,12 +9,17 @@
    Reference Orders
    @@ -25,6 +30,7 @@
    + @@ -33,6 +39,7 @@ + @@ -63,6 +70,7 @@ + @@ -71,6 +79,7 @@ + diff --git a/src/main/ui/static/risk/templates/risk_remark.html b/src/main/ui/static/risk/templates/risk_remark.html new file mode 100644 index 000000000..8a994ca79 --- /dev/null +++ b/src/main/ui/static/risk/templates/risk_remark.html @@ -0,0 +1,25 @@ +
    +

    Phone Top Up

    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + +
    + +
    +
    +
    +
    +
    +
    From 942acf08babb5f7ed9ffe540da4a5838cffe3e6a Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Sat, 28 Apr 2018 16:50:21 +0800 Subject: [PATCH 08/11] update --- .../manage/risk/core/impl/RiskMerchantServiceImpl.java | 10 +++------- src/main/ui/static/risk/risk.js | 4 ++-- src/main/ui/static/risk/templates/risk_detail.html | 6 ++++-- src/main/ui/static/risk/templates/risk_edit.html | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java index 2243b8368..8d99a5afe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java @@ -53,11 +53,6 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { detail.put("auditor_id", account.getString("manager_id")); detail.put("create_time", new Date()); riskMerchantDetailLogMapper.save(detail); - record.put("status", 2); - JSONObject recordUpdate = new JSONObject(); - recordUpdate.put("record_id", record.getString("record_id")); - recordUpdate.put("status", 2); - riskMerchantRecordMapper.update(recordUpdate); } @Override @@ -140,6 +135,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { } @Override + @Transactional public void dealRiskRecordDirectly(JSONObject account, String record_id) { JSONObject record = riskMerchantRecordMapper.findById(record_id); if (record == null) { @@ -157,9 +153,9 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { detail.put("create_time", new Date()); riskMerchantDetailLogMapper.save(detail); JSONObject recordUpdate = new JSONObject(); - recordUpdate.put("record_id",record_id); + recordUpdate.put("id",record_id); recordUpdate.put("status", 1); - riskMerchantRecordMapper.update(record); + riskMerchantRecordMapper.update(recordUpdate); } @Override diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js index c033d960e..3b78fdeb6 100644 --- a/src/main/ui/static/risk/risk.js +++ b/src/main/ui/static/risk/risk.js @@ -148,8 +148,6 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }) }; $scope.listDetail(1); - - $scope.addRemark = function () { $uibModal.open({ templateUrl: '/static/risk/templates/risk_remark.html', @@ -158,6 +156,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS return record.id; }} }).result.then(function () { + $scope.listDetail(1); commonDialog.alert({ title: 'Success', type: 'success' @@ -176,6 +175,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS type: 'Success' }); $scope.listDetail(1); + $scope.record.status=1; }).then(function (resp) { commonDialog.alert({ title: 'Error', diff --git a/src/main/ui/static/risk/templates/risk_detail.html b/src/main/ui/static/risk/templates/risk_detail.html index 03e8d87f5..08ebab206 100644 --- a/src/main/ui/static/risk/templates/risk_detail.html +++ b/src/main/ui/static/risk/templates/risk_detail.html @@ -21,8 +21,10 @@
    Risk Details
    -
    -
    +
    + + +
    Order Id Amount ChannelCreate Time Risk Types
    {{order.order_id}} {{order.amount}} {{order.channel}}{{order.create_time}} {{order.risk_types|risk_type}}
    Order Id Amount ChannelCreate Time Risk Types
    {{order.order_id}} {{order.amount}} {{order.channel}}{{order.create_time}} {{order.risk_types|risk_type}}
    diff --git a/src/main/ui/static/risk/templates/risk_edit.html b/src/main/ui/static/risk/templates/risk_edit.html index c6d99e4c3..a1fa06c5d 100644 --- a/src/main/ui/static/risk/templates/risk_edit.html +++ b/src/main/ui/static/risk/templates/risk_edit.html @@ -1,5 +1,5 @@
    -

    Phone Top Up

    +

    Add Remark

    From b71cfdaa5c89eadd2f19a9f01406a98262b01475 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Sat, 28 Apr 2018 17:15:41 +0800 Subject: [PATCH 09/11] update --- .../risk/core/impl/RiskMerchantServiceImpl.java | 14 +++++++------- src/main/ui/static/risk/templates/risk.html | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java index 8d99a5afe..d62762e94 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java @@ -74,7 +74,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { detail.put("client_id", riskRecord.getIntValue("client_id")); detail.put("auditor", account.getString("display_name")); detail.put("auditor_id", account.getString("manager_id")); - detail.put("operation", "进行掉单处理"); + detail.put("remark", "进行掉单处理"); detail.put("create_time", new Date()); riskMerchantDetailLogMapper.save(detail); } @@ -97,7 +97,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { detail.put("record_id", recordId); detail.put("client_id", riskRecord.getIntValue("client_id")); detail.put("auditor", account.getString("display_name")); - detail.put("operation", "不做处理"); + detail.put("remark", "不做处理"); detail.put("create_time", new Date()); riskMerchantDetailLogMapper.save(detail); } @@ -112,22 +112,22 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { if (record.getIntValue("status") != 0) { throw new BadRequestException("The Record Has Been Handled"); } - String operation = ""; + String remark = ""; if (dealRiskRecord.getLimitAmount() != null) { clientManager.setMaxOrderAmount(record.getString("client_moniker"), dealRiskRecord.getLimitAmount()); - operation = operation + "限额" + dealRiskRecord.getLimitAmount(); + remark = remark + "限额" + dealRiskRecord.getLimitAmount(); } if (dealRiskRecord.getDisableMerchat()) { clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Wechat", false); clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Alipay", false); - operation = operation + " 关闭支付通道"; + remark = remark + " 关闭支付通道"; } JSONObject detail = new JSONObject(); detail.put("record_id", dealRiskRecord.getRecordId()); detail.put("client_id", record.getIntValue("client_id")); detail.put("auditor", account.getString("display_name")); - detail.put("operation", StringUtils.isEmpty(operation) ? null : (operation = "处理结果:" + operation)); + detail.put("remark", StringUtils.isEmpty(remark) ? null : (remark = "处理结果:" + remark)); detail.put("create_time", new Date()); riskMerchantDetailLogMapper.save(detail); record.put("status", 2); @@ -149,7 +149,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { detail.put("client_id", record.getIntValue("client_id")); detail.put("auditor", account.getString("display_name")); detail.put("auditor_id", account.getString("manager_id")); - detail.put("operation", "关结"); + detail.put("remark", "结停"); detail.put("create_time", new Date()); riskMerchantDetailLogMapper.save(detail); JSONObject recordUpdate = new JSONObject(); diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html index f5cd1f7da..ff55c8552 100644 --- a/src/main/ui/static/risk/templates/risk.html +++ b/src/main/ui/static/risk/templates/risk.html @@ -14,7 +14,7 @@
    - r + From f4ee21ae6a87f05b6a2966580df32bc6365445c1 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Sat, 28 Apr 2018 17:21:16 +0800 Subject: [PATCH 10/11] update --- src/main/ui/static/risk/templates/risk_detail.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/ui/static/risk/templates/risk_detail.html b/src/main/ui/static/risk/templates/risk_detail.html index 08ebab206..52d28fd32 100644 --- a/src/main/ui/static/risk/templates/risk_detail.html +++ b/src/main/ui/static/risk/templates/risk_detail.html @@ -31,7 +31,6 @@ - @@ -39,7 +38,6 @@ - From 393b2cea906ea4891758ff9de761a4859dd125ef Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 2 May 2018 15:42:12 +0800 Subject: [PATCH 11/11] update --- src/db/modify.sql | 67 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/src/db/modify.sql b/src/db/modify.sql index 8b4a19fcf..f61633f2e 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -370,4 +370,69 @@ CREATE TABLE `log_client_sub_merchant_id` ( `create_time` datetime NOT NULL COMMENT '创建时间', `client_id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + + + +create table risk_merchant_record( + id varchar(50) not null comment 'id', + create_time datetime not null comment '创建时间', + expiry_time datetime not null comment '过期时间', + client_id int(11) not null comment '商户id', + client_moniker varchar(20) not null comment '商户code', + status varchar(5) not null comment '记录状态 0:未处理,1已处理,2处理中', + risk_types varchar(50) not null comment '触发的风控类型 "," 号分割', + risk_counts varchar(70) null comment '对应类型触发次数 "," 号分割', + primary key(id), + key(client_id) using BTREE +); + + +create table risk_white_list( + client_id int(11) not null comment '商户id', + client_moniker varchar(20) not null comment '商户code', + create_time datetime not null comment '创建时间', + is_valid TINYINT(1) DEFAULT 1 COMMENT '是否可用', + primary key(client_id), + key(client_id) USING BTREE, + key(client_moniker) +); + + +create table risk_merchant_detail_log( + id varchar(50) not null comment 'id', + record_id varchar(50) not null comment '商户风控记录id', + create_time datetime not null comment '创建时间', + client_id int(11) not null comment '商户id', + auditor varchar(30) not null comment '操作者', + auditor_id varchar(50) not null comment '操作者id', + files varchar(500) null comment '上传附件 "," 号分割', + remark varchar(100) null comment '备注', + primary key(id), + key(client_id) using BTREE, + key(record_id) + +); + + +create table risk_transaction_log( + id varchar(50) not null comment 'id', + order_id varchar(500) not null comment '问题订单id', + record_id varchar(50) not null comment '商户风控记录id', + amount DECIMAL(10,2) not null comment '过期时间', + channel varchar(15) NULL COMMENT '订单支付通道', + client_id int(11) not null comment '商户id', + risk_types varchar(50) not null comment '触发的风控类型 ","号分割 ', + create_time datetime not null, + primary key(id), + key(order_id), + key(record_id), + key(client_id) + + + +); + +insert into `royalpay_production`.`sys_configs` ( `config_key`, `config_value`) values ( 'risk_counts', '3'); +insert into `royalpay_production`.`sys_configs` ( `config_key`, `config_value`) values ( 'risk_total_amout', '5000'); \ No newline at end of file
    Client MonikerCreate TimeCreate Time Waring Time Status Risk Types
    Create Time auditoroperation remark
    {{record.create_time}} {{record.auditor}}{{record.operation}} {{record.remark}}