定时生成罚息

This commit is contained in:
zhouyahui 2018-08-10 10:48:43 +08:00
parent c086f834e8
commit c1e4d3a275

View File

@ -0,0 +1,79 @@
package com.tenwa.lease.app.quartzmession;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import jbo.com.tenwa.lease.comm.CONTRACT_RENT_MONTH;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.amarsoft.app.awe.config.InitDBType;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.log.Log;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
import com.base.util.QuartzUtil;
import com.tenwa.leasing.service.voucher.CreateVoucherService;
import com.tenwa.leasing.serviceImpl.voucher.CreateVoucherServiceImpl;
import com.tenwa.reckon.constant.Scale;
import com.tenwa.reckon.util.Conn;
import com.tenwa.reckon.util.DateTools;
import com.tenwa.reckon.util.DateUtils;
public class Daypenalty implements Job{
/*
* (non-Javadoc)
* @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
* 定时生成罚息更新lc_rent_plan表penalty和插入日志表
*/
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
JBOTransaction tx=null;
Conn conn=null;
String startime =StringFunction.getTodayNow();;
try {
tx= JBOFactory.createJBOTransaction();
conn= new Conn(tx);
// 未计提或发生变更的合同重新计提
String sql="UPDATE lc_rent_plan SET penalty =getRentPenalty(lc_rent_plan.PAYMENT_NUMBER,lc_rent_plan.PLAN_LIST,DATE_FORMAT (SYSDATE(),'%Y/%m/%d')) ";
conn.executeUpdate(sql);
tx.commit();
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.Daypenalty", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.Daypenalty", "success", "失败");
logger.error(e.getMessage());
e.printStackTrace();
}finally{
if(tx!=null){
try {
tx.rollback();
} catch (JBOException e) {
e.printStackTrace();
}
conn = null;
}
}
}
private static Log logger=ARE.getLog();
}