天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 769|回复: 5

[已解决] 在流程中,审批人角色获取不正确

[复制链接]
伊示雅 发表于 2013-10-15 17:12:56 | 显示全部楼层 |阅读模式
本帖最后由 kimi 于 2013-10-15 17:30 编辑

在审批流程中,审批人脚本中,用户的角色和相关审批角色比较,取值不正确
kimi 发表于 2013-10-15 17:16:05 | 显示全部楼层
您好:可否把您的脚本贴出来呢?
 楼主| 伊示雅 发表于 2013-10-15 17:20:04 | 显示全部楼层
var userIds=getItemValue("权限用户");
println("【选择权限用户】权限用户ID:"+userIds);
var flag=isNotNull(userIds);
var userList = createObject("java.util.ArrayList");
if(flag){
        var finaRole= getRoleByName("财务总监");
        println("【财务总监的 ID】"+finaRole.getId());
        userIds=new String(userIds).toString().split(";");
        for(var i=0;i<userIds.length;i++){
                println("【选择财务总监】责任人ID:"+userIds[i]);
                var userVO = getUserById(userIds[i]);
                var roles = userVO.getRoles();
                if(roles != null && roles.size()>0){
                        for(var iter=roles.iterator(); iter.hasNext();){   
                                var userRole=iter.next();
                                println("循环到角色【"+userRole.getName()+"】,ID是:"+userRole.getId());
                                println("userRole="+userRole+": finaRole = "+finaRole);
                                println(userRole==finaRole);
                                if(userRole==finaRole){
                                        println("权限用户ID=="+userIds[i]+";用户角色=="+userRole.getId()+"; 财务总监ID==" +finaRole.getId());
                                        userList.add(userVO);
                                        break;
                                }
                        }
                }
        }
}
println(userList);
userList;
kimi 发表于 2013-10-15 17:26:10 | 显示全部楼层
您好:麻烦您把这里的代码if(userRole==finaRole)  改为if(userRole.getId().equals(finaRole.getId()))
您先尝试,有问题我们再沟通。
 楼主| 伊示雅 发表于 2013-10-15 17:28:44 | 显示全部楼层
恩恩,可以了,谢谢
kimi 发表于 2013-10-15 17:30:13 | 显示全部楼层
恩好的,感谢您的反馈。

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-13 04:30

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表