2019-12-24 14:58:51 +08:00

83 lines
2.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.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();
Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId");
String curUserId = userId == null? "system" : userId.toString();
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", "成功", curUserId);
} catch (Exception e) {
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.Daypenalty", "success", "失败", curUserId);
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();
}