|
|
@ -12,7 +12,6 @@ import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
|
|
|
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
|
|
|
|
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
|
|
|
|
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
|
|
|
|
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
|
|
|
@ -148,6 +147,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<JSONObject> getRiskEventOrderList(JSONObject riskEvent) {
|
|
|
|
public List<JSONObject> getRiskEventOrderList(JSONObject riskEvent) {
|
|
|
|
String orderIds = riskEvent.getString("order_ids");
|
|
|
|
String orderIds = riskEvent.getString("order_ids");
|
|
|
|
|
|
|
|
JSONObject client = clientMapper.findClientByMonikerAll(riskEvent.getString("client_moniker"));
|
|
|
|
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(",");
|
|
|
@ -156,13 +156,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
// 获取订单信息
|
|
|
|
// 获取订单信息
|
|
|
|
if (riskEvent.getIntValue("order_type") == 3) {
|
|
|
|
if (riskEvent.getIntValue("order_type") == 3) {
|
|
|
|
for (int i = 0; i < orderIdArray.length; i++) {
|
|
|
|
for (int i = 0; i < orderIdArray.length; i++) {
|
|
|
|
realOrderId = orderMapper.findOrderById(orderIdArray[i]).getString("order_id");
|
|
|
|
realOrderId = orderMapper.findOrderById(orderIdArray[i],client.getIntValue("client_id")).getString("order_id");
|
|
|
|
orderInfo = tradeLogService.getOrderDetail(new JSONObject(), riskEvent.getString("client_moniker"), realOrderId, null);
|
|
|
|
orderInfo = tradeLogService.getOrderDetail(new JSONObject(), riskEvent.getString("client_moniker"), realOrderId, null);
|
|
|
|
tradeLogs.add(orderInfo);
|
|
|
|
tradeLogs.add(orderInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
for (int i = 0; i < orderIdArray.length; i++) {
|
|
|
|
for (int i = 0; i < orderIdArray.length; i++) {
|
|
|
|
orderInfo = orderMapper.findOrderById(orderIdArray[i]);
|
|
|
|
orderInfo = orderMapper.findOrderById(orderIdArray[i],client.getIntValue("client_id"));
|
|
|
|
tradeLogs.add(orderInfo);
|
|
|
|
tradeLogs.add(orderInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -193,7 +193,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
String[] orderIdArray = orderIds.split(",");
|
|
|
|
String[] orderIdArray = orderIds.split(",");
|
|
|
|
List<String> orderAmountList = new ArrayList<>();
|
|
|
|
List<String> orderAmountList = new ArrayList<>();
|
|
|
|
for (int i = 0; i < orderIdArray.length; i++) {
|
|
|
|
for (int i = 0; i < orderIdArray.length; i++) {
|
|
|
|
JSONObject orderInfo = orderMapper.findOrderById(orderIdArray[i]);
|
|
|
|
JSONObject orderInfo = orderMapper.findOrderById(orderIdArray[i],client.getIntValue("client_id"));
|
|
|
|
// 判断该笔订单是否存在,是否属于该商户
|
|
|
|
// 判断该笔订单是否存在,是否属于该商户
|
|
|
|
if (orderInfo == null)
|
|
|
|
if (orderInfo == null)
|
|
|
|
throw new OrderNotExistsException();
|
|
|
|
throw new OrderNotExistsException();
|
|
|
@ -262,7 +262,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
royalThreadPoolExecutor.execute(() -> {
|
|
|
|
royalThreadPoolExecutor.execute(() -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String emailId = mailService.sendRiskEmail(title, emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
|
|
|
|
String emailId = mailService.sendRiskEmail(title, emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
|
|
|
|
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List<JSONObject>)ctx.getVariable("files"):null,event.getIntValue("order_type"));
|
|
|
|
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), "",content, null,event.getIntValue("order_type"));
|
|
|
|
event.put("email_status",1);
|
|
|
|
event.put("email_status",1);
|
|
|
|
event.put("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType());
|
|
|
|
event.put("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType());
|
|
|
|
event.put("submit_url",uploadUrl);
|
|
|
|
event.put("submit_url",uploadUrl);
|
|
|
@ -349,7 +349,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
royalThreadPoolExecutor.execute(() -> {
|
|
|
|
royalThreadPoolExecutor.execute(() -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String emailId = mailService.sendRiskEmail("You need to resubmit risk materials", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
|
|
|
|
String emailId = mailService.sendRiskEmail("You need to resubmit risk materials", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
|
|
|
|
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List<JSONObject>)ctx.getVariable("files"):null,event.getIntValue("order_type"));
|
|
|
|
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), "",content, null,event.getIntValue("order_type"));
|
|
|
|
event.put("email_status",2);
|
|
|
|
event.put("email_status",2);
|
|
|
|
event.put("result_type",RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType());
|
|
|
|
event.put("result_type",RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType());
|
|
|
|
event.put("submit_url",uploadUrl);
|
|
|
|
event.put("submit_url",uploadUrl);
|
|
|
@ -370,7 +370,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
royalThreadPoolExecutor.execute(() -> {
|
|
|
|
royalThreadPoolExecutor.execute(() -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String emailId = mailService.sendRiskEmail("Please submit risk materials as soon as possible", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
|
|
|
|
String emailId = mailService.sendRiskEmail("Please submit risk materials as soon as possible", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
|
|
|
|
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List<JSONObject>)ctx.getVariable("files"):null,event.getIntValue("order_type"));
|
|
|
|
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","),"", content, null,event.getIntValue("order_type"));
|
|
|
|
event.put("email_status",3);
|
|
|
|
event.put("email_status",3);
|
|
|
|
riskEventMapper.update(event);
|
|
|
|
riskEventMapper.update(event);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
@ -440,7 +440,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
case 2:
|
|
|
|
for(String orderId : orderIds){
|
|
|
|
for(String orderId : orderIds){
|
|
|
|
JSONObject order = orderMapper.findOrderById(orderId);
|
|
|
|
JSONObject order = orderMapper.findOrderById(orderId,client.getIntValue("client_id"));
|
|
|
|
if(order==null){
|
|
|
|
if(order==null){
|
|
|
|
throw new BadRequestException("Order: "+orderId+" not exists");
|
|
|
|
throw new BadRequestException("Order: "+orderId+" not exists");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -453,7 +453,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
case 3:
|
|
|
|
case 3:
|
|
|
|
String realOrderId = "";
|
|
|
|
String realOrderId = "";
|
|
|
|
for(String orderId : orderIds){
|
|
|
|
for(String orderId : orderIds){
|
|
|
|
realOrderId = orderMapper.findOrderById(orderId).getString("order_id");
|
|
|
|
realOrderId = orderMapper.findOrderById(orderId,client.getIntValue("client_id")).getString("order_id");
|
|
|
|
JSONObject order = tradeLogService.getOrderDetail(new JSONObject(), clientMoniker, realOrderId, null);
|
|
|
|
JSONObject order = tradeLogService.getOrderDetail(new JSONObject(), clientMoniker, realOrderId, null);
|
|
|
|
if(order==null){
|
|
|
|
if(order==null){
|
|
|
|
throw new BadRequestException("Order: "+orderId+" not exists");
|
|
|
|
throw new BadRequestException("Order: "+orderId+" not exists");
|
|
|
@ -469,12 +469,12 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
orders.add(order);
|
|
|
|
orders.add(order);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx.setVariable("orders", orders);
|
|
|
|
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");
|
|
|
|
file.put("content", Base64.encodeBase64String(generateRiskOrders(event)));
|
|
|
|
// file.put("content", Base64.encodeBase64String(generateRiskOrders(event)));
|
|
|
|
attachList.add(file);
|
|
|
|
// attachList.add(file);
|
|
|
|
ctx.setVariable("files",attachList);
|
|
|
|
// ctx.setVariable("files",attachList);
|
|
|
|
case 4:
|
|
|
|
case 4:
|
|
|
|
ctx.setVariable("title","RoyalPay风控调查 — " + client.getString("short_name"));
|
|
|
|
ctx.setVariable("title","RoyalPay风控调查 — " + client.getString("short_name"));
|
|
|
|
ctx.setVariable("emailsCcs", bdEmails);
|
|
|
|
ctx.setVariable("emailsCcs", bdEmails);
|
|
|
@ -516,10 +516,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
|
|
|
|
|
|
|
|
|
|
|
|
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(",");
|
|
|
|
|
|
|
|
JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker"));
|
|
|
|
Workbook wb = new XSSFWorkbook();
|
|
|
|
Workbook wb = new XSSFWorkbook();
|
|
|
|
String realOrderId = "";
|
|
|
|
String realOrderId = "";
|
|
|
|
for(String orderId : orderIds){
|
|
|
|
for(String orderId : orderIds){
|
|
|
|
realOrderId = orderMapper.findOrderById(orderId).getString("order_id");
|
|
|
|
realOrderId = orderMapper.findOrderById(orderId,client.getIntValue("client_id")).getString("order_id");
|
|
|
|
JSONObject orderDetail = tradeLogService.getOrderDetail(new JSONObject(), event.getString("client_moniker"), realOrderId, null);
|
|
|
|
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);
|
|
|
|