コード例 #1
0
  @Override
  public void flowStepUpdate(DeptContactParamVo params) {
    if (resultInfo.getOperateFlag()) {
      DeptContactMainVo mainVo = params.mainVo;

      TDeptContactMain mainBo =
          (TDeptContactMain) commonService.load(mainVo.getId(), TDeptContactMain.class);

      String taskUserLoginName = userInfo.getLoginName();

      try {
        BeanUtils.copyProperties(mainBo, mainVo);
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }

      mainBo.setUpdateTime(time);

      mainBo.setOperateDate(time);
      mainBo.setOperateUser(taskUserLoginName);
      mainBo.setOperateName(userInfo.getUserName());

      params.mainBo = mainBo;
      deptContactCommonService.saveReferences(params);

      commonService.update(mainBo);
    }
  }
コード例 #2
0
  @Override
  public void flowStepApply(DeptContactParamVo params) {
    if (resultInfo.getOperateFlag()) {
      String taskUserLoginName = LoginUtil.getUserLoginName(userInfo);
      // mainBo = (TDeptContactMain) params.get("mainBo");
      mainBo = (TDeptContactMain) commonService.load(operateVo.getId(), TDeptContactMain.class);
      params.addProcessParam("cname", mainBo.getProcessname());
      params.addProcessParam("cincident", mainBo.getIncidentno());

      boolean flag = flowApply();

      if (flag) {
        /** 相关资料 */
        params.mainBo = mainBo;
        deptContactCommonService.saveReferences(params);

        /** 取消 */
        if (DeptContactConstants.CHOICE_APPLY_TO_CANCEL.equals(operateVo.getChoice())) {
          mainBo.setRemoved(1);
        }

        /** 更新操作人及更新信息 */
        mainBo.setUpdateTime(time);
        mainBo.setOperateDate(time);
        mainBo.setOperateUser(taskUserLoginName);
        mainBo.setOperateName(userInfo.getUserName());
        commonService.update(mainBo);

        /** 保存意见 */
        deptContactCommonService.saveApprovedInfo(params);

        /** 更新待办事项状态 */
        updateTaskStatus(params.operateVo.getTaskId());

        /** 跳转URL */
        resultInfo.url = TextUtil.generateDeptContactUrl(mainBo, operateVo.getSteplabel());
      } else {
        resultInfo.addErrors(DeptContactMessage.FAIL_TO_COMPLETE_STEP);
        throw new RuntimeException(DeptContactMessage.FAIL_TO_COMPLETE_STEP.textCn);
      }
    }
  }
コード例 #3
0
  @Override
  public void flowStepSign(DeptContactParamVo params) {
    if (resultInfo.getOperateFlag()) {
      mainBo = (TDeptContactMain) commonService.load(operateVo.getId(), TDeptContactMain.class);

      // log.debug("id:"+operateVo.getId());
      // log.debug(params);

      params.addProcessParam("cname", mainBo.getProcessname());
      params.addProcessParam("cincident", mainBo.getIncidentno());

      boolean flag = flowSign();

      if (flag) {
        String taskUserLoginName = LoginUtil.getUserLoginName(userInfo);

        /** 更新操作人及更新信息 */
        mainBo.setUpdateTime(time);
        mainBo.setOperateDate(time);
        mainBo.setOperateUser(taskUserLoginName);
        mainBo.setOperateName(userInfo.getUserName());
        commonService.update(mainBo);

        /** 保存意见 */
        deptContactCommonService.saveApprovedInfo(params);

        /** 更新待办事项状态 */
        updateTaskStatus(params.operateVo.getTaskId());

        /** 跳转URL */
        resultInfo.url = TextUtil.generateDeptContactUrl(mainBo, operateVo.getSteplabel());
      } else {
        resultInfo.addErrors(DeptContactMessage.FAIL_TO_COMPLETE_STEP);
        throw new RuntimeException(DeptContactMessage.FAIL_TO_COMPLETE_STEP.textCn);
      }
    }
  }
コード例 #4
0
  @Override
  public void flowStepAdd(DeptContactParamVo params) {
    // log.debug(resultInfo.checkFlag+" "+resultInfo.checkOnly);
    if (resultInfo.getOperateFlag()) {

      String taskUserLoginName = LoginUtil.getUserLoginName(userInfo);
      String processName = DeptContactConstants.PROCESSNAME;

      /** 创建mainBo */
      mainBo = new TDeptContactMain();
      try {
        BeanUtils.copyProperties(mainBo, mainVo);
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }

      mainBo.setCreateDeptid(userInfo.getDeptId());
      mainBo.setCreateDeptname(userInfo.getDeptName());

      mainBo.setInitiator(userInfo.getLoginName());
      mainBo.setInitiatorName(userInfo.getUserName());

      mainBo.setStartTime(time);

      mainBo.setOperateDate(time);
      mainBo.setOperateUser(taskUserLoginName);
      mainBo.setOperateName(userInfo.getUserName());

      mainBo.setProcessname(processName);

      /** 添加关联信息 */
      TDeptContactTree treeBo = DeptContactUtil.generateTreeBo();
      params.treeBo = treeBo;

      treeBo.setCname(processName);
      treeBo.setType(DeptContactConstants.STATUS_MAIN);

      commonService.save(treeBo);

      /** 发起流程 */
      int incidentNo = flowBegin();

      if (incidentNo > 0) {

        String incidentNoStr = String.valueOf(incidentNo);
        mainBo.setIncidentno(incidentNoStr);
        commonService.save(mainBo);

        String id = StringUtil.getNotNullValueString(mainBo.getId());
        if (id.length() == 0) {
          log.warn(DeptContactMessage.FAIL_TO_SAVE_DATA);
          resultInfo.addErrors(DeptContactMessage.FAIL_TO_SAVE_DATA);
          throw new RuntimeException(DeptContactMessage.FAIL_TO_SAVE_DATA.textCn);
        }

        DeptContactUtil.copyOperateInfo(treeBo, mainBo);
        /** 更新关联信息 */
        treeBo.setCId(id);
        treeBo.setCincident(incidentNoStr);
        commonService.update(treeBo);

        try {

          params.addProcessParam("cname", mainBo.getProcessname());
          params.addProcessParam("cincident", mainBo.getIncidentno());

          params.mainBo = mainBo;
          deptContactCommonService.saveReferences(params);

          deptContactCommonService.saveApprovedInfo(params);

        } catch (Exception e) {
          e.printStackTrace();
        }

        /** 跳转URL */
        resultInfo.url =
            TextUtil.generateDeptContactUrl(
                mainBo.getProcessname(), incidentNoStr, mainBo.getProcessname(), incidentNoStr, "");
      } else {
        log.warn(DeptContactMessage.FAIL_TO_LAUNCH_PROCESS);
        resultInfo.addErrors(DeptContactMessage.FAIL_TO_LAUNCH_PROCESS);
        throw new RuntimeException(DeptContactMessage.FAIL_TO_LAUNCH_PROCESS.textCn);
      }
    }
  }