[fix]风控最后一次上传,回家

master
lujian 6 years ago
parent e84593be88
commit 36ac260230

@ -36,10 +36,10 @@ public interface RiskBusinessService {
/** /**
* *
* @param orderIds * @param riskEvent
* @return * @return
*/ */
List<JSONObject> getRiskEventOrderList(String orderIds); List<JSONObject> getRiskEventOrderList(JSONObject riskEvent);
/** /**
* *

@ -146,15 +146,25 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
} }
@Override @Override
public List<JSONObject> getRiskEventOrderList(String orderIds) { public List<JSONObject> getRiskEventOrderList(JSONObject riskEvent) {
String orderIds = riskEvent.getString("order_ids");
List<JSONObject> tradeLogs = new ArrayList<>(); List<JSONObject> tradeLogs = new ArrayList<>();
if (StringUtils.isNotBlank(orderIds)) { if (StringUtils.isNotBlank(orderIds)) {
String[] orderIdArray = orderIds.trim().split(","); String[] orderIdArray = orderIds.trim().split(",");
JSONObject query = new JSONObject(); JSONObject orderInfo = new JSONObject();
String realOrderId = "";
// 获取订单信息 // 获取订单信息
for (int i = 0; i < orderIdArray.length; i++) { if (riskEvent.getIntValue("order_type") == 3) {
JSONObject orderInfo = orderMapper.findOrderById(orderIdArray[i]); for (int i = 0; i < orderIdArray.length; i++) {
tradeLogs.add(orderInfo); realOrderId = orderMapper.findOrderById(orderIdArray[i]).getString("order_id");
orderInfo = tradeLogService.getOrderDetail(new JSONObject(), riskEvent.getString("client_moniker"), realOrderId, null);
tradeLogs.add(orderInfo);
}
} else {
for (int i = 0; i < orderIdArray.length; i++) {
orderInfo = orderMapper.findOrderById(orderIdArray[i]);
tradeLogs.add(orderInfo);
}
} }
} }
return tradeLogs; return tradeLogs;
@ -370,7 +380,8 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
} }
private Context getMailContext(JSONObject event) throws IOException { private Context getMailContext(JSONObject event) throws IOException {
JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker")); String clientMoniker = event.getString("client_moniker");
JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
@ -379,12 +390,20 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
codeKey = RandomStringUtils.random(20, true, true); codeKey = RandomStringUtils.random(20, true, true);
} }
String codeKeyValue = RandomStringUtils.random(10, true, true); String codeKeyValue = RandomStringUtils.random(10, true, true);
/*
String expireDay = "7"; String expireDay = "7";
if(event.getIntValue("order_type")>2){ if(event.getIntValue("order_type")>2){
expireDay = "3"; expireDay = "3";
} }
)*/
// 原来设定的过期时间是7天现在改成一个月
String expireDay = "30";
stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS); stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS);
String uploadUrl = PlatformEnvironment.getEnv().concatUrl("/risk/upload/") + event.getString("risk_id") + "/" + codeKey; String uploadUrl = PlatformEnvironment.getEnv().concatUrl("/risk/upload/") + event.getString("risk_id") + "/" + codeKey;
int orderType = event.getIntValue("order_type");
if (orderType == 1 || orderType == 2)
uploadUrl = PlatformEnvironment.getEnv().concatUrl("/manage.html#/analysis/monitoring/") + event.getString("risk_id") + "/bd/detail";
//uploadUrl = "localhost:9009" + "/manage.html#/analysis/monitoring/" + event.getString("risk_id") + "/bd/detail";
List<JSONObject> bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); List<JSONObject> bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date());
List<String> bdNames = new ArrayList<>(); List<String> bdNames = new ArrayList<>();
List<String> bdEmails = new ArrayList<>(); List<String> bdEmails = new ArrayList<>();
@ -403,8 +422,10 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
String bdNamesStr = bdNames.isEmpty() ? "" : StringUtils.join(bdNames, ","); String bdNamesStr = bdNames.isEmpty() ? "" : StringUtils.join(bdNames, ",");
String reply_date = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy年MM月dd日"); String reply_date = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy年MM月dd日");
String reply_date_english = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"dd/MM/yyyy"); String reply_date_english = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"dd/MM/yyyy");
GregorianCalendar gregorianCalendar = new GregorianCalendar();
String hello = gregorianCalendar.get(GregorianCalendar.AM_PM) == 0 ? "上午好" : "下午好";
Context ctx = new Context(); Context ctx = new Context();
ctx.setVariable("hello", hello);
ctx.setVariable("order_type", event.getIntValue("order_type")); ctx.setVariable("order_type", event.getIntValue("order_type"));
ctx.setVariable("bdNamesStr", bdNamesStr); ctx.setVariable("bdNamesStr", bdNamesStr);
ctx.setVariable("reply_date", reply_date); ctx.setVariable("reply_date", reply_date);
@ -413,11 +434,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
ctx.setVariable("uploadUrl", uploadUrl); ctx.setVariable("uploadUrl", uploadUrl);
ctx.setVariable("royalpay_order_type", event.getIntValue("royalpay_order_type")); ctx.setVariable("royalpay_order_type", event.getIntValue("royalpay_order_type"));
ctx.setVariable("warning_order_type", event.getIntValue("warning_order_type")); ctx.setVariable("warning_order_type", event.getIntValue("warning_order_type"));
String[] orderIds = event.getString("order_ids").split(",");
List<JSONObject> orders = new ArrayList();
switch (event.getIntValue("order_type")){ switch (event.getIntValue("order_type")){
case 1: case 1:
case 2: case 2:
String[] orderIds = event.getString("order_ids").split(",");
List<JSONObject> orders = new ArrayList();
for(String orderId : orderIds){ for(String orderId : orderIds){
JSONObject order = orderMapper.findOrderById(orderId); JSONObject order = orderMapper.findOrderById(orderId);
if(order==null){ if(order==null){
@ -430,6 +451,24 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
ctx.setVariable("emailsTos", bdEmails); ctx.setVariable("emailsTos", bdEmails);
break; break;
case 3: case 3:
String realOrderId = "";
for(String orderId : orderIds){
realOrderId = orderMapper.findOrderById(orderId).getString("order_id");
JSONObject order = tradeLogService.getOrderDetail(new JSONObject(), clientMoniker, realOrderId, null);
if(order==null){
throw new BadRequestException("Order: "+orderId+" not exists");
}
order.put("order_description", StringUtils.defaultString(order.getString("order_description")));
order.put("gateway", getGateWay(order.getIntValue("gateway")));
order.put("status", getStatus(order.getIntValue("status")));
order.put("order_detail", StringUtils.defaultString(order.getString("order_detail")));
order.put("total_amount", order.getString("currency") + " " + order.getString("total_amount"));
order.put("display_amount", order.getString("currency") + " " + order.getString("display_amount"));
order.put("customer_payment_amount", order.getString("currency") + " " + order.getString("customer_payment_amount"));
order.put("clearing_amount", "AUD "+ order.getString("clearing_amount"));
orders.add(order);
}
ctx.setVariable("orders", orders);
List<JSONObject> attachList = new ArrayList<>(); List<JSONObject> attachList = new ArrayList<>();
JSONObject file = new JSONObject(); JSONObject file = new JSONObject();
file.put("name", client.getString("short_name")+ "被查单号相关信息.xlsx"); file.put("name", client.getString("short_name")+ "被查单号相关信息.xlsx");
@ -473,11 +512,15 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
return null; return null;
} }
private byte[] generateRiskOrders(JSONObject event) throws IOException { private byte[] generateRiskOrders(JSONObject event) throws IOException {
String[] orderIds = event.getString("order_ids").split(","); String[] orderIds = event.getString("order_ids").split(",");
Workbook wb = new XSSFWorkbook(); Workbook wb = new XSSFWorkbook();
String realOrderId = "";
for(String orderId : orderIds){ for(String orderId : orderIds){
JSONObject orderDetail = tradeLogService.getOrderDetail(new JSONObject(), event.getString("client_moniker"), orderId, null); realOrderId = orderMapper.findOrderById(orderId).getString("order_id");
JSONObject orderDetail = tradeLogService.getOrderDetail(new JSONObject(), event.getString("client_moniker"), realOrderId, null);
Sheet sheet = wb.createSheet(orderId); Sheet sheet = wb.createSheet(orderId);
sheet.setDefaultColumnWidth((short) 40); sheet.setDefaultColumnWidth((short) 40);
Row row0 = sheet.createRow(0); Row row0 = sheet.createRow(0);

@ -48,7 +48,7 @@ public class RiskBusinessController {
public JSONObject getRiskEventDetail(@PathVariable("risk_id") String riskId, public JSONObject getRiskEventDetail(@PathVariable("risk_id") String riskId,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject riskEvent = riskBusinessService.getRiskEventDetail(riskId); JSONObject riskEvent = riskBusinessService.getRiskEventDetail(riskId);
List<JSONObject> tradeLogs = riskBusinessService.getRiskEventOrderList(riskEvent.getString("order_ids")); List<JSONObject> tradeLogs = riskBusinessService.getRiskEventOrderList(riskEvent);
riskEvent.put("tradeLogs", tradeLogs); riskEvent.put("tradeLogs", tradeLogs);
return riskEvent; return riskEvent;
} }

@ -1,8 +1,14 @@
<html xmlns:th="http://www.thymeleaf.org" lang="zh"> <html xmlns:th="http://www.thymeleaf.org" lang="zh">
<div th:if="${order_type==1||order_type==2}"> <div th:if="${order_type==1||order_type==2}">
<b>Dear <span th:text="${bdNamesStr}"></span> :</b> <b>Dear <span th:text="${bdNamesStr}"></span> :</b>
<p>您好<span th:if="${refuse}">,您提交的风控材料已被拒绝</span>。请于<span th:text="${reply_date}"></span>下午6:00悉尼时间前提供被查商户<span th:text="${client.short_name}"></span> (<span th:text="${client.client_moniker}"></span>)的以下材料</p> <p>
<p>请提供以下被查单号的小票, 物流单据(如有邮寄产品的情况), 以及消费者与买家的聊天记录等来佐证被查交易单号。 被查交易单号如下:</p> <span th:text="${hello}"></span><span th:text="${bdNamesStr}"></span>
<span th:if="${refuse}">,您提交的风控材料已被拒绝</span>。 请于
<span th:text="${reply_date}" style="background: #FCE824;"></span>
<span style="background: #FCE824;">下午5:00悉尼时间</span>提供腾讯被查商户
<span th:text="${client.short_name}"></span> (<span th:text="${client.client_moniker}"></span>)的以下材料:
</p>
<p>1、请提供以下被查单号的小票 物流单据(如有邮寄产品的情况), 以及消费者与买家的聊天记录等来佐证被查交易单号。 被查交易单号如下:</p>
<table style="border: 1.0px solid;border-collapse: collapse;"> <table style="border: 1.0px solid;border-collapse: collapse;">
<thead> <thead>
<tr> <tr>
@ -29,7 +35,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>如果提交的材料不齐, 则有关停支付的风险。还请按时提供商户材料并直接回复该邮件, 感谢,辛苦。</p> <p>如果提交的材料不齐, 则有关停支付的风险。<!--还请按时提供商户材料并直接回复该邮件, -->感谢,辛苦。</p>
<!--<p>请点击此链接上传所需材料<a th:href="${uploadUrl}"><span th:text="${uploadUrl}"></span></a></p>--> <!--<p>请点击此链接上传所需材料<a th:href="${uploadUrl}"><span th:text="${uploadUrl}"></span></a></p>-->
<p><a th:href="${uploadUrl}" style="color: rgb(255, 255, 255); text-align: center; padding: 12px 10px; height: 100%; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; text-decoration: none; background-color: #00c0ef; min-width: 150px;"><strong>Submit Risk Materials</strong></a></p> <p><a th:href="${uploadUrl}" style="color: rgb(255, 255, 255); text-align: center; padding: 12px 10px; height: 100%; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; text-decoration: none; background-color: #00c0ef; min-width: 150px;"><strong>Submit Risk Materials</strong></a></p>
</div> </div>
@ -39,8 +45,8 @@
<p th:if="${refuse}" style="background-color: #dd0000">您提交的风控材料已被拒绝。<br> <p th:if="${refuse}" style="background-color: #dd0000">您提交的风控材料已被拒绝。<br>
The risk materials you submitted has been rejected The risk materials you submitted has been rejected
</p> </p>
<p>近期由于我们的风控系统检测到您的交易异常<span th:if="${royalpay_order_type==1}" style="background: #FCE824">已暂时将您的清算周期调整为T+<span th:text="${client.clean_days}"></span></span>,还请您提供以下材料,还原附件中列明的交易的真实背景:<br> <p>近期由于我们的风控系统检测到您的交易异常<span th:if="${royalpay_order_type==1}">已暂时将您的清算周期调整为T+<span th:text="${client.clean_days}"></span></span>,还请您提供以下材料,还原附件中列明的交易的真实背景:<br>
RoyalPay's risk management system recently has identified abnormal transactions from your records<span th:if="${royalpay_order_type==1}" style="background: #FCE824">, clean days has been adjusted to T+<span th:text="${client.clean_days}"></span></span>.so please provide us with following materials to assist in verifying the real scenario of the transactions attached:</p> RoyalPay's risk management system recently has identified abnormal transactions from your records<span th:if="${royalpay_order_type==1}">, clean days has been adjusted to T+<span th:text="${client.clean_days}"></span></span>.so please provide us with following materials to assist in verifying the real scenario of the transactions attached:</p>
<p>1.请解释相应的消费场景/业务模式,例如网站商城,扫码支付, 消费者到店支付等;<br> <p>1.请解释相应的消费场景/业务模式,例如网站商城,扫码支付, 消费者到店支付等;<br>
&nbsp;&nbsp;Please explain the relative payment scenario/business activities, for example, online store, QR code payment, payment at the store, etc;</p> &nbsp;&nbsp;Please explain the relative payment scenario/business activities, for example, online store, QR code payment, payment at the store, etc;</p>
<p>2.提供相应购物清单,订单小票(请提供与被查交易订单号相匹配的交易时间及金额的发票);<br>  <p>2.提供相应购物清单,订单小票(请提供与被查交易订单号相匹配的交易时间及金额的发票);<br> 
@ -52,7 +58,47 @@
<p>5.其他可以还原交易背景的资料,如和消费者的聊天记录等,来佐证被查单号交易的真实性;<br> <p>5.其他可以还原交易背景的资料,如和消费者的聊天记录等,来佐证被查单号交易的真实性;<br>
&nbsp;&nbsp;Other materials that can verify the payment scenario, for example, chatting history, to prove the truth of the transactions;</p> &nbsp;&nbsp;Other materials that can verify the payment scenario, for example, chatting history, to prove the truth of the transactions;</p>
<p>注:以上证件需原件扫描件/数码拍摄件,且照片内容需真实有效,不得做任何修改。 </p> <p>注:以上证件需原件扫描件/数码拍摄件,且照片内容需真实有效,不得做任何修改。 </p>
<p>请查收附件中关于被抽查的订单交易的相关信息,并在<span style="background: #FCE824"><span th:text="${reply_date}"></span>下午600 (悉尼时间)前</span>将所需材料直接回复该邮件,未能按时提交完整证明材料,支付渠道将被关停,请您务必配合调查。感谢。<br> <table style="border: 1.0px solid;border-collapse: collapse;">
<thead>
<tr>
<th style="border: 1.0px solid;border-collapse: collapse;">Partner</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Order ID</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Platform Transaction ID</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Order Description</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Customer ID</th>
<th style="border: 1.0px solid;border-collapse: collapse;">IP</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Total Amount</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Input Amount</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Pay Amount</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Exchange Rate</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Clearing Amount</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Gateway</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Create Time</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Status</th>
<th style="border: 1.0px solid;border-collapse: collapse;">Pay Time</th>
</tr>
</thead>
<tbody>
<tr th:each="order : ${orders}">
<td th:text="${order.client.short_name} + (${order.client.client_moniker})" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.order_id}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.system_transaction_id}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.order_description}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.customer_id}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.customer_ip}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.total_amount}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.display_amount}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.customer_payment_amount}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.exchange_rate}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.clearing_amount}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.gateway}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.create_time}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.status}" style="border: 1.0px solid;border-collapse: collapse;"></td>
<td th:text="${order.transaction_time}" style="border: 1.0px solid;border-collapse: collapse;"></td>
</tr>
</tbody>
</table>
<p>请查收关于被抽查的订单交易的相关信息,并在<span style="background: #FCE824"><span th:text="${reply_date}"></span>下午600 (悉尼时间)前</span>将所需材料直接回复该邮件,未能按时提交完整证明材料,支付渠道将被关停,请您务必配合调查。感谢。<br>
Please find sampled transactions in attachment, and reply required materials to this email <span style="background: #FCE824">before 6:00 pm <span th:text="${reply_date_english}"></span> (AEST).</span> If you can not provide qualified materials on time, the payment channels would be suspended or restricted with amount limit. Please be sure to assist the investigation. Thanks.</p> Please find sampled transactions in attachment, and reply required materials to this email <span style="background: #FCE824">before 6:00 pm <span th:text="${reply_date_english}"></span> (AEST).</span> If you can not provide qualified materials on time, the payment channels would be suspended or restricted with amount limit. Please be sure to assist the investigation. Thanks.</p>
<!--<p>请点击此链接上传所需材料。<a th:href="${uploadUrl}"><span th:text="${uploadUrl}"></span></a><br>--> <!--<p>请点击此链接上传所需材料。<a th:href="${uploadUrl}"><span th:text="${uploadUrl}"></span></a><br>-->
<!--Please click on this link to upload the required materials.<a th:href="${uploadUrl}"><span th:text="${uploadUrl}"></span></a>--> <!--Please click on this link to upload the required materials.<a th:href="${uploadUrl}"><span th:text="${uploadUrl}"></span></a>-->

@ -223,7 +223,48 @@
</div> </div>
<div class="box-body table-responsive"> <div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped" ng-if="riskEvent.order_type == 3">
<thead>
<tr>
<th>Partner</th>
<th>Order ID</th>
<th>Platform Transaction ID</th>
<th>Order Description</th>
<th>Customer ID</th>
<th>IP</th>
<th>Total Amount</th>
<th>Input Amount</th>
<th>Pay Amount</th>
<th>Exchange Rate</th>
<th>Clearing Amount</th>
<th>Gateway</th>
<th>Create Time</th>
<th>Status</th>
<th>Paytime</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="trade in tradeLogs">
<td>{{trade.client.short_name}}({{trade.client.client_moniker}})</td>
<td>{{trade.order_id}}</td>
<td>{{trade.system_transaction_id}}</td>
<td>{{trade.order_description}}</td>
<td>{{trade.customer_id}}</td>
<td>{{trade.customer_ip}}</td>
<td>{{trade.currency}} {{trade.total_amount}}</td>
<td>{{trade.currency}} {{trade.display_amount}}</td>
<td>{{trade.currency}} {{trade.customer_payment_amount}}</td>
<td>{{trade.exchange_rate}}</td>
<td>AUD {{trade.clearing_amount}}</td>
<td>{{trade.gateway | tradeGateway}}</td>
<td>{{trade.create_time}}</td>
<td>{{trade.status | tradeStatus}}</td>
<td>{{trade.transaction_time}}</td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-hover table-striped" ng-if="riskEvent.order_type != 3">
<thead> <thead>
<tr> <tr>
<th>Order ID</th> <th>Order ID</th>

@ -31,9 +31,9 @@
<td ng-bind="trade.display_amount | currency: trade.currency"></td> <td ng-bind="trade.display_amount | currency: trade.currency"></td>
<td ng-bind="trade.clearing_amount | currency: 'AUD'"></td> <td ng-bind="trade.clearing_amount | currency: 'AUD'"></td>
<td> <td>
<span ng-if="(trade.channel != 'hf') && (trade.channel != 'Rpay')" <span ng-if="(trade.channel != 'hf') && (trade.channel != 'Rpay')"
ng-bind="trade.exchange_rate"> ng-bind="trade.exchange_rate">
</span> </span>
<span ng-if="(trade.channel == 'hf') || (trade.channel == 'Rpay')"> - </span> <span ng-if="(trade.channel == 'hf') || (trade.channel == 'Rpay')"> - </span>
</td> </td>
<td ng-bind="trade.status"></td> <td ng-bind="trade.status"></td>

Loading…
Cancel
Save