ACTION DD

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)); //员工提交申报后的状态
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值