package org.better.hr.web.action;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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.better.hr.biz.ConfigFileFirstKindBiz;
import org.better.hr.biz.ConfigFileSecondKindBiz;
import org.better.hr.biz.ConfigFileThirdKindBiz;
import org.better.hr.biz.ConfigMajorBiz;
import org.better.hr.biz.ConfigMajorKindBiz;
import org.better.hr.biz.ConfigPublicCharBiz;
import org.better.hr.biz.HumanFileBiz;
import org.better.hr.biz.HumanFileDigBiz;
import org.better.hr.biz.SalaryStandardBiz;
import org.better.hr.comm.CopyBean;
import org.better.hr.comm.Load;
import org.better.hr.comm.Util;
import org.better.hr.entity.EngageResume;
import org.better.hr.entity.HumanFile;
import org.better.hr.entity.HumanFileDig;
import org.better.hr.exception.HrException;
import org.better.hr.web.form.HumanFileForm;
import org.springframework.beans.BeanUtils;
public class HumanFileAction extends BasicAction {
private HumanFileBiz humanfileBiz; //业务操作对象
private ConfigPublicCharBiz configpubliccharBiz;
private ConfigFileFirstKindBiz configfilefirstkindBiz;
private ConfigFileSecondKindBiz configfilesecondkindBiz;
private ConfigFileThirdKindBiz configfilethirdkindBiz;
private ConfigMajorKindBiz configmajorkindBiz;
private ConfigMajorBiz configmajorBiz;
private SalaryStandardBiz salarystandardBiz;
private HumanFileDigBiz humanfiledigBiz;
private final String _PICPATH = "Upload\\img\\";
private final String _ATTPATH = "Upload\\attach\\";
public HumanFileBiz getHumanfileBiz() {
return humanfileBiz;
}
public void setHumanfileBiz(HumanFileBiz humanfileBiz) {
this.humanfileBiz = humanfileBiz;
}
public ConfigPublicCharBiz getConfigpubliccharBiz() {
return configpubliccharBiz;
}
public void setConfigpubliccharBiz(ConfigPublicCharBiz configpubliccharBiz) {
this.configpubliccharBiz = configpubliccharBiz;
}
public ConfigFileFirstKindBiz getConfigfilefirstkindBiz() {
return configfilefirstkindBiz;
}
public void setConfigfilefirstkindBiz(
ConfigFileFirstKindBiz configfilefirstkindBiz) {
this.configfilefirstkindBiz = configfilefirstkindBiz;
}
public ConfigFileSecondKindBiz getConfigfilesecondkindBiz() {
return configfilesecondkindBiz;
}
public void setConfigfilesecondkindBiz(
ConfigFileSecondKindBiz configfilesecondkindBiz) {
this.configfilesecondkindBiz = configfilesecondkindBiz;
}
public ConfigFileThirdKindBiz getConfigfilethirdkindBiz() {
return configfilethirdkindBiz;
}
public void setConfigfilethirdkindBiz(
ConfigFileThirdKindBiz configfilethirdkindBiz) {
this.configfilethirdkindBiz = configfilethirdkindBiz;
}
public ConfigMajorBiz getConfigmajorBiz() {
return configmajorBiz;
}
public void setConfigmajorBiz(ConfigMajorBiz configmajorBiz) {
this.configmajorBiz = configmajorBiz;
}
public ConfigMajorKindBiz getConfigmajorkindBiz() {
return configmajorkindBiz;
}
public void setConfigmajorkindBiz(ConfigMajorKindBiz configmajorkindBiz) {
this.configmajorkindBiz = configmajorkindBiz;
}
public SalaryStandardBiz getSalarystandardBiz() {
return salarystandardBiz;
}
public void setSalarystandardBiz(SalaryStandardBiz salarystandardBiz) {
this.salarystandardBiz = salarystandardBiz;
}
public HumanFileDigBiz getHumanfiledigBiz() {
return humanfiledigBiz;
}
public void setHumanfiledigBiz(HumanFileDigBiz humanfiledigBiz) {
this.humanfiledigBiz = humanfiledigBiz;
}
/**
* 跳转到新增页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
List list_firstkind = this.getConfigfilefirstkindBiz().list(null);
List list_secondkind = this.getConfigfilesecondkindBiz().list(null);
List list_thirdkind = this.getConfigfilethirdkindBiz().list(null);
List list_majorkind = this.getConfigmajorkindBiz().list(null);
List list_major = this.getConfigmajorBiz().list(null);
HashMap map = this.getConfigpubliccharBiz().listForHumanFile(null);
List list_salary = this.getSalarystandardBiz().list(null);
request.setAttribute("list_firstkind", list_firstkind);
request.setAttribute("list_secondkind", list_secondkind);
request.setAttribute("list_thirdkind", list_thirdkind);
request.setAttribute("list_majorkind", list_majorkind);
request.setAttribute("list_major", list_major);
request.setAttribute("map", map);
request.setAttribute("list_salary", list_salary);
return mapping.findForward("add");
}
/**
* 跳转到添加图片页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toUpLoadPhoto(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
HumanFileForm myForm = (HumanFileForm) form;
HttpSession session = request.getSession();
if(myForm.getItem().getHumanName() != null)
session.setAttribute("item", myForm.getItem());
String method = request.getParameter("method");
if(method.equals("register"))
return mapping.findForward("register_addPhoto");
else if(method.equals("check"))
return mapping.findForward("check_addPhoto");
else
return mapping.findForward("change_addPhoto");
}
/**
* 执行添加图片操作
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws HrException
*/
public ActionForward doUpLoadPhoto(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
HumanFileForm myForm = (HumanFileForm) form;
FormFile file = myForm.getThePhoto();
String filepath = servlet.getServletContext().getRealPath("\\") + _PICPATH;
String myPic = Load.upload(file, filepath);
HttpSession session = request.getSession();
HumanFile hufile = (HumanFile)session.getAttribute("item");
hufile.setHumanPicture(_PICPATH + myPic);
session.setAttribute("item", hufile);
String method = request.getParameter("method");
if(method.equals("register"))
return mapping.findForward("register_addAttach");
else if(method.equals("check"))
return mapping.findForward("check_addAttach");
else
return mapping.findForward("change_addAttach");
}
/**
* 跳转到添加附件页面
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws HrException
*/
public ActionForward toUpLoadAttach(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
HumanFileForm myForm = (HumanFileForm) form;
HttpSession session = request.getSession();
if(myForm.getItem().getHumanName() != null)
session.setAttribute("item", myForm.getItem());
String method = request.getParameter("method");
if(method.equals("register"))
return mapping.findForward("register_addAttach");
else if(method.equals("check"))
return mapping.findForward("check_addAttach");
else
return mapping.findForward("change_addAttach");
}
/**
* 执行添加附件操作
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws HrException
*/
public ActionForward doUpLoadAttach(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
HumanF