feat: 完善一级需求任务显示

1. 任务查询中添加一级需求发起人信息(primaryPublisherName, primaryPublisherDeptName)
2. 需求部门完善人的已完成任务中显示一级需求任务(通过detail_completer_id查询)
3. fillTaskRelatedInfo方法填充一级需求发起人信息
This commit is contained in:
Your Name 2026-01-20 00:44:00 +08:00
parent 048c5e189e
commit 29dbaf1d69
2 changed files with 36 additions and 4 deletions

View File

@ -28,7 +28,9 @@ public interface TaskMapper extends BaseMapper<Task> {
" b.brand_name AS brand_name, " +
" c.category_name AS category_name, " +
" p.platform_name AS platform_name, " +
" approver.real_name AS current_approver_name " +
" approver.real_name AS current_approver_name, " +
" primary_user.real_name AS primary_publisher_name, " +
" primary_dept.dept_name AS primary_publisher_dept_name " +
"FROM task t " +
"LEFT JOIN sys_user u ON t.publisher_id = u.id " +
"LEFT JOIN sys_dept d ON t.publisher_dept_id = d.id " +
@ -36,6 +38,8 @@ public interface TaskMapper extends BaseMapper<Task> {
"LEFT JOIN category c ON t.category_id = c.id " +
"LEFT JOIN platform p ON t.platform_id = p.id " +
"LEFT JOIN sys_user approver ON t.current_approver_id = approver.id " +
"LEFT JOIN sys_user primary_user ON t.primary_publisher_id = primary_user.id " +
"LEFT JOIN sys_dept primary_dept ON t.primary_publisher_dept_id = primary_dept.id " +
"WHERE t.status = 'pending' AND t.approval_status = 'approved' AND t.deleted = 0 AND (t.is_pipeline = 0 OR t.is_pipeline IS NULL)" +
"<if test='taskTypeId != null'> AND t.task_type_id = #{taskTypeId}</if>" +
"<if test='demandTypeId != null'> AND t.demand_type_id = #{demandTypeId}</if>" +
@ -87,7 +91,9 @@ public interface TaskMapper extends BaseMapper<Task> {
" b.brand_name AS brand_name, " +
" c.category_name AS category_name, " +
" p.platform_name AS platform_name, " +
" approver.real_name AS current_approver_name " +
" approver.real_name AS current_approver_name, " +
" primary_user.real_name AS primary_publisher_name, " +
" primary_dept.dept_name AS primary_publisher_dept_name " +
"FROM task t " +
"LEFT JOIN sys_user u ON t.publisher_id = u.id " +
"LEFT JOIN sys_dept d ON t.publisher_dept_id = d.id " +
@ -95,6 +101,8 @@ public interface TaskMapper extends BaseMapper<Task> {
"LEFT JOIN category c ON t.category_id = c.id " +
"LEFT JOIN platform p ON t.platform_id = p.id " +
"LEFT JOIN sys_user approver ON t.current_approver_id = approver.id " +
"LEFT JOIN sys_user primary_user ON t.primary_publisher_id = primary_user.id " +
"LEFT JOIN sys_dept primary_dept ON t.primary_publisher_dept_id = primary_dept.id " +
"WHERE t.status = 'pending' AND t.approval_status = 'approved' AND t.deleted = 0 AND (t.is_pipeline = 0 OR t.is_pipeline IS NULL)" +
"<if test='allowedTaskTypeIds != null and allowedTaskTypeIds.size() > 0'>" +
" AND t.task_type_id IN " +
@ -153,7 +161,9 @@ public interface TaskMapper extends BaseMapper<Task> {
" p.platform_name AS platformName, " +
" u.real_name AS publisherName, " +
" d.dept_name AS publisherDeptName, " +
" approver.real_name AS currentApproverName " +
" approver.real_name AS currentApproverName, " +
" primary_user.real_name AS primaryPublisherName, " +
" primary_dept.dept_name AS primaryPublisherDeptName " +
"FROM task t " +
"LEFT JOIN brand b ON t.brand_id = b.id " +
"LEFT JOIN category c ON t.category_id = c.id " +
@ -161,6 +171,8 @@ public interface TaskMapper extends BaseMapper<Task> {
"LEFT JOIN sys_user u ON t.publisher_id = u.id " +
"LEFT JOIN sys_dept d ON t.publisher_dept_id = d.id " +
"LEFT JOIN sys_user approver ON t.current_approver_id = approver.id " +
"LEFT JOIN sys_user primary_user ON t.primary_publisher_id = primary_user.id " +
"LEFT JOIN sys_dept primary_dept ON t.primary_publisher_dept_id = primary_dept.id " +
"WHERE t.publisher_id = #{userId} AND t.deleted = 0 " +
"<if test='status != null'> AND t.status = #{status}</if> " +
"ORDER BY t.create_time DESC" +
@ -180,7 +192,9 @@ public interface TaskMapper extends BaseMapper<Task> {
" p.platform_name AS platformName, " +
" u.real_name AS publisherName, " +
" d.dept_name AS publisherDeptName, " +
" approver.real_name AS currentApproverName " +
" approver.real_name AS currentApproverName, " +
" primary_user.real_name AS primaryPublisherName, " +
" primary_dept.dept_name AS primaryPublisherDeptName " +
"FROM task t " +
"LEFT JOIN brand b ON t.brand_id = b.id " +
"LEFT JOIN category c ON t.category_id = c.id " +
@ -188,6 +202,8 @@ public interface TaskMapper extends BaseMapper<Task> {
"LEFT JOIN sys_user u ON t.publisher_id = u.id " +
"LEFT JOIN sys_dept d ON t.publisher_dept_id = d.id " +
"LEFT JOIN sys_user approver ON t.current_approver_id = approver.id " +
"LEFT JOIN sys_user primary_user ON t.primary_publisher_id = primary_user.id " +
"LEFT JOIN sys_dept primary_dept ON t.primary_publisher_dept_id = primary_dept.id " +
"WHERE (t.receiver_id = #{userId} OR t.detail_completer_id = #{userId}) AND t.deleted = 0 " +
"<if test='status != null'> AND t.status = #{status}</if> " +
"ORDER BY t.create_time DESC" +

View File

@ -1405,6 +1405,22 @@ public class TaskService {
}
}
// 填充一级需求发起人信息
if (task.getPrimaryPublisherId() != null) {
User primaryPublisher = userService.getUserById(task.getPrimaryPublisherId());
if (primaryPublisher != null) {
task.setPrimaryPublisherName(primaryPublisher.getRealName() != null ? primaryPublisher.getRealName() : primaryPublisher.getUsername());
}
}
// 填充一级需求发起人部门名称
if (task.getPrimaryPublisherDeptId() != null) {
Department primaryDept = departmentService.getDepartmentById(task.getPrimaryPublisherDeptId());
if (primaryDept != null) {
task.setPrimaryPublisherDeptName(primaryDept.getDeptName());
}
}
// 填充子任务统计信息
fillSubTaskStats(task);
}