修复:一级需求任务的发布人显示明细完善人,明细完善人可以撤回任务
This commit is contained in:
parent
1e7e6fd456
commit
d5f8835745
@ -186,17 +186,19 @@ public interface TaskMapper extends BaseMapper<Task> {
|
||||
/**
|
||||
* 查询我发布的任务
|
||||
* 包括:作为发布人的任务 或 作为一级需求任务明细完善人的任务
|
||||
* 对于一级需求任务,publisherName 显示明细完善人
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT t.*, " +
|
||||
" b.brand_name AS brandName, " +
|
||||
" c.category_name AS categoryName, " +
|
||||
" p.platform_name AS platformName, " +
|
||||
" u.real_name AS publisherName, " +
|
||||
" d.dept_name AS publisherDeptName, " +
|
||||
" CASE WHEN t.is_primary_task = 1 AND t.detail_completer_id IS NOT NULL THEN detail_user.real_name ELSE u.real_name END AS publisherName, " +
|
||||
" CASE WHEN t.is_primary_task = 1 AND t.detail_completer_id IS NOT NULL THEN detail_dept.dept_name ELSE d.dept_name END AS publisherDeptName, " +
|
||||
" approver.real_name AS currentApproverName, " +
|
||||
" primary_user.real_name AS primaryPublisherName, " +
|
||||
" primary_dept.dept_name AS primaryPublisherDeptName " +
|
||||
" primary_dept.dept_name AS primaryPublisherDeptName, " +
|
||||
" detail_user.real_name AS detailCompleterName " +
|
||||
"FROM task t " +
|
||||
"LEFT JOIN brand b ON t.brand_id = b.id " +
|
||||
"LEFT JOIN category c ON t.category_id = c.id " +
|
||||
@ -206,6 +208,8 @@ public interface TaskMapper extends BaseMapper<Task> {
|
||||
"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 " +
|
||||
"LEFT JOIN sys_user detail_user ON t.detail_completer_id = detail_user.id " +
|
||||
"LEFT JOIN sys_dept detail_dept ON detail_user.dept_id = detail_dept.id " +
|
||||
"WHERE (t.publisher_id = #{userId} OR t.detail_completer_id = #{userId}) AND t.deleted = 0 " +
|
||||
"<if test='status != null'> AND t.status = #{status}</if> " +
|
||||
"ORDER BY t.update_time DESC" +
|
||||
|
||||
@ -2398,6 +2398,7 @@ public class TaskService {
|
||||
/**
|
||||
* 撤回任务(用于编辑后重新发布)
|
||||
* 只有任务发起人可以撤回,且任务必须未被抢单
|
||||
* 对于一级需求任务,明细完善人也可以撤回
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void withdrawTask(Long taskId, Long userId) {
|
||||
@ -2405,8 +2406,14 @@ public class TaskService {
|
||||
|
||||
Task task = getTaskById(taskId);
|
||||
|
||||
// 验证权限(必须是任务发布人)
|
||||
if (!userId.equals(task.getPublisherId())) {
|
||||
// 验证权限:
|
||||
// 1. 原始发布人可以撤回
|
||||
// 2. 对于一级需求任务,明细完善人也可以撤回
|
||||
boolean hasPermission = userId.equals(task.getPublisherId());
|
||||
if (!hasPermission && task.getIsPrimaryTask() != null && task.getIsPrimaryTask() == 1) {
|
||||
hasPermission = userId.equals(task.getDetailCompleterId());
|
||||
}
|
||||
if (!hasPermission) {
|
||||
throw new BusinessException(ResultCode.FORBIDDEN, "只有任务发布人可以撤回任务");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user