|
|
@ -17,9 +17,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.apache.dolphinscheduler.api.service.impl; |
|
|
|
package org.apache.dolphinscheduler.api.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.api.enums.Status; |
|
|
|
import org.apache.dolphinscheduler.api.enums.Status; |
|
|
|
import org.apache.dolphinscheduler.api.service.ProjectService; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.api.service.TaskGroupQueueService; |
|
|
|
import org.apache.dolphinscheduler.api.service.TaskGroupQueueService; |
|
|
|
import org.apache.dolphinscheduler.api.utils.PageInfo; |
|
|
|
import org.apache.dolphinscheduler.api.utils.PageInfo; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
@ -27,8 +25,8 @@ import org.apache.dolphinscheduler.common.enums.AuthorizationType; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.Project; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.Project; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskGroupQueue; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskGroupQueue; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; |
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper; |
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper; |
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
@ -53,10 +51,7 @@ public class TaskGroupQueueServiceImpl extends BaseServiceImpl implements TaskGr |
|
|
|
TaskGroupQueueMapper taskGroupQueueMapper; |
|
|
|
TaskGroupQueueMapper taskGroupQueueMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private TaskInstanceMapper taskInstanceMapper; |
|
|
|
private ProjectMapper projectMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ProjectService projectService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(TaskGroupQueueServiceImpl.class); |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(TaskGroupQueueServiceImpl.class); |
|
|
|
|
|
|
|
|
|
|
@ -73,18 +68,18 @@ public class TaskGroupQueueServiceImpl extends BaseServiceImpl implements TaskGr |
|
|
|
public Map<String, Object> queryTasksByGroupId(User loginUser, String taskName |
|
|
|
public Map<String, Object> queryTasksByGroupId(User loginUser, String taskName |
|
|
|
, String processName, Integer status, int groupId, int pageNo, int pageSize) { |
|
|
|
, String processName, Integer status, int groupId, int pageNo, int pageSize) { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_QUEUE); |
|
|
|
Page<TaskGroupQueue> page = new Page<>(pageNo, pageSize); |
|
|
|
if (!canOperatorPermissions){ |
|
|
|
PageInfo<TaskGroupQueue> pageInfo = new PageInfo<>(pageNo, pageSize); |
|
|
|
result.put(Constants.STATUS, Status.NO_CURRENT_OPERATING_PERMISSION); |
|
|
|
Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); |
|
|
|
|
|
|
|
if (projectIds.isEmpty()) { |
|
|
|
|
|
|
|
result.put(Constants.DATA_LIST, pageInfo); |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
Page<TaskGroupQueue> page = new Page<>(pageNo, pageSize); |
|
|
|
List<Project> projects = projectMapper.selectBatchIds(projectIds); |
|
|
|
Map<String, Object> objectMap = this.projectService.queryAuthorizedProject(loginUser, loginUser.getId()); |
|
|
|
|
|
|
|
List<Project> projects = (List<Project>)objectMap.get(Constants.DATA_LIST); |
|
|
|
|
|
|
|
IPage<TaskGroupQueue> taskGroupQueue = taskGroupQueueMapper.queryTaskGroupQueueByTaskGroupIdPaging(page, taskName |
|
|
|
IPage<TaskGroupQueue> taskGroupQueue = taskGroupQueueMapper.queryTaskGroupQueueByTaskGroupIdPaging(page, taskName |
|
|
|
,processName,status,groupId,projects); |
|
|
|
,processName,status,groupId,projects); |
|
|
|
|
|
|
|
|
|
|
|
PageInfo<TaskGroupQueue> pageInfo = new PageInfo<>(pageNo, pageSize); |
|
|
|
|
|
|
|
pageInfo.setTotal((int) taskGroupQueue.getTotal()); |
|
|
|
pageInfo.setTotal((int) taskGroupQueue.getTotal()); |
|
|
|
pageInfo.setTotalList(taskGroupQueue.getRecords()); |
|
|
|
pageInfo.setTotalList(taskGroupQueue.getRecords()); |
|
|
|
|
|
|
|
|
|
|
|