apzl_leasing/src_tenwa/com/tenwa/lease/app/quartzmession/AutoFiveGradeClassification.java
2018-08-03 21:14:49 +08:00

74 lines
3.2 KiB
Java
Raw Blame History

package com.tenwa.lease.app.quartzmession;
import java.util.List;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_STATUS;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.amarsoft.app.util.ProductParamUtil;
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.base.util.QuartzUtil;
import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.flow.comm.handler.flowmanage.OverdueProjectCache;
public class AutoFiveGradeClassification implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException{
JBOTransaction tx=null;
try {
tx= JBOFactory.createJBOTransaction();
BizObjectManager lccsManager = JBOFactory.getBizObjectManager(LC_CALC_CONDITION_STATUS.CLASS_NAME);
BizObjectManager lciManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME);
tx.join(lccsManager);
tx.join(lciManager);
List<BizObject> lccss = lccsManager.createQuery("IS_AUTO='Y' ").getResultList(false);
if(lccss.size()>0){
for(BizObject lccs:lccss){
BizObject lci = lciManager.createQuery("ID=:id ").setParameter("id",lccs.getAttribute("CONTRACT_ID").getString()).getSingleResult(false);
if (lci == null) {
continue;
}
String productId = lci.getAttribute("PRODUCT_ID").getString();
if(productId!=null){
String overdays = OverdueProjectCache.getOverDays(lccs.getAttribute("CONTRACT_ID").getString(), lccs.getAttribute("PAYMENT_NUMBER").getString());
String fiveResult = ProductParamUtil.getFiveGradeClassification(productId,overdays,"OverDueDays","ClassifyResult");
String fivegrade = lccs.getAttribute("FIVE_GRADE").toString().trim();
if (!"".equals(fivegrade)) {
int i = Integer.valueOf(fiveResult.replace("ClassifyResult", ""));
int j = Integer.valueOf(fivegrade.replace("ClassifyResult", ""));
//<2F><EFBFBD><E5BCB6><EFBFBD><EFBFBD><E0B7A2><EFBFBD>µ<EFBFBD>
if (i > j) {
lccsManager.createQuery("update o set IS_REMIND=:isremind,FIVE_GRADE=:fivegrade,FIVE_GRADE_DATE=:fivegradedate where ID=:id ").setParameter("isremind","Y").setParameter("fivegrade",fiveResult).setParameter("fivegradedate",DateAssistant.getToday()).setParameter("id",lccs.getAttribute("ID").getString()).executeUpdate();
}
}else{
lccsManager.createQuery("update o set FIVE_GRADE=:fivegrade,FIVE_GRADE_DATE=:fivegradedate where ID=:id ").setParameter("fivegrade",fiveResult).setParameter("fivegradedate",DateAssistant.getToday()).setParameter("id",lccs.getAttribute("ID").getString()).executeUpdate();
}
}
}
}
tx.commit();
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.AutoFiveGradeClassification", "success", "<EFBFBD>ɹ<EFBFBD>");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.AutoFiveGradeClassification", "success", "ʧ<EFBFBD><EFBFBD>");
try {
if(tx!=null){
tx.rollback();
}
} catch (JBOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
e.printStackTrace();
}
}
}