fix: 需求部门用户可看到自己发起的已完成任务
This commit is contained in:
parent
321274a312
commit
e716803cbb
@ -682,7 +682,8 @@ public class TaskService {
|
||||
|
||||
/**
|
||||
* 获取已完成任务列表(根据角色权限)
|
||||
* - 个人用户:只看自己接的已完成任务
|
||||
* - 需求部门用户:看自己发起的已完成任务
|
||||
* - 接单部门用户:看自己接单的已完成任务
|
||||
* - 部门负责人:看本部门所有已完成任务
|
||||
* - 管理员:看所有已完成任务
|
||||
*/
|
||||
@ -697,6 +698,15 @@ public class TaskService {
|
||||
boolean isAdmin = isAdminUser(userId);
|
||||
boolean isDeptHead = isDeptHeadUser(userId);
|
||||
|
||||
// 获取用户所属部门类型
|
||||
String deptType = null;
|
||||
if (user.getDeptId() != null) {
|
||||
Department dept = departmentMapper.selectById(user.getDeptId());
|
||||
if (dept != null) {
|
||||
deptType = dept.getDeptType();
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 构建查询条件
|
||||
Page<Task> pageParam = new Page<>(page, pageSize);
|
||||
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
||||
@ -716,10 +726,14 @@ public class TaskService {
|
||||
.eq(Task::getReceiverDeptId, user.getDeptId()) // 或本部门接的
|
||||
);
|
||||
log.info("部门负责人查看部门已完成任务: deptId={}", user.getDeptId());
|
||||
} else if ("demand".equals(deptType)) {
|
||||
// 需求部门用户:看自己发起的已完成任务
|
||||
wrapper.eq(Task::getPublisherId, userId);
|
||||
log.info("需求部门用户查看自己发起的已完成任务: userId={}", userId);
|
||||
} else {
|
||||
// 普通用户:只看自己接的
|
||||
// 接单部门用户:看自己接单的已完成任务
|
||||
wrapper.eq(Task::getReceiverId, userId);
|
||||
log.info("个人用户查看个人已完成任务: userId={}", userId);
|
||||
log.info("接单部门用户查看自己接单的已完成任务: userId={}", userId);
|
||||
}
|
||||
|
||||
// 4. 关键词搜索
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user