diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java index 94ac8396b..52ccf932d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskBusinessService.java @@ -36,10 +36,10 @@ public interface RiskBusinessService { /** * 获取风险事件的调单信息 - * @param orderIds + * @param riskEvent * @return */ - List getRiskEventOrderList(String orderIds); + List getRiskEventOrderList(JSONObject riskEvent); /** * 新增风险事件 diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java index b64c2744a..783d94b4a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java @@ -146,15 +146,25 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo } @Override - public List getRiskEventOrderList(String orderIds) { + public List getRiskEventOrderList(JSONObject riskEvent) { + String orderIds = riskEvent.getString("order_ids"); List tradeLogs = new ArrayList<>(); if (StringUtils.isNotBlank(orderIds)) { String[] orderIdArray = orderIds.trim().split(","); - JSONObject query = new JSONObject(); + JSONObject orderInfo = new JSONObject(); + String realOrderId = ""; // 获取订单信息 - for (int i = 0; i < orderIdArray.length; i++) { - JSONObject orderInfo = orderMapper.findOrderById(orderIdArray[i]); - tradeLogs.add(orderInfo); + if (riskEvent.getIntValue("order_type") == 3) { + for (int i = 0; i < orderIdArray.length; i++) { + 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; @@ -370,7 +380,8 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo } 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) { throw new InvalidShortIdException(); } @@ -379,12 +390,20 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo codeKey = RandomStringUtils.random(20, true, true); } String codeKeyValue = RandomStringUtils.random(10, true, true); + /* String expireDay = "7"; if(event.getIntValue("order_type")>2){ expireDay = "3"; } + )*/ + // 原来设定的过期时间是7天,现在改成一个月 + String expireDay = "30"; stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS); 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 bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); List bdNames = new ArrayList<>(); List bdEmails = new ArrayList<>(); @@ -403,8 +422,10 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo 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_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(); + ctx.setVariable("hello", hello); ctx.setVariable("order_type", event.getIntValue("order_type")); ctx.setVariable("bdNamesStr", bdNamesStr); ctx.setVariable("reply_date", reply_date); @@ -413,11 +434,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo ctx.setVariable("uploadUrl", uploadUrl); ctx.setVariable("royalpay_order_type", event.getIntValue("royalpay_order_type")); ctx.setVariable("warning_order_type", event.getIntValue("warning_order_type")); + String[] orderIds = event.getString("order_ids").split(","); + List orders = new ArrayList(); switch (event.getIntValue("order_type")){ case 1: case 2: - String[] orderIds = event.getString("order_ids").split(","); - List orders = new ArrayList(); for(String orderId : orderIds){ JSONObject order = orderMapper.findOrderById(orderId); if(order==null){ @@ -430,6 +451,24 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo ctx.setVariable("emailsTos", bdEmails); break; 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 attachList = new ArrayList<>(); JSONObject file = new JSONObject(); file.put("name", client.getString("short_name")+ "被查单号相关信息.xlsx"); @@ -473,11 +512,15 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo return null; } + + private byte[] generateRiskOrders(JSONObject event) throws IOException { String[] orderIds = event.getString("order_ids").split(","); Workbook wb = new XSSFWorkbook(); + String realOrderId = ""; 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.setDefaultColumnWidth((short) 40); Row row0 = sheet.createRow(0); diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java index ba33b0ab9..b92252ec5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/web/RiskBusinessController.java @@ -48,7 +48,7 @@ public class RiskBusinessController { public JSONObject getRiskEventDetail(@PathVariable("risk_id") String riskId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { JSONObject riskEvent = riskBusinessService.getRiskEventDetail(riskId); - List tradeLogs = riskBusinessService.getRiskEventOrderList(riskEvent.getString("order_ids")); + List tradeLogs = riskBusinessService.getRiskEventOrderList(riskEvent); riskEvent.put("tradeLogs", tradeLogs); return riskEvent; } diff --git a/src/main/resources/templates/mail/risk_upload_mail.html b/src/main/resources/templates/mail/risk_upload_mail.html index 16459d5c4..38e301ca0 100644 --- a/src/main/resources/templates/mail/risk_upload_mail.html +++ b/src/main/resources/templates/mail/risk_upload_mail.html @@ -1,8 +1,14 @@
Dear : -

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

-

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

+

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

+

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

@@ -29,7 +35,7 @@
-

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

+

如果提交的材料不齐, 则有关停支付的风险。感谢,辛苦。

Submit Risk Materials

@@ -39,8 +45,8 @@

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

-

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

+

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

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

2.提供相应购物清单,订单小票(请提供与被查交易订单号相匹配的交易时间及金额的发票);
  @@ -52,7 +58,47 @@

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

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

-

请查收附件中关于被抽查的订单交易的相关信息,并在下午6:00 (悉尼时间)前将所需材料直接回复该邮件,未能按时提交完整证明材料,支付渠道将被关停,请您务必配合调查。感谢。
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PartnerOrder IDPlatform Transaction IDOrder DescriptionCustomer IDIPTotal AmountInput AmountPay AmountExchange RateClearing AmountGatewayCreate TimeStatusPay Time
+

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

diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index d4f1c0def..2ecd9b4f9 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -223,7 +223,48 @@
- +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PartnerOrder IDPlatform Transaction IDOrder DescriptionCustomer IDIPTotal AmountInput AmountPay AmountExchange RateClearing AmountGatewayCreate TimeStatusPaytime
{{trade.client.short_name}}({{trade.client.client_moniker}}){{trade.order_id}}{{trade.system_transaction_id}}{{trade.order_description}}{{trade.customer_id}}{{trade.customer_ip}}{{trade.currency}} {{trade.total_amount}}{{trade.currency}} {{trade.display_amount}}{{trade.currency}} {{trade.customer_payment_amount}}{{trade.exchange_rate}}AUD {{trade.clearing_amount}}{{trade.gateway | tradeGateway}}{{trade.create_time}}{{trade.status | tradeStatus}}{{trade.transaction_time}}
+ diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html b/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html index beac21adc..f524f866c 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail_bd.html @@ -31,9 +31,9 @@
Order ID - - + + -