📄 salchanceaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package org.jb.y2t308.team3.web.action;
import java.io.IOException;
import java.io.PrintWriter;
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.SalChanceBiz;
import org.jb.y2t308.team3.entity.SalChance;
import org.jb.y2t308.team3.web.form.SalChanceForm;
/**
* MyEclipse Struts Creation date: 02-16-2009
*
* XDoclet definition:
*
* @struts.action path="/salChance" name="salChanceForm" parameter="operate"
* scope="request" validate="true"
* @struts.action-forward name="toAdd" path="/WEB-INF/jsp/~sale/add.jsp"
*/
public class SalChanceAction extends BaseAction {
/*
* Generated Methods
*/
private SalChanceBiz salChanceBiz = null;
/**
* 显示销售机会列表(分页、模糊查询)
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward toSalChanceList(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
this.salChanceBiz.getSaleList(salChanceForm.getSalChance(),
salChanceForm.getPageResult());
return mapping.findForward("toSalChanceList");
}
/***************************************************************************
* 跳转到新建销售机会页面
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
return mapping.findForward("toAdd");
}
/**
* 新建销售机会操作
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward doAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
SalChance sal = new SalChance();
// _______________________________________________________________修改于2-19...By_gHOst
// salChanceForm.getSalChance().setChcCreateId(new Long(1));
salChanceForm.getSalChance().setChcStatus("1");
this.salChanceBiz.addSaleChance(salChanceForm.getSalChance());
try {
response.sendRedirect("salChance.do?operate=toSalChanceList");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/***************************************************************************
* 跳转到编辑页面
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
String chanceId = request.getParameter("chanceId");
SalChance salChance = this.salChanceBiz
.getSaleChanceByChanceId(new Long(chanceId));
request.setAttribute("salChance", salChance);
return mapping.findForward("toEdit");
}
/***************************************************************************
* 执行编辑操作
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward doEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
SalChance salChance = salChanceForm.getSalChance();
// ________________________________________修改于....ghost--2-19
// salChance.setChcCreateId(new Long(1));
salChance.setChcStatus("1");
this.salChanceBiz.updateSaleChance(salChance);
try {
response.sendRedirect("salChance.do?operate=toSalChanceList");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* 跳转到指派页面
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toDue(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
String chanceId = request.getParameter("chanceId");
SalChance salChance = this.salChanceBiz
.getSaleChanceByChanceId(new Long(chanceId));
List custMaList= this.salChanceBiz.getCustomerManagerList(3);
request.setAttribute("custMaList", custMaList);
request.setAttribute("salChance", salChance);
return mapping.findForward("toDue");
}
/************************************************************
* 修改于2-19---gHost---删除Action
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward doDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
PrintWriter out = null;
response.setContentType("text/html;charset=GB18030");
try {
out = response.getWriter();
} catch (IOException e1) {
e1.printStackTrace();
}
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
String chanceId = request.getParameter("chanceId");
int userId = Integer.parseInt(request.getParameter("userId"));
SalChance salChance = this.salChanceBiz
.getSaleChanceByChanceId(new Long(chanceId));
int createId = Integer.parseInt(salChance.getChcCreateId().toString());
if (userId == createId) {
this.salChanceBiz.delSaleChance(Long.parseLong(chanceId));
try {
response.sendRedirect("salChance.do?operate=toSalChanceList");
} catch (IOException e) {
e.printStackTrace();
}
} else {
out.print("<script>alert('您无权删除『" + salChance.getChcCreateBy()
+ "』的记录!');history.go(-1);</script>");
}
return null;
}
/**
* 执行指派操作
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward doDue(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SalChanceForm salChanceForm = (SalChanceForm) form;// TODO
//SalChance salChance=salChanceForm.getSalChance();
String chanceId = request.getParameter("chcId");
SalChance salChance = this.salChanceBiz
.getSaleChanceByChanceId(new Long(chanceId));
salChance.setChcDueDate(salChanceForm.getSalChance().getChcDueDate());
salChance.setChcDueTo(salChanceForm.getSalChance().getChcDueTo());
salChance.setChcCreateId(salChanceForm.getSalChance().getChcCreateId());
salChance.setChcStatus("2");
this.salChanceBiz.updateSaleChance(salChance);
try {
response.sendRedirect("salChance.do?operate=toSalChanceList");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public void setSalChanceBiz(SalChanceBiz salChanceBiz) {
this.salChanceBiz = salChanceBiz;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -