diff --git a/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecJobPhaseNodeErrorType.java b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecJobPhaseNodeErrorType.java new file mode 100644 index 0000000000000000000000000000000000000000..00dc14bca9fa4177462e86cccfa41599f420f685 --- /dev/null +++ b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecJobPhaseNodeErrorType.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.autoexec.constvalue; + +import neatlogic.framework.util.$; + +public enum AutoexecJobPhaseNodeErrorType{ + IP_INVALID(1,"ip不合法"), + RUNNER_NOT_MATCH(2,"根据ip找不到匹配的runner,请核对runner组配置") + ; + + private final int value; + private final String text; + + AutoexecJobPhaseNodeErrorType(int value, String text) { + this.value = value; + this.text = text; + } + + + public Integer getValue() { + return value; + } + + public static AutoexecJobPhaseNodeErrorType getErrorType(int value){ + for (AutoexecJobPhaseNodeErrorType errorType : AutoexecJobPhaseNodeErrorType.values()){ + if(errorType.getValue() == value){ + return errorType; + } + } + return null; + } + + public String getText() { + return $.t(text); + } +} diff --git a/src/main/java/neatlogic/framework/autoexec/constvalue/JobNodeStatus.java b/src/main/java/neatlogic/framework/autoexec/constvalue/JobNodeStatus.java index 5c179d8a840dfffec7b8e95842816ded05a7b9f0..26baea7a1a0e907f446956641931c0e689c6466b 100755 --- a/src/main/java/neatlogic/framework/autoexec/constvalue/JobNodeStatus.java +++ b/src/main/java/neatlogic/framework/autoexec/constvalue/JobNodeStatus.java @@ -17,7 +17,8 @@ public enum JobNodeStatus implements IEnum { SUCCEED("succeed", "已成功"), FAILED("failed", "已失败"), IGNORED("ignored", "已忽略"), - WAIT_INPUT("waitInput", "待输入"); + WAIT_INPUT("waitInput", "待输入"), + INVALID("invalid", "非法节点"); private final String status; private final String text; diff --git a/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.java b/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.java index 3355463c0571cd4b050734cdbfd972807f19536e..5baf7dbd43bdf8861e3d82a19211c02b8a296d38 100644 --- a/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.java +++ b/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.java @@ -133,16 +133,12 @@ public interface AutoexecJobMapper { List getJobPhaseNodeIdListByNodeVoAndStartNum(@Param("nodeVo") AutoexecJobPhaseNodeVo jobPhaseNodeVo, @Param("startNum") Integer startNum); - int searchJobPhaseNodeCountWithResource(AutoexecJobPhaseNodeVo jobPhaseNodeVo); - int searchJobPhaseNodeCount(AutoexecJobPhaseNodeVo jobPhaseNodeVo); int searchJobPhaseNodeByDistinctResourceIdCount(AutoexecJobPhaseNodeVo jobPhaseNodeVo); List getJobPhaseNodeStatusCount(Long jobId); - int checkIsJobPhaseNodeExist(AutoexecJobPhaseNodeVo nodeVo); - List getJobPhaseOperationCustomTemplateListByJobPhaseId(Long jobPhaseId); List getJobPhaseOpertionIdListByJobPhaseId(Long jobPhaseId); @@ -154,8 +150,6 @@ public interface AutoexecJobMapper { int updateJobPhaseNodeStatus(AutoexecJobPhaseNodeVo nodeVo); - int updateJobPhaseNodeStatusByJobIdAndJobPhaseIdListAndRunnerId(@Param("jobId") Long jobId, @Param("jobPhaseIdList") List jobPhaseIdList, @Param("nodeStatusList") List jobNodeStatusList, @Param("runnerId") Long runnerId); - int searchJobPhaseSqlCount(AutoexecJobPhaseNodeVo jobPhaseNodeVo); AutoexecJobPhaseNodeVo getJobPhaseNodeInfoByJobNodeId(@Param("nodeId") Long nodeId); @@ -168,7 +162,7 @@ public interface AutoexecJobMapper { List getJobPhaseNodeListByJobIdAndPhaseNameAndExceptStatusAndRunnerId(@Param("jobId") Long jobId, @Param("phaseName") String phaseName, @Param("exceptStatus") List exceptStatus, @Param("runnerId") Long runnerId); - List getJobPhaseNodeListByJobIdAndPhaseIdAndExceptStatus(@Param("jobId") Long jobId, @Param("phaseId") Long phaseId, @Param("exceptStatus") List exceptStatus); + List getJobPhaseNodeListByJobIdAndPhaseIdAndExceptStatus(@Param("phaseId") Long phaseId, @Param("exceptStatus") List exceptStatus); List getJobPhaseNodeListByJobIdAndPhaseIdAndExceptStatusAndRunnerMapId(@Param("jobId") Long jobId, @Param("phaseId") Long phaseId, @Param("exceptStatus") List exceptStatus, @Param("runnerMapId") Long runnerMapId); @@ -309,10 +303,6 @@ public interface AutoexecJobMapper { int insertJobInvoke(AutoexecJobInvokeVo invokeVo); - Integer insertIgnoreJobPhaseNodeRunner(AutoexecJobPhaseNodeRunnerVo nodeRunnerVo); - - Integer batchInsertJobPhaseNodeRunner(List nodeRunnerVo); - Integer insertJobPhaseRunner(@Param("jobId") Long jobId, @Param("jobGroupId") Long jobGroupId, @Param("jobPhaseId") Long jobPhaseId, @Param("runnerMapId") Long runnerMapId, @Param("lcd") Date lcd); Integer insertJob(AutoexecJobVo jobVo); @@ -325,6 +315,10 @@ public interface AutoexecJobMapper { Integer batchInsertJobPhaseNode(List nodeList); + Integer batchInsertIgnoreJobPhaseNode(List nodeList); + + Integer batchInsertDuplicateJobPhaseNode(List nodeList); + Integer insertJobPhaseOperation(AutoexecJobPhaseOperationVo operationVo); Integer insertIgnoreJobContent(AutoexecJobContentVo contentVo); @@ -337,8 +331,6 @@ public interface AutoexecJobMapper { Integer updateJobPhaseStatusByJobIdAndPhaseStatus(@Param("jobId") Long jobId, @Param("whereStatus") String whereStatus, @Param("status") String status); - Integer updateJobPhaseNodeStatusByJobIdAndIsDelete(@Param("jobId") Long id, @Param("status") String status, @Param("isDelete") Integer isDelete); - Integer updateJobPhaseNodeStatusByJobPhaseIdAndIsDelete(@Param("jobPhaseId") Long id, @Param("status") String status, @Param("isDelete") Integer isDelete); Integer updateJobPhaseRunnerStatusBatch(@Param("phaseIdList") List phaseIdList, @Param("status") String phaseStatus, @Param("runnerId") Long runnerId); @@ -357,8 +349,6 @@ public interface AutoexecJobMapper { Integer updateJobPhaseNodeById(AutoexecJobPhaseNodeVo jobPhaseNodeVo); - Integer updateJobPhaseNodeByJobIdAndPhaseIdAndResourceId(AutoexecJobPhaseNodeVo jobPhaseNodeVo); - Integer updateJobPhaseRunnerFireNextByPhaseIdAndRunnerId(@Param("phaseId") Long phaseId, @Param("isFireNext") int isFireNext, @Param("runnerMapId") Long runnerMapId); Integer updateJobPhaseRunnerFireNextByJobIdAndGroupSortAndRunnerId(@Param("jobId") Long jobId, @Param("groupSort") Integer groupSort, @Param("isFireNext") int isFireNext, @Param("runnerMapId") Long runnerMapId); @@ -367,7 +357,7 @@ public interface AutoexecJobMapper { Integer updateJobPhaseLncdById(@Param("jobPhaseId") Long jobPhaseId, @Param("lcd") Date lcd); - Integer updateJobPhaseNodeIsDeleteByJobPhaseIdAndLcd(@Param("jobPhaseId") Long jobPhaseId, @Param("lcd") Date lcd); + Integer updateJobPhaseNodeIsDeleteByJobPhaseIdAndUpdateTag(@Param("jobPhaseId") Long jobPhaseId, @Param("updateTag") Long updateTag); Integer updateJobParamHashById(@Param("jobId") Long jobId, @Param("paramHash") String paramHash); @@ -417,13 +407,7 @@ public interface AutoexecJobMapper { void deleteJobPhaseRunnerByJobId(Long jobId); - void deleteJobPhaseNodeRunnerByJobId(Long jobId); - - void deleteJobPhaseNodeByJobPhaseIdAndLcd(@Param("jobPhaseId") Long jobPhaseId, @Param("lcd") Date lcd); - - Integer deleteJobPhaseNodeByJobPhaseIdAndLcdAndStatus(@Param("jobPhaseId") Long jobPhaseId, @Param("lcd") Date lcd, @Param("status") String status); - - void deleteJobPhaseNodeRunnerByJobPhaseIdAndLcdAndStatus(@Param("jobPhaseId") Long jobPhaseId, @Param("lcd") Date lcd, @Param("status") String status); + Integer deleteJobPhaseNodeByJobPhaseIdAndUpdateTagAndStatus(@Param("jobPhaseId") Long jobPhaseId, @Param("updateTag") Long updateTag, @Param("status") String status); void deleteJobEvnByJobId(Long jobId); @@ -444,4 +428,10 @@ public interface AutoexecJobMapper { void updateJobSqlStatusByJobIdAndPhaseId(@Param("jobId") Long jobId,@Param("phaseId") Long phaseId,@Param("status") String status); void updateJobPhaseRunnerStatusByJobIdAndPhaseId(@Param("jobId") Long jobId,@Param("phaseId") Long phaseId,@Param("status") String status); + + void updateJobPhaseNodeBatch(@Param("jobPhaseId") Long phaseId,@Param("resourceIdList") List resourceIdList,@Param("status") String value,@Param("updateTag") long time); + + void updateJobPhaseNodeListStatusByPhaseIdAndExceptStatus(@Param("phaseId") Long phaseId, @Param("exceptStatus") List exceptStatus,@Param("status") String status); + + Integer isHasPendingNode(Long jobPhaseId); } diff --git a/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.xml b/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.xml index 3bced62d4df9e385e71625692aa32ad624329333..a6a3edd895f27e3d1908abd96efc419668c07537 100644 --- a/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.xml +++ b/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecJobMapper.xml @@ -295,10 +295,11 @@ along with this program. If not, see .--> ajpn.`start_time` AS startTime, ajpn.`end_time` AS endTime, ajpn.`status`, + ajpn.`error_type` as errorType, ajpn.`protocol_id` as protocolId, ajpn.`resource_id` AS resourceId, ajpn.`warn_count` as warnCount, - ri.`id` AS nodeId, + ajpn.`resource_id` AS nodeId, ajpn.name AS nodeName, ajpn.type AS nodeType, ajpn.is_delete as isDelete, @@ -312,9 +313,7 @@ along with this program. If not, see .--> `autoexec_job_phase_node` ajpn LEFT JOIN `autoexec_job_phase` ajp ON ajpn.`job_phase_id` = ajp.`id` left join `autoexec_job_group` ajg on ajp.job_id = ajg.job_id and ajp.group_id = ajg.id - LEFT JOIN @{DATA_SCHEMA}.`scence_ipobject_id` ri ON ajpn.resource_id = ri.`id` - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpn.id = ajpnr.`node_id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` LEFT JOIN `runner` ap ON arm.`runner_id` = ap.`id` @@ -358,8 +357,7 @@ along with this program. If not, see .--> `autoexec_job_phase_node` ajpn LEFT JOIN `autoexec_job_phase` ajp ON ajpn.`job_phase_id` = ajp.`id` left join `autoexec_job_group` ajg on ajp.job_id = ajg.job_id and ajp.group_id = ajg.id - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpn.id = ajpnr.`node_id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` LEFT JOIN `runner` ap ON arm.`runner_id` = ap.`id` @@ -401,20 +399,6 @@ along with this program. If not, see .--> limit #{startNum}, #{nodeVo.pageSize} - - - - @@ -958,8 +931,7 @@ along with this program. If not, see .--> ajpn.`status`, arm.`runner_id` as runnerId FROM `autoexec_job_phase_node` ajpn - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr on ajpn.id = ajpnr.`node_id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` WHERE ajpn.`job_id` = #{jobId} AND ajpn.`job_phase_id` = #{phaseId} @@ -988,9 +960,8 @@ along with this program. If not, see .--> arm.`runner_id` AS runnerId, ajp.`name` AS jobPhaseName FROM `autoexec_job_phase_node` ajpn - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpn.id = ajpnr.`node_id` LEFT JOIN `autoexec_job_phase` ajp ON ajpn.`job_phase_id` = ajp.`id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` where ajpn.`job_id` = #{jobId} and ajp.`name` = #{phaseName} and arm.`runner_id` = #{runnerId} and ajpn.`status` not in @@ -1001,15 +972,10 @@ along with this program. If not, see .--> SELECT DISTINCT ar.`id`, ar.`name`, ar.`url`, ar.`host`, ar.`port` FROM `autoexec_job_phase_node` ajpn - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpn.id = ajpnr.`node_id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` - LEFT JOIN `runner` ar ON arm.`runner_id` = ar.`id` + JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` + JOIN `runner` ar ON arm.`runner_id` = ar.`id` WHERE ajpn.`job_id` = #{value} @@ -1280,11 +1243,10 @@ along with this program. If not, see .--> ajpn.`type` as nodeType, ajpn.`protocol_id` as protocolId, ajpn.`status`, - ajpnr.runner_map_id as runnerMapId, + ajpn.runner_map_id as runnerMapId, r.url as runnerUrl FROM `autoexec_job_phase_node` ajpn - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpnr.`node_id` = ajpn.`id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` LEFT JOIN `runner` r on arm.runner_id = r.id where ajpn.`id` in @@ -1307,11 +1269,10 @@ along with this program. If not, see .--> ajpn.`type` as nodeType, ajpn.`protocol_id` as protocolId, ajpn.`status`, - ajpnr.runner_map_id as runnerMapId, + ajpn.runner_map_id as runnerMapId, r.url as runnerUrl FROM `autoexec_job_phase_node` ajpn - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpnr.`node_id` = ajpn.`id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` LEFT JOIN `runner` r on arm.runner_id = r.id where ajpn.`job_phase_id` = #{jobPhaseId} and ajpn.`is_delete` = 0 and ajpn.`status` not in @@ -1390,8 +1351,7 @@ along with this program. If not, see .--> ap.`url` AS runnerUrl FROM `autoexec_job_phase_node` ajpn LEFT JOIN `autoexec_job_phase` ajp ON ajpn.`job_phase_id` = ajp.`id` - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpn.id = ajpnr.`node_id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` LEFT JOIN `runner` ap ON arm.`runner_id` = ap.`id` where ajpn.`job_phase_id` = #{jobPhaseId} @@ -1422,8 +1382,7 @@ along with this program. If not, see .--> ap.`url` AS runnerUrl FROM `autoexec_job_phase_node` ajpn LEFT JOIN `autoexec_job_phase` ajp ON ajpn.`job_phase_id` = ajp.`id` - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpn.id = ajpnr.`node_id` - LEFT JOIN `runner_map` arm ON ajpnr.`runner_map_id` = arm.`id` + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` LEFT JOIN `runner` ap ON arm.`runner_id` = ap.`id` where ajpn.job_id = #{jobId} and ajp.`name` = #{jobPhaseName} @@ -1548,8 +1507,7 @@ along with this program. If not, see .--> ajpn.`resource_id` as resourceId FROM `autoexec_job_phase_node` ajpn LEFT JOIN `autoexec_job_phase` ajp ON ajpn.`job_phase_id` = ajp.`id` - LEFT JOIN `autoexec_job_phase_node_runner` ajpnr ON ajpn.`id` = ajpnr.`node_id` - WHERE ajpnr.`runner_map_id` = #{runnerId} + WHERE ajpn.`runner_map_id` = #{runnerId} AND ajpn.`job_phase_id` IN #{jobPhaseId} @@ -1663,12 +1621,12 @@ along with this program. If not, see .--> ar.`url`, ar.`host`, ar.`port`, - ajpr.runner_map_id as runnerMapId - FROM `autoexec_job_phase_node_runner` ajpr - LEFT JOIN `runner_map` arm ON ajpr.`runner_map_id` = arm.`id` + ajpn.runner_map_id as runnerMapId + FROM `autoexec_job_phase_node` ajpn + LEFT JOIN `runner_map` arm ON ajpn.`runner_map_id` = arm.`id` LEFT JOIN `runner` ar ON arm.`runner_id` = ar.`id` - WHERE ajpr.`job_id` = #{jobId} - and ajpr.node_id in + WHERE ajpn.`job_id` = #{jobId} + and ajpn.id in #{nodeId} @@ -1676,9 +1634,9 @@ along with this program. If not, see .--> + INSERT INTO `autoexec_job` (`id`, @@ -2442,8 +2404,8 @@ along with this program. If not, see .--> `type`, `user_name`, `resource_id`, - `lcd`, - `status`) + `status`, + `runner_map_id`) VALUES (#{id}, #{jobId}, #{jobPhaseId}, @@ -2454,11 +2416,77 @@ along with this program. If not, see .--> #{nodeType}, #{userName}, #{resourceId}, - #{lcd}, - #{status}) + #{status}, + #{runnerMapId}) + INSERT IGNORE INTO `autoexec_job_phase_node` (`id`, + `job_id`, + `job_phase_id`, + `host`, + `port`, + `protocol_id`, + `name`, + `type`, + `user_name`, + `resource_id`, + `status`, + `update_tag`, + `runner_map_id`, + `error_type`) + VALUES + #{node.id}, + #{node.jobId}, + #{node.jobPhaseId}, + #{node.host}, + #{node.port}, + #{node.protocolId}, + #{node.nodeName}, + #{node.nodeType}, + #{node.userName}, + #{node.resourceId}, + #{node.status}, + #{node.updateTag}, + #{node.runnerMapId}, + #{node.errorType} + + + + + INSERT IGNORE INTO `autoexec_job_phase_node` (`id`, + `job_id`, + `job_phase_id`, + `host`, + `port`, + `protocol_id`, + `name`, + `type`, + `user_name`, + `resource_id`, + `status`, + `update_tag`, + `runner_map_id`, + `error_type`) + VALUES + #{node.id}, + #{node.jobId}, + #{node.jobPhaseId}, + #{node.host}, + #{node.port}, + #{node.protocolId}, + #{node.nodeName}, + #{node.nodeType}, + #{node.userName}, + #{node.resourceId}, + #{node.status}, + #{node.updateTag}, + #{node.runnerMapId}, + #{node.errorType} + + + + INSERT INTO `autoexec_job_phase_node` (`id`, `job_id`, `job_phase_id`, @@ -2469,8 +2497,9 @@ along with this program. If not, see .--> `type`, `user_name`, `resource_id`, - `lcd`, - `status`) + `status`, + `update_tag`, + `runner_map_id`) VALUES #{node.id}, #{node.jobId}, @@ -2482,15 +2511,16 @@ along with this program. If not, see .--> #{node.nodeType}, #{node.userName}, #{node.resourceId}, - #{node.lcd}, - #{node.status} + #{node.status}, + #{node.updateTag}, + #{node.runnerMapId} ON DUPLICATE KEY UPDATE `status` = VALUES(`status`), `start_time` = VALUES(start_time), `end_time` = VALUES(end_time), `is_delete` = 0, - `lcd` = VALUES(lcd) + `update_tag` = VALUES(update_tag) @@ -2550,20 +2580,6 @@ along with this program. If not, see .--> VALUES (#{hash}, #{content}) - - INSERT ignore INTO `autoexec_job_phase_node_runner` (`job_id`, `job_phase_id`, `node_id`, `runner_map_id`) - VALUES (#{jobId}, #{jobPhaseId}, #{nodeId}, #{runnerMapId}) - - - - INSERT ignore INTO `autoexec_job_phase_node_runner` (`job_id`, `job_phase_id`, `node_id`, `runner_map_id`) - VALUES - - #{nodeRunner.jobId}, #{nodeRunner.jobPhaseId}, #{nodeRunner.nodeId}, #{nodeRunner.runnerMapId} - - - INSERT INTO `autoexec_job_phase_runner` (`job_id`, `job_group_id`, `job_phase_id`, `runner_map_id`, `lcd`) VALUES (#{jobId}, #{jobGroupId}, #{jobPhaseId}, #{runnerMapId}, #{lcd}) @@ -2812,15 +2828,7 @@ along with this program. If not, see .--> , `end_time` = NULL WHERE `job_id` = #{jobId} - - UPDATE `autoexec_job_phase_node` - SET `status` = #{status} - , `start_time` = NULL - , `end_time` = NULL - WHERE `job_id` = #{jobId} - and `is_delete` = #{isDelete} - UPDATE `autoexec_job_phase_node` SET `status` = #{status} @@ -2828,6 +2836,7 @@ along with this program. If not, see .--> , `end_time` = NULL WHERE `job_phase_id` = #{jobPhaseId} and `is_delete` = #{isDelete} + and `status` not in ('invalid') UPDATE @@ -2885,6 +2894,7 @@ along with this program. If not, see .--> #{nodeId} + and `status` != 'invalid' and `is_delete` = 0 @@ -2906,41 +2916,6 @@ along with this program. If not, see .--> WHERE `id` = #{id} - - UPDATE - `autoexec_job_phase_node` - SET `status` = #{status}, - `start_time` = #{startTime}, - `end_time` = #{endTime}, - `is_delete` = 0, - `lcd` = #{lcd} - WHERE `job_id` = #{jobId} - and `job_phase_id` = #{jobPhaseId} - - and `resource_id` is null - - - and `resource_id` = #{resourceId} - - - - - - UPDATE - `autoexec_job_phase_node` - SET - `end_time` = NOW(3), - `status` = #{status} - WHERE `job_id` = #{jobId} - AND `job_phase_id` in - - #{jobPhaseId} - - and `status` in - - #{nodeStatus} - - update `autoexec_job_phase_runner` set is_fire_next = #{isFireNext} @@ -3041,12 +3016,13 @@ along with this program. If not, see .--> `id` = #{id} - + update `autoexec_job_phase_node` set `is_delete` = 1 where `job_phase_id` = #{jobPhaseId} - and (`lcd` != #{lcd} OR `lcd` IS NULL) + and `update_tag` != #{updateTag} + and `status` not in ('invalid','ignored') and `is_delete` != 1 @@ -3123,6 +3099,40 @@ along with this program. If not, see .--> WHERE `job_id` = #{jobId} and `job_phase_id` = #{phaseId} + + UPDATE + `autoexec_job_phase_node` + SET `update_tag` = #{updateTag}, + `status` = #{status}, + `start_time` = null, + `end_time` = null + WHERE + `job_phase_id` = #{jobPhaseId} + and `resource_id` in + + #{resourceId} + + and `status` != 'invalid' + + + UPDATE + `autoexec_job_phase_node` + SET + `status` = #{status}, + + `start_time` = null, + + + `end_time` = null + + WHERE `job_phase_id` = #{phaseId} and + `status` not in + + #{status} + + and `status` != 'invalid' + and `is_delete` = 0 + DELETE @@ -3169,38 +3179,16 @@ along with this program. If not, see .--> FROM `autoexec_job_phase_runner` WHERE `job_id` = #{value} - - DELETE ajpnr - FROM `autoexec_job_phase_node_runner` ajpnr - LEFT JOIN `autoexec_job_phase_node` ajpn ON ajpnr.`node_id` = ajpn.`id` - WHERE ajpn.`job_id` = #{value} - and ajpn.`is_executed` = 0 - - - DELETE - FROM `autoexec_job_phase_node` - where `job_phase_id` = #{jobPhaseId} - and (`lcd` != #{lcd} OR `lcd` IS NULL) - and `is_executed` = 0 - - + + DELETE FROM `autoexec_job_phase_node` where `job_phase_id` = #{jobPhaseId} - and (`lcd` != #{lcd} OR `lcd` IS NULL) + and `update_tag` != #{updateTag} and `status` = #{status} and `is_delete` = 0 and `is_executed` = 0 - - DELETE ajpnr - FROM `autoexec_job_phase_node_runner` ajpnr - LEFT JOIN `autoexec_job_phase_node` ajpn ON ajpnr.`node_id` = ajpn.`id` - WHERE ajpn.`job_phase_id` = #{jobPhaseId} - and (ajpn.`lcd` != #{lcd} OR ajpn.`lcd` IS NULL) - and ajpn.`status` = #{status} - and ajpn.`is_executed` = 0 - DELETE FROM `autoexec_job_env` diff --git a/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobPhaseNodeVo.java b/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobPhaseNodeVo.java index e40890478d72ccf70eb5559819d8cae4fed043f8..f68f9b421c612fcb31699697714dc4c217b90fd5 100644 --- a/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobPhaseNodeVo.java +++ b/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobPhaseNodeVo.java @@ -17,6 +17,7 @@ package neatlogic.framework.autoexec.dto.job; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; +import neatlogic.framework.autoexec.constvalue.AutoexecJobPhaseNodeErrorType; import neatlogic.framework.autoexec.constvalue.JobNodeStatus; import neatlogic.framework.autoexec.dto.INodeDetail; import neatlogic.framework.autoexec.dto.combop.AutoexecCombopParamVo; @@ -105,6 +106,8 @@ public class AutoexecJobPhaseNodeVo extends AutoexecJobNodeVo implements INodeDe private Integer isExecuted;//是否执行过,用于标识执行过的节点不能删除 @JSONField(serialize = false) private Integer isDownloadGroup;//是否下载组节点,用于下载节点接口 + @EntityField(name = "初始化节点异常类型", type = ApiParamType.STRING) + private Integer errorType; public AutoexecJobPhaseNodeVo() { } @@ -466,4 +469,28 @@ public class AutoexecJobPhaseNodeVo extends AutoexecJobNodeVo implements INodeDe this.isDownloadGroup = isDownloadGroup; } + public Long getUpdateTag(){ + if(this.getLcd() != null){ + return this.getLcd().getTime(); + } + return null; + } + + public Integer getErrorType() { + return errorType; + } + + public void setErrorType(Integer errorType) { + this.errorType = errorType; + } + + public String getErrorMsg() { + if(errorType != null){ + AutoexecJobPhaseNodeErrorType errorTypeEnum = AutoexecJobPhaseNodeErrorType.getErrorType(errorType); + if(errorTypeEnum != null){ + return errorTypeEnum.getText(); + } + } + return StringUtils.EMPTY; + } } diff --git a/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobVo.java b/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobVo.java index 3f49f0fc7ac385be6d915d04ead4e52b18dae69d..19248bb670c23acc3b56ec8d91dab86ae2903e01 100644 --- a/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobVo.java +++ b/src/main/java/neatlogic/framework/autoexec/dto/job/AutoexecJobVo.java @@ -257,6 +257,10 @@ public class AutoexecJobVo extends BaseEditorVo implements Serializable { @EntityField(name = "runner执行组标签", type = ApiParamType.JSONOBJECT) private ParamMappingVo runnerGroupTag; + @JSONField(serialize = false) + @EntityField(name = "是否第一次初始化", type = ApiParamType.JSONOBJECT) + private int isFirstInit = 0; + public AutoexecJobVo() { } @@ -1083,4 +1087,12 @@ public class AutoexecJobVo extends BaseEditorVo implements Serializable { public void setRunnerGroupTag(ParamMappingVo runnerGroupTag) { this.runnerGroupTag = runnerGroupTag; } + + public int getIsFirstInit() { + return isFirstInit; + } + + public void setIsFirstInit(int isFirstInit) { + this.isFirstInit = isFirstInit; + } }