📄 lostaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package web.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import web.condition.customers.CustomersCondition;
import web.form.LostForm;
import biz.customers.CustomerBiz;
import biz.lost.ILostBIZ;
import entity.Lost;
import entity.Measure;
/**
* MyEclipse Struts
* Creation date: 10-27-2008
*
* XDoclet definition:
* @struts.action path="/lost" name="lostForm" input="/form/lost.jsp" parameter="method" scope="request"
*/
public class LostAction extends DispatchAction {
/*
* Generated Methods
*/
ILostBIZ lbiz = null;
CustomerBiz cbiz = null;
Logger log =Logger.getLogger(LostAction.class);
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward toLostList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
log.info("暂缓流失客户...");
LostForm lostForm = (LostForm) form;// TODO Auto-generated method stub
Lost lost = lostForm.getLost();
if(lost.getMancondition()!=null&&""!=lost.getMancondition()){
CustomersCondition condition = new CustomersCondition();
condition.setManager(lost.getMancondition());
List list = cbiz.SearchList(condition);
lost.setCondition(list);
}
/*加载暂缓流失客户信息*/
List lostlist = lbiz.searchByCondition(lost);
request.setAttribute("lostlist", lostlist);
/*加载记录数*/
int count = lbiz.getCount(lost);
int flag = count%Integer.parseInt(lost.getMaxResults());
int pages =count/Integer.parseInt(lost.getMaxResults());
if(flag!=0){
pages+=1;
}
request.setAttribute("count", count);
request.setAttribute("pages", pages);
log.info("当前页:"+lost.getPageNo());
return mapping.findForward("tolostlist");
}
public ActionForward toConfirm(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
log.info("确认流失客户...");
String lid = request.getParameter("lid");
log.info("流失ID号:"+lid);
List measure = lbiz.getMeasureByLostId(Integer.parseInt(lid));
Lost lost = null;
if(measure!=null&&measure.size()>0){
lost = ((Measure)measure.get(0)).getLost();
}
if(lost ==null){
lost = lbiz.getById(Integer.parseInt(lid));
}
request.setAttribute("lost", lost);
request.setAttribute("measure", measure);
return mapping.findForward("toconfirm");
}
public ActionForward doLost(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
log.info("确认流失客户...");
String lid = request.getParameter("lid");
log.info("流失ID号:"+lid);
LostForm lostForm = (LostForm) form;// TODO Auto-generated method stub
Lost lost = lostForm.getLost();
String cause = lost.getLostCause();
log.info("流失原因:"+cause);
lbiz.lostCustomer(Integer.parseInt(lid), cause);
return this.toLostList(mapping, form, request, response);
}
public ActionForward toRelay(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
log.info("暂缓流失客户...");
String lid = request.getParameter("lid");
log.info("流失ID号:"+lid);
List measure = lbiz.getMeasureByLostId(Integer.parseInt(lid));
Lost lost =null;
if(measure!=null&&measure.size()>0){
lost = ((Measure)measure.get(0)).getLost();
}
if(lost == null){
lost = lbiz.getById(Integer.parseInt(lid));
}
request.setAttribute("lost", lost);
request.setAttribute("measure", measure);
return mapping.findForward("torelay");
}
public ActionForward doMeasure(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
log.info("暂缓流失客户...");
String lid = request.getParameter("lid");
log.info("流失ID号:"+lid);
LostForm lostForm = (LostForm) form;// TODO Auto-generated method stub
Measure lost = lostForm.getMeasure();
String cause = lost.getMeasureMethod();
log.info("流失原因:"+cause);
lbiz.addMeasure(Integer.parseInt(lid), cause);
return this.toLostList(mapping, form, request, response);
}
public ILostBIZ getLbiz() {
return lbiz;
}
public void setLbiz(ILostBIZ lbiz) {
this.lbiz = lbiz;
}
public CustomerBiz getCbiz() {
return cbiz;
}
public void setCbiz(CustomerBiz cbiz) {
this.cbiz = cbiz;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -