// 签收
  @At("/apply")
  @Ok("redirect:locate.action?runactkey=${obj.runactkey}")
  public Map apply(String runactkey) throws Exception {
    DynamicObject swapFlow = get_author_common();

    String loginname = swapFlow.getFormatAttr(GlobalConstants.swap_coperatorloginname);
    boolean sign =
        partyduebaseapproveService
            .getWorkFlowEngine()
            .getActManager()
            .enableApplyNew(runactkey, loginname, DBFieldConstants.PUB_PARTICIPATOR_PERSON);

    if (!sign) {
      throw new RuntimeException("您没有操作权限!");
    }

    VApply vo = new VApply();
    vo.userid = swapFlow.getFormatAttr(GlobalConstants.swap_coperatorid);
    vo.loginname = swapFlow.getFormatAttr(GlobalConstants.swap_coperatorloginname);
    vo.username = swapFlow.getFormatAttr(GlobalConstants.swap_coperatorloginname);
    vo.usertype = DBFieldConstants.PUB_PARTICIPATOR_PERSON;
    vo.runactkey = runactkey;

    partyduebaseapproveService.getWorkFlowEngine().getActManager().vapply(vo);

    ro.put("runactkey", runactkey);

    return ro;
  }
  public void loc(String runactkey) throws Exception {
    HttpSession session = Mvcs.getHttpSession(true);
    DynamicObject token =
        (DynamicObject)
            session.getAttribute(com.skynet.framework.spec.GlobalConstants.sys_login_token);
    String deptid = token.getFormatAttr(com.skynet.framework.spec.GlobalConstants.sys_login_dept);

    DynamicObject ract =
        partyduebaseapproveService
            .getWorkFlowEngine()
            .getActManager()
            .getRactService()
            .locate(runactkey);
    String id = ract.getFormatAttr("dataid");
    String tableid = ract.getFormatAttr("tableid");
    DynamicObject baseapprove = partyduebaseapproveService.locate(id);
    DynamicObject baseapprovedetail =
        partyduebaseapprovedetailService.locateBy(
            Cnd.where("suggestid", "=", id).and("deptid", "=", deptid));
    List<DynamicObject> baseapprovedetails =
        partyduebaseapprovedetailService.findByCond(Cnd.where("suggestid", "=", id)); // 汇总意见
    // 权限设置
    set_author();

    // 查询可选路由
    String actdefid = ract.getFormatAttr("actdefid");
    List<DynamicObject> routes =
        partyduebaseapproveService
            .getWorkFlowEngine()
            .getFlowManager()
            .getBrouteService()
            .getRoutes(actdefid);

    ro.put("tableid", tableid);
    ro.put("runactkey", runactkey);
    ro.put("baseapprove", baseapprove);
    ro.put("baseapprovedetail", baseapprovedetail);
    ro.put("baseapprovedetails", baseapprovedetails);
    ro.put("routes", routes);
  }
  public DynamicObject get_author_common() throws Exception {
    // 获取各类权限
    // 流程信息
    DynamicObject swapFlow = ActionHelper.prepared_author_base();

    String runactkey = Mvcs.getReq().getParameter("runactkey");
    DynamicObject ract =
        partyduebaseapproveService
            .getWorkFlowEngine()
            .getActManager()
            .getRactService()
            .locate(runactkey);
    String runflowkey = ract.getFormatAttr("runflowkey");
    String dataid = ract.getFormatAttr("dataid");

    swapFlow.setAttr(GlobalConstants.swap_dataid, dataid);
    swapFlow.setAttr(GlobalConstants.swap_runactkey, runactkey);
    swapFlow.setAttr(GlobalConstants.swap_runflowkey, runflowkey);

    swapFlow.setAttr(GlobalConstants.swap_tableid, "PartyDue");

    return swapFlow;
  }