邮箱采集-增加识别状态信息

release
zhenghaiyang@ele-cloud.com 2 years ago
parent 374857200f
commit c81855ca8d
  1. 23
      dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java

@ -106,11 +106,8 @@ public class SnEmailGatherTask {
Store store = mailAuth(emailName, password);
if(store == null){
MailGatherLogVo gatherLogVo = new MailGatherLogVo();
gatherLogVo.setId(UUIDUtils.generateShortUuid());
gatherLogVo.setErrorMsg("邮箱认证失败");
gatherLogVo.setOcrType("1");
gatherLogVo.setFromAddress(emailName);
mailGatherLogService.insert(gatherLogVo);
buildMsg(gatherLogVo,"1","邮箱认证失败");
return;
}
Folder folder = store.getFolder("INBOX");
@ -184,21 +181,19 @@ public class SnEmailGatherTask {
Map resultMap = JSONObject.parseObject(body, Map.class);
Object status = resultMap.get("status");
if(status != null && "200".equals(String.valueOf(status))){
buildMsg(gatherLogVo,"1","推送影像票夹成功");
}else {
gatherLogVo.setFphm("");
gatherLogVo.setOcrType("0");
gatherLogVo.setErrorMsg("推送影像票夹失败");
mailGatherLogService.insert(gatherLogVo);
buildMsg(gatherLogVo,"0","推送影像票夹失败");
break;
}
System.out.println(body);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}else {
log.debug("山能OCR识别失败------");
buildMsg(gatherLogVo,"1","山能OCR识别失败");
}
}
}
@ -208,9 +203,7 @@ public class SnEmailGatherTask {
}
//进行数据插入
if(StringUtils.isNotBlank(gatherLogVo.getFpdm()) && StringUtils.isNotBlank(gatherLogVo.getFphm())){
gatherLogVo.setOcrType("0");
gatherLogVo.setErrorMsg("采集成功");
mailGatherLogService.insert(gatherLogVo);
buildMsg(gatherLogVo,"0","采集成功");
}else {
log.info("未采集到有效数据");
}
@ -228,6 +221,12 @@ public class SnEmailGatherTask {
}
}
public void buildMsg(MailGatherLogVo gatherLogVo, String type, String msg){
gatherLogVo.setOcrType(type);
gatherLogVo.setErrorMsg(msg);
mailGatherLogService.insert(gatherLogVo);
}
public static Map<String, Object> convertToOcrResult(List<OpenServiceOcr> openServiceOcrs, Map<String, String> map,EmailMaintainVo maintainVo){
List<OcrResultToyxVo> resultToyxVoList = Lists.newArrayList();
Map<String, Object> hashMap = Maps.newHashMap();

Loading…
Cancel
Save