package com.tenwa.lease.app.quartzmession; import java.util.List; import jbo.com.tenwa.lease.comm.VI_LC_AUDIT_RENT_PLAN; import org.quartz.Job; 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; import com.base.util.QuartzUtil; import com.tenwa.collectaudit.cache.CollectAuditInfoCache; import com.tenwa.comm.util.date.DateAssistant; public class AutoRefresh implements Job{ @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { CollectAuditInfoCache ca = new CollectAuditInfoCache(); JBOTransaction tx = null; String plan_date = DateAssistant.getToday(); Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId"); String curUserId = userId == null? "system" : userId.toString(); try { tx = JBOFactory.createJBOTransaction(); List bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款','代偿') and O.BATCH_STATUS='process' and O.PLAN_DATE <= '"+plan_date+"'").getResultList(true); StringBuffer ids = new StringBuffer(); 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); } QuartzUtil.insertLog(plan_date,"com.tenwa.lease.app.quartzmession.AutoRefresh", "success", "成功",curUserId); } catch (Exception e) { e.printStackTrace(); QuartzUtil.insertLog(plan_date,"com.tenwa.lease.app.quartzmession.AutoRefresh", "error", "失败",curUserId); }finally{ try { tx.commit(); } catch (JBOException e) { e.printStackTrace(); } } } }