예제 #1
0
  /**
   * start CreditNote WorkFlow [serviceSheetNo] equals [CreditNoteNo]
   *
   * @param cnForm
   * @param cnm
   * @return
   * @throws Exception
   */
  @SuppressWarnings("rawtypes")
  public String startCreditNoteWorkFlow(CreditNoteForm cnForm, CreditNoteMain cnm)
      throws Exception {
    if (cnm.getId() == null) {
      throw new IllegalArgumentException("CreditNoteMain-->id can not be null!!!");
    }
    String wfid = workflowService.getBusinessId();
    UserForm uf = new UserForm();
    uf.setId(cnForm.getCurrentUserId());
    uf.setUserName(cnForm.getCurrentUserName());
    uf.setPosition("");
    log.info("CreditNote->启动工作流开始...............");
    String[] roleConfig = workFlowInit.getAllRole2(tmplateName, "C", cnForm.getStType());
    String[] nextRole =
        workFlowInit.getNextRole(
            roleConfig,
            Integer.parseInt(wfid),
            BPEProcessConstants.NOTQUERY,
            BPEProcessConstants.NOUPDATENEXTROLETABLE);
    Map<String, Object> businessMap = new HashMap<String, Object>();
    businessMap.put("varOrganizationCode", cnForm.getOrgCode());
    businessMap.put("varPcType", "C");
    businessMap.put("varStType", cnForm.getStType());
    businessMap.put(ParameterConstants.PARAM_BUSINESS_CODE, cnm.getId() + "");

    // 准备申请流程参数
    Map params = workFlowInit.initapplyMap(businessMap, uf, wfid.toString(), tmplateId);
    // 当前用户对象封装
    NewsisUser nu = new NewsisUser();
    nu.setUserId(String.valueOf(uf.getId()));
    nu.setUserName(uf.getUserName());
    String[] strs = new String[] {nextRole[0]};
    Long[] longs = new Long[strs.length + 2];
    longs[0] = null;
    longs[1] = null;
    for (int i = 0; i < strs.length; i++) {
      longs[i + 2] = new Long(strs[i]);
    }
    String roleConfigStr = roleConfig[0];
    if (roleConfigStr.indexOf(",") != -1) {
      roleConfigStr = roleConfigStr.substring(0, roleConfigStr.indexOf(","));
    }
    WBIDBOperateBo wbido = new WBIDBOperateBo();
    wbido.insertStartInfo(
        Long.parseLong(wfid),
        "D",
        uf.getId(),
        cnm.getId(),
        cnForm.getCnNo(),
        new Long(roleConfigStr),
        longs);
    // /启动BPE申请工作流
    IWorkFlowService workFlowService = (IWorkFlowService) workflowService;
    workFlowService.doStartProcess(params, nu);
    return wfid;
  }
예제 #2
0
  /**
   * Method of submiting controled part applicaiton
   *
   * @param ralpf Controled part application
   * @param approveRoles Approve role list
   * @return 1:Successful,-1:Unsuccessful
   */
  public int pageSave(RepairApplicationPRForm ralpf, UserForm uf) {
    int returnFlag = -1;
    AllDefaultDaoImp daoImp = (AllDefaultDaoImp) SpringContextUtil.getBean("dao");
    String stType =
        ((CommonSearch) SpringContextUtil.getBean("commonSearch"))
            .findStTypeByOrgCode(ralpf.getOrganizationCode());
    WorkFlowConfigRole wfcr = null;
    try {

      ralpf.setWorkflowId(Long.valueOf(workFlowService.getBusinessId()));
      /* *******************************************************************/
      /*@Added/Modified by        : Deepak
      /*@Date                     : 14/10/2012
      /*@Reason                   : Part request application workflow
      /**********************************************************************/
      MultiEntity multiEntity = (MultiEntity) SpringContextUtil.getBean("multiEntity");
      String[] roleConfig = null;
      if (!multiEntity.getCountryCode().equalsIgnoreCase("IN")) {
        roleConfig =
            workFlowInit.getAllRole(BPEProcessConstants.PARTREQUEST, stType); // need to change
        ralpf.setAllApproveRoles(roleConfig[0]);
        logger.info("if ===from getallrole pagesave method==Deepak==" + roleConfig[0]);
      } else {
        if (ralpf.getWarrantyType().equals("O") && ralpf.getPartFeeType().equals("N")) {
          wfcr = daoImp.findByTempNameAndStep(BPEProcessConstants.PARTREQUEST, "STEP2", stType);
          logger.info("if part wfcr.getConfigRole()" + wfcr.getConfigRole());
          ralpf.setAllApproveRoles(wfcr.getConfigRole());

        } else {
          wfcr = daoImp.findByTempNameAndStep(BPEProcessConstants.PARTREQUEST, "STEP1", stType);
          //                  System.out.println("else part
          // wfcr.getConfigRole()"+wfcr.getConfigRole());
          ralpf.setAllApproveRoles(wfcr.getConfigRole());
          logger.info("else ===from getallrole pagesave method==Deepak==" + wfcr.getConfigRole());
        }
      }
      logger.info("===Pagesave method of Repair applicationPRBo.java file ");
      /** ******************************************************************* */
      returnFlag = this.getDao().insert(ralpf) ? 1 : -1;

      String tmplateId = "13";

      Map businessMap = new HashMap();
      businessMap.put("businessCode", ralpf.getServiceSheetNo());
      businessMap.put("varStType", stType);
      businessMap.put("varOrganizationCode", String.valueOf(ralpf.getOrganizationCode()));
      Map params =
          workFlowInit.initapplyMap(businessMap, uf, ralpf.getWorkflowId().toString(), tmplateId);
      NewsisUser nu = new NewsisUser();

      nu.setUserId(String.valueOf(uf.getId()));
      nu.setUserName(uf.getUserName());

      //			/***/
      WBIDBOperateBo wbido = new WBIDBOperateBo();
      String[] strs = ralpf.getAllApproveRoles().split(",");
      Long[] longs = new Long[strs.length + 2];
      longs[0] = null;
      longs[1] = null;
      for (int i = 0; i < strs.length; i++) {
        longs[i + 2] = new Long(strs[i]);
      }
      wbido.insertStartInfo(
          ralpf.getWorkflowId(),
          "P",
          ralpf.getApplyMan(),
          ralpf.getRepairNo(),
          ralpf.getServiceSheetNo(),
          new Long(strs[0]),
          longs);

      //			    System.out.println("写入到RepairUnRepairStatusInfoForm-----");
      List batchInsertList = new ArrayList();
      RepairUnRepairStatusInfoForm rursif = new RepairUnRepairStatusInfoForm();
      rursif.setRepairNo(ralpf.getRepairNo());
      rursif.setUnRepairStatus("E"); // Waiting for internal approve
      rursif.setDbBeginDate(((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
      rursif.setOrganizationCode(ralpf.getOrganizationCode().toString());
      rursif.setUnrepairGenType("A");
      rursif.setWorkFlowNo(ralpf.getWorkflowId().toString());
      rursif.setCreateBy(ralpf.getCreateBy());
      rursif.setCreateDate(Operate.toUtilDate());
      batchInsertList.add(rursif);

      returnFlag = this.getBatchDao().insertBatch(batchInsertList) ? 1 : -1;
      //			///启动BPE申请工作流
      ProcessInfo pinfo = workFlowService.doStartProcess(params, nu);

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