上传邮件截图

master
dalong306 3 years ago
parent 5737da4db9
commit a36a299c57

@ -257,4 +257,7 @@ public interface RetailAppService {
JSONObject getAccountBindInfos(JSONObject device);
JSONObject postAppMessage(JSONObject device, RetailAppMessage message);
void submitEmailCertificate(JSONObject material, JSONObject device);
}

@ -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");

@ -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);

@ -15,4 +15,7 @@ public interface RiskFileMapper {
@AutoSql(SqlType.SELECT)
List<JSONObject> findAllFiles(@Param("material_id") String material_id);
@AutoSql(SqlType.SELECT)
List<JSONObject> findEmailScreenshot(@Param("material_id") String material_id,@Param("file_type") String file_type);
}

@ -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);
}

@ -8,6 +8,11 @@ public interface RiskUploadService {
* @param material
*/
void submitMaterial(JSONObject material);
/**
*
* @param material
*/
void submitEmailCertificate(JSONObject material);
/**
*

@ -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<JSONObject> riskMaterialList = riskMaterialMapper.findAllMaterials(riskEvent.getString("risk_id"));
if (riskMaterialList != null && !riskMaterialList.isEmpty()) {
JSONObject fileNew = riskMaterialList.get(0);
List<JSONObject> 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<String> 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;",

@ -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));

Loading…
Cancel
Save