📄 cstserviceaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package org.jb.y2t308.team3.web.action;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.jb.common.web.action.BaseAction;
import org.jb.y2t308.team3.biz.CstServiceBiz;
import org.jb.y2t308.team3.biz.SalChanceBiz;
import org.jb.y2t308.team3.entity.CstService;
import org.jb.y2t308.team3.web.form.CstServiceForm;
/**
* MyEclipse Struts Creation date: 02-16-2009
*
* XDoclet definition:
*
* @struts.action path="/cstService" name="cstServiceForm" parameter="oper"
* scope="request"
* @struts.action-forward name="success"
* path="/WEB-INF/jsp/~cust/service/add.jsp"
*/
public class CstServiceAction extends BaseAction {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
private CstServiceBiz cstServiceBiz = null;
private SalChanceBiz salChanceBiz = null;
// 跳转到服务添加页面
public ActionForward toAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstServiceForm cstServiceForm = (CstServiceForm) form;// TODO
// Auto-generated
// method stub
// CstService cstService = cstServiceForm.getItem();
SimpleDateFormat smf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String date = smf.format(new Date());
request.setAttribute("date", date);
request.setAttribute("svcId", new Long(2));
return mapping.findForward("add");
}
// 服务创建
public ActionForward doAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstServiceForm cstServiceForm = (CstServiceForm) form;// TODO
// Auto-generated
// method stub
CstService cstService = cstServiceForm.getItem();
request.setAttribute("cstService", cstService);
try {
this.cstServiceBiz.add(cstService);
response.sendRedirect("cstService.do?oper=toAdd");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
// 跳转服务分配页面
public ActionForward toDispatch(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstServiceForm cstServiceForm = (CstServiceForm) form;// TODO
CstService cstService = cstServiceForm.getItem();
this.cstServiceBiz.getServiceList(cstService, cstServiceForm
.getPageResult());
// request.setAttribute("cstServiceForm", cstServiceForm);
return mapping.findForward("toDispatch");
}
// 服务分配处理 点分配
public ActionForward doDispatch(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstServiceForm cstServiceForm = (CstServiceForm) form;
String svrId = request.getParameter("svrId");
List list = salChanceBiz.getCustomerManagerList(3);
request.setAttribute("list", list);
CstService cstService = this.cstServiceBiz.getSerivceById(Long
.parseLong(svrId.trim()));
this.cstServiceBiz.update(cstService);
request.setAttribute("cstServiceForm", cstServiceForm);
try {
response.sendRedirect("cstService.do?oper=toDispatch");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
// 跳转到处理列表
public ActionForward toDealList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstServiceForm cstServiceForm = (CstServiceForm) form;// TODO
CstService cstService = cstServiceForm.getItem();
String scf = request.getParameter("item.cstCustomer.custName");
// method stub
this.cstServiceBiz.getServiceList(cstService, cstServiceForm
.getPageResult());
return mapping.findForward("toDealList");
}
// 点击 删除 删除服务信息
public ActionForward doDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String avrId = request.getParameter("avrId");
this.cstServiceBiz.delete(Long.parseLong(avrId.trim()));
try {
response.sendRedirect("cstService.do?oper=toDispatch");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
// 跳转到详细服务页面
public ActionForward toDealDetail(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstServiceForm cstServiceForm = (CstServiceForm) form;// TODO
String svrId1=request.getParameter("svrId");
CstService cstService=cstServiceBiz.getSerivceById(Long.parseLong(svrId1));
request.setAttribute("cstService",cstService);
request.setAttribute("svrId1",svrId1);
return mapping.findForward("toDealDetail");
}
// 详细处理服务页面
public ActionForward doDealDetial(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstServiceForm cstServiceForm = (CstServiceForm) form;// TODO
//得到form中的值
CstService item=cstServiceForm.getItem();
//得到当前时间
SimpleDateFormat smf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String date = smf.format(new Date());
//得到订单id
String svrId=request.getParameter("svrId1");
//将得到的服务id转换成Long型
Long svrId1=new Long(svrId);
//根据id找到服务处理对象
CstService cstService=this.cstServiceBiz.getSerivceById(svrId1);
item.setSvrId(Long.valueOf(svrId1));
//处理之后保存改对象
this.cstServiceBiz.update(cstService);
//封装服务id
request.setAttribute("svrId1",svrId1);
request.setAttribute("date", date);
//跳转到显示服务列表页面
return mapping.findForward("toFeedback");
}
/**
* @return the cstServiceBiz
*/
public CstServiceBiz getCstServiceBiz() {
return cstServiceBiz;
}
/**
* @param cstServiceBiz
* the cstServiceBiz to set
*/
public void setCstServiceBiz(CstServiceBiz cstServiceBiz) {
this.cstServiceBiz = cstServiceBiz;
}
/**
* @return the salChanceBiz
*/
public SalChanceBiz getSalChanceBiz() {
return salChanceBiz;
}
/**
* @param salChanceBiz
* the salChanceBiz to set
*/
public void setSalChanceBiz(SalChanceBiz salChanceBiz) {
this.salChanceBiz = salChanceBiz;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -