diff --git a/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar b/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar index 707633c7..1ebdf505 100644 Binary files a/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar and b/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar differ diff --git a/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java b/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java index aed2f9d4..a84fa2b4 100644 --- a/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java +++ b/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java @@ -697,10 +697,19 @@ public class CooperationWeb extends ActionWeb { Timestamp now = new Timestamp(System.currentTimeMillis()); List memberList = new ArrayList<>(); boolean isOlderVersion = SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal", "IsOlderVersion", true); - if (isOlderVersion){ + + JSONArray roleIds = new JSONArray(); + if (!isOlderVersion){ // 查询当前设置的角色 String roleId = dataObj.getString("roleId"); - CoeCooperationRoleDao roleDao = new CoeCooperationRoleDao(); + roleIds.add(roleId); + }else { + roleIds = dataObj.getJSONArray("roleId"); + } + //多角色的校验 + CoeCooperationRoleDao roleDao = new CoeCooperationRoleDao(); + for (int i = 0; i < roleIds.size(); i++) { + String roleId = roleIds.getString(i); CoeCooperationRoleModel role = roleDao.getInstance(roleId); // 如果当前设置的角色不是管理员,查询其他用户是否有管理员角色,小组中必须有至少一位管理员用户 if (role.getRoleType() != CoeCooperationConst.ROLE_TYPE_MANAGER) { @@ -716,52 +725,21 @@ public class CooperationWeb extends ActionWeb { if (!flag) { return ResponseObject.newErrResponse("不允许修改,小组中必须至少存在一位管理员用户").toString(); } + }else { + break; } - for (int i = 0; i < userIds.size(); i++) { - //删除原有角色 - api.removeCooperationMemeber(teamId,userIds.getString(i)); + } + //设置多角色 + for (int i = 0; i < userIds.size(); i++) { + //删除原有角色 + api.removeCooperationMemeber(teamId,userIds.getString(i)); + for (int j = 0; j < roleIds.size(); j++) { + String roleId = roleIds.getString(j); CoeCooperationMemberModel memberModel = new CoeCooperationMemberModel(UUIDGener.getUUID(),teamId,userIds.getString(i),roleId,_uc.getUID(),now,_uc.getUID(),now); memberList.add(memberModel); - //重新添加多角色 - api.createCooperationMemebers(memberList); - } - }else { - //设置多角色的校验 - JSONArray roleIds = dataObj.getJSONArray("roleId"); - CoeCooperationRoleDao roleDao = new CoeCooperationRoleDao(); - for (int i = 0; i < roleIds.size(); i++) { - String roleId = roleIds.getString(i); - CoeCooperationRoleModel role = roleDao.getInstance(roleId); - // 如果当前设置的角色不是管理员,查询其他用户是否有管理员角色,小组中必须有至少一位管理员用户 - if (role.getRoleType() != CoeCooperationConst.ROLE_TYPE_MANAGER) { - // 查询其他用户的角色是否有管理员 - boolean flag = false; - List adminUsers = api.queryCooperationAdminUsers(teamId); - for (String adminUser : adminUsers) { - if (!userIds.contains(adminUser)) { - flag = true; - break; - } - } - if (!flag) { - return ResponseObject.newErrResponse("不允许修改,小组中必须至少存在一位管理员用户").toString(); - } - }else { - break; - } - } - //设置多角色 - for (int i = 0; i < userIds.size(); i++) { - //删除原有角色 - api.removeCooperationMemeber(teamId,userIds.getString(i)); - for (int j = 0; j < roleIds.size(); j++) { - String roleId = roleIds.getString(j); - CoeCooperationMemberModel memberModel = new CoeCooperationMemberModel(UUIDGener.getUUID(),teamId,userIds.getString(i),roleId,_uc.getUID(),now,_uc.getUID(),now); - memberList.add(memberModel); - } - //重新添加多角色 - api.createCooperationMemebers(memberList); } + //重新添加多角色 + api.createCooperationMemebers(memberList); } //更新用户权限缓存 CooperationCache.updateTeamInfo(teamId); @@ -824,7 +802,7 @@ public class CooperationWeb extends ActionWeb { actionPermOpts.add(actionObj3); }else { JSONObject actionObj1 = new JSONObject(); - actionObj1.put("value", "新增、修改"); + actionObj1.put("value", "新建流程"); actionObj1.put("label", CoeCooperationConst.ACTION_CREATE_PROCESS); JSONObject actionObj2 = new JSONObject(); actionObj2.put("value", "批量创建/替换"); @@ -834,14 +812,14 @@ public class CooperationWeb extends ActionWeb { JSONObject actionObj3 = new JSONObject(); - actionObj1.put("value", "编辑"); - actionObj1.put("label", CoeCooperationConst.ACTION_WRITE); + actionObj3.put("value", "编辑"); + actionObj3.put("label", CoeCooperationConst.ACTION_WRITE); JSONObject actionObj4 = new JSONObject(); - actionObj2.put("value", "删除"); - actionObj2.put("label", CoeCooperationConst.ACTION_DELETE); + actionObj4.put("value", "删除"); + actionObj4.put("label", CoeCooperationConst.ACTION_DELETE); JSONObject actionObj5 = new JSONObject(); - actionObj3.put("value", "版本管理"); - actionObj3.put("label", CoeCooperationConst.ACTION_VERSION); + actionObj5.put("value", "版本管理"); + actionObj5.put("label", CoeCooperationConst.ACTION_VERSION); dataActionPermOpts.add(actionObj3); dataActionPermOpts.add(actionObj4); dataActionPermOpts.add(actionObj5);