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 c5f769b4..bdc20412 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/CooperationController.java b/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/CooperationController.java index 9efb8a34..682f4495 100644 --- a/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/CooperationController.java +++ b/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/CooperationController.java @@ -326,6 +326,27 @@ public class CooperationController { return web.removeCooperationMember(teamId, userIds); } + /** + * 权限复制 + * @param uc + * @param teamId + * @param userid + * @param targetUserid + * @return + */ + @Mapping("com.actionsoft.apps.coe.pal.cooperation_manage_team_member_perm_copy") + public String copyCooperationMemberPerm(UserContext uc,String teamId,String userid,String targetUserid){ + CooperationWeb web = new CooperationWeb(uc); + return web.copyCooperationMemberPerm(teamId,userid,targetUserid); + } + @Mapping("com.actionsoft.apps.coe.pal.cooperation_test") + public String test(UserContext uc) { + ResponseObject ro = ResponseObject.newOkResponse(); + List allTeamInfo = CooperationCache.getAllTeamInfo(); + ro.put("perms",allTeamInfo); + + return ro.toString(); + } } 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 c7a360d6..5d9f4a6f 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 @@ -1693,6 +1693,53 @@ public class CooperationWeb extends ActionWeb { return data; } + /** + * 权限复制 + * @param teamId + * @param userid 待复制用户id + * @param targetUserid 目标用户id + * @return + */ + public String copyCooperationMemberPerm(String teamId,String userid,String targetUserid){ + ResponseObject ro = ResponseObject.newOkResponse(); + CoeUser coeUser = new CoeUser(); + if(userid.equals(targetUserid)){ + return ResponseObject.newErrResponse("待复制用户id与目标用户id不能相同").toString(); + } + if (!coeUser.validateIsAccessCOE(userid) || !coeUser.validateIsAccessCOE(targetUserid)){ + return ResponseObject.newErrResponse("用户id异常").toString(); + } + CoeCooperationAPIManager api = CoeCooperationAPIManager.getInstance(); + if (CoeCooperationAPIManager.getInstance().queryCooperationRoleByUser(teamId,userid) == null || CoeCooperationAPIManager.getInstance().queryCooperationRoleByUser(teamId,targetUserid) == null){ + return ResponseObject.newErrResponse("参与复制的用户必须在对应小组下").toString(); + } + + //处理小组下成员信息,先删除关系,后将target的角色id复制到user上新增 + api.removeCooperationMemeber(teamId,userid); + List memberModels = api.queryCooperationTeamMembersByUser(teamId, targetUserid); + Timestamp now = new Timestamp(System.currentTimeMillis()); + List copyUsers = new ArrayList<>(); + for (CoeCooperationMemberModel memberModel : memberModels) { + CoeCooperationMemberModel member = new CoeCooperationMemberModel(UUIDGener.getUUID(), teamId, userid, memberModel.getRoleId(), _uc.getUID(), now, _uc.getUID(), now); + copyUsers.add(member); + } + api.createCooperationMemebers(copyUsers); + + //处理隐藏角色的权限复制, + CoeCooperationRoleModel originHideRole = api.queryCooperationTeamHideRole(teamId, userid); + api.removeCooperationRolePerms(teamId,originHideRole.getId()); + CoeCooperationRoleModel targetHideRole = api.queryCooperationTeamHideRole(teamId, targetUserid); + List targetRolePerms = api.queryCooperationRoleDataPermList(teamId, targetHideRole.getId()); + List permModelList = new ArrayList<>(); + for (CoeCooperationRolePermModel targetRolePerm : targetRolePerms) { + CoeCooperationRolePermModel permModel = new CoeCooperationRolePermModel(UUIDGener.getUUID(), teamId, originHideRole.getId(), targetRolePerm.getPalVersionId(), targetRolePerm.getActionPerm()); + permModelList.add(permModel); + } + api.createCooperationRolePerms(permModelList); + + return ro.toString(); + } + /** * 获取单位下第一级部门 * @param companyId