master
hellolujian 6 years ago
parent d0532b21da
commit f99a5a6ff5

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.riskbusiness.core;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -50,4 +51,10 @@ public interface RiskBusinessService {
* @param params
*/
void updateRiskEvent(JSONObject params);
/**
* zip
* @param riskId
*/
void downloadAuditMaterialZiP(String riskId, HttpServletResponse response);
}

@ -1,18 +1,28 @@
package au.com.royalpay.payment.manage.riskbusiness.core.impl;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskEventMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* @Author lvjian
@ -27,6 +37,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
@Autowired
private OrderMapper orderMapper;
@Autowired
private ClientMapper clientMapper;
@Override
public List<JSONObject> getRiskEvents(JSONObject params) {
return riskEventMapper.findAll(params);
@ -41,7 +54,18 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
@Override
public JSONObject getRiskEventDetail(String riskId) {
return riskEventMapper.findById(riskId);
JSONObject riskEventDetail = riskEventMapper.findById(riskId);
// 获取商户信息
String clientMoniker = riskEventDetail.getString("client_moniker");
JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
} else {
riskEventDetail.put("clientInfo", client);
}
return riskEventDetail;
}
@Override
@ -70,4 +94,33 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
public void updateRiskEvent(JSONObject params) {
riskEventMapper.update(params);
}
@Override
public void downloadAuditMaterialZiP(String riskId, HttpServletResponse response) {
JSONObject riskEvent = riskEventMapper.findById(riskId);
String clientMoniker = riskEvent.getString("client_moniker");
try {
String downloadFilename = clientMoniker + "_audit_materials_" + DateFormatUtils.format(new Date(), "dd/MM/yyyy HH:mm:ss").toString() + ".zip";// 文件的名称
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename);
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
String filePath = "https://file.royalpay.com.au/open/2018/09/20/1537438083143_tqIYPEDYPr40Y9Cyj4Ps1xgSRrDrVb.jpg";
zos.putNextEntry(new ZipEntry(filePath.substring(filePath.lastIndexOf("/"))));
InputStream inputStream = new URL(filePath).openConnection().getInputStream();
byte[] buffer = new byte[1024];
int result = 0;
while ((result = inputStream.read(buffer)) != -1) {
zos.write(buffer, 0, result);
}
inputStream.close();
zos.flush();
zos.close();
zos.flush();
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -49,5 +50,10 @@ public class RiskBusinessController {
public void UpdateRiskEvent(@RequestBody JSONObject params) {
riskBusinessService.updateRiskEvent(params);
}
@GetMapping(value = "/{risk_id}/download/materialsAsZIP")
public void downloadComplianceZip(@PathVariable("risk_id") String riskId, HttpServletResponse response) throws Exception {
riskBusinessService.downloadAuditMaterialZiP(riskId, response);
}
}

@ -14,8 +14,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
var resultTypesMap = {
"0": "未处理",
"1": "处理中",
"2": "已处理"
"1": "已发送邮件至BD",
"2": "BD已提交材料等待审核",
"3": "材料审核通过",
"4": "材料审核不通过,已打回",
"5": "已处理()",
};
var emailStatusMap = {
@ -43,6 +46,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
url: '/new_riskEvent',
templateUrl: '/static/analysis/templates/new_riskEvent.html',
controller: 'newRiskEventCtrl'
}).state('analysis_monitoring.riskEvent_detail.audit_material', {
url: '/audit_material',
templateUrl: '/static/analysis/templates/audit_material.html',
controller: 'auditMaterialCtrl'
});
}]);
@ -69,6 +76,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
app.controller('riskEventDetailCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', 'riskEvent',
function ($scope, $state, $http, $uibModal, $filter, commonDialog, riskEvent) {
$scope.orderTypes = orderTypesMap;
$scope.riskEvent = riskEvent.data;
// 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图
@ -79,7 +88,9 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 调单信息
$scope.tradeLogs = $scope.riskEvent.tradeLogs;
$scope.orderTypes = orderTypesMap;
// 商户信息
$scope.clientInfo = $scope.riskEvent.clientInfo;
// 控制编辑表格的显示
$scope.editFlag = false;
@ -121,6 +132,56 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
});
});
};
// 关停渠道
$scope.updateChannel = function (orderType) {
var channel;
if (orderType == "1")
channel = 'wechat';
else if (orderType == "2")
channel = 'alipay';
$http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/channels/' + channel + '/permission', {allow: $scope.clientInfo['enable_' + channel]}).then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({
title: 'Failed to change ' + channel + ' channel permission status',
content: resp.data.message,
type: 'error'
})
});
};
// 关停商户
$scope.updateClient = function(isValid) {
if (isValid) {
$http.put('/sys/partners/' + $scope.riskEvent.client_moniker + '/revert').then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
} else {
$http.delete('/sys/partners/' + $scope.riskEvent.client_moniker).then(function () {
$state.reload('analysis_monitoring.riskEvent_detail');
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}
};
// 获取riskEvent详细信息
$scope.loadRiskEventDetail = function(riskId) {
$http.get('/risk/business/events/' + riskId)
}
}
]);
app.controller('auditMaterialCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog',
function ($scope, $state, $http, $uibModal, $filter, commonDialog) {
$scope.downloadAsZip = function () {
var url = '/risk/business/' + $scope.riskEvent.risk_id + '/download/materialsAsZIP';
return url;
};
}
]);

@ -0,0 +1,35 @@
<div class="panel panel-default">
<div class="panel-heading">Audit Files &nbsp;&nbsp;&nbsp;
<!--后面需要加上ng-if="file"-->
<a class="btn-group btn btn-success" ng-href="{{downloadAsZip()}}" target="_blank">
<i class="fa fa-cloud-download">一键下载</i>
</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="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">
</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>-->

@ -1,8 +1,20 @@
<div ui-view>
<div class="content">
<!--
<section class="content-header">
<h1>Risk Event</h1>
</section>
<div class="content">
</section>-->
<div class="row">
<div class="col-sm-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li ui-sref-active-eq="active">
<a ui-sref="analysis_monitoring.riskEvent_detail">Risk Detail</a>
</li>
<li ui-sref-active="active">
<a ui-sref=".audit_material">Audit material</a>
</li>
</ul>
<div class="tab-content" ui-view>
<div class="row" ng-if="!editFlag">
<div class="col-sm-12">
<div class="nav-tabs-custom">
@ -79,6 +91,26 @@
</p>
</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)">
<input type="checkbox"
ng-if="riskEvent.order_type == '2'"
ng-model="clientInfo.enable_alipay"
bs-switch ng-change="updateChannel(riskEvent.order_type)">
</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>
</div>
@ -269,3 +301,6 @@
</form>
</div>
</div>
</div>
</div>
</div>
Loading…
Cancel
Save