diff --git a/tall/src/main/java/com/ccsens/tall/bean/vo/RoleVo.java b/tall/src/main/java/com/ccsens/tall/bean/vo/RoleVo.java index 81364a5c..28789dd6 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/vo/RoleVo.java +++ b/tall/src/main/java/com/ccsens/tall/bean/vo/RoleVo.java @@ -1,5 +1,6 @@ package com.ccsens.tall.bean.vo; +import com.sun.org.apache.xpath.internal.operations.Bool; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -36,8 +37,22 @@ public class RoleVo { private String name; @ApiModelProperty("角色排序") private Integer sequence; - @ApiModelProperty("是否是pm 是pm;true 不是pm; false ") + @ApiModelProperty("是否是pm 是pm;true 不是pm; false") private Boolean isPM; + @ApiModelProperty("是否是变身后 0否 1是") + private Integer imitation=0; + @ApiModelProperty("该角色是否显示") + private Boolean isShow = true; + @ApiModelProperty("当前用户是否属于该角色") + private Boolean mine; + @ApiModelProperty("是否是项目虚拟的角色 0否 1是") + private Integer projectRole=0; + @ApiModelProperty("关联项目的id") + private Integer relevanceProjectId; + @ApiModelProperty("关联项目的名称") + private Integer relevanceProjectName; + @ApiModelProperty("是否是当前角色的奖惩干系人") + private Boolean stakeholder = false; } @Data @ApiModel("添加时返回成员信息") diff --git a/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java b/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java index 560b805a..0f5cb310 100644 --- a/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java +++ b/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java @@ -74,7 +74,7 @@ public interface IProRoleService { * @param param * @return */ - RoleVo.JueSeByProIdLists queryRoleShows(QueryDto param); + RoleVo.JueSeByProIdLists queryRoleShows(QueryDto param) throws Exception; void queryRoleIsShows(QueryDto param); diff --git a/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java b/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java index f814af83..7532d476 100644 --- a/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java +++ b/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java @@ -754,7 +754,7 @@ public class ProRoleService implements IProRoleService { } @Override - public RoleVo.JueSeByProIdLists queryRoleShows(QueryDto param) { + public RoleVo.JueSeByProIdLists queryRoleShows(QueryDto param) throws Exception { RoleVo.JueSeByProIdLists jueSeByProIdLists=new RoleVo.JueSeByProIdLists(); //获取成员id Long memberId = queryMemberId(param.getParam().getProjectId(), param.getUserId()); @@ -769,18 +769,46 @@ public class ProRoleService implements IProRoleService { List proRoles = proRoleMapper.selectByExample(proRoleExample1); List jili1=proRoles.stream().map(action->action.getId()).collect(Collectors.toList()); + //获取用户在项目中的角色 + List roleList = proMemberService.selectRolesByUserIdAndProjectId(param.getUserId(), param.getParam().getProjectId(), 0); + //查询已经添加的角色 List listBefor=proRoleDao.queryRoleShowslistAfter(memberId); List listBeforeId= listBefor.stream().map(action ->{return action.getId();}).collect(Collectors.toList()); for (int i = 0; i < listBefor.size(); i++) { + //是否项目经理 if(jili1.contains(listBefor.get(i).getId())){ listBefor.get(i).setIsPM(true); }else { listBefor.get(i).setIsPM(false); } + //当前用户是否属于该角色 + for (ProRole proRole : roleList) { + if (listBefor.get(i).getId().equals(proRole.getId())){ + listBefor.get(i).setMine(true); + }else{ + listBefor.get(i).setMine(false); + } + } } //查询未添加的角色 List listAfter=proRoleDao.queryRoleShowslistBefore(param.getParam().getProjectId(),listBeforeId); + for (int i = 0; i < listAfter.size(); i++) { + //是否项目经理 + if(jili1.contains(listBefor.get(i).getId())){ + listBefor.get(i).setIsPM(true); + }else { + listBefor.get(i).setIsPM(false); + } + //当前用户是否属于该角色 + for (ProRole proRole : roleList) { + if (listBefor.get(i).getId().equals(proRole.getId())){ + listBefor.get(i).setMine(true); + }else{ + listBefor.get(i).setMine(false); + } + } + } jueSeByProIdLists.setListAfter(listAfter); jueSeByProIdLists.setListBefore(listBefor); return jueSeByProIdLists; diff --git a/tall/src/main/java/com/ccsens/tall/web/RoleController.java b/tall/src/main/java/com/ccsens/tall/web/RoleController.java index 62ed2015..c3a222fe 100644 --- a/tall/src/main/java/com/ccsens/tall/web/RoleController.java +++ b/tall/src/main/java/com/ccsens/tall/web/RoleController.java @@ -127,7 +127,7 @@ public class RoleController { @MustLoginTall @ApiOperation(value = "获取该成员的角色信息和未添加的角色信息",notes = "") @RequestMapping(value = "/queryRoleShows", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse queryRoleShows(@ApiParam @Validated @RequestBody QueryDto param){ + public JsonResponse queryRoleShows(@ApiParam @Validated @RequestBody QueryDto param) throws Exception { log.info("传入参数:{}", param); RoleVo.JueSeByProIdLists jueSeByProIdLists=proRoleService.queryRoleShows(param); return JsonResponse.newInstance().ok(jueSeByProIdLists); diff --git a/tall/src/main/resources/mapper_dao/ProRoleDao.xml b/tall/src/main/resources/mapper_dao/ProRoleDao.xml index 0099670b..814abbd6 100644 --- a/tall/src/main/resources/mapper_dao/ProRoleDao.xml +++ b/tall/src/main/resources/mapper_dao/ProRoleDao.xml @@ -357,6 +357,8 @@ where tpr.rec_status=0 and tpr.project_id=#{param1} and tpr.parent_id !=0 + and (SELECT name FROM t_pro_role pr WHERE tpr.parent_id = pr.id) in ('PM','Member') + and tpr.name not IN('观众', 'MVP') and tpr.id not in