package quartz; import java.util.HashMap; import java.util.List; import java.util.Map; import jbo.app.tenwa.calc.VI_NORMALSETTLE_CONTRACT; import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO; import jbo.com.tenwa.lease.comm.VI_NORMALEND_CONTRACT; 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.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; import com.base.util.QuartzUtil; //import com.tenwa.action.channelportal.ContractSignAction; //import com.tenwa.action.channelportal.comm.ContractTransferRightForEnd; import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.comm.util.jboutil.SaveBusinessStatus; import com.tenwa.lease.app.quartzmession.JobInitUserName; import com.tenwa.officetempalte.action.CreateOfficeAction; //import com.tenwa.quartz.BeforeSerialTimingTask; //import com.tenwa.quartz.service.BeforeSerialTimingTaskService; //import com.tenwa.quartz.serviceImpl.BeforeSerialTimingTaskServiceImpl; import com.tenwa.reckon.util.UUIDUtil; import org.apache.log4j.Logger; public class ContractInfoForNomalSettle 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.ContractInfoForNomalSettle", "success", "成功", curUserId); } catch (Exception e) { QuartzUtil.insertLog(startime, "quartz.ContractInfoForNomalSettle", "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 customerName = conInfo.split("@")[1]; String contractId = conInfo.split("@")[0]; 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, "51", jboName.getUserId(arg0, tx)); } } } //获取正常结清的合同 public String getContractId(JBOTransaction tx ) throws Exception{ BizObjectManager bom=JBOFactory.getBizObjectManager(VI_NORMALSETTLE_CONTRACT.CLASS_NAME,tx); List boList = bom.createQuery("contract_status <> '105'").getResultList(false); 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; } }