98 lines
4.4 KiB
Java
98 lines
4.4 KiB
Java
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.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.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 ROLL_BACK='0' 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<BizObject> lriBoList = bomLri.createQuery(SQL).getResultList(true);
|
|
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 !=null ){
|
|
System.out.println("罚息减免撤销的plan_id:"+lriBo.getAttribute("PLAN_ID").toString());
|
|
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", "1");
|
|
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);
|
|
//更新红冲状态
|
|
lriBo.setAttributeValue("ROLL_BACK", "1");
|
|
bomLri.saveObject(lriBo);
|
|
}
|
|
}
|
|
} catch (JBOException e) {
|
|
if (tx != null) {
|
|
try {
|
|
tx.rollback();
|
|
tx=null;
|
|
} catch (JBOException e1) {
|
|
e1.printStackTrace();
|
|
}
|
|
}
|
|
}finally{
|
|
try {
|
|
if(tx !=null){
|
|
|
|
tx.commit();
|
|
}
|
|
} catch (JBOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|