📄 majorchangeaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.accphr.web.action;
import java.io.PrintWriter;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
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 com.accphr.biz.IHumanFileBiz;
import com.accphr.biz.IMajorChangeBiz;
import com.accphr.biz.IStandardsBiz;
import com.accphr.entity.HumanFile;
import com.accphr.entity.MajorChange;
import com.accphr.entity.Standards;
import com.accphr.page.PageResult;
import com.accphr.web.form.MajorChangeForm;
/**
* 职位调动
* XDoclet definition:
* @struts.action path="/majorChange" name="majorChangeForm" parameter="opmc" scope="request"
* @struts.action-forward name="tocheckfind" path="/WEB-INF/page/diaodong/majorchange_check_find.jsp"
* @struts.action-forward name="toregistfind" path="/WEB-INF/page/diaodong/majorchange_regist_find.jsp"
* @struts.action-forward name="tofind" path="/WEB-INF/page/diaodong/majorchange_select.jsp"
*/
public class MajorChangeAction extends DispatchAction {
private IMajorChangeBiz majorChangeBiz;
private IHumanFileBiz humanFileBiz;
private IStandardsBiz standardsBiz;
public void setStandardsBiz(IStandardsBiz standardsBiz) {
this.standardsBiz = standardsBiz;
}
public void setHumanFileBiz(IHumanFileBiz humanFileBiz) {
this.humanFileBiz = humanFileBiz;
}
public void setMajorChangeBiz(IMajorChangeBiz majorChangeBiz) {
this.majorChangeBiz = majorChangeBiz;
}
//到查询页面
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
PageResult pageResult=majorChangeForm.getPageResult();
this.majorChangeBiz.setPageResult(null, pageResult);
return mapping.findForward("tofind");
}
//到注册查询页面
public ActionForward toRegistFind(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
PageResult pageResult=majorChangeForm.getPageResult();
MajorChange majorChange=majorChangeForm.getMajorChange();
//查询复核条件的员工
HumanFile humanFile=new HumanFile();
if(majorChange.getFirstKindId()!=null){
humanFile.setFirstKindId(Short.parseShort(String.valueOf(majorChange.getFirstKindId())));
}
if(majorChange.getSecondKindId()!=null){
humanFile.setSecondKindId(Short.parseShort(majorChange.getSecondKindId()));
}
if(majorChange.getThirdKindId()!=null){
humanFile.setThirdKindId(Short.parseShort(majorChange.getThirdKindId()));
}
if(majorChange.getMajorKindId()!=null){
humanFile.setHumanMajorKindId(Short.parseShort(majorChange.getMajorKindId()));
}
if(majorChange.getMajorId()!=null){
humanFile.setHumanMajorId(Short.parseShort(majorChange.getMajorId()));
}
humanFile.setCheckStatus(Short.parseShort("1"));
humanFile.setHumanFileStatus(Short.parseShort("1"));
this.humanFileBiz.setPageResult(humanFile, pageResult);
return mapping.findForward("toregistfind");
}
//到复核查询页面
public ActionForward toCheckFind(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
MajorChange majorChange=majorChangeForm.getMajorChange();
majorChange.setCheckStatus(Short.parseShort("0"));
PageResult pageResult=majorChangeForm.getPageResult();
this.majorChangeBiz.setPageResult(majorChange, pageResult);
return mapping.findForward("tocheckfind");
}
//到注册页面
public ActionForward toRegist(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
Short hid=Short.parseShort(request.getParameter("hid"));
HumanFile humanFile=this.humanFileBiz.findById(hid);
request.setAttribute("rhuman", humanFile);
return mapping.findForward("toregist");
}
//到复核页面
public ActionForward toCheck(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
Short mid=Short.parseShort(request.getParameter("hid"));
MajorChange majorChange=this.majorChangeBiz.findById(mid);
majorChangeForm.setMajorChange(majorChange);
return mapping.findForward("tocheck");
}
//注册
public ActionForward doRegist(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
MajorChange majorChange =majorChangeForm.getMajorChange();
//设置新的薪酬总额
if(majorChange.getNewSalaryStandardId()!=null){
Standards standards=this.standardsBiz.findBySid(majorChange.getNewSalaryStandardId());
majorChange.setNewSalarySum(standards.getSalarySum());
}
//设置复核状态
majorChange.setCheckStatus(Short.parseShort("0"));
//设置登记时间
String times=request.getParameter("times");
try {
SimpleDateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=format.parse(times);
//设置登记时间
majorChange.setRegistTime(new Timestamp(date.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
//判断是否为单级 机构
if(majorChange.getNewSecondKindId().equals("---未选择---")){
majorChange.setNewSecondKindId("");
}
if(majorChange.getNewThirdKindId().equals("---未选择---")){
majorChange.setNewThirdKindId("");
}
//设置薪酬总额
Standards standards=this.standardsBiz.findBySid(majorChange.getNewSalaryStandardId());
majorChange.setNewSalarySum(standards.getSalarySum());
this.majorChangeBiz.add(majorChange);
PrintWriter out=response.getWriter();
out.print("<script>alert('添加成功');location.href='majorChange.do?opmc=toRegistFind'</script>");
return null;
}
//复核
public ActionForward doCheck(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
MajorChange majorChange=majorChangeForm.getMajorChange();
//设置复核状态
majorChange.setCheckStatus(Short.parseShort("1"));
//设置登记时间
String times=request.getParameter("times");
try {
SimpleDateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=format.parse(times);
//设置登记时间
majorChange.setCheckTime(new Timestamp(date.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
//设置薪酬总额
Standards standards=this.standardsBiz.findBySid(majorChange.getNewSalaryStandardId());
majorChange.setNewSalarySum(standards.getSalarySum());
//更新数据库
this.majorChangeBiz.update(majorChange);
//设置并更新到人力资源
HumanFile humanFile=this.humanFileBiz.findById(Short.parseShort(majorChange.getHumanId()));
humanFile.setFirstKindId(Short.parseShort(majorChange.getNewFirstKindId()));
humanFile.setFirstKindName(majorChange.getNewFirstKindName());
if(majorChange.getNewSecondKindId()!=null&&majorChange.getNewSecondKindId().length()>0){
humanFile.setSecondKindId(Short.parseShort(majorChange.getNewSecondKindId()));
humanFile.setSecondKindName(majorChange.getNewSecondKindName());
}
if(majorChange.getNewThirdKindId()!=null&&majorChange.getNewThirdKindId().length()>0){
humanFile.setThirdKindId(Short.parseShort(majorChange.getNewThirdKindId()));
humanFile.setThirdKindName(majorChange.getNewThirdKindName());
}
if(humanFile.getMajorChangeAmount()==null){
humanFile.setMajorChangeAmount(Short.parseShort("1"));
}else{
humanFile.setMajorChangeAmount(Short.parseShort(String.valueOf(humanFile.getMajorChangeAmount()+1)));
}
if(humanFile.getFileChangAmount()==null){
humanFile.setFileChangAmount(Short.parseShort("1"));
}else{
humanFile.setFileChangAmount(Short.parseShort(String.valueOf(humanFile.getFileChangAmount()+1)));
}
if(majorChange.getNewMajorId()!=null&&majorChange.getNewMajorId().length()>0){
humanFile.setHumanMajorId(Short.parseShort(majorChange.getNewMajorId()));
humanFile.setHunmaMajorName(majorChange.getNewMajorName());
}
if(majorChange.getNewMajorKindId()!=null&&majorChange.getNewMajorKindId().length()>0){
humanFile.setHumanMajorKindId(Short.parseShort(majorChange.getNewMajorKindId()));
humanFile.setHumanMajorKindName(majorChange.getNewMajorKindName());
}
humanFile.setSalaryStandardId(majorChange.getNewSalaryStandardId());
humanFile.setSalaryStandardName(majorChange.getNewSalaryStandardName());
humanFile.setSalarySum(majorChange.getNewSalarySum());
humanFile.setCheckStatus(Short.parseShort("0"));
this.humanFileBiz.update(humanFile);
PrintWriter out=response.getWriter();
out.print("<script>alert('复核成功');location.href='majorChange.do?opmc=toCheckFind'</script>");
return null;
}
//删除
public ActionForward toDel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
MajorChangeForm majorChangeForm = (MajorChangeForm) form;
Short mid=Short.parseShort(request.getParameter("smid"));
this.majorChangeBiz.del(mid);
PrintWriter out=response.getWriter();
out.print("<script>alert('删除成功');location.href='majorChange.do?opmc=toCheckFind'</script>");
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -