小组权限复制功能阶段提交
This commit is contained in:
		
							parent
							
								
									136b351e97
								
							
						
					
					
						commit
						98efe9831a
					
				
										
											Binary file not shown.
										
									
								
							| @ -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<TeamInfo> allTeamInfo = CooperationCache.getAllTeamInfo(); | ||||
|         ro.put("perms",allTeamInfo); | ||||
| 
 | ||||
|         return ro.toString(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -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<CoeCooperationMemberModel> memberModels = api.queryCooperationTeamMembersByUser(teamId, targetUserid); | ||||
|         Timestamp now = new Timestamp(System.currentTimeMillis()); | ||||
|         List<CoeCooperationMemberModel> 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<CoeCooperationRolePermModel> targetRolePerms = api.queryCooperationRoleDataPermList(teamId, targetHideRole.getId()); | ||||
|         List<CoeCooperationRolePermModel> 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 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 anhc
						anhc