Merge branch 'develop_risk' of E:\globalPay\manage_develop_9009\royalpay.manage with conflicts.

master
hellolujian 8 years ago
parent 1eb2811503
commit 336ba5070b

@ -1,10 +1,14 @@
package au.com.royalpay.payment.manage.mappers.riskbusiness;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.apache.catalina.LifecycleState;
import java.util.List;
@AutoMapper(tablename = "risk_material", pkName = "material_id")
public interface RiskMaterialMapper {
@ -12,4 +16,7 @@ public interface RiskMaterialMapper {
void save(JSONObject material);
JSONObject findOperatorById(@Param("risk_id") String risk_id);
List<JSONObject> getRiskMaterial(JSONObject param);
}

@ -1,8 +1,13 @@
package au.com.royalpay.payment.manage.riskbusiness.bean;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* @Author lvjian
* @Date 2018/10/10 11:27
@ -24,9 +29,18 @@ public class RiskEventQuery {
// 邮件发送状态
private Integer emailStatus;
// 行业
private String industry;
// 处理结果
private Integer resultType;
// 收到调单邮件日期
private String receiveEmailDate;
// 邮件回复截止日期
private String replyEmailDate;
public Integer getOrderType() {
return orderType;
}
@ -59,6 +73,46 @@ public class RiskEventQuery {
this.orderIds = orderIds;
}
public Integer getEmailStatus() {
return emailStatus;
}
public void setEmailStatus(Integer emailStatus) {
this.emailStatus = emailStatus;
}
public String getIndustry() {
return industry;
}
public void setIndustry(String industry) {
this.industry = industry;
}
public Integer getResultType() {
return resultType;
}
public void setResultType(Integer resultType) {
this.resultType = resultType;
}
public String getReceiveEmailDate() {
return receiveEmailDate;
}
public void setReceiveEmailDate(String receiveEmailDate) {
this.receiveEmailDate = receiveEmailDate;
}
public String getReplyEmailDate() {
return replyEmailDate;
}
public void setReplyEmailDate(String replyEmailDate) {
this.replyEmailDate = replyEmailDate;
}
public JSONObject toJSON() {
JSONObject params = new JSONObject();
@ -76,6 +130,7 @@ public class RiskEventQuery {
}
if (StringUtils.isNotBlank(orderIds)) {
orderIds = orderIds.trim().replace("", ",");
params.put("order_ids", orderIds);
}
@ -87,6 +142,18 @@ public class RiskEventQuery {
params.put("result_type", resultType);
}
if (StringUtils.isNotBlank(industry)) {
params.put("industry", industry);
}
if (receiveEmailDate != null) {
params.put("receive_email_date", receiveEmailDate);
}
if (replyEmailDate != null) {
params.put("reply_email_date", replyEmailDate);
}
return params;
}
}

@ -71,4 +71,11 @@ public interface RiskBusinessService {
*/
void sendRefuseEmail(String riskId) throws IOException;
/**
*
* @param param
* @return
*/
JSONObject getRiskMaterial(JSONObject param);
}

@ -4,11 +4,13 @@ import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper;
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskOrderTypeEnum;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
@ -73,6 +75,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
private RoyalThreadPoolExecutor royalThreadPoolExecutor;
private final String UPLOAD_MAIL_PREFIX = "UPLOAD_MAIL";
@Autowired
private RiskMaterialMapper riskMaterialMapper;
@Override
public List<JSONObject> getRiskEvents(JSONObject params) {
return riskEventMapper.findAll(params);
@ -87,31 +92,34 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
@Override
public JSONObject getRiskEventDetail(String riskId) {
JSONObject riskEventDetail = riskEventMapper.findById(riskId);
// 获取商户信息
JSONObject client = null;
String clientMoniker = riskEventDetail.getString("client_moniker");
JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
} else {
riskEventDetail.put("clientInfo", client);
if (clientMoniker != null) {
client = clientMapper.findClientByMonikerAll(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
}
riskEventDetail.put("clientInfo", client);
return riskEventDetail;
}
@Override
public List<JSONObject> getRiskEventOrderList(String orderIds) {
String[] orderIdArray = orderIds.trim().split(",");
JSONObject query = new JSONObject();
List<JSONObject> tradeLogs = new ArrayList<>();
// 获取每笔订单的信息
for (int i = 0; i < orderIdArray.length; i++) {
query.put("order_id", orderIdArray[i]);
PageList<JSONObject> logs = orderMapper.listOrders(query, new PageBounds());
if (logs != null && logs.size() != 0) {
tradeLogs.add(logs.get(0));
if (StringUtils.isNotBlank(orderIds)) {
String[] orderIdArray = orderIds.trim().split(",");
JSONObject query = new JSONObject();
// 获取每笔订单的信息
for (int i = 0; i < orderIdArray.length; i++) {
query.put("order_id", orderIdArray[i]);
PageList<JSONObject> logs = orderMapper.listOrders(query, new PageBounds());
if (logs != null && logs.size() != 0) {
tradeLogs.add(logs.get(0));
}
}
}
return tradeLogs;
@ -119,12 +127,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
@Override
public void addRiskEvent(JSONObject params) {
JSONObject client = clientMapper.findClientByMoniker(params.getString("client_moniker"));
if(client == null){
throw new InvalidShortIdException();
}
if(client.containsKey("sub_merchant_id")){
params.put("sub_merchant_id",client.getString("sub_merchant_id"));
// 通用号调单不需要填写client_moniker
JSONObject client = null;
String clientMoniker = params.getString("client_moniker");
if (clientMoniker != null) {
client = clientMapper.findClientByMoniker(clientMoniker);
if(client == null){
throw new InvalidShortIdException();
}
}
riskEventMapper.save(params);
}
@ -139,23 +149,29 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
JSONObject riskEvent = riskEventMapper.findById(riskId);
String clientMoniker = riskEvent.getString("client_moniker");
JSONObject param = new JSONObject();
param.put("risk_id", riskId);
param.put("orderby_type", "update_time");
JSONObject riskMaterial = getRiskMaterial(param);
try {
String downloadFilename = clientMoniker + "_audit_materials_" + DateFormatUtils.format(new Date(), "dd/MM/yyyy HH:mm:ss").toString() + ".zip";// 文件的名称
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename);
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
String filePath = "https://file.royalpay.com.au/open/2018/09/20/1537438083143_tqIYPEDYPr40Y9Cyj4Ps1xgSRrDrVb.jpg";
zos.putNextEntry(new ZipEntry(filePath.substring(filePath.lastIndexOf("/"))));
InputStream inputStream = new URL(filePath).openConnection().getInputStream();
byte[] buffer = new byte[1024];
int result = 0;
while ((result = inputStream.read(buffer)) != -1) {
zos.write(buffer, 0, result);
String filePath = null;
for (int i = 1; i <= 10; i++) {
filePath = riskMaterial.getString("file" + i + "_url");
if (filePath != null) {
zos.putNextEntry(new ZipEntry(filePath.substring(filePath.lastIndexOf("/"))));
InputStream inputStream = new URL(filePath).openConnection().getInputStream();
byte[] buffer = new byte[1024];
int result = 0;
while ((result = inputStream.read(buffer)) != -1) {
zos.write(buffer, 0, result);
}
inputStream.close();
}
}
inputStream.close();
zos.flush();
zos.close();
zos.flush();
zos.close();
} catch (IOException e) {
@ -284,6 +300,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
return UPLOAD_MAIL_PREFIX + codeKey;
}
@Override
public JSONObject getRiskMaterial(JSONObject param) {
List<JSONObject> riskMaterialList = riskMaterialMapper.getRiskMaterial(param);
if (riskMaterialList != null && riskMaterialList.size() > 0)
return riskMaterialList.get(0);
return null;
}
private byte[] generateRiskOrders(JSONObject event) throws IOException {
String[] orderIds = event.getString("order_ids").split(",");
Workbook wb = new XSSFWorkbook();

@ -0,0 +1,27 @@
package au.com.royalpay.payment.manage.riskbusiness.enums;
/**
* @Author lvjian
* @Date 2018/10/16 20:18
*/
public enum RiskOrderTypeEnum {
WECHAT_ORDER(1),
ALIPAY_ORDER(2),
ROYALPAY_ORDER(3),
WARNING_ORDER(4),
ALREADY_HANDLED(5);
private Integer orderType;
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
RiskOrderTypeEnum(Integer orderType) {
this.orderType = orderType;
}
}

@ -0,0 +1,29 @@
package au.com.royalpay.payment.manage.riskbusiness.enums;
/**
* @Author lvjian
* @Date 2018/10/16 20:40
*/
public enum RiskResultTypeEnum {
NOT_HANDLED(0),
SEND_EMAIL_TO_BD(1),
WAIT_FOR_AUDIT(2),
MATERIAL_AUDIT_PASS(3),
MATERIAL_NOT_PASS(4),
ALREADY_HANDLED(5);
private Integer orderType;
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
RiskResultTypeEnum(Integer orderType) {
this.orderType = orderType;
}
}

@ -1,11 +1,15 @@
package au.com.royalpay.payment.manage.riskbusiness.web;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.riskbusiness.bean.RiskEventQuery;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.xerces.internal.impl.dv.xs.BooleanDV;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -23,13 +27,15 @@ import java.util.List;
* @Date 2018/10/10 1:12
*/
@RestController
//@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
@RequestMapping(value = "/risk/business/")
@ManagerMapping(value = "/risk/business/", role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public class RiskBusinessController {
@Autowired
private RiskBusinessService riskBusinessService;
@Autowired
private ClientManager clientManager;
@GetMapping(value = "events")
public JSONObject getRiskEvents(RiskEventQuery riskEventQuery) {
JSONObject params = riskEventQuery.toJSON();
@ -50,6 +56,11 @@ public class RiskBusinessController {
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
params.put("fillin_id", manager.getString("manager_id"));
params.put("fillin_person", manager.getString("display_name"));
String orderIds = params.getString("order_ids");
if (StringUtils.isNotBlank(orderIds)) {
orderIds = orderIds.trim().replace("", ",");
params.put("order_ids", orderIds);
}
riskBusinessService.addRiskEvent(params);
}
@ -74,6 +85,34 @@ public class RiskBusinessController {
riskBusinessService.sendRefuseEmail(risk_id);
}
@GetMapping(value = "/{risk_id}/material")
public JSONObject getRiskMaterial(@PathVariable("risk_id") String riskId) {
JSONObject param = new JSONObject();
param.put("risk_id", riskId);
param.put("orderby_type", "update_time");
return riskBusinessService.getRiskMaterial(param);
}
@PutMapping(value = "/channel/{channel}/permission/{channelFlag}")
public void updateMerchantChannel(@RequestBody JSONObject params,
@PathVariable("channelFlag") Boolean channelFlag,
@PathVariable("channel") String channel,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchChannelPermission(manager, params.getString("client_moniker"), channel, channelFlag);
riskBusinessService.updateRiskEvent(params);
}
@PutMapping(value = "/partner/{isValid}")
public void updateMerchantValid(@RequestBody JSONObject params,
@PathVariable("isValid") Boolean isValid,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
String clientMoniker = params.getString("client_moniker");
if (isValid)
clientManager.disableClient(clientMoniker, manager);
else
clientManager.revertClient(clientMoniker, manager);
riskBusinessService.updateRiskEvent(params);
}
}

@ -1,6 +1,6 @@
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schema-name=royalpay_production
spring.datasource.host=192.168.0.49:3306
spring.datasource.host=192.168.0.111:3306
spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root

@ -2,18 +2,62 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper">
<select id="listRisksByPage" resultType="com.alibaba.fastjson.JSONObject">
SELECT *
from risk_event
SELECT
re.risk_id,
re.client_moniker,
re.order_ids,
re.order_type,
re.royalpay_order_type,
re.warning_order_type,
re.description,
re.email_status,
re.receive_email_date,
re.reply_email_date,
re.fillin_person,
re.fillin_id,
re.result_type,
re.channel_result,
re.temporary_close_channel,
re.temporary_close_merchant,
re.in_merchant_blacklist,
re.in_user_blacklist,
re.processed_remark,
re.create_time,
sc.industry,
sc.short_name,
IFNULL(sc.sub_merchant_id, re.sub_merchant_id) sub_merchant_id
FROM risk_event re
LEFT JOIN sys_clients sc
ON re.client_moniker = sc.client_moniker
<where>
<if test="risk_id != null">
AND re.risk_id = #{risk_id}
</if>
<if test="client_moniker != null">
AND client_moniker = #{client_moniker}
AND re.client_moniker = #{client_moniker}
</if>
<if test="order_type != null">
AND order_type = #{order_type}
AND re.order_type = #{order_type}
</if>
<if test="result_type != null">
AND re.result_type = #{result_type}
</if>
<if test="order_ids != null">
AND order_ids LIKE CONCAT('%', #{order_ids}, '%')
AND re.order_ids LIKE CONCAT('%', #{order_ids}, '%')
</if>
<if test="sub_merchant_id != null">
AND sc.sub_merchant_id = #{sub_merchant_id}
</if>
<if test="industry != null">
AND sc.industry = #{industry}
</if>
<if test="receive_email_date != null">
AND re.receive_email_date = #{receive_email_date}
</if>
<if test="reply_email_date != null">
AND re.reply_email_date = #{reply_email_date}
</if>
</where>
</select>
</mapper>

@ -11,4 +11,36 @@
WHERE r.risk_id = #{risk_id}
LIMIT 1
</select>
</mapper>
<resultMap id="materialResultMap" type="com.alibaba.fastjson.JSONObject">
<id column="material_id" property="material_id"/>
<result column="risk_id" property="risk_id"/>
<result column="description" property="description"/>
<result column="file1_url" property="file1_url"/>
<result column="file2_url" property="file2_url"/>
<result column="file3_url" property="file3_url"/>
<result column="file4_url" property="file4_url"/>
<result column="file5_url" property="file5_url"/>
<result column="file6_url" property="file6_url"/>
<result column="file7_url" property="file7_url"/>
<result column="file8_url" property="file8_url"/>
<result column="file9_url" property="file9_url"/>
<result column="file10_url" property="file10_url"/>
<result column="update_time" property="update_time"/>
</resultMap>
<select id="getRiskMaterial" resultMap="materialResultMap">
SELECT *
from risk_material
<where>
<if test="material_id != null">
AND material_id = #{material_id}
</if>
<if test="risk_id != null">
AND risk_id = #{risk_id}
</if>
</where>
<if test="orderby_type != null">
ORDER BY ${orderby_type} DESC
</if>
</select>
</mapper>

@ -23,7 +23,7 @@
<a ui-sref="analysis_monitoring.risk_manager"><i class="fa fa-tv"></i> <span>风控记录|Risk Records</span></a>
</li>
<li ui-sref-active-eq="active" ng-if="('riskBusiness'|withModule)&&(currentUser.org_id==null)&&(currentUser.display_name == 'lujian' || currentUser.display_name == 'zhh')">
<li ui-sref-active-eq="active" ng-if="('riskBusiness'|withModule)&&(currentUser.org_id==null)">
<a ui-sref="analysis_monitoring.risk_business"><i class="fa fa-tv"></i> <span>风控业务</span></a>
</li>

@ -18,7 +18,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"2": "BD已提交材料等待审核",
"3": "材料审核通过",
"4": "材料审核不通过,已打回",
"5": "已处理",
"5": "已处理",
};
var emailStatusMap = {
@ -55,15 +55,19 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}]);
app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog',
function ($scope, $state, $http, $uibModal, commonDialog) {
app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', 'industryMap',
function ($scope, $state, $http, $uibModal, $filter, commonDialog, industryMap) {
$scope.orderTypes = orderTypesMap;
$scope.resultTypes = resultTypesMap;
$scope.industries = industryMap.configs();
$scope.pagination = {};
$scope.params = {};
$scope.loadRiskEvents = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
params.replyEmailDate = $filter('date')(params.replyEmailDate, 'yyyy-MM-dd');
params.receiveEmailDate = $filter('date')(params.receiveEmailDate, 'yyyy-MM-dd');
$http.get('/risk/business/events', {params: params}).then(function (resp) {
$scope.riskEvents = resp.data.data;
$scope.pagination = resp.data.pagination;
@ -80,7 +84,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope.orderTypes = orderTypesMap;
$scope.riskEvent = riskEvent.data;
var orderChannel = 'enable_';
if ($scope.riskEvent.order_type == 1) {
orderChannel += 'wechat';
} else if ($scope.riskEvent.order_type == 2) {
orderChannel += 'alipay';
} else {
orderChannel = null;
}
// 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图
$scope.riskEventEdit = angular.copy(riskEvent.data);
@ -92,6 +103,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 商户信息
$scope.clientInfo = $scope.riskEvent.clientInfo;
if (orderChannel != null)
$scope.enableChannel = $scope.clientInfo[orderChannel];
// 控制编辑表格的显示
$scope.editFlag = false;
@ -100,8 +113,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 如果是在编辑状态需要将日期转换为date类型前端控件需要
// 如果是在非编辑状态需要将日期转换为yyyy-MM-dd格式
if ($scope.editFlag) {
$scope.riskEventEdit.receive_email_date = new Date($scope.riskEventEdit.receive_email_date.replace(/-/g, "/"));
$scope.riskEventEdit.reply_email_date = new Date($scope.riskEventEdit.reply_email_date.replace(/-/g, "/"));
} else {
$scope.riskEvent.receive_email_date = $filter('date')($scope.riskEvent.receive_email_date, 'yyyy-MM-dd');
$scope.riskEvent.reply_email_date = $filter('date')($scope.riskEvent.reply_email_date, 'yyyy-MM-dd');
}
};
@ -118,6 +133,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 保存时需要重新将日期转换为yyyy-MM-dd格式传入后端
$scope.riskEventEdit.reply_email_date = $filter('date')($scope.riskEventEdit.reply_email_date, 'yyyy-MM-dd');
$scope.riskEventEdit.receive_email_date = $filter('date')($scope.riskEventEdit.receive_email_date, 'yyyy-MM-dd');
$http.put('/risk/business/events', $scope.riskEventEdit).then(function (resp) {
commonDialog.alert({
title: 'Success',
@ -134,14 +150,40 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
});
};
// 关停渠道
$scope.updateChannel = function (orderType) {
/**
* 关停渠道
* @param orderType 调单类型
* @param channelFlag
* @param temporaryFlag 是否临时关闭
$scope.updateChannel = function (orderType, channelFlag, temporaryFlag) {
var channel;
if (orderType == "1")
channel = 'wechat';
else if (orderType == "2")
channel = 'alipay';
$http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/channels/' + channel + '/permission', {allow: channelFlag}).then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({
title: 'Failed to change ' + channel + ' channel permission status',
content: resp.data.message,
type: 'error'
})
});
};*/
$scope.updateChannel = function (orderType, channelFlag, temporaryFlag) {
var channel;
if (orderType == "1")
channel = 'wechat';
else if (orderType == "2")
channel = 'alipay';
$http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/channels/' + channel + '/permission', {allow: $scope.clientInfo['enable_' + channel]}).then(function () {
$scope.riskEvent.temporary_close_channel = temporaryFlag;
$http.put('/risk/business/channel/' + channel + '/permission/' + channelFlag, $scope.riskEvent).then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({
@ -153,20 +195,13 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
};
// 关停商户
$scope.updateClient = function(isValid) {
if (isValid) {
$http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/revert').then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
} else {
$http.delete('/sys/partners/' + $scope.riskEvent.client_moniker).then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}
$scope.updateClient = function(isValid, temporaryFlag) {
$scope.riskEvent.temporary_close_merchant = temporaryFlag;
$http.put('/risk/business/partner/' + isValid, $scope.riskEvent).then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
@ -191,16 +226,62 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
app.controller('auditMaterialCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog',
function ($scope, $state, $http, $uibModal, $filter, commonDialog) {
// 一键下载功能
$scope.downloadAsZip = function () {
var url = '/risk/business/' + $scope.riskEvent.risk_id + '/download/materialsAsZIP';
return url;
};
// 加载提交材料
$scope.fileObject = {};
$scope.loadRiskMaterial = function() {
$http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) {
var riskMaterial = resp.data;
for (var i = 1; i <= 10; i++) {
var key = "file" + i;
if (riskMaterial[key + '_url'] != null)
$scope.fileObject[key] = riskMaterial[key + '_url'];
}
$scope.fileLength = Object.keys($scope.fileObject).length;
})
};
$scope.loadRiskMaterial();
// 材料审核
$scope.auditMaterial = function(auditType) {
$scope.riskEvent.result_type = auditType;
// 后面把url当做参数传递进去删除重复的代码
if (auditType == 3) {
$http.put('/risk/business/events', $scope.riskEvent).then(function (resp) {
$state.go('^', {}, {reload: true});
}, function (resp) {
commonDialog.alert({
title: 'Error',
content: resp.data.message,
type: 'error'
});
});
} else if (auditType == 4) {
$http.put('/risk/business/' + $scope.riskEvent.risk_id + '/refuse').then(function(resp) {
$state.go('^', {}, {reload: true});
}, function (resp) {
commonDialog.alert({
title: 'Error',
content: resp.data.message,
type: 'error'
});
});
}
}
}
]);
app.controller('newRiskEventCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog',
function ($scope, $state, $http, $uibModal, $filter, commonDialog) {
$scope.today = new Date();
$scope.orderTypes = orderTypesMap;
$scope.save = function(form) {
@ -213,11 +294,15 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
return;
}
// 默认设置邮件回复截止日期为七天后
var replyDeadline = new Date();
if ($scope.riskEvent.receive_email_date == null)
$scope.riskEvent.receive_email_date = new Date();
// 默认设置邮件回复截止日期为收到邮件的七天后
var replyDeadline = angular.copy($scope.riskEvent.receive_email_date);
replyDeadline.setDate(replyDeadline.getDate() + 7);
$scope.riskEvent.reply_email_date = $filter('date')(replyDeadline, 'yyyy-MM-dd');
$scope.riskEvent.receive_email_date = $filter('date')($scope.riskEvent.receive_email_date, 'yyyy-MM-dd');
$http.post('/risk/business/events', $scope.riskEvent).then(function (resp) {
commonDialog.alert({
title: 'Success',

@ -1,35 +1,31 @@
<div class="panel panel-default">
<div class="panel panel-default" ng-if="fileLength != 0">
<div class="panel-heading">Audit Files &nbsp;&nbsp;&nbsp;
<!--后面需要加上ng-if="file"-->
<a class="btn-group btn btn-success" ng-href="{{downloadAsZip()}}" target="_blank">
<a class="btn-group btn btn-success"
ng-href="{{downloadAsZip()}}"
target="_blank">
<i class="fa fa-cloud-download">一键下载</i>
</a>
<a class="btn-group btn btn-success pull-right"
ng-if="riskEvent.result_type == 2 || riskEvent.result_type == 4"
ng-click="auditMaterial(3)">通过
</a>
<a class="btn-group btn btn-warning pull-right"
ng-if="riskEvent.result_type == 2 || riskEvent.result_type == 4"
ng-click="auditMaterial(4)" style="margin: 0 10px">打回
</a>
</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2">* bank statement</label>
<div class="form-vertical">
<div class="form-group" ng-repeat="(key, value) in fileObject">
<label class="control-label col-sm-2">{{key}}</label>
<div class="col-sm-4">
<div class="form-control-static">
<uib-progressbar value="bankFileProgress.value" ng-if="bankFileProgress"></uib-progressbar>
<a ng-if="bankIsImage" target="_blank" ng-href="{{file.client_bank_file}}">
<img ng-src="{{file.client_bank_file}}" class="col-sm-8"></a>
</div>
<div class="col-sm-6">
<div class="form-control-static">
<p>Example请保证图片信息清晰可见,如下图</p>
<img class="col-sm-6" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/03/07/1488859920633_5ruVtDa30yY2ytBSDAAqxg0Ob2nreh.jpeg">
<a ng-if="value" target="_blank" ng-href="{{value}}">
<img ng-src="{{value}}" class="col-sm-8"></a>
</div>
</div>
</div>
</div>
</div>
<div style="text-align: center">
<a role="button" style="margin-bottom: 25px;" class="btn btn-success btn-sm ng-scope" ng-if="('10'|withRole)" ng-click="complianceCheck()">check</a>
</div>
</div>
<!--<div class="margin-bottom margin-top">-->
<!--<button class="btn-group btn btn-success" type="button" ng-click="updateFile()">Save-->
<!--</button>-->
<!--</div>-->
</div>

@ -11,6 +11,29 @@
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group"
ng-class="{'has-error':riskEventForm.order_type.$invalid && riskEventForm.order_type.$dirty}">
<label class="control-label col-sm-2"
for="order-type-input">Order Type
</label>
<div class="col-sm-8">
<select class="form-control"
name="order_type"
ng-model="riskEvent.order_type"
id="order-type-input"
required
ng-options="key as value for (key, value) in orderTypes">
<option value="">Please Choose</option>
</select>
<div ng-messages="riskEventForm.order_type.$error"
ng-if="riskEventForm.order_type.$dirty">
<p class="small text-danger"
ng-message="required">required field
</p>
</div>
</div>
</div>
<div class="form-group"
ng-if="riskEvent.order_type != 5"
ng-class="{'has-error':riskEventForm.client_moniker.$invalid && riskEventForm.client_moniker.$dirty}">
<label class="control-label col-sm-2"
for="short-id-input">* Partner Code
@ -41,21 +64,19 @@
</div>
<div class="form-group"
ng-class="{'has-error':riskEventForm.order_type.$invalid && riskEventForm.order_type.$dirty}">
ng-if="riskEvent.order_type != 4"
ng-class="{'has-error':riskEventForm.order_ids.$invalid && riskEventForm.order_ids.$dirty}">
<label class="control-label col-sm-2"
for="order-type-input">Order Type
</label>
for="order-ids-input">Order IDs</label>
<div class="col-sm-8">
<select class="form-control"
name="order_type"
ng-model="riskEvent.order_type"
id="order-type-input"
required
ng-options="key as value for (key, value) in orderTypes">
<option value="">Please Choose</option>
</select>
<div ng-messages="riskEventForm.order_type.$error"
ng-if="riskEventForm.order_type.$dirty">
<input class="form-control"
ng-model="riskEvent.order_ids"
type="text"
name="order_ids"
id="order-ids-input"
required>
<div ng-messages="riskEventForm.order_ids.$error"
ng-if="riskEventForm.order_ids.$dirty">
<p class="small text-danger"
ng-message="required">required field
</p>
@ -64,18 +85,19 @@
</div>
<div class="form-group"
ng-class="{'has-error':riskEventForm.order_ids.$invalid && riskEventForm.order_ids.$dirty}">
ng-if="riskEvent.order_type == 5"
ng-class="{'has-error':riskEventForm.sub_merchant_id.$invalid && riskEventForm.sub_merchant_id.$dirty}">
<label class="control-label col-sm-2"
for="order-ids-input">Order IDs</label>
for="sub-merchant-id-input">Sub Merchant ID</label>
<div class="col-sm-8">
<input class="form-control"
ng-model="riskEvent.order_ids"
ng-model="riskEvent.sub_merchant_id"
type="text"
name="order_ids"
id="order-ids-input"
name="sub_merchant_id"
id="sub-merchant-id-input"
required>
<div ng-messages="riskEventForm.order_ids.$error"
ng-if="riskEventForm.order_ids.$dirty">
ng-if="riskEventForm.sub_merchant_id.$dirty">
<p class="small text-danger"
ng-message="required">required field
</p>
@ -83,6 +105,24 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="receive-date-input">Receive Date
</label>
<div class="col-xs-2">
<input class="form-control"
id="receive-date-input"
type="text"
ng-model="riskEvent.receive_email_date"
uib-datepicker-popup
size="10"
placeholder="Receive Email Date"
datepicker-options="{maxDate:today}"
is-open="ReceiveDate.open"
ng-click="ReceiveDate.open=true">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="description-input">Description

@ -31,7 +31,7 @@
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group">
<div class="form-group" ng-if="riskEvent.client_moniker != null">
<label class="control-label col-sm-2">Partner Code</label>
<div class="col-sm-10">
<p class="form-control-static"
@ -39,7 +39,23 @@
</div>
</div>
<div class="form-group">
<div class="form-group" ng-if="clientInfo.short_name != null">
<label class="control-label col-sm-2">Short Name</label>
<div class="col-sm-10">
<p class="form-control-static"
ng-bind="clientInfo.short_name"></p>
</div>
</div>
<div class="form-group" ng-if="riskEvent.order_type == 1 || riskEvent.order_type == 5">
<label class="control-label col-sm-2">Sub Merchant ID</label>
<div class="col-sm-10">
<p class="form-control-static"
ng-bind="riskEvent.sub_merchant_id"></p>
</div>
</div>
<div class="form-group" ng-if="riskEvent.order_ids != null">
<label class="control-label col-sm-2">Order IDs</label>
<div class="col-sm-10">
<p class="form-control-static"
@ -74,6 +90,15 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Receive Date</label>
<div class="col-sm-10">
<p class="form-control-static">
{{riskEvent.receive_email_date | limitTo:10}}
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Reply Deadline</label>
<div class="col-sm-10">
@ -92,23 +117,95 @@
</div>
</div>
<!--
<div class="form-group">
<label class="control-label col-sm-2">临时关闭渠道</label>
<div class="col-xs-6">
<input type="checkbox"
ng-if="riskEvent.order_type == '1'"
ng-model="clientInfo.enable_wechat"
bs-switch ng-change="updateChannel(riskEvent.order_type)">
bs-switch ng-change="updateChannel(riskEvent.order_type, true)">
<input type="checkbox"
ng-if="riskEvent.order_type == '2'"
ng-model="clientInfo.enable_alipay"
bs-switch ng-change="updateChannel(riskEvent.order_type)">
bs-switch ng-change="updateChannel(riskEvent.order_type, true)">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">临时关闭商户</label>
<div class="col-xs-6">
<input type="checkbox" ng-model="clientInfo.is_valid" bs-switch ng-change="updateClient(clientInfo.is_valid)">
<input type="checkbox"
ng-model="clientInfo.is_valid"
bs-switch ng-change="updateClient(clientInfo.is_valid)">
</div>
</div>
-->
<div ng-if="clientInfo != null">
<div class="form-group" ng-if="riskEvent.result_type <= 2">
<label class="control-label col-sm-2">Operaction</label>
<div class="col-xs-2">
<button class="btn btn-info"
type="button"
ng-click="updateChannel(riskEvent.order_type, false, true)">临时关闭渠道
</button>
</div>
<div class="col-xs-2">
<button class="btn btn-info"
type="button"
ng-click="updateClient(false)">临时关闭商户
</button>
</div>
</div>
<div ng-if="riskEvent.result_type > 2">
<div class="form-group">
<label class="control-label col-sm-2">加入商户黑名单</label>
<div class="col-xs-6">
<input type="checkbox" bs-switch ng-model="clientInfo.is_valid" ng-change="updateClient(clientInfo.is_valid)">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">加入用户黑名单</label>
<div class="col-xs-6">
<input type="checkbox"
ng-model="clientInfo.is_valid"
bs-switch
ng-change="updateClient(clientInfo.is_valid)">
</div>
</div>
</div>
<div class="form-group" ng-if="riskEvent.result_type > 2">
<label class="control-label col-sm-2">Handle Result</label>
<div class="col-xs-2" ng-if="riskEvent.temporary_close_channel != 1 && enableChannel == 1">
<button class="btn btn-info"
type="button"
ng-click="updateChannel(riskEvent.order_type, false, true)">关停渠道
</button>
</div>
<div class="col-xs-2" ng-if="riskEvent.temporary_close_merchant != 1 && clientInfo.is_valid == 1">
<button class="btn btn-info"
type="button"
ng-click="updateClient(true)">关停商户
</button>
</div>
<div class="col-xs-2">
<button class="btn btn-info"
ng-if="enableChannel == 0"
type="button"
ng-click="updateChannel(riskEvent.order_type, true, false)">重新启用渠道
</button>
</div>
<div class="col-xs-2" ng-if="clientInfo.is_valid == 0">
<button class="btn btn-info"
type="button"
ng-click="updateClient(false, false)">重新启用商户
</button>
</div>
</div>
</div>
</div>
@ -160,13 +257,24 @@
</div>
<a role="button"
class="btn btn-info" ng-click="resendUploadEmail()">Send Email
ng-if="riskEvent.order_type == 1 || riskEvent.order_type == 2"
class="btn btn-info"
ng-click="resendUploadEmail()">Send Email {{riskEvent.result_type == 1 ? 'again' : ''}}
</a>
<a role="button"
ng-if="riskEvent.order_type == 4 && riskEvent.result_type == 0"
class="btn btn-info"
ng-click="resendUploadEmail()">Send Warning Email
</a>
</div>
</div>
</div>
</div>
<!--编辑表单-->
<form novalidate name="riskEventForm" ng-if="editFlag">
<div class="row">
<div class="col-sm-12">
@ -175,6 +283,7 @@
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group"
ng-if="riskEventEdit.order_type != 5"
ng-class="{'has-error':riskEventForm.client_moniker.$invalid && riskEventForm.client_moniker.$dirty}">
<label class="control-label col-sm-2"
for="short-id-input">* Partner Code
@ -229,6 +338,7 @@
</div>
<div class="form-group"
ng-if="riskEventEdit.order_type != 4"
ng-class="{'has-error':riskEventForm.order_ids.$invalid && riskEventForm.order_ids.$dirty}">
<label class="control-label col-sm-2"
for="order-ids-input">Order IDs
@ -249,6 +359,48 @@
</div>
</div>
<div class="form-group"
ng-if="riskEventEdit.order_type == 5"
ng-class="{'has-error':riskEventForm.sub_merchant_id.$invalid && riskEventForm.sub_merchant_id.$dirty}">
<label class="control-label col-sm-2"
for="order-ids-input">Sub Merchant ID
</label>
<div class="col-sm-8">
<input class="form-control"
ng-model="riskEventEdit.sub_merchant_id"
type="text"
name="sub_merchant_id"
id="sub-merchant-id-input"
required>
<div ng-messages="riskEventForm.sub_merchant_id.$error"
ng-if="riskEventForm.sub_merchant_id.$dirty">
<p class="small text-danger"
ng-message="required">required field
</p>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="receive-email-input">Receive Date
</label>
<div class="col-sm-8">
<div style="display: inline-block">
<input class="form-control"
id="receive-email-input"
type="text"
ng-model="riskEventEdit.receive_email_date"
uib-datepicker-popup
size="10"
placeholder="Receive Date"
is-open="receiveDate.open"
ng-click="receiveDate.open=true"
datepicker-options="{maxDate:today}">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="reply-deadline-input">Reply Deadline
@ -263,8 +415,7 @@
size="10"
placeholder="Reply Deadline"
is-open="replyDeadline.open"
ng-click="replyDeadline.open=true"
datepicker-options="{minDate:today}">
ng-click="replyDeadline.open=true">
</div>
</div>
</div>
@ -281,6 +432,19 @@
id="description-input">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="channel-result-input">渠道处理结果
</label>
<div class="col-sm-8">
<input class="form-control"
ng-model="riskEventEdit.channel_result"
type="text"
name="description"
id="channel-result-input">
</div>
</div>
</div>
</div>
</div>

@ -4,7 +4,9 @@
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<!--
<div class="form-inline">
<div class="form-group">
<label class="control-label"
for="partner-code-search">Partner Code
@ -39,20 +41,159 @@
id="order-ids-input">
</div>
<div class="form-group">
</div>
-->
<div class="form-horizontal">
<!--Partner Code-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="partner-code-search">Partner Code
</label>
<div class="col-xs-6">
<input type="text"
class="form-control"
id="partner-code-search"
ng-model="params.clientMoniker">
</div>
</div>
<!--Sub Merchant ID-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="sub-merchant-id-search">Sub Merchant ID
</label>
<div class="col-xs-6">
<input type="text"
class="form-control"
id="sub-merchant-id-search"
ng-model="params.subMerchantId">
</div>
</div>
<!--Order Type-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="order-type-input">Order Type
</label>
<div class="col-xs-6">
<select class="form-control"
name="order_type"
ng-model="params.orderType"
id="order-type-input"
ng-options="key as value for (key, value) in orderTypes">
<option value="">ALL</option>
</select>
</div>
</div>
<!--Order IDs-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="order-ids-input">Order IDs
</label>
<div class="col-xs-6">
<input class="form-control"
ng-model="params.orderIds"
type="text"
name="order_ids"
id="order-ids-input">
</div>
</div>
<!--Result Type-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="order-type-input">Result Type
</label>
<div class="col-xs-6">
<select class="form-control"
name="result_type"
ng-model="params.resultType"
id="result-type-input"
ng-options="key as value for (key, value) in resultTypes">
<option value="">ALL</option>
</select>
</div>
</div>
<!--Industry-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="industry-select">Industry</label>
<div class="col-xs-6">
<select ng-model="params.industry"
id="industry-select"
class="form-control"
ng-options="industry.value as industry.label for industry in industries">
<option value="">All</option>
</select>
</div>
</div>
<!--Receive Email Date-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="receive-date-input">Receive Date
</label>
<div class="col-xs-6">
<input class="form-control"
id="receive-date-input"
type="text"
ng-model="params.receiveEmailDate"
uib-datepicker-popup
size="10"
placeholder="Receive Email Date"
datepicker-options="{maxDate:today}"
is-open="ReceiveDate.open"
ng-click="ReceiveDate.open=true">
</div>
</div>
<!--Reply Email Deadline-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="reply-deadline-input">Reply Deadline
</label>
<div class="col-xs-6">
<input class="form-control"
id="reply-deadline-input"
type="text"
ng-model="params.replyEmailDate"
uib-datepicker-popup
size="10"
placeholder="Reply Email Deadline"
is-open="ReplyDeadline.open"
ng-click="ReplyDeadline.open=true">
</div>
</div>
<!--支付金额,待定-->
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="payment-select">payment</label>
<div class="col-xs-6">
<select ng-model="params.payment"
id="payment-select"
class="form-control">
<option value="">All</option>
</select>
</div>
</div>
<div class="col-xs-12">
<button class="btn btn-primary"
type="button"
ng-click="loadRiskEvents(1)">
<i class="fa fa-search"></i>
search<i class="fa fa-search"></i>
</button>
<a role="button"
class="btn btn-info"
ui-sref=".new_riskEvent"
title="New Event">
<i class="fa fa-plus"></i>New Event
</a>
</div>
<a role="button"
class="btn btn-info pull-right"
ui-sref=".new_riskEvent"
title="New Event">
<i class="fa fa-plus"></i>New Event
</a>
</div>
</div>
</div>
@ -81,7 +222,21 @@
<tr ng-repeat="riskEvent in riskEvents">
<td ng-bind="riskEvent.client_moniker"></td>
<td ng-bind="riskEvent.order_type | orderType"></td>
<td ng-bind="riskEvent.result_type | resultType"></td>
<td>
<span ng-if="riskEvent.result_type != 5">
{{riskEvent.result_type | resultType}}(
<span ng-if="riskEvent.temporary_close_merchant == 1">临时关停商户 </span>
<span ng-if="riskEvent.temporary_close_channel == 1">临时关停渠道 </span>
)
</span>
<span ng-if="riskEvent.result_type == 5">
{{riskEvent.result_type | resultType}}(
<span ng-if="riskEvent.in_merchant_blacklist == 1">加入商户黑名单 </span>
<span ng-if="riskEvent.in_user_blacklist == 1">加入用户黑名单 </span>
)
</span>
</td>
<td ng-bind="riskEvent.sub_merchant_id"></td>
<td ng-bind="riskEvent.email_status | emailStatus"></td>
<td ng-bind="riskEvent.fillin_person"></td>

Loading…
Cancel
Save