From c81855ca8de195546939b3d8a5a8b3544115bb92 Mon Sep 17 00:00:00 2001 From: "zhenghaiyang@ele-cloud.com" Date: Tue, 18 Apr 2023 10:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E7=AE=B1=E9=87=87=E9=9B=86-=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AF=86=E5=88=AB=E7=8A=B6=E6=80=81=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dxhy/core/task/SnEmailGatherTask.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java index ad3675ff..cf3e995d 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java +++ b/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 convertToOcrResult(List openServiceOcrs, Map map,EmailMaintainVo maintainVo){ List resultToyxVoList = Lists.newArrayList(); Map hashMap = Maps.newHashMap();