diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java index cb0a76396..0b400d7dd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java @@ -80,7 +80,7 @@ public interface OrderMapper { PageList listTransactionsForApp(JSONObject params, PageBounds pageBounds); - JSONObject findOrderById(@Param("order_id") String orderId); + JSONObject findOrderById(@Param("order_id") String orderId,@Param("client_id") int clientId); List listHalloweenActOrder(JSONObject param); } diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java index d03ea0cbe..1763781d6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java @@ -17,7 +17,7 @@ public interface MailService { String sendEmail(String title, String mailTos, String mailCcs, String content, List attachFiles) throws URISyntaxException, IOException; - String sendRiskEmail(String title, String mailTos, String mailCcs, String content, List attachFiles, int order_type) throws URISyntaxException, IOException; + String sendRiskEmail(String title, String mailTos, String mailCcs,String mailBcc, String content, List attachFiles, int order_type) throws URISyntaxException, IOException; List checkEmailStatus(String emailId); diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java index a44a49cab..cb639e796 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java @@ -267,13 +267,14 @@ public class MailServiceImp implements MailService { } @Override - public String sendRiskEmail(String title, String mailTos, String mailCcs, String content, List attachFiles, int order_type) throws URISyntaxException, IOException { + public String sendRiskEmail(String title, String mailTos, String mailCcs,String mailBcc, String content, List attachFiles, int order_type) throws URISyntaxException, IOException { NoticeBean noticeBean = new NoticeBean(); noticeBean.setTitle(title); List mailClients = new ArrayList<>(); JSONObject mailClient = new JSONObject(); mailClient.put("mailto", mailTos); mailClient.put("mailcc", mailCcs); + mailClient.put("mailbcc", mailBcc); mailClients.add(mailClient); noticeBean.setMailClients(mailClients); noticeBean.setContent(content); 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 3ada0f519..27802aa3e 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 @@ -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.ClientMapper; 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.pushMessage.bean.AppManagerMessageBuilder; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; @@ -148,6 +147,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo @Override public List getRiskEventOrderList(JSONObject riskEvent) { String orderIds = riskEvent.getString("order_ids"); + JSONObject client = clientMapper.findClientByMonikerAll(riskEvent.getString("client_moniker")); List tradeLogs = new ArrayList<>(); if (StringUtils.isNotBlank(orderIds)) { String[] orderIdArray = orderIds.trim().split(","); @@ -156,13 +156,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo // 获取订单信息 if (riskEvent.getIntValue("order_type") == 3) { 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); tradeLogs.add(orderInfo); } } else { 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); } } @@ -193,7 +193,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo String[] orderIdArray = orderIds.split(","); List orderAmountList = new ArrayList<>(); 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) throw new OrderNotExistsException(); @@ -262,7 +262,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo royalThreadPoolExecutor.execute(() -> { try { String emailId = mailService.sendRiskEmail(title, emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), - emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), content, event.getIntValue("order_type")==3?(List)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("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()); event.put("submit_url",uploadUrl); @@ -349,7 +349,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo royalThreadPoolExecutor.execute(() -> { try { 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)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("result_type",RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType()); event.put("submit_url",uploadUrl); @@ -370,7 +370,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo royalThreadPoolExecutor.execute(() -> { try { 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)ctx.getVariable("files"):null,event.getIntValue("order_type")); + emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","),"", content, null,event.getIntValue("order_type")); event.put("email_status",3); riskEventMapper.update(event); } catch (Exception e) { @@ -440,7 +440,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo case 1: case 2: for(String orderId : orderIds){ - JSONObject order = orderMapper.findOrderById(orderId); + JSONObject order = orderMapper.findOrderById(orderId,client.getIntValue("client_id")); if(order==null){ throw new BadRequestException("Order: "+orderId+" not exists"); } @@ -453,7 +453,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo case 3: String realOrderId = ""; 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); if(order==null){ throw new BadRequestException("Order: "+orderId+" not exists"); @@ -469,12 +469,12 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo orders.add(order); } ctx.setVariable("orders", orders); - List attachList = new ArrayList<>(); - JSONObject file = new JSONObject(); - file.put("name", client.getString("short_name")+ "被查单号相关信息.xlsx"); - file.put("content", Base64.encodeBase64String(generateRiskOrders(event))); - attachList.add(file); - ctx.setVariable("files",attachList); +// List attachList = new ArrayList<>(); +// JSONObject file = new JSONObject(); +// file.put("name", client.getString("short_name")+ "被查单号相关信息.xlsx"); +// file.put("content", Base64.encodeBase64String(generateRiskOrders(event))); +// attachList.add(file); +// ctx.setVariable("files",attachList); case 4: ctx.setVariable("title","RoyalPay风控调查 — " + client.getString("short_name")); ctx.setVariable("emailsCcs", bdEmails); @@ -516,10 +516,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo private byte[] generateRiskOrders(JSONObject event) throws IOException { String[] orderIds = event.getString("order_ids").split(","); + JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker")); Workbook wb = new XSSFWorkbook(); String realOrderId = ""; 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); Sheet sheet = wb.createSheet(orderId); sheet.setDefaultColumnWidth((short) 40); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index cdbb3d8d2..2eb0ebb9b 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -819,7 +819,7 @@ AND t.refund_id IS NULL AND t.transaction_type = 'Credit' AND t.channel != 'System' - WHERE t.system_transaction_id = #{order_id} + WHERE t.system_transaction_id = #{order_id} AND p.client_id = #{client_id}