apzl_leasing/src_tenwa/com/tenwa/lease/app/quartzmession/QueryBatchCollectResult.java
2018-06-03 22:26:41 +08:00

65 lines
1.9 KiB
Java

package com.tenwa.lease.app.quartzmession;
import java.util.List;
import jbo.app.tenwa.calc.LC_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.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.tenwa.collectaudit.cache.CollectAuditInfoCache;
public class QueryBatchCollectResult implements Job{
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
JBOTransaction tx = null;
try {
tx = JBOFactory.createJBOTransaction();
BizObjectManager bm = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME);
List<BizObject> bolist = bm.createQuery("select crs.collect_sn as v.id from O,jbo.com.tenwa.lease.comm.COLLECT_RECORD_STATUS crs where O.id = crs.rent_plan_id and O.AUDIT_STATE = 'Y' and O.COLLECT_STATUS = '1' and crs.deduct_stata = 'processing' ").getResultList(false);
CollectAuditInfoCache collect = new CollectAuditInfoCache();
StringBuffer parms = new StringBuffer();
for (BizObject bo : bolist) {
String id = bo.getAttribute("id").toString();
if (parms.length()==0) {
parms.append("'"+id+"'");
}else{
parms.append(",'"+id+"'");
}
}
if (parms.length() > 0) {
//查询批量收款状态,并更新租金回笼表
collect.queryBatchCollectStatus(tx,parms);
}
tx.commit();
} catch (JBOException e) {
try {
if (tx != null){
tx.rollback();
}
} catch (JBOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
e.printStackTrace();
} catch (Exception e) {
try {
if (tx != null){
tx.rollback();
}
} catch (JBOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
e.printStackTrace();
}
}
}