|
|
|
@ -2,8 +2,13 @@ package com.ccsens.yanyuan.service; |
|
|
|
|
|
|
|
import com.ccsens.common.bean.dto.CRoleDto; |
|
|
|
import com.ccsens.common.bean.vo.CRoleVo; |
|
|
|
import com.ccsens.util.PropUtil; |
|
|
|
import com.ccsens.yanyuan.bean.dto.ProjectDto; |
|
|
|
import com.ccsens.yanyuan.bean.dto.RoleDto; |
|
|
|
import com.ccsens.yanyuan.bean.vo.ProjectVo; |
|
|
|
import com.ccsens.yanyuan.bean.vo.RoleVo; |
|
|
|
import com.ccsens.yanyuan.bean.vo.ToolVo; |
|
|
|
import com.ccsens.yanyuan.persist.dao.TraineeDao; |
|
|
|
import com.ccsens.yanyuan.persist.dao.UserRelationDao; |
|
|
|
import com.ccsens.yanyuan.util.YanYuanConstant; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -21,6 +26,8 @@ import java.util.List; |
|
|
|
public class RoleService implements IYRoleService { |
|
|
|
@Resource |
|
|
|
private UserRelationDao userRelationDao; |
|
|
|
@Resource |
|
|
|
private TraineeDao traineeDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public RoleVo.QueryRole queryShowRole(RoleDto.QueryRoleById param, Long userId) { |
|
|
|
@ -31,7 +38,42 @@ public class RoleService implements IYRoleService { |
|
|
|
return new RoleVo.QueryRole(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ProjectVo.ProjectInformation findProjectById(ProjectDto.ProjectById param, Long userId) { |
|
|
|
switch (param.getTemplateCode()) { |
|
|
|
case YanYuanConstant.Project.TEMPLATE_USER: return getUserProject(param.getProjectId(), userId); |
|
|
|
} |
|
|
|
|
|
|
|
return new ProjectVo.ProjectInformation(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询项目信息 |
|
|
|
* @param projectId |
|
|
|
* @param userId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private ProjectVo.ProjectInformation getUserProject(Long projectId, Long userId) { |
|
|
|
|
|
|
|
ToolVo.UserInfoSimple simple = traineeDao.getSimpleByKeyId(projectId); |
|
|
|
if (simple == null) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
ProjectVo.ProjectInformation information = new ProjectVo.ProjectInformation(); |
|
|
|
information.setId(simple.getKeyUserId()); |
|
|
|
information.setName( simple.getUserName() + "智能训练"); |
|
|
|
information.setUrl(PropUtil.domain); |
|
|
|
return information; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询项目角色 |
|
|
|
* @param projectId 项目ID |
|
|
|
* @param userId 用户ID |
|
|
|
* @return 角色 |
|
|
|
*/ |
|
|
|
private RoleVo.QueryRole getUserRole(Long projectId, Long userId) { |
|
|
|
log.info("查询用户角色:{},{}", projectId, userId); |
|
|
|
RoleVo.QueryRole queryRole = new RoleVo.QueryRole(); |
|
|
|
List<CRoleVo.RoleInfo> visibleList = new ArrayList<>(); |
|
|
|
List<CRoleVo.RoleInfo> invisibleList = new ArrayList<>(); |
|
|
|
@ -42,10 +84,12 @@ public class RoleService implements IYRoleService { |
|
|
|
BeanUtils.copyProperties(YanYuanConstant.YanYuanRole.Setting, setting); |
|
|
|
// 查询待审核的用户信息
|
|
|
|
int num = userRelationDao.getWaitAuditNum(projectId, userId); |
|
|
|
log.info("待审核用户信息:{}", num); |
|
|
|
setting.setRemindNum(num); |
|
|
|
visibleList.add(setting); |
|
|
|
queryRole.setVisibleList(visibleList); |
|
|
|
queryRole.setInvisibleList(invisibleList); |
|
|
|
log.info("角色:{}", queryRole); |
|
|
|
return queryRole; |
|
|
|
} |
|
|
|
|
|
|
|
|