public ActionForward createApply (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors errors = new ActionErrors();
//几个重要参数 paryrollID , elementID, processID, apply_employee_id(申报人的person_id),organization_id
ApplyForm applyForm = (ApplyForm) form;
//return list Exception
List<InstanceContentVO> errorList = new ArrayList<InstanceContentVO>();
//获取模板开始
//elementID & payrollId 是联合主键
int elementID = applyForm.getApplyVO().getElementId();
String elementName = applyForm.getElementVO().getElementName();
EmployeeVO employeeVO=getEmployeeVO(request); //得到申报用户的 person_id;
int apply_employee_id=employeeVO.getEmployeeId();
int payrollID =applyForm.getAssignmentvo().getPayrollId(); // 根据申报用户的 person_id 获取payrollID
String hrmsElementName = applyForm.getElementVO().getHrms_elementName();
if ((Integer) elementID != null && (Integer) payrollID != 0 && (Integer) apply_employee_id != null ) {
//获取模板
request.setAttribute("Templatelist", this.getTemplateInfo(elementID, payrollID));
int processID=0;
//获取流程ID
ApplicationDelegate applicationDelegate = new ApplicationDelegate();
String processIDStr = applicationDelegate.getProcessID(elementID, payrollID);
if(processIDStr!=null ){
processID=Integer.parseInt(processIDStr.trim());
}
//创建审批的数据保存
List applyList = applyForm.getApplyVO().getInstanceContentList();//获取到页面的数据
//连接系统中的开始时间和开始日期,后者结束时间和结束日期格式成字符串
setListAfter_connectTime(applyList);
if(applyList.isEmpty()){
throw new ApplicationException("A0000B0107", "Submit fail: Can't submit empty record!" );
}
//这个两个表的VO
InstanceContentVO instancecontentvo = new InstanceContentVO();
InstanceControlVO instancecontrolvo = new InstanceControlVO();
//这里需要根据processID查询step为2的roleID,再根据roleID查询对应的roleType,根据roleType设置对应的状态值
String roleTypeName = "";
PayrollDelegate payrollDelegate = new PayrollDelegate();
ProcessVO processVO = payrollDelegate.getProcessById(processID);
List nodeList = processVO.getProcessNodeList();
for(int j=0;j<nodeList.size();j++){
ProcessNodeVO node = (ProcessNodeVO)nodeList.get(j);
if(node.getStep()==2){
RoleTypeVO roleType = payrollDelegate.getRoleTypeByRoleId(node.getRoleId());
if(roleType!=null){
roleTypeName = roleType.getTypeName();
}
}
}
instancecontentvo.setElement_id(elementID);
instancecontentvo.setElement_name(elementName);
instancecontentvo.setHRMSElementName(hrmsElementName);
...
instancecontentvo.setCreate_by(apply_employee_id); //创建人
instancecontentvo.setPayrollId(payrollID);
instancecontrolvo.setProcess_id(processID);
instancecontrolvo.setStep(2); //申报时的初始step为2
// BaseConfigConstants.IS_DRAFT_NO 为正式提交 ,其他为草稿 ,2写到常量里去
if((BaseConfigConstants.IS_DRAFT_NO).trim().equals(applyForm.getIsDraft())){
instancecontentvo.setContentStatus(getContentStatusByRoleType(roleTypeName)); //员工提交申报后的状态
}
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors errors = new ActionErrors();
//几个重要参数 paryrollID , elementID, processID, apply_employee_id(申报人的person_id),organization_id
ApplyForm applyForm = (ApplyForm) form;
//return list Exception
List<InstanceContentVO> errorList = new ArrayList<InstanceContentVO>();
//获取模板开始
//elementID & payrollId 是联合主键
int elementID = applyForm.getApplyVO().getElementId();
String elementName = applyForm.getElementVO().getElementName();
EmployeeVO employeeVO=getEmployeeVO(request); //得到申报用户的 person_id;
int apply_employee_id=employeeVO.getEmployeeId();
int payrollID =applyForm.getAssignmentvo().getPayrollId(); // 根据申报用户的 person_id 获取payrollID
String hrmsElementName = applyForm.getElementVO().getHrms_elementName();
if ((Integer) elementID != null && (Integer) payrollID != 0 && (Integer) apply_employee_id != null ) {
//获取模板
request.setAttribute("Templatelist", this.getTemplateInfo(elementID, payrollID));
int processID=0;
//获取流程ID
ApplicationDelegate applicationDelegate = new ApplicationDelegate();
String processIDStr = applicationDelegate.getProcessID(elementID, payrollID);
if(processIDStr!=null ){
processID=Integer.parseInt(processIDStr.trim());
}
//创建审批的数据保存
List applyList = applyForm.getApplyVO().getInstanceContentList();//获取到页面的数据
//连接系统中的开始时间和开始日期,后者结束时间和结束日期格式成字符串
setListAfter_connectTime(applyList);
if(applyList.isEmpty()){
throw new ApplicationException("A0000B0107", "Submit fail: Can't submit empty record!" );
}
//这个两个表的VO
InstanceContentVO instancecontentvo = new InstanceContentVO();
InstanceControlVO instancecontrolvo = new InstanceControlVO();
//这里需要根据processID查询step为2的roleID,再根据roleID查询对应的roleType,根据roleType设置对应的状态值
String roleTypeName = "";
PayrollDelegate payrollDelegate = new PayrollDelegate();
ProcessVO processVO = payrollDelegate.getProcessById(processID);
List nodeList = processVO.getProcessNodeList();
for(int j=0;j<nodeList.size();j++){
ProcessNodeVO node = (ProcessNodeVO)nodeList.get(j);
if(node.getStep()==2){
RoleTypeVO roleType = payrollDelegate.getRoleTypeByRoleId(node.getRoleId());
if(roleType!=null){
roleTypeName = roleType.getTypeName();
}
}
}
instancecontentvo.setElement_id(elementID);
instancecontentvo.setElement_name(elementName);
instancecontentvo.setHRMSElementName(hrmsElementName);
...
instancecontentvo.setCreate_by(apply_employee_id); //创建人
instancecontentvo.setPayrollId(payrollID);
instancecontrolvo.setProcess_id(processID);
instancecontrolvo.setStep(2); //申报时的初始step为2
// BaseConfigConstants.IS_DRAFT_NO 为正式提交 ,其他为草稿 ,2写到常量里去
if((BaseConfigConstants.IS_DRAFT_NO).trim().equals(applyForm.getIsDraft())){
instancecontentvo.setContentStatus(getContentStatusByRoleType(roleTypeName)); //员工提交申报后的状态
}