From a51b710b1c8ae43d9e9bcbc386af4d81fb7e6b65 Mon Sep 17 00:00:00 2001 From: Tq Date: Sun, 24 Apr 2022 13:29:27 +0800 Subject: [PATCH] fix alert msg and change primitive to String to avoid wrong format (#9689) --- .../api/service/impl/ExecutorServiceImpl.java | 6 +++--- .../impl/ProcessDefinitionServiceImpl.java | 20 +++++++++---------- .../impl/ProcessTaskRelationServiceImpl.java | 14 ++++++------- .../service/impl/SchedulerServiceImpl.java | 10 +++++----- .../impl/TaskDefinitionServiceImpl.java | 18 ++++++++--------- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java index 8fd4ce47d667..783940d3432a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java @@ -215,10 +215,10 @@ public Map checkProcessDefinitionValid(long projectCode, Process Map result = new HashMap<>(); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { // check process definition exists - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefineCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); } else if (processDefinition.getReleaseState() != ReleaseState.ONLINE) { // check process definition online - putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, processDefineCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, String.valueOf(processDefineCode)); } else if (!checkSubProcessDefinitionValid(processDefinition)){ // check sub process definition online putMsg(result, Status.SUB_PROCESS_DEFINE_NOT_RELEASE); @@ -488,7 +488,7 @@ private Map insertCommand(User loginUser, Integer instanceId, lo command.setProcessInstanceId(instanceId); if (!processService.verifyIsNeedCreateCommand(command)) { - putMsg(result, Status.PROCESS_INSTANCE_EXECUTING_COMMAND, processDefinitionCode); + putMsg(result, Status.PROCESS_INSTANCE_EXECUTING_COMMAND, String.valueOf(processDefinitionCode)); return result; } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index 30b6307f859c..1127d63d8a8a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -482,7 +482,7 @@ public Map queryProcessDefinitionByCode(User loginUser, long pro ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); } else { Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId()); if (tenant != null) { @@ -576,7 +576,7 @@ public Map updateProcessDefinition(User loginUser, ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); // check process definition exists if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { @@ -699,7 +699,7 @@ public Map deleteProcessDefinitionByCode(User loginUser, long pr } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } @@ -711,7 +711,7 @@ public Map deleteProcessDefinitionByCode(User loginUser, long pr // check process definition is already online if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { - putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, code); + putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, String.valueOf(code)); return result; } // check process instances is already running @@ -777,7 +777,7 @@ public Map releaseProcessDefinition(User loginUser, long project ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } switch (releaseState) { @@ -1341,7 +1341,7 @@ public Map getTaskNodeListByDefinitionCode(User loginUser, long ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.info("process define not exists"); - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } DagData dagData = processService.genDagData(processDefinition); @@ -1487,7 +1487,7 @@ public Map viewTree(long projectCode, long code, Integer limit) ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (null == processDefinition || projectCode != processDefinition.getProjectCode()) { logger.info("process define not exists"); - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } DAG dag = processService.genDagGraph(processDefinition); @@ -1897,7 +1897,7 @@ public Map deleteProcessDefinitionVersion(User loginUser, long p ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); } else { if (processDefinition.getVersion() == version) { putMsg(result, Status.MAIN_TABLE_USING_VERSION); @@ -2085,7 +2085,7 @@ public Map updateProcessDefinitionBasicInfo(User loginUser, ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); // check process definition exists if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { @@ -2186,7 +2186,7 @@ public Map releaseWorkflowAndSchedule(User loginUser, long proje ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java index 88254d19fec2..26a1e88a05dd 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java @@ -107,7 +107,7 @@ public Map createProcessTaskRelation(User loginUser, long projec } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode)); return result; } if (processDefinition.getProjectCode() != projectCode) { @@ -122,7 +122,7 @@ public Map createProcessTaskRelation(User loginUser, long projec .collect(Collectors.toMap(ProcessTaskRelation::getPreTaskCode, processTaskRelation -> processTaskRelation)); if (!preTaskCodeMap.isEmpty()) { if (preTaskCodeMap.containsKey(preTaskCode) || (!preTaskCodeMap.containsKey(0L) && preTaskCode == 0L)) { - putMsg(result, Status.PROCESS_TASK_RELATION_EXIST, processDefinitionCode); + putMsg(result, Status.PROCESS_TASK_RELATION_EXIST, String.valueOf(processDefinitionCode)); return result; } if (preTaskCodeMap.containsKey(0L) && preTaskCode != 0L) { @@ -202,12 +202,12 @@ public Map deleteTaskProcessRelation(User loginUser, long projec } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode)); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (null == taskDefinition) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); return result; } List processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); @@ -305,7 +305,7 @@ public Map deleteUpstreamRelation(User loginUser, long projectCo } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(upstreamList.get(0).getProcessDefinitionCode()); if (processDefinition == null) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, upstreamList.get(0).getProcessDefinitionCode()); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(upstreamList.get(0).getProcessDefinitionCode())); return result; } List processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinition.getCode()); @@ -364,7 +364,7 @@ public Map deleteDownstreamRelation(User loginUser, long project } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(downstreamList.get(0).getProcessDefinitionCode()); if (processDefinition == null) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, downstreamList.get(0).getProcessDefinitionCode()); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(downstreamList.get(0).getProcessDefinitionCode())); return result; } List processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinition.getCode()); @@ -468,7 +468,7 @@ public Map deleteEdge(User loginUser, long projectCode, long pro } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode)); return result; } List processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java index 49b3f1fe3ffe..d2ff0bd4e67c 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java @@ -257,7 +257,7 @@ public Map updateSchedule(User loginUser, ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(schedule.getProcessDefinitionCode()); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, schedule.getProcessDefinitionCode()); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(schedule.getProcessDefinitionCode())); return result; } @@ -306,7 +306,7 @@ public Map setScheduleState(User loginUser, } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(scheduleObj.getProcessDefinitionCode()); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, scheduleObj.getProcessDefinitionCode()); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(scheduleObj.getProcessDefinitionCode())); return result; } List processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, scheduleObj.getProcessDefinitionCode()); @@ -336,7 +336,7 @@ public Map setScheduleState(User loginUser, if (subProcessDefinition.getReleaseState() != ReleaseState.ONLINE) { logger.info("not release process definition id: {} , name : {}", subProcessDefinition.getId(), subProcessDefinition.getName()); - putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, subProcessDefinition.getId()); + putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, String.valueOf(subProcessDefinition.getId())); return result; } } @@ -406,7 +406,7 @@ public Result querySchedule(User loginUser, long projectCode, long processDefine ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefineCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); return result; } @@ -618,7 +618,7 @@ public Map updateScheduleByProcessDefinitionCode(User loginUser, ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode)); return result; } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java index 48f86f9e8b82..cd617958e086 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java @@ -180,11 +180,11 @@ public Map createTaskBindsWorkFlow(User loginUser, } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode)); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { - putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, processDefinitionCode); + putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, String.valueOf(processDefinitionCode)); return result; } TaskDefinitionLog taskDefinition = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class); @@ -314,7 +314,7 @@ public Map deleteTaskDefinitionByCode(User loginUser, long proje } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); return result; } if (processService.isTaskOnline(taskCode) && taskDefinition.getFlag() == Flag.YES) { @@ -406,7 +406,7 @@ private TaskDefinitionLog updateTask(User loginUser, long projectCode, long task } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); return null; } if (processService.isTaskOnline(taskCode) && taskDefinition.getFlag() == Flag.YES) { @@ -557,7 +557,7 @@ public Map switchVersion(User loginUser, long projectCode, long } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); return result; } TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version); @@ -618,7 +618,7 @@ public Map deleteByCodeAndVersion(User loginUser, long projectCo TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); } else { if (taskDefinition.getVersion() == version) { putMsg(result, Status.MAIN_TABLE_USING_VERSION); @@ -645,7 +645,7 @@ public Map queryTaskDefinitionDetail(User loginUser, long projec TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); } else { result.put(Constants.DATA_LIST, taskDefinition); putMsg(result, Status.SUCCESS); @@ -752,12 +752,12 @@ public Map releaseTaskDefinition(User loginUser, long projectCod } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(code); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, code); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, taskDefinition.getVersion()); if (taskDefinitionLog == null) { - putMsg(result, Status.TASK_DEFINE_NOT_EXIST, code); + putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } switch (releaseState) {