apzl_leasing/src_tenwa/quartz/ContractInfoForOverdue.java
2018-09-18 20:42:52 +08:00

73 lines
2.8 KiB
Java

package quartz;
import java.util.List;
import jbo.app.tenwa.calc.VI_CONTRACT_OVERDUE;
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.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.util.StringFunction;
import com.base.util.QuartzUtil;
//import com.tenwa.action.channelportal.ContractSignAction;
//import com.tenwa.action.channelportal.comm.ContractTransferRightForEnd;
import com.tenwa.comm.util.jboutil.SaveBusinessStatus;
import com.tenwa.lease.app.quartzmession.JobInitUserName;
//import com.tenwa.quartz.BeforeSerialTimingTask;
//import com.tenwa.quartz.service.BeforeSerialTimingTaskService;
//import com.tenwa.quartz.serviceImpl.BeforeSerialTimingTaskServiceImpl;
public class ContractInfoForOverdue implements Job{
private JobInitUserName jboName;
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
String startime = StringFunction.getTodayNow();
Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId");
String curUserId = userId == null? "system" : userId.toString();
try {
JBOTransaction tx = JBOFactory.createJBOTransaction();
ownershipTransferSign(tx,arg0);
tx.commit();
QuartzUtil.insertLog(startime, "quartz.ContractInfoForOverdue", "success", "³É¹¦", curUserId);
} catch (Exception e) {
QuartzUtil.insertLog(startime, "quartz.ContractInfoForOverdue", "error", "ʧ°Ü", curUserId);
e.printStackTrace();
}
}
public void ownershipTransferSign(JBOTransaction tx ,JobExecutionContext arg0) throws Exception{
String conInfo1 = getContractId(tx);
if(!(conInfo1 == null || conInfo1.length() <= 0)){
String[] conInfos = conInfo1.split("@");
for(String conInfo:conInfos){
String contractId = conInfo;
//BizObjectManager bm = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME, tx);
//bm.createQuery("update O set contract_status = '105' where id = '"+contractId+"'").executeUpdate();
SaveBusinessStatus.saveByContractId(contractId, tx, "46", jboName.getUserId(arg0, tx));
}
}
}
//»ñÈ¡ÓâÆÚµÄºÏͬ
public String getContractId(JBOTransaction tx ) throws Exception{
BizObjectManager bom=JBOFactory.getBizObjectManager(VI_CONTRACT_OVERDUE.CLASS_NAME);
List<BizObject> boList = bom.createQuery("contract_status <> '105'").getResultList(true);
String conInfos = new String();
for(BizObject bo : boList){
conInfos += bo.getAttribute("contract_id")+"@";
//conInfos += bo.getAttribute("income_number")+",";
// conInfos += bo.getAttribute("BUSINESS_STATUS")+",";
}
return conInfos;
}
}