e533c6622e82f217c68324ff587e027bcb1193f6.svn-base 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.sinosoft.am.drill.dao;
  2. import java.util.ArrayList;
  3. import java.util.Date;
  4. import java.util.List;
  5. import org.apache.log4j.Logger;
  6. import org.quartz.Job;
  7. import org.quartz.JobExecutionContext;
  8. import org.quartz.JobExecutionException;
  9. import com.persistence.service.PersistenceFactory;
  10. import com.persistence.service.SysPersistence;
  11. import com.sinosoft.lz.system.sms.dao.SmsDao;
  12. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  13. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  14. public class DrillMonitor implements Job{
  15. private Logger log = Logger.getLogger(this.getClass());
  16. public void getList(){
  17. SysModel sysmodel = ModelFactory.getSysmodel();
  18. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  19. List<String>List=new ArrayList<String>();
  20. try {
  21. // String sql="select name from sys_department_0827 where id='"+list.get(i)+"'";
  22. 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";
  23. List<String[]> tempList;
  24. tempList = persistence.getSearchResult(99, sql.toString());
  25. log.info("tempList.size===="+tempList.size());
  26. for(int i=0;i<tempList.size();i++){
  27. String[]arr=tempList.get(i);
  28. String name=arr[3];
  29. String mobile=arr[1];
  30. String drill_name=arr[0];
  31. String plan_time=arr[2];
  32. SmsDao sd=new SmsDao();
  33. List<String>l=new ArrayList<String>();
  34. l.add(mobile);
  35. String content=name+",您好!你指定的应急演练计划:"+drill_name+"将于"+plan_time+"到达计划完成时间,特此提醒!";
  36. sd.saveSms("应急演练计划执行提醒", l, new Date()+"", content, "zkradmin");
  37. }
  38. }catch(Exception e){
  39. this.log.error(e.getMessage(), e);
  40. }
  41. }
  42. @Override
  43. public void execute(JobExecutionContext arg0) throws JobExecutionException {
  44. // TODO Auto-generated method stub
  45. getList();
  46. }
  47. }