From 5ff5998dec5b74e3566c77198d3a51c2984a4094 Mon Sep 17 00:00:00 2001 From: jianghongdong Date: Thu, 2 Aug 2018 11:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A4=84=E7=90=86=E6=9F=A5?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=95=B0=E6=8D=AE=E6=97=B6=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lease/app/quartzmession/AutoBuckle.java | 27 ++++++++++++------- .../lease/app/quartzmession/AutoRefresh.java | 27 ++++++++++++------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java index f2f1bcfc0..aa7d2f7e0 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java @@ -9,6 +9,7 @@ import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.Configure; @@ -20,24 +21,32 @@ public class AutoBuckle implements Job{ @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { CollectAuditInfoCache ca = new CollectAuditInfoCache(); - JBOTransaction tx; + JBOTransaction tx = null; String plan_date = DateAssistant.getToday(); try { tx = JBOFactory.createJBOTransaction(); //and (O.rent<>'' or O.rent<>'0' or O.rent<>'0.0') List bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款') and O.PLAN_DATE <= '"+plan_date+"' and O.BATCH_STATUS<>'process' ").getResultList(true); StringBuffer ids = new StringBuffer(); - for (BizObject bo : bos) { - ids.append(bo.getAttribute("id").getString()+"@"); + if(bos.size()>0){ + for (BizObject bo : bos) { + ids.append(bo.getAttribute("id").getString()+"@"); + } + ca.setId(ids.toString().substring(0, ids.toString().length()-1)); + Configure CurConfig = Configure.getInstance(); + ca.setFileSavePath(CurConfig.getConfigure("InterfaceFileSavePath")); + ca.setInputuserid("system"); + ca.setInputorgid("system"); + ca.batchCollectManage(tx); } - ca.setId(ids.toString().substring(0, ids.toString().length()-1)); - Configure CurConfig = Configure.getInstance(); - ca.setFileSavePath(CurConfig.getConfigure("InterfaceFileSavePath")); - ca.setInputuserid("system"); - ca.setInputorgid("system"); - ca.batchCollectManage(tx); } catch (Exception e) { e.printStackTrace(); + }finally{ + try { + tx.commit(); + } catch (JBOException e) { + e.printStackTrace(); + } } } } diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoRefresh.java b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoRefresh.java index 2169df9e0..e3bdfd968 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoRefresh.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoRefresh.java @@ -9,6 +9,7 @@ import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.Configure; @@ -20,23 +21,31 @@ public class AutoRefresh implements Job{ @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { CollectAuditInfoCache ca = new CollectAuditInfoCache(); - JBOTransaction tx; + JBOTransaction tx = null; String plan_date = DateAssistant.getToday(); try { tx = JBOFactory.createJBOTransaction(); List bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款') and O.PLAN_DATE <= '"+plan_date+"'").getResultList(true); StringBuffer ids = new StringBuffer(); - for (BizObject bo : bos) { - ids.append(bo.getAttribute("id").getString()+"@"); + if(bos.size()>0){ + for (BizObject bo : bos) { + ids.append(bo.getAttribute("id").getString()+"@"); + } + ca.setId(ids.toString().substring(0, ids.toString().length()-1)); + Configure CurConfig = Configure.getInstance(); + ca.setFileSavePath(CurConfig.getConfigure("InterfaceFileSavePath")); + ca.setInputuserid("system"); + ca.setInputorgid("system"); + ca.queryBatchCollectStatus(tx); } - ca.setId(ids.toString().substring(0, ids.toString().length()-1)); - Configure CurConfig = Configure.getInstance(); - ca.setFileSavePath(CurConfig.getConfigure("InterfaceFileSavePath")); - ca.setInputuserid("system"); - ca.setInputorgid("system"); - ca.queryBatchCollectStatus(tx); } catch (Exception e) { e.printStackTrace(); + }finally{ + try { + tx.commit(); + } catch (JBOException e) { + e.printStackTrace(); + } } } }