|
|
@@ -13,10 +13,7 @@ import com.google.common.collect.Lists;
|
|
|
import com.zhongshu.card.client.model.org.AuthModel;
|
|
|
import com.zhongshu.card.client.model.org.EditAuthParam;
|
|
|
import com.zhongshu.card.client.model.org.ModularModel;
|
|
|
-import com.zhongshu.card.client.model.org.role.RoleAddParam;
|
|
|
-import com.zhongshu.card.client.model.org.role.RoleModel;
|
|
|
-import com.zhongshu.card.client.model.org.role.RoleQueryParam;
|
|
|
-import com.zhongshu.card.client.model.org.role.RoleSearchParam;
|
|
|
+import com.zhongshu.card.client.model.org.role.*;
|
|
|
import com.zhongshu.card.client.type.DataState;
|
|
|
import com.zhongshu.card.client.type.EditType;
|
|
|
import com.zhongshu.card.client.type.PermissionPointType;
|
|
|
@@ -30,7 +27,6 @@ import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.domain.org.OrganizationUser;
|
|
|
import com.zhongshu.card.server.core.domain.org.Role;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
-import com.zhongshu.card.server.core.domain.scene.RoleSceneInfo;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.scene.RoleSceneInfoService;
|
|
|
@@ -802,6 +798,35 @@ public class RoleServiceImpl extends SuperService {
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
+ public ResultContent<List<RoleSimpleModel>> xcxGetCurrentRoles() {
|
|
|
+ String projectOid = getCurrentProjectOid();
|
|
|
+ String userId = getCurrentUserId();
|
|
|
+ return ResultContent.buildSuccess(getUserInProjectRoles(projectOid, userId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 得到用户在项目下所有的角色信息
|
|
|
+ *
|
|
|
+ * @param projectOid
|
|
|
+ * @param userId
|
|
|
+ */
|
|
|
+ public List<RoleSimpleModel> getUserInProjectRoles(String projectOid, String userId) {
|
|
|
+ List<RoleSimpleModel> models = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotEmpty(projectOid) && ObjectUtils.isNotEmpty(userId)) {
|
|
|
+ List<OrganizationUser> list = organizationUserDao.findByUserIdAndProjectOidAndIsOrg(userId, projectOid, Boolean.TRUE);
|
|
|
+ List<Role> roles = new ArrayList<>();
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
+ list.stream().forEach(it -> {
|
|
|
+ if (ObjectUtils.isNotEmpty(it.getRoles())) {
|
|
|
+ roles.addAll(it.getRoles());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ models = roles.stream().map(this::toSimpleModel).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return models;
|
|
|
+ }
|
|
|
+
|
|
|
//--------------------------模型转换 start---------------------
|
|
|
|
|
|
public List<RoleModel> toModels(List<Role> roles) {
|
|
|
@@ -819,4 +844,12 @@ public class RoleServiceImpl extends SuperService {
|
|
|
return roleModel;
|
|
|
}
|
|
|
|
|
|
+ public RoleSimpleModel toSimpleModel(Role role) {
|
|
|
+ RoleSimpleModel roleModel = new RoleSimpleModel();
|
|
|
+ if (ObjectUtils.isNotEmpty(role)) {
|
|
|
+ BeanUtils.copyProperties(role, roleModel);
|
|
|
+ }
|
|
|
+ return roleModel;
|
|
|
+ }
|
|
|
+
|
|
|
}
|