|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.fusion.common.PageInfo;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.enums.IdPreEnum;
|
|
|
+import com.fdkankan.fusion.common.enums.RoleKeyEnum;
|
|
|
import com.fdkankan.fusion.common.util.IdUtils;
|
|
|
import com.fdkankan.fusion.common.util.PatternEnum;
|
|
|
import com.fdkankan.fusion.common.util.RedisKeyUtil;
|
|
@@ -57,6 +58,10 @@ public class TmProjectServiceImpl extends ServiceImpl<ITmProjectMapper, TmProjec
|
|
|
ITmAttachmentService tmAttachmentService;
|
|
|
@Autowired
|
|
|
RedisUtil redisUtil;
|
|
|
+ @Autowired
|
|
|
+ ITmRoleService tmRoleService;
|
|
|
+ @Autowired
|
|
|
+ ITmUserRoleService tmUserRoleService;
|
|
|
|
|
|
@Override
|
|
|
public Object pageList(ProjectRequestDto tmProject) {
|
|
@@ -265,6 +270,27 @@ public class TmProjectServiceImpl extends ServiceImpl<ITmProjectMapper, TmProjec
|
|
|
if(CollectionUtils.isEmpty(idList)){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
+ List<TmProject> tmProjects = this.listByIds(idList);
|
|
|
+ Set<String> projectDeptIds = tmProjects.stream().map(TmProject::getDeptId).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ TmUser loginUser = tmUserService.getLoginUser();
|
|
|
+ TmRole tmRole = tmRoleService.getByUserId(loginUser.getId());
|
|
|
+ if(tmRole.getRoleKey().equals(RoleKeyEnum.ADMIN_DEPT.getName())){
|
|
|
+ List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(loginUser.getDeptId());
|
|
|
+ List<String> deptIds = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
|
|
|
+ for (String projectDeptId : projectDeptIds) {
|
|
|
+ if(!deptIds.contains(projectDeptId)){
|
|
|
+ throw new BusinessException(ResultCode.NOT_PER);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(tmRole.getRoleKey().equals(RoleKeyEnum.ADMIN_ORDINARY.getName())){
|
|
|
+ for (String projectDeptId : projectDeptIds) {
|
|
|
+ if(projectDeptId.equals(loginUser.getDeptId())){
|
|
|
+ throw new BusinessException(ResultCode.NOT_PER);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
LambdaUpdateWrapper<TmProject> wrapper = new LambdaUpdateWrapper<>();
|
|
|
wrapper.in(TmProject::getId,idList);
|
|
|
wrapper.set(TmProject::getIsTeached,commonDto.getStatus());
|