1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package com.sinosoft.am.drill.dao;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import org.apache.log4j.Logger;
- import org.quartz.Job;
- import org.quartz.JobExecutionContext;
- import org.quartz.JobExecutionException;
- import com.persistence.service.PersistenceFactory;
- import com.persistence.service.SysPersistence;
- import com.sinosoft.lz.system.sms.dao.SmsDao;
- import com.sysmodel.datamodel.xmlmodel.ModelFactory;
- import com.sysmodel.datamodel.xmlmodel.able.SysModel;
- public class DrillMonitor implements Job{
- private Logger log = Logger.getLogger(this.getClass());
- public void getList(){
- SysModel sysmodel = ModelFactory.getSysmodel();
- SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
- List<String>List=new ArrayList<String>();
- try {
- // String sql="select name from sys_department_0827 where id='"+list.get(i)+"'";
- String sql="select a.drill_name,b.mobile,a.plan_time,b.real_name from EMC_AM_EMERGENCY_DRILL a,sys_user_info b where a.plan_maker=b.user_id and a.is_del='0' and IMPLEMENT_STAT='0'and (to_date(a.plan_time,'yyyy-mm-dd')+interval '15' day)=sysdate";
- List<String[]> tempList;
- tempList = persistence.getSearchResult(99, sql.toString());
-
- log.info("tempList.size===="+tempList.size());
- for(int i=0;i<tempList.size();i++){
- String[]arr=tempList.get(i);
- String name=arr[3];
- String mobile=arr[1];
- String drill_name=arr[0];
- String plan_time=arr[2];
- SmsDao sd=new SmsDao();
- List<String>l=new ArrayList<String>();
- l.add(mobile);
- String content=name+",您好!你指定的应急演练计划:"+drill_name+"将于"+plan_time+"到达计划完成时间,特此提醒!";
- sd.saveSms("应急演练计划执行提醒", l, new Date()+"", content, "zkradmin");
-
- }
- }catch(Exception e){
- this.log.error(e.getMessage(), e);
- }
- }
- @Override
- public void execute(JobExecutionContext arg0) throws JobExecutionException {
- // TODO Auto-generated method stub
- getList();
- }
- }
|