日期:2014-05-16 浏览次数:20619 次
package com.netinfo.sjsascoa.serviceWindow.action; import com.opensymphony.xwork.Action; import com.opensymphony.xwork.ModelDriven; import com.opensymphony.xwork.ActionContext; import com.opensymphony.webwork.ServletActionContext; import com.netinfo.ares.webwork.XmlParameterInterceptor; import com.netinfo.ares.webwork.XmlSerializer; import com.netinfo.ares.system.domain.Usr; import com.netinfo.sjsascoa.serviceWindow.domain.Operationinfo; import com.netinfo.sjsascoa.serviceWindow.bo.IServiceWindowBO; import com.netinfo.sjsascoa.serviceWindow.bo.SetLeftTimeBO; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.quartz.*; import org.quartz.impl.StdSchedulerFactory; import javax.servlet.http.HttpSession; import java.io.Writer; import java.util.Date; /** * Created by IntelliJ IDEA. * User: ltp * Date: 2006-8-10 * Time: 10:08:37 * To change this template use File | Settings | File Templates. */ public class SaveOperationInfoAction implements Action, ModelDriven { Log log = LogFactory.getLog(getClass()); Operationinfo info = new Operationinfo(); IServiceWindowBO serviceWindowBO; public String execute() throws Exception { Writer writer = (Writer) ActionContext.getContext().get(XmlParameterInterceptor.WRITER); String output; HttpSession sess = ServletActionContext.getRequest().getSession(); Usr usr = (Usr) sess.getAttribute("usr"); String name = usr.getName(); String ou = usr.getDepartment(); info.setEditperson(name); info.setDept(ou); try { serviceWindowBO.saveOperationInfo(info); /*进行收文登记的保存操作*/ startClock(info.getId()); output = XmlSerializer.serialize("登记信息保存成功"); } catch (Exception e) { output = XmlSerializer.serialize(e); } writer.write(output); writer.close(); return Action.NONE; } private void startClock(String operationinfoid) throws Exception { SchedulerFactory sf = new StdSchedulerFactory(); Scheduler sched = sf.getScheduler(); Date runTime = TriggerUtils.getNextGivenMinuteDate(new Date(), 1); JobDetail job = new JobDetail(operationinfoid, null, SetLeftTimeBO.class); job.getJobDataMap