From 0c8a0352fc7a8b3468546976fa4b5a7358a689bc Mon Sep 17 00:00:00 2001 From: ap007 Date: Tue, 20 Dec 2022 12:47:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=B1=E5=83=8F=E8=B7=91=E6=89=B9=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ample/icms/service/ImageInfoService.java | 4 +- .../ample/icms/service/ImageOcrService.java | 4 +- .../lease/app/quartzmession/AutoOcr.java | 242 ++++++++++-------- 3 files changed, 146 insertions(+), 104 deletions(-) diff --git a/src/com/ample/icms/service/ImageInfoService.java b/src/com/ample/icms/service/ImageInfoService.java index 322daf93e..cc4ba9fea 100644 --- a/src/com/ample/icms/service/ImageInfoService.java +++ b/src/com/ample/icms/service/ImageInfoService.java @@ -52,11 +52,11 @@ public class ImageInfoService { Element elm = (Element) it.next(); }*/ if(node==null){ - throw new Exception("未找到对应的文件信息"); + return null; } String pageId = node.element("LEAF").getTextTrim(); if("".equals(pageId)||pageId==null){ - throw new Exception("未找到对应的图片信息"); + return null; } Element page = (Element) root.selectSingleNode("//PAGE[@PAGEID='"+pageId+"']"); String pageUrl = page.attributeValue("PAGE_URL"); diff --git a/src/com/ample/icms/service/ImageOcrService.java b/src/com/ample/icms/service/ImageOcrService.java index 60122b998..2bef6eaa7 100644 --- a/src/com/ample/icms/service/ImageOcrService.java +++ b/src/com/ample/icms/service/ImageOcrService.java @@ -17,7 +17,9 @@ public class ImageOcrService { iis.setContractId(contractId); iis.setFlowNo(flowNo); String fileUrl = iis.getFileUrl(floder,tx); - + if(fileUrl==null){ + return "未找到对应的文件"; + } ImageOcr io = new ImageOcr(); String result = io.doPost(fileUrl, ocrType); diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoOcr.java b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoOcr.java index 936b9820f..9535d180a 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoOcr.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoOcr.java @@ -1,19 +1,20 @@ package com.tenwa.lease.app.quartzmession; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; import com.amarsoft.are.jbo.*; import com.amarsoft.are.util.StringFunction; import com.ample.icms.scan.ImageOcr; import com.ample.icms.service.ImageOcrService; import com.ample.icms.util.GetInfoUtil; +import com.ample.icms.util.PropertiesUtil; import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO; import jbo.oti.BANK_CARD_ORC_RESULT; import jbo.oti.ID_CARD_OCR_RESULT; import jbo.oti.INVOICE_ORC_RESULT; import org.quartz.Job; import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; import java.util.List; @@ -23,30 +24,44 @@ public class AutoOcr implements Job { @Override - public synchronized void execute(JobExecutionContext arg0) throws JobExecutionException { + public synchronized void execute(JobExecutionContext arg0){ JBOTransaction tx =null; try { tx = JBOFactory.createJBOTransaction(); ImageOcrService is = new ImageOcrService(); GetInfoUtil giu = new GetInfoUtil(); - List lciBos = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME,tx).createQuery("select id from O where BUSINESSTYPE=1 and CONTRACT_STATUS>=31 and project_date>'2022/01/01 00:00:00'").getResultList(false); - for(int i=0;i<30;i++){ + String sql = PropertiesUtil.get("auto_sql"); + List lciBos = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME,tx).createQuery(sql).getResultList(false); + if(lciBos.size()==0){ + throw new Exception("未找到需要跑批的合同"); + } + int limitCount =Integer.valueOf(PropertiesUtil.get("limit_count").length()>0?PropertiesUtil.get("limit_count"):"0"); + for(int i=0;i