EAS_审批转交相关实现

EAS后台有个意见表,意见表里保存打回,跳转、加签、转交等时的意见

 表中一个属性type标识了各个类型

表中的数据如下,该表保存了转交的意见,单据id,转交后的人,操作前的流程id,操作后的流程id、活动示例id

 

如果要实现转交我们可以参考如下实现

IEnactmentService svc = EnactmentServiceFactory.createEnactService(ctx);
             AssignmentInfo assign = svc.getAssignmentById(inParam.getTaskId());
           if ((!(assign.getState().equals(WfAssignmentState.ASSIGNED)))
                   && (!(assign.getState().equals(WfAssignmentState.ACCEPTED)))){
               throw new Exception("任务已处理,无法继续转交");
           }
            String personUserName = assign.getAssignInfo().getPersonUserName();
            String personUserId = assign.getAssignInfo().getPersonUserID().toString();
            if (userId.equals(personUserId)){
                throw new Exception("任务已在转交人待办任务中,无法继续转交,请重新选择转交人");
            }
            WfAssignmentState state = assign.getState();
            if (state.equals(WfAssignmentState.ACCEPTED) || state.equals(WfAssignmentState.ASSIGNED)) {
                Locale locale = ctx.getLocale();
                HashMap<Object, Object> localMap = new HashMap<Object, Object>();
                String opinionStr = inParam.getOpinion() +"\n"+"转交人:"+personUserName;
                localMap.put(locale, opinionStr);
                svc.forwardAssignment(assignId, userId, localMap);
            }

 

 我们如果想要传给按EAS页面将转交的先关意见给第三方,可以按如下方式

   private void addtip() {
        String tip = "";

        try {
            String sql = "select c.ftype,c.FOpinion_l2,c.fassignmentid FROM t_bas_option c \t WHERE c.FNEXTASSIGNID='" + this.assignmentId + "'";
            IRowSet rs = null;
            IEnactmentService svc = EnactmentServiceFactory.createRemoteEnactService();
            ISQLExecutor sqlExecutor = SQLExecutorFactory.getRemoteInstance(sql);
            rs = sqlExecutor.executeSQL();
            if (rs != null && rs.next()) {
                AssignmentInfo Info = svc.getAssignmentById(rs.getString(3));
                String type = OptionType.getEnum(Integer.parseInt(rs.getString(1).toString())).getAlias();
                String opinion = rs.getString(2);
                if (opinion == null) {
                    opinion = "空";
                }
                tip = "此审批任务为 [" + Info.getAssignInfo().getPersonUserName() + "] 在节点 [" + Info.getActDefName(this.getCurrentLocale()) + "] " + type + "的任务," + type + "意见:" + opinion;
        System.out.println(tip);
            }
        } catch (Exception var9) {
            log.error(var9);
        }

    }

 

posted @ 2025-07-16 18:10  凉了记忆  阅读(14)  评论(0)    收藏  举报