📄 c_fjcmainaction.java
字号:
package com.suyuannet.sycb.action.handset;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import org.apache.struts.util.LabelValueBean;
import com.suyuannet.sycb.action.BaseAction;
import com.suyuannet.sycb.business.handset.C_FJCDownloadProcess;
import com.suyuannet.sycb.business.handset.C_FJCInitProcess;
import com.suyuannet.sycb.business.handset.C_FJCUploadProcess;
import com.suyuannet.sycb.common.PubFunc;
import com.suyuannet.sycb.db.vo.OperuserinfoVO;
import com.suyuannet.sycb.entity.LoginInfo;
import com.suyuannet.sycb.form.handset.C_FJCMainForm;
/**
*<b>ClassName</b><br>
* C_FJCMainAction
*<br><br>
*<b>Function</b>
* 非集抄数据上下装
*<br>
*@copyright SuYuanNet
*@author <a href="mailto:flyfox37@hotmail.com">starsky</a>
*@date 2005-05-19
*@since JDK 1.4
*/
public class C_FJCMainAction extends BaseAction{
public ActionForward doExecute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
ActionForward actionForward = null;
try {
C_FJCMainForm theForm = (C_FJCMainForm)form;
theForm.setMessage("");
theForm.setFilepath("");
if ("SEARCH".equals(theForm.getActionId())) {
actionForward = search(mapping, theForm, request, response);
return actionForward;
} else if ("UPFILE".equals(theForm.getActionId())) {
actionForward = upload(mapping, theForm, request, response);
return actionForward;
} else if ("DOWNFILE".equals(theForm.getActionId())) {
actionForward = download(mapping, theForm, request, response);
return actionForward;
} else if ("SHOWDETAIL".equals(theForm.getActionId())) {
actionForward = showdetail(mapping, theForm, request, response);
return actionForward;
} else {
actionForward = init(mapping, theForm, request, response);
return actionForward;
}
}catch(Exception e) {
return mapping.findForward("SystemError");
}
}
/**初始化*/
public ActionForward init(
ActionMapping mapping,
C_FJCMainForm thisForm,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
dataBean.setParameter("selCmp",thisForm.getSelCmp());
dataBean.setParameter("dh",thisForm.getDh());
C_FJCInitProcess initProcess = new C_FJCInitProcess();
initProcess.process(dataBean);
thisForm.setListCmp((ArrayList)dataBean.getParameter("listCmp"));
thisForm.setDhnoselList((ArrayList)dataBean.getParameter("listDH"));
thisForm.setDhselList(new ArrayList());
return mapping.findForward("INIT");
}
/**段号查询*/
public ActionForward search(
ActionMapping mapping,
C_FJCMainForm thisForm,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
dataBean.setParameter("selCmp",thisForm.getSelCmp());
dataBean.setParameter("dh",thisForm.getDh());
C_FJCInitProcess initProcess = new C_FJCInitProcess();
initProcess.process(dataBean);
thisForm.setListCmp((ArrayList)dataBean.getParameter("listCmp"));
thisForm.setDhnoselList((ArrayList)dataBean.getParameter("listDH"));
thisForm.setDhselList(new ArrayList());
return mapping.findForward("INIT");
}
/**手抄机文件下装*/
public ActionForward download(
ActionMapping mapping,
C_FJCMainForm thisForm,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
C_FJCDownloadProcess process = new C_FJCDownloadProcess();
LoginInfo loginUser = this.getLoginInfo(request);
OperuserinfoVO userVO = loginUser.getUserinfoVO();
String userid = ""+userVO.getId();
String unitid = userVO.getOu_depid();
ActionErrors errors= new ActionErrors();
if (userid != null){
dataBean.setParameter("userid",userid);
dataBean.setParameter("unitid",unitid);
dataBean.setParameter("downtype",thisForm.getFlag());
dataBean.setParameter("dhs",thisForm.getDhsel());
dataBean.setParameter("exp","0");
dataBean.setParameter("rootPath",thisForm.getRootPath());
process.process(dataBean);
String flag = (String)dataBean.getParameter("flag");
thisForm.setFlag(flag);
if (flag.equals("0")) {
thisForm.setFilepath(request.getContextPath()+(String)dataBean.getParameter("path"));
}
}
else{
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("errors.sessin"));
}
saveErrors(request, errors);
dataBean.setParameter("selCmp",thisForm.getSelCmp());
dataBean.setParameter("dh",thisForm.getDh());
C_FJCInitProcess initProcess = new C_FJCInitProcess();
initProcess.process(dataBean);
thisForm.setListCmp((ArrayList)dataBean.getParameter("listCmp"));
String[] dhnosel = thisForm.getDhnosel();
String[] dhsel = thisForm.getDhsel();
ArrayList dhnoselList = new ArrayList(); //未选择的段号
ArrayList dhselList = new ArrayList(); //已选的段号
if (dhnosel!=null && dhnosel.length>0) {
for (int i=0;i<dhnosel.length;i++) {
dhnoselList.add(new LabelValueBean(dhnosel[i],dhnosel[i]));
}
}
if (dhsel!=null && dhsel.length>0) {
for (int i=0;i<dhsel.length;i++) {
dhselList.add(new LabelValueBean(dhsel[i],dhsel[i]));
}
}
thisForm.setDhnoselList(dhnoselList);
thisForm.setDhselList(dhselList);
// thisForm.setDhnoselList((ArrayList)dataBean.getParameter("listDH"));
// thisForm.setDhselList(new ArrayList());
thisForm.setActionId("");
return mapping.findForward("INIT");
}
/**手抄机文件上装*/
public ActionForward upload(
ActionMapping mapping,
C_FJCMainForm thisForm,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
C_FJCUploadProcess process = new C_FJCUploadProcess();
LoginInfo loginUser = this.getLoginInfo(request);
OperuserinfoVO userVO = loginUser.getUserinfoVO();
String userid = ""+userVO.getId();
String unitid = userVO.getOu_depid();
ActionErrors errors= new ActionErrors();
if (userid != null){
dataBean.setParameter("userid",userid);
dataBean.setParameter("unitid",unitid);
dataBean.setParameter("upLoadFile",thisForm.getUpLoadFile());
dataBean.setParameter("rootPath",thisForm.getRootPath());
dataBean.setParameter("fileMode",thisForm.getFileMode());
FormFile tempfile = thisForm.getUpLoadFile();
dataBean.setParameter("filename",tempfile.getFileName());
process.process(dataBean);
String flag = (String)dataBean.getParameter("flag");
if (flag.equals("0"))
thisForm.setMessage("上传文件成功!数据已入库!");
else if (flag.equals("1"))
thisForm.setMessage("上传文件失败!");
else if (flag.equals("2"))
thisForm.setMessage("文件入库失败,请检查文件格式,重新上传!");
else if (flag.equals("3"))
thisForm.setMessage("文件格式错误,请检查文件格式,重新上传!");
}
else{
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("errors.sessin"));
}
saveErrors(request, errors);
dataBean.setParameter("selCmp",thisForm.getSelCmp());
dataBean.setParameter("dh",thisForm.getDh());
C_FJCInitProcess initProcess = new C_FJCInitProcess();
initProcess.process(dataBean);
thisForm.setListCmp((ArrayList)dataBean.getParameter("listCmp"));
String[] dhnosel = thisForm.getDhnosel();
String[] dhsel = thisForm.getDhsel();
ArrayList dhnoselList = new ArrayList(); //未选择的段号
ArrayList dhselList = new ArrayList(); //已选的段号
if (dhnosel!=null && dhnosel.length>0) {
for (int i=0;i<dhnosel.length;i++) {
dhnoselList.add(new LabelValueBean(dhnosel[i],dhnosel[i]));
}
}
if (dhsel!=null && dhsel.length>0) {
for (int i=0;i<dhsel.length;i++) {
dhselList.add(new LabelValueBean(dhsel[i],dhsel[i]));
}
}
thisForm.setDhnoselList(dhnoselList);
thisForm.setDhselList(dhselList);
// thisForm.setDhnoselList((ArrayList)dataBean.getParameter("listDH"));
// thisForm.setDhselList(new ArrayList());
thisForm.setActionId("");
return mapping.findForward("INIT");
}
/**手抄机文件下装*/
public ActionForward showdetail(
ActionMapping mapping,
C_FJCMainForm thisForm,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
C_FJCDownloadProcess process = new C_FJCDownloadProcess();
LoginInfo loginUser = this.getLoginInfo(request);
OperuserinfoVO userVO = loginUser.getUserinfoVO();
String userid = ""+userVO.getId();
String unitid = userVO.getOu_depid();
ActionErrors errors= new ActionErrors();
if (userid != null){
dataBean.setParameter("userid",userid);
dataBean.setParameter("unitid",unitid);
dataBean.setParameter("downtype",thisForm.getFlag());
String seldh = request.getParameter("seldh");
seldh = seldh.substring(0,seldh.length()-1);
PubFunc pf = PubFunc.getInstance();
String[] temp = pf.splitString(seldh,"@");
//dataBean.setParameter("jzqs",thisForm.getJzqsel());
dataBean.setParameter("dhs",temp);
dataBean.setParameter("exp","1");
process.process(dataBean);
String flag = (String)dataBean.getParameter("flag");
thisForm.setFlag(flag);
if (flag.equals("0")) {
thisForm.setFilepath(request.getContextPath()+(String)dataBean.getParameter("path"));
}
ArrayList listCQ = (ArrayList)dataBean.getParameter("listCQ");
thisForm.setListCQ(listCQ);
}
else{
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("errors.sessin"));
}
saveErrors(request, errors);
// dataBean.setParameter("selCmp",thisForm.getSelCmp());
// dataBean.setParameter("dh",thisForm.getDh());
//
// C_FJCInitProcess initProcess = new C_FJCInitProcess();
// initProcess.process(dataBean);
//
// thisForm.setListCmp((ArrayList)dataBean.getParameter("listCmp"));
// thisForm.setDhnoselList((ArrayList)dataBean.getParameter("listDH"));
// thisForm.setDhselList(new ArrayList());
return mapping.findForward("EXP");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -