/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.sxdx.hr.human.web.action;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.Timestamp;
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.apache.struts.actions.DispatchAction;
import org.apache.struts.upload.FormFile;
import com.sxdx.hr.human.service.IHumanDigService;
import com.sxdx.hr.human.service.IHumanService;
import com.sxdx.hr.human.web.form.HumanFileForm;
import com.sxdx.hr.salary.service.ISalaryStandardService;
import com.sxdx.hr.systemset.hrset.service.IMajorService;
import com.sxdx.hr.systemset.hrset.service.IMajorTypeService;
import com.sxdx.hr.systemset.hrset.service.IOrganFirstService;
import com.sxdx.hr.systemset.hrset.service.IOrganThirdService;
import com.sxdx.hr.systemset.otherset.service.IPublicPropertyService;
import com.sxdx.vo.ConfigFileFirstKind;
import com.sxdx.vo.ConfigFileThirdKind;
import com.sxdx.vo.ConfigMajor;
import com.sxdx.vo.ConfigMajorKind;
import com.sxdx.vo.ConfigPublicChar;
import com.sxdx.vo.HumanFile;
import com.sxdx.vo.HumanFileDig;
import com.sxdx.vo.SalaryStandard;
public class HumanFileAction extends DispatchAction {
private IOrganFirstService organFirstService;
private IMajorTypeService majorTypeService;
private IPublicPropertyService proService;
private ISalaryStandardService salaryService;
private IOrganThirdService organThirdService;
private IMajorService majorService;
private IHumanDigService humandigService;
public void setHumandigService(IHumanDigService humandigService) {
this.humandigService = humandigService;
}
public void setMajorService(IMajorService majorService) {
this.majorService = majorService;
}
public void setOrganThirdService(IOrganThirdService organThirdService) {
this.organThirdService = organThirdService;
}
public void setMajorTypeService(IMajorTypeService majorTypeService) {
this.majorTypeService = majorTypeService;
}
public void setProService(IPublicPropertyService proService) {
this.proService = proService;
}
public void setSalaryService(ISalaryStandardService salaryService) {
this.salaryService = salaryService;
}
public void setOrganFirstService(IOrganFirstService organFirstService) {
this.organFirstService = organFirstService;
}
private IHumanService humanService;
public void setHumanService(IHumanService humanService) {
this.humanService = humanService;
}
//执行人力资源登记
public ActionForward doRegister(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HumanFileForm humanFileForm = (HumanFileForm) form;// TODO Auto-generated method stub
HumanFile human = humanFileForm.getHuman();
//给生日属性赋值
human.setTempTime(human.getTempTime()+" 00:00:00");
//获取机构信息
ConfigFileThirdKind cftk = organThirdService.getOrganById(Short.parseShort(request.getParameter("thirdKindId")));
human.setFirstKindId(cftk.getFirstKindId());
human.setFirstKindName(cftk.getFirstKindName());
human.setSecondKindId(cftk.getSecondKindId());
human.setSecondKindName(cftk.getSecondKindName());
human.setThirdKindId(cftk.getThirdKindId());
human.setThirdKindName(cftk.getThirdKindName());
//获取职务信息
ConfigMajor cm = majorService.getMajorById(Short.parseShort(request.getParameter("humanMajorId")));
human.setHumanMajorKindId(cm.getMajorKindId());
human.setHumanMajorKindName(cm.getMajorKindName());
human.setHunmaMajorName(cm.getMajorName());
human.setHumanMajorId(cm.getMajorId());
//获取薪酬标准信息
SalaryStandard ssd = salaryService.getById(Short.parseShort(request.getParameter("salaryStandardId")));
human.setSalaryStandardId(ssd.getStandardId());
human.setSalaryStandardName(ssd.getStandardName());
//获取当前系统时间
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String sdfer = sdf.format(date);
Timestamp ti = Timestamp.valueOf(sdfer);
human.setRegistTime(ti);
//登记时,档案复核状态默认为0<未审核>
human.setCheckStatus(Short.parseShort("0"));
//档案状态,默认为True<未被删除,可用>
human.setHumanFileStatus(true);
//实现编号自动增长
short maxid = Short.parseShort(humanService.getMaxHumanId());
short newid = ++maxid;
String prefix ="";
if(newid>=0&&newid<10)
{
prefix="00000000";
}
if(newid>9&&newid<100)
{
prefix="0000000";
}else if(newid>99&&newid<1000)
{
prefix="000000";
}else if(newid>999&&newid<10000)
{
prefix="00000";
}else if(newid>9999&&newid<100000)
{
prefix="0000";
}else if(newid>99999&&newid<1000000)
{
prefix="000";
}
human.setHumanId(prefix+newid);
//执行添加
try
{
humanService.addHumanFile(human);
}catch(Exception ex)
{
return null;
}
request.setAttribute("humanid", human.getHumanId());
return mapping.findForward("uploadphoto");
}
//跳转到复核页面
public ActionForward toRegCheck(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HumanFileForm humanFileForm = (HumanFileForm) form;// TODO Auto-generated method stub
//获取所有待审核信息
List<HumanFile> humanlist = humanService.getByNoCheck();
request.setAttribute("count", humanlist.size());
request.setAttribute("humanlist", humanlist);
return mapping.findForward("toregcheck");
}
//执行复核,跳转到复核修改页面
public ActionForward toCheckUpdate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HumanFileForm humanFileForm = (HumanFileForm) form;// TODO Auto-generated method stub
String hid = request.getParameter("hid");
HumanFile human = humanService.getHumanFileById(Short.parseShort(hid));
request.setAttribute("human", human);
//获取所有国籍
List<ConfigPublicChar> humanNationalitylist = proService.getByPropertyName("国籍");
request.setAttribute("humanNationalitylist", humanNationalitylist);
//获取所有民族
List<ConfigPublicChar> humanRacelist = proService.getByPropertyName("民族");
request.setAttribute("humanRacelist", humanRacelist);
//获取所有宗教
List<ConfigPublicChar> humanReligionlist = proService.getByPropertyName("宗教信仰");
request.setAttribute("humanReligionlist", humanReligionlist);
//获取所有政治面貌
List<ConfigPublicChar> humanPartylist = proService.getByPropertyName("政治面貌");
request.setAttribute("humanPartylist", humanPartylist);
//获取所有学历
List<ConfigPublicChar> humanEducatedDegreelist = proService.getByPropertyName("学历");
request.setAttribute("humanEducatedDegreelist", humanEducatedDegreelist);
//获取所有教育年限
List<ConfigPublicChar> humanEducatedYearslist = proService.getByPropertyName("教育年限");
request.setAttribute("humanEducatedYearslist", humanEducatedYearslist);
//获取所有专业
List<ConfigPublicChar> humanEducatedMajorlist = proService.getByPropertyName("专业");
request.setAttribute("humanEducatedMajorlist", humanEducatedMajorlist);
//获取所有职称
List<ConfigPublicChar> humanProDesignationlist = proService.getByPropertyName("职称");
request.setAttribute("humanProDesignationlist", humanProDesignationlist);
//获取所有薪酬标准
List<SalaryStandard> salaryStandardlist = salaryService.getAll();
request.setAttribute("salaryStandardlist", salaryStandardlist);
//获取所有特长
List<ConfigPublicChar> humanSpecialitylist = proService.getByPropertyName("特长");
request.setAttribute("humanSpecialitylist", humanSpecialitylist);
//
评论30
最新资源