diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index df98abc54..56a2fe3af 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -257,4 +257,7 @@ public interface RetailAppService { JSONObject getAccountBindInfos(JSONObject device); JSONObject postAppMessage(JSONObject device, RetailAppMessage message); + + void submitEmailCertificate(JSONObject material, JSONObject device); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 59ae53947..89dd6ca66 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -2944,6 +2944,26 @@ public class RetailAppServiceImp implements RetailAppService { return resp; } + @Override + public void submitEmailCertificate(JSONObject material, JSONObject device) { + riskUploadService.submitEmailCertificate(material); + JSONObject event = riskBusinessService.getRiskEventDetail(material.getString("risk_id")); + //材料审核通过后可以重新提交 + if (event.getIntValue("result_type") == 3) { + return; + } + JSONObject account = clientAccountMapper.findById(device.getString("account_id")); + if (account == null) { + account = new JSONObject(); + } + riskProcessLogService.addRiskProcessLog(material.getString("risk_id"), + account.getString("account_id"), + account.getString("display_name"), + RiskResultTypeEnum.WAIT_FOR_AUDIT.getRemark(), + RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType(), + RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType()); + } + private void exportCBBankAggregateFile(JSONObject client, HttpServletResponse httpResponse) { httpResponse.setContentType("application/pdf"); httpResponse.setHeader("content-disposition", "attachment;filename=" + client.getString("client_moniker") + "_AGREEMENT_" + new Date() + ".pdf"); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index d92cf4dd7..d218d7ddb 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -686,6 +686,16 @@ public class RetailAppController { public JSONObject getRiskEventMaterialsRemark(@PathVariable("risk_id") String riskId) { return riskBusinessService.getRiskEventMaterialsRemark(riskId); } + /** + * app端获取风控事件上传的材料信息 + * + * @param riskId + * @return + */ + @GetMapping(value = "/risk/business/events/{risk_id}/emailscreenshot") + public JSONObject getEmailScreenshot(@PathVariable("risk_id") String riskId) { + return riskBusinessService.getEmailScreenshot(riskId); + } /** * app端上传调单材料接口 @@ -697,6 +707,16 @@ public class RetailAppController { retailAppService.submitMaterial(material, device); } + /** + * 提交邮件截图 + * @param material + * @param device + */ + @PostMapping(value = "/risk/business/events/emailscreenshot") + public void uploadEmailCertificate(@RequestBody JSONObject material, @ModelAttribute(RETAIL_DEVICE) JSONObject device) { + retailAppService.submitEmailCertificate(material, device); + } + @PostMapping("/risk/business/upload/files") public JSONObject uploadImage(@RequestParam MultipartFile file) throws Exception { return attachmentClient.uploadFile(file, false); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java index 4857032f8..cce888a21 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/riskbusiness/RiskFileMapper.java @@ -15,4 +15,7 @@ public interface RiskFileMapper { @AutoSql(SqlType.SELECT) List findAllFiles(@Param("material_id") String material_id); + + @AutoSql(SqlType.SELECT) + List findEmailScreenshot(@Param("material_id") String material_id,@Param("file_type") String file_type); } 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 fffbedaec..aaff5b3f6 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 @@ -146,4 +146,12 @@ public interface RiskBusinessService { void updateRiskEventRemark(String riskId, String remark); void markChargebackStatus(String riskId, JSONObject manager, ChargebackStatus status); + + /** + * 获取邮件截图 + * @param riskId + * @return + */ + JSONObject getEmailScreenshot(String riskId); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java index 33cc158b2..75b697ed4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/RiskUploadService.java @@ -8,6 +8,11 @@ public interface RiskUploadService { * @param material */ void submitMaterial(JSONObject material); + /** + * 上传 邮件材料 + * @param material + */ + void submitEmailCertificate(JSONObject material); /** * 删除缓存 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 0748122e9..b8cb17ad4 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 @@ -71,6 +71,7 @@ import org.thymeleaf.context.Context; import org.thymeleaf.spring5.SpringTemplateEngine; import javax.annotation.Resource; +import javax.rmi.CORBA.Util; import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -1432,6 +1433,28 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo } } + @Override + public JSONObject getEmailScreenshot(String riskId) { + JSONObject riskEvent = riskEventMapper.findById(riskId); + JSONObject result = new JSONObject(); + if (riskEvent == null || riskEvent.isEmpty()) return result; + + List riskMaterialList = riskMaterialMapper.findAllMaterials(riskEvent.getString("risk_id")); + if (riskMaterialList != null && !riskMaterialList.isEmpty()) { + JSONObject fileNew = riskMaterialList.get(0); + List files = riskFileMapper.findEmailScreenshot(fileNew.getString("material_id"),"0"); + logger.info("====>files:"+files); + for (JSONObject file : files) { +// int fileType = file.getIntValue("file_type"); + result.put("fileUrl" , file.getString("file_url")); + + } + result.put("description", fileNew.getString("description")); + } + + return result; + } + private List getShopTemplate() { return Arrays.asList("1.与调查交易金额对应的购物小票/发票存根照片 要求:照片应清晰,必须显示商户名称、商户地址、购物时间、物品名称、购物金额等;\n" + "Photos of shopping receipts/ invoice stubs Requirement corresponding with the investigated orders Requirement: The photos should be clear and must show Merchant name, Business address, Transaction time, Product information, Quantity purchased, etc;", diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java index 6b6d47c40..c368cabfa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskUploadServiceIpml.java @@ -69,6 +69,37 @@ public class RiskUploadServiceIpml implements RiskUploadService { // } } + @Override + public void submitEmailCertificate(JSONObject material) { + String riskId = material.getString("risk_id"); + JSONObject event = riskEventMapper.findById(riskId); + Integer resultType = event.getInteger("result_type"); + if (!resultType.equals(RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()) && !resultType.equals(RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType()) && !resultType.equals(RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType())) { + throw new BadRequestException("Committed Already"); + } + material.put("update_time", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); + riskMaterialMapper.save(material); + material.put("material_id",riskMaterialMapper.findAllMaterials(riskId).get(0).getString("material_id")); + if(material.containsKey("file0_url")){ + JSONArray urls = material.getJSONArray("file0_url"); + if (urls == null || urls.isEmpty()) + throw new BadRequestException("Picture cannot be empty"); + + for(Object url:urls){ + JSONObject file = new JSONObject(); + file.put("file_url",url.toString()); + file.put("file_type",0); + file.put("material_id",material.getString("material_id")); + riskFileMapper.save(file); + } + } + + if(event.getIntValue("result_type")!= RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType()){ + event.put("result_type", RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType()); + riskEventMapper.update(event); + } + } + @Override public void deleteUploadMailKey(String codeKey) { stringRedisTemplate.delete(getRiskUploadKey(codeKey));