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(); + } } } }