43 lines
1.3 KiB
Java
43 lines
1.3 KiB
Java
package com.tenwa.message;
|
|
|
|
import com.amarsoft.are.jbo.JBOException;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.are.jbo.JBOTransaction;
|
|
import com.ample.sms.SmsController;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.quartz.Job;
|
|
import org.quartz.JobExecutionContext;
|
|
import org.quartz.JobExecutionException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
public class JobSendMessage implements Job{
|
|
|
|
private Log logger = LogFactory.getLog(this.getClass());
|
|
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
@Override
|
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
|
JBOTransaction tx = null;
|
|
String smsnoticeid = null;
|
|
try {
|
|
tx= JBOFactory.createJBOTransaction();
|
|
smsnoticeid = context.getJobDetail().getJobDataMap().getString("smsnoticeid");
|
|
logger.info("short message running..... LB_SMS_NOTICE_TASKS[ID]: "+smsnoticeid);
|
|
SmsController sc = new SmsController();
|
|
sc.setIds(smsnoticeid);
|
|
sc.sendMessage(tx);
|
|
tx.commit();
|
|
} catch (Exception e) {
|
|
logger.error("short message error LB_SMS_NOTICE_TASKS[ID] : "+smsnoticeid ,e);
|
|
try {
|
|
tx.rollback();
|
|
} catch (JBOException e1) {
|
|
e1.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|