From c42d1ba891033b15ba45706c715ebfb0b02d2076 Mon Sep 17 00:00:00 2001 From: andream7 <2236407598@qq.com> Date: Tue, 29 Jun 2021 18:41:49 +0800 Subject: [PATCH 1/3] test --- .../dolphinscheduler/service/queue/TaskPriorityQueue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java index 1325afe9b2..b643852926 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit; * task priority queue * @param */ -public interface TaskPriorityQueue { +public interface TaskPriorityQueue { /** * put task info @@ -61,4 +61,4 @@ public interface TaskPriorityQueue { * @throws TaskPriorityQueueException */ int size() throws TaskPriorityQueueException; -} \ No newline at end of file +} -- Gitee From 3042d9cb4391d9ead83306e353806b3e6bc5def4 Mon Sep 17 00:00:00 2001 From: andream7 <2236407598@qq.com> Date: Tue, 29 Jun 2021 18:45:46 +0800 Subject: [PATCH 2/3] Revert "test" This reverts commit c42d1ba8 --- .../dolphinscheduler/service/queue/TaskPriorityQueue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java index b643852926..1325afe9b2 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskPriorityQueue.java @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit; * task priority queue * @param */ -public interface TaskPriorityQueue { +public interface TaskPriorityQueue { /** * put task info @@ -61,4 +61,4 @@ public interface TaskPriorityQueue { * @throws TaskPriorityQueueException */ int size() throws TaskPriorityQueueException; -} +} \ No newline at end of file -- Gitee From 5d83571169ad2713c605c5257d506cb94226f0d8 Mon Sep 17 00:00:00 2001 From: andream7 <2236407598@qq.com> Date: Tue, 29 Jun 2021 22:06:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[I3ROAS][feat]=20=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E7=BB=84=E6=8E=A5=E5=8F=A3=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/AlertGroupController.java | 23 +++++++++++++ .../dolphinscheduler/api/enums/Status.java | 1 + .../api/service/AlertGroupService.java | 9 +++++ .../service/impl/AlertGroupServiceImpl.java | 34 ++++++++++++++++--- .../dao/mapper/AlertGroupMapper.java | 10 ++++++ .../dao/mapper/AlertGroupMapper.xml | 11 +++++- 6 files changed, 83 insertions(+), 5 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java index 4ddc3c9d2a..5f6b58adf4 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java @@ -21,6 +21,7 @@ import static org.apache.dolphinscheduler.api.enums.Status.CREATE_ALERT_GROUP_ER import static org.apache.dolphinscheduler.api.enums.Status.DELETE_ALERT_GROUP_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.LIST_PAGING_ALERT_GROUP_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ALL_ALERTGROUP_ERROR; +import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ALERT_GROUP_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_ALERT_GROUP_ERROR; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; @@ -141,6 +142,28 @@ public class AlertGroupController extends BaseController { result = alertGroupService.listPaging(loginUser, searchVal, pageNo, pageSize); return returnDataListPaging(result); } + /** + * check alarm group detail by Id + * + * @param loginUser login user + * @param id alert group id + * @return one alert group + */ + @ApiOperation(value = "queryAlertGroupById", notes = "QUERY_ALERT_GROUP_BY_ID_NOTES") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", dataType = "Int", example = "1") + }) + @GetMapping(value = "/query") + @ResponseStatus(HttpStatus.OK) + @ApiException(QUERY_ALERT_GROUP_ERROR) + @AccessLogAnnotation(ignoreRequestArgs = "loginUser") + public Result queryAlertGroupById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + @RequestParam("id") Integer id) { + + Map result = alertGroupService.queryAlertGroupById(loginUser, id); + return returnDataList(result); + } + /** * updateProcessInstance alert group diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java index 8372a69355..4c7d25efca 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java @@ -211,6 +211,7 @@ public enum Status { WORKER_ADDRESS_INVALID(10177, "worker address {0} invalid", "worker地址[{0}]无效"), QUERY_WORKER_ADDRESS_LIST_FAIL(10178, "query worker address list fail ", "查询worker地址列表失败"), TRANSFORM_PROJECT_OWNERSHIP(10179, "Please transform project ownership [{0}]", "请先转移项目所有权[{0}]"), + QUERY_ALERT_GROUP_ERROR(10180, "query alert group error", "查询告警组错误"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java index 71e09cab6d..810bb80ddd 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java @@ -33,6 +33,15 @@ public interface AlertGroupService { */ Map queryAlertgroup(); + /** + * query alert group by id + * + * @param loginUser login user + * @param id alert group id + * @return one alert group + */ + Map queryAlertGroupById(User loginUser, Integer id); + /** * paging query alarm group list * diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java index 02a564a75f..8b62bbb805 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java @@ -69,6 +69,33 @@ public class AlertGroupServiceImpl extends BaseServiceImpl implements AlertGroup return result; } + /** + * query alert group by id + * + * @param loginUser login user + * @param id alert group id + * @return one alert group + */ + @Override + public Map queryAlertGroupById(User loginUser, Integer id) { + Map result = new HashMap<>(); + result.put(Constants.STATUS, false); + + //only admin can operate + if (isNotAdmin(loginUser, result)) { + return result; + } + //check exist + AlertGroup alertGroup = alertGroupMapper.selectById(id); + if (alertGroup == null) { + putMsg(result, Status.ALERT_GROUP_NOT_EXIST); + return result; + } + result.put("data", alertGroup); + putMsg(result, Status.SUCCESS); + return result; + } + /** * paging query alarm group list * @@ -85,11 +112,10 @@ public class AlertGroupServiceImpl extends BaseServiceImpl implements AlertGroup if (isNotAdmin(loginUser, result)) { return result; } - - Page page = new Page<>(pageNo, pageSize); - IPage alertGroupIPage = alertGroupMapper.queryAlertGroupPage( + Page> page = new Page<>(pageNo, pageSize); + IPage> alertGroupIPage = alertGroupMapper.queryAlertGroup( page, searchVal); - PageInfo pageInfo = new PageInfo<>(pageNo, pageSize); + PageInfo> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount((int) alertGroupIPage.getTotal()); pageInfo.setLists(alertGroupIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.java index b8f4188fc7..e478f4db2d 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.java @@ -22,6 +22,7 @@ import org.apache.dolphinscheduler.dao.entity.AlertGroup; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -82,4 +83,13 @@ public interface AlertGroupMapper extends BaseMapper { * @return */ String queryAlertGroupInstanceIdsById(@Param("alertGroupId") int alertGroupId); + + /** + * alert group page + * @param page page + * @param groupName groupName + * @return map IPage + */ + IPage> queryAlertGroup(Page> page, + @Param("groupName") String groupName); } diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.xml index 8a7d3a57e8..1dead3298d 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.xml @@ -32,6 +32,15 @@ order by update_time desc + - \ No newline at end of file + -- Gitee