diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/ReductionPenaltyRemove.java b/src_tenwa/com/tenwa/lease/app/quartzmession/ReductionPenaltyRemove.java new file mode 100644 index 000000000..a64bb5508 --- /dev/null +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/ReductionPenaltyRemove.java @@ -0,0 +1,82 @@ +package com.tenwa.lease.app.quartzmession; + + +import java.util.List; + +import jbo.app.tenwa.calc.LC_RENT_INCOME; +import jbo.app.tenwa.calc.VI_LC_RENT_PLAN; +import jbo.com.tenwa.lease.carbrand.lb_automatic_compensatory; +import jbo.com.tenwa.lease.comm.CONFIGURATE; + +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.amarsoft.are.util.StringFunction; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.dict.als.cache.CacheLoaderFactory; +import com.tenwa.reckon.util.UUIDUtil; + + +/** + * 自动移除罚息减免金额 + * @author tangfutang + */ +public class ReductionPenaltyRemove implements Job{ + + public void execute(JobExecutionContext arg0) throws JobExecutionException { + JBOTransaction tx=null; + try { + tx = JBOFactory.createJBOTransaction(); + BizObject dateNoBo= JBOFactory.getBizObjectManager(CONFIGURATE.CLASS_NAME, tx).createQuery("attr_id='罚息减免申请自动取消' and field1='汽车'").getSingleResult(false); + String dateNo =dateNoBo.getAttribute("ATTR_VALUE").toString(); + String SQL = "settle_method='settlemethod12' AND v.DATEDIFF(v.SYSDATE(),v.STR_TO_DATE(inputtime,'%Y/%m/%d'))>'"+dateNo+"'"; + BizObjectManager bomLri = JBOFactory.getBizObjectManager(LC_RENT_INCOME.CLASS_NAME,tx); + List lriBoList = bomLri.createQuery(SQL).getResultList(false); + for(BizObject lriBo:lriBoList){ + String planId = lriBo.getAttribute("plan_id").toString(); + BizObject clrpBo= JBOFactory.getBizObjectManager(VI_LC_RENT_PLAN.CLASS_NAME, tx).createQuery("id=:id and (rent_over>0 or penalty_over>0)").setParameter("id", planId).getSingleResult(false); + if(clrpBo.getAttribute("id")!=null){ + BizObject boLRi = bomLri.newObject(); + boLRi.setAttributeValue("ID", UUIDUtil.getUUID()); + boLRi.setAttributeValue("PROJECT_ID", lriBo.getAttribute("PROJECT_ID").toString()); + boLRi.setAttributeValue("PROJECT_PLAN_NUMBER", lriBo.getAttribute("PROJECT_PLAN_NUMBER").toString()); + boLRi.setAttributeValue("CONTRACT_ID", lriBo.getAttribute("CONTRACT_ID").toString()); + boLRi.setAttributeValue("CONTRACT_PLAN_NUMBER", lriBo.getAttribute("CONTRACT_PLAN_NUMBER").toString()); + boLRi.setAttributeValue("PAYMENT_NUMBER", lriBo.getAttribute("PAYMENT_NUMBER").toString()); + boLRi.setAttributeValue("PLAN_ID", lriBo.getAttribute("PLAN_ID").toString()); + boLRi.setAttributeValue("PLAN_LIST", lriBo.getAttribute("PLAN_LIST").toString()); + boLRi.setAttributeValue("HIRE_LIST", lriBo.getAttribute("HIRE_LIST").toString()); + boLRi.setAttributeValue("HIRE_DATE", lriBo.getAttribute("HIRE_DATE").toString()); + boLRi.setAttributeValue("RENT", lriBo.getAttribute("RENT").toString()); + boLRi.setAttributeValue("CORPUS", lriBo.getAttribute("CORPUS").toString()); + boLRi.setAttributeValue("INTEREST", lriBo.getAttribute("INTEREST").toString()); + boLRi.setAttributeValue("PENALTY", lriBo.getAttribute("PENALTY").toString()); + boLRi.setAttributeValue("CORPUS_ADJUST", lriBo.getAttribute("CORPUS_ADJUST").toString()); + boLRi.setAttributeValue("INTEREST_ADJUST", lriBo.getAttribute("INTEREST_ADJUST").toString()); + boLRi.setAttributeValue("PENALTY_ADJUST", "-"+lriBo.getAttribute("PENALTY_ADJUST").toString()); + boLRi.setAttributeValue("SETTLE_METHOD", lriBo.getAttribute("SETTLE_METHOD").toString()); + boLRi.setAttributeValue("MEMO", "超期未还款,罚息减免撤销"); + boLRi.setAttributeValue("ROLL_BACK", lriBo.getAttribute("ROLL_BACK").toString()); + boLRi.setAttributeValue("INPUTUSERID", "8009U00000002"); + boLRi.setAttributeValue("INPUTORGID", "8009001"); + boLRi.setAttributeValue("INPUTTIME", StringFunction.getTodayNow()); + boLRi.setAttributeValue("UPDATEUSERID", "8009U00000002"); + boLRi.setAttributeValue("UPDATEORGID", "8009001"); + boLRi.setAttributeValue("UPDATETIME", StringFunction.getTodayNow()); + bomLri.saveObject(boLRi); + } + } + } catch (JBOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +}