Commit 712b42c4 by guo_minglei@163.com

Merge remote-tracking branch 'origin/developer' into developer

parents e08ba1e0 8b44c534
...@@ -27,6 +27,20 @@ ...@@ -27,6 +27,20 @@
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sourceforge.nekohtml/nekohtml -->
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-swagger2</artifactId>
...@@ -48,6 +62,12 @@ ...@@ -48,6 +62,12 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>myth-job</groupId> <groupId>myth-job</groupId>
<artifactId>myth-web-core</artifactId> <artifactId>myth-web-core</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
......
...@@ -2,8 +2,13 @@ package com.byit; ...@@ -2,8 +2,13 @@ package com.byit;
import com.byit.annotations.EnablePluginClient; import com.byit.annotations.EnablePluginClient;
import com.byit.rpc.remoting.provider.annotation.RpcService; import com.byit.rpc.remoting.provider.annotation.RpcService;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/** /**
* @program: byit-myth-job->AdminApplication * @program: byit-myth-job->AdminApplication
...@@ -18,4 +23,21 @@ public class AdminApplication { ...@@ -18,4 +23,21 @@ public class AdminApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(AdminApplication.class,args); SpringApplication.run(AdminApplication.class,args);
} }
private CorsConfiguration corsConfiguration(){
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*");
corsConfiguration.addAllowedHeader("*");
corsConfiguration.addAllowedMethod("*");
corsConfiguration.setAllowCredentials(true);
corsConfiguration.setMaxAge(3600L);
return corsConfiguration;
}
@Bean
public CorsFilter corsFilter(){
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**",corsConfiguration());
return new CorsFilter(source);
}
} }
...@@ -30,6 +30,7 @@ public class ApiNodeController { ...@@ -30,6 +30,7 @@ public class ApiNodeController {
return monitorKey; return monitorKey;
} }
@PostMapping("runHistory") @PostMapping("runHistory")
public ResponseResult runHistory(String nodeId){ public ResponseResult runHistory(String nodeId){
List<JobTaskRunLog> jobTaskRunLogList = apiNodeService.runHistory(nodeId); List<JobTaskRunLog> jobTaskRunLogList = apiNodeService.runHistory(nodeId);
...@@ -84,6 +85,12 @@ public class ApiNodeController { ...@@ -84,6 +85,12 @@ public class ApiNodeController {
return ResponseResult.ok("SUCCESS"); return ResponseResult.ok("SUCCESS");
} }
@PostMapping("runTask")
public ResponseResult runTask(String jobName){
apiNodeService.runTask(jobName);
return ResponseResult.ok("SUCCESS");
}
@PostMapping("loadCurrentStatusByJobName") @PostMapping("loadCurrentStatusByJobName")
public ResponseResult loadCurrentStatusByJobName(String jobNames){ public ResponseResult loadCurrentStatusByJobName(String jobNames){
Map<String, JobTaskRunLog> jobTaskRunLogMap = apiNodeService.loadCurrentStatusByJobName(jobNames); Map<String, JobTaskRunLog> jobTaskRunLogMap = apiNodeService.loadCurrentStatusByJobName(jobNames);
......
package com.byit.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class IndexController {
@RequestMapping("/")
public String index()
{
return "index";
}
}
...@@ -17,6 +17,8 @@ public interface ApiNodeService { ...@@ -17,6 +17,8 @@ public interface ApiNodeService {
*/ */
String runNode(String param); String runNode(String param);
/** /**
* 根据nodeid查询运行历史 * 根据nodeid查询运行历史
* @param nodeId * @param nodeId
...@@ -43,6 +45,13 @@ public interface ApiNodeService { ...@@ -43,6 +45,13 @@ public interface ApiNodeService {
void addJavaTask(String param) throws Exception; void addJavaTask(String param) throws Exception;
/** /**
* 立即运行任务不需要验证是否存在
* @param param
* @throws Exception
*/
void runTask(String param) ;
/**
* 功能描述 更新任务配置信息 * 功能描述 更新任务配置信息
* @author gml * @author gml
* @date 2020-04-14 11:28 * @date 2020-04-14 11:28
......
...@@ -21,6 +21,7 @@ import com.byit.task.JavaTaskJobTask; ...@@ -21,6 +21,7 @@ import com.byit.task.JavaTaskJobTask;
import com.byit.task.ScriptExecutorJobTask; import com.byit.task.ScriptExecutorJobTask;
import com.byit.utils.ValidationUtil; import com.byit.utils.ValidationUtil;
import io.netty.util.TimerTask; import io.netty.util.TimerTask;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -143,6 +144,23 @@ public class ApiNodeServiceImpl implements ApiNodeService { ...@@ -143,6 +144,23 @@ public class ApiNodeServiceImpl implements ApiNodeService {
} }
@Override @Override
public void runTask(String param) {
ValidationUtil.dataNotBank(param, "请求参数不允许为空!");
JavaTask javaTask = JSON.parseObject(param, JavaTask.class);
ValidationUtil.dataNotBank(javaTask.getTaskName(), "任务实现类的名称不允许为空!");
if(StringUtils.isBlank(javaTask.getJobName())){
javaTask.setJobName(javaTask.getTaskName());
}
javaTask.setTriggerTime(0L);
if (null != javaTask.getAlarmlAction() && "0".equals(javaTask.getRepeatCount())){
ValidationUtil.dataNotBank(javaTask.getAlarmEmail(), "设置为告警时告警邮箱不允许为空");
}
TimerTask timerTask = new JavaTaskJobTask(javaTask);
WorkRoulette.addJob(timerTask, System.currentTimeMillis());
}
@Override
public void updateJavaTask(String param) throws Exception { public void updateJavaTask(String param) throws Exception {
JavaTask javaTask = validate(param); JavaTask javaTask = validate(param);
ValidationUtil.dataNotBank(javaTask.getJobName(), "jobName不允许为空"); ValidationUtil.dataNotBank(javaTask.getJobName(), "jobName不允许为空");
......
package com.byit.view;
import com.byit.service.FlowVersionService;
import com.byit.vo.FlowVersionVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 工作流视图界面
* @author huangfu
*/
@RestController
@RequestMapping("view/flow")
public class FlowViewController {
private final FlowVersionService flowVersionService;
public FlowViewController(FlowVersionService flowVersionService) {
this.flowVersionService = flowVersionService;
}
@PostMapping("getAllFlowVersion")
public List<FlowVersionVo> getAllFlowVersion(){
return flowVersionService.findAllFlow();
}
}
...@@ -4,6 +4,16 @@ spring: ...@@ -4,6 +4,16 @@ spring:
url: jdbc:mysql://10.0.10.118:3306/myth-job?Unicode=true&characterEncoding=UTF-8&useSSL=true url: jdbc:mysql://10.0.10.118:3306/myth-job?Unicode=true&characterEncoding=UTF-8&useSSL=true
username: root username: root
password: 123456 password: 123456
thymeleaf:
prefix: classpath:/templates/
suffix: .html
cache: false
enabled: true
check-template: true
check-template-location: true
encoding: utf-8
mode: HTML5
mail: mail:
host: smtp.163.com host: smtp.163.com
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Title</title>
</head>
<body>
<h1>遇见事情不要慌qqqqssss</h1>
<script src="/js/jquery.min.js"/>
</body>
</html>
\ No newline at end of file
...@@ -27,7 +27,7 @@ public class WorkRoulette { ...@@ -27,7 +27,7 @@ public class WorkRoulette {
public static void addJob(TimerTask timerTask,long triggerNextTime) { public static void addJob(TimerTask timerTask,long triggerNextTime) {
log.info("-----添加任务{}-------",((JavaTaskJobTask)timerTask).getJavaTask().getTaskName()); //log.info("-----添加任务{}-------",((JavaTaskJobTask)timerTask).getJavaTask().getTaskName());
HASHED_WHEEL_TIMER.newTimeout(timerTask, TimeUnit.MILLISECONDS.toNanos(triggerNextTime-System.currentTimeMillis()), TimeUnit.NANOSECONDS); HASHED_WHEEL_TIMER.newTimeout(timerTask, TimeUnit.MILLISECONDS.toNanos(triggerNextTime-System.currentTimeMillis()), TimeUnit.NANOSECONDS);
} }
......
package com.byit.mapper; package com.byit.mapper;
import com.byit.model.FlowVersion; import com.byit.model.FlowVersion;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface FlowVersionMapper { public interface FlowVersionMapper {
/**
* 查询全部的工作流
* @return
*/
List<FlowVersion> findAllFlow();
int deleteById(Integer flowVersionId); int deleteById(Integer flowVersionId);
int insertSelective(FlowVersion record); int insertSelective(FlowVersion record);
......
package com.byit.service;
import com.byit.model.FlowVersion;
import com.byit.vo.FlowVersionVo;
import java.util.List;
/**
* @author huangfu
*/
public interface FlowVersionService {
/**
* 查询全部的工作流
* @return
*/
List<FlowVersionVo> findAllFlow();
}
package com.byit.service.impl;
import com.byit.mapper.FlowVersionMapper;
import com.byit.model.FlowVersion;
import com.byit.service.FlowVersionService;
import com.byit.vo.FlowVersionVo;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 工作流版本业务的实现
* @author huangfu
*/
@Service
public class FlowVersionServiceImpl implements FlowVersionService {
private final FlowVersionMapper flowVersionMapper;
public FlowVersionServiceImpl(FlowVersionMapper flowVersionMapper) {
this.flowVersionMapper = flowVersionMapper;
}
@Override
public List<FlowVersionVo> findAllFlow() {
List<FlowVersion> allFlow = flowVersionMapper.findAllFlow();
Map<String, List<FlowVersion>> versionColl = allFlow.stream().collect(Collectors.groupingBy(FlowVersion::getFlowName));
List<FlowVersionVo> flowVersionVos = new ArrayList<>();
versionColl.forEach((key,value) ->{
FlowVersionVo flowVersionVo = new FlowVersionVo();
flowVersionVo.setFlowName(key);
flowVersionVo.setChildren(value);
flowVersionVos.add(flowVersionVo);
});
return flowVersionVos;
}
}
...@@ -30,9 +30,6 @@ public class JavaTaskAndLogServiceServiceImpl implements JavaTaskAndLogService { ...@@ -30,9 +30,6 @@ public class JavaTaskAndLogServiceServiceImpl implements JavaTaskAndLogService {
JavaTask updateJavaTask = new JavaTask(); JavaTask updateJavaTask = new JavaTask();
try { try {
BeanUtils.copyProperties(javaTask,updateJavaTask); BeanUtils.copyProperties(javaTask,updateJavaTask);
Date nextValidTimeAfter = new CronExpression(javaTask.getCron()).getNextValidTimeAfter(new Date());
System.out.println("------下次执行时间为,{}-----"+ DateUtil.format(nextValidTimeAfter,"yyyy-MM-dd HH:mm:ss"));
System.out.println("------当前线程为:-----"+ Thread.currentThread().getName()+"----hash---"+Thread.currentThread().hashCode());
updateJavaTask.setTriggerTime(new CronExpression(javaTask.getCron()).getNextValidTimeAfter(new Date(javaTask.getTriggerTime())).getTime()); updateJavaTask.setTriggerTime(new CronExpression(javaTask.getCron()).getNextValidTimeAfter(new Date(javaTask.getTriggerTime())).getTime());
} catch (ParseException e) { } catch (ParseException e) {
javaTask.setTriggerTime(999999999999999999L); javaTask.setTriggerTime(999999999999999999L);
......
...@@ -152,6 +152,8 @@ public class ScriptExecutorJobTask implements TimerTask { ...@@ -152,6 +152,8 @@ public class ScriptExecutorJobTask implements TimerTask {
//上一次的执行日志 //上一次的执行日志
String runMsg = jobTaskRunLogById.getRunMsg(); String runMsg = jobTaskRunLogById.getRunMsg();
jobTaskRunLog.setRunMsg(runMsg+"|"+dispatchResponseDto.getMsg()); jobTaskRunLog.setRunMsg(runMsg+"|"+dispatchResponseDto.getMsg());
}else{
jobTaskRunLog.setRunMsg(dispatchResponseDto.getMsg());
} }
} }
//获取执行机地址 //获取执行机地址
......
...@@ -34,14 +34,14 @@ public class JavaTaskThreadRunHelper extends BaseThreadRunHelper { ...@@ -34,14 +34,14 @@ public class JavaTaskThreadRunHelper extends BaseThreadRunHelper {
long nowTime = System.currentTimeMillis(); long nowTime = System.currentTimeMillis();
List<JavaTask> javaTasks = javaTaskService.findAllByTriggerTimeLessThanEqual(nowTime + JAVA_TASK_WAIT_TIME); List<JavaTask> javaTasks = javaTaskService.findAllByTriggerTimeLessThanEqual(nowTime + JAVA_TASK_WAIT_TIME);
if(CollectionUtil.isNotEmpty(javaTasks)){ if(CollectionUtil.isNotEmpty(javaTasks)){
javaTasks.forEach(javaTask -> { for (JavaTask javaTask : javaTasks) {
//查看该任务的剩余执行次数 //查看该任务的剩余执行次数
Integer repeatCount = javaTask.getRepeatCount(); Integer repeatCount = javaTask.getRepeatCount();
if(repeatCount > 0){ if(repeatCount > 0){
javaTask.setRepeatCount(javaTask.getRepeatCount()-1); javaTask.setRepeatCount(javaTask.getRepeatCount()-1);
} }
javaTaskAndLogService.updateJavaTaskAndSaveLog(javaTask); javaTaskAndLogService.updateJavaTaskAndSaveLog(javaTask);
}); }
} }
return JAVA_TASK_WAIT_TIME; return JAVA_TASK_WAIT_TIME;
} }
......
...@@ -230,7 +230,7 @@ public class TaskThreadRunHelper extends BaseThreadRunHelper { ...@@ -230,7 +230,7 @@ public class TaskThreadRunHelper extends BaseThreadRunHelper {
} }
for (JobTaskRunLog jobTaskRunLog : errorJobLog) { for (JobTaskRunLog jobTaskRunLog : errorJobLog) {
//失败重试次数大于0 而且错误原因不是上级节点执行失败 //失败重试次数大于0 而且错误原因不是上级节点执行失败
if(jobTaskRunLog.getFailedRemainingCount()>0 && !("6".equals(jobTaskRunLog.getRunCode()) && "5".equals(jobTaskRunLog.getRunCode()))){ if(jobTaskRunLog.getFailedRemainingCount()!= null && jobTaskRunLog.getFailedRemainingCount()>0 && !("6".equals(jobTaskRunLog.getRunCode()) || "5".equals(jobTaskRunLog.getRunCode()))){
log.debug("----------------【{}节点没有重试完毕】----------------",jobTaskRunLog); log.debug("----------------【{}节点没有重试完毕】----------------",jobTaskRunLog);
return false; return false;
} }
......
package com.byit.vo;
import com.byit.model.FlowVersion;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 工作流版本的视图载体
* @author huangfu
*/
@ApiModel("工作流版本的视图载体")
@Data
public class FlowVersionVo implements Serializable {
/**
* 工作流名字
*/
@ApiModelProperty("工作流的名字")
private String flowName;
/**
* 对应的版本
*/
@ApiModelProperty("对应的工作流的所由版本")
private List<FlowVersion> children;
}
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
repeat_count, version_mark, workspace_id, author, principal, version_name, is_inner repeat_count, version_mark, workspace_id, author, principal, version_name, is_inner
</sql> </sql>
<select id="findAllFlow" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from flow_version where remove_mark = '1'
</select>
<select id="getById" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="getById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!-- generated @mbg.generated date: 2019-12-31 --> <!-- generated @mbg.generated date: 2019-12-31 -->
select select
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="run_type" jdbcType="CHAR" property="runType" /> <result column="run_type" jdbcType="CHAR" property="runType" />
<result column="trigger_code" jdbcType="VARCHAR" property="triggerCode" /> <result column="trigger_code" jdbcType="VARCHAR" property="triggerCode" />
<result column="trigger_time" jdbcType="DATE" property="triggerTime" /> <result column="trigger_time" jdbcType="TIMESTAMP" property="triggerTime" />
<result column="job_group_ip" jdbcType="VARCHAR" property="jobGroupIp" /> <result column="job_group_ip" jdbcType="VARCHAR" property="jobGroupIp" />
<result column="map_flow_id" jdbcType="INTEGER" property="mapFlowId" /> <result column="map_flow_id" jdbcType="INTEGER" property="mapFlowId" />
<result column="run_command" jdbcType="VARCHAR" property="runCommand" /> <result column="run_command" jdbcType="VARCHAR" property="runCommand" />
...@@ -349,7 +349,7 @@ ...@@ -349,7 +349,7 @@
#{triggerCode,jdbcType=VARCHAR}, #{triggerCode,jdbcType=VARCHAR},
</if> </if>
<if test="triggerTime != null"> <if test="triggerTime != null">
#{triggerTime,jdbcType=DATE}, #{triggerTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="jobGroupIp != null"> <if test="jobGroupIp != null">
#{jobGroupIp,jdbcType=VARCHAR}, #{jobGroupIp,jdbcType=VARCHAR},
...@@ -453,7 +453,7 @@ ...@@ -453,7 +453,7 @@
trigger_code = #{triggerCode,jdbcType=VARCHAR}, trigger_code = #{triggerCode,jdbcType=VARCHAR},
</if> </if>
<if test="triggerTime != null"> <if test="triggerTime != null">
trigger_time = #{triggerTime,jdbcType=DATE}, trigger_time = #{triggerTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="jobGroupIp != null"> <if test="jobGroupIp != null">
job_group_ip = #{jobGroupIp,jdbcType=VARCHAR}, job_group_ip = #{jobGroupIp,jdbcType=VARCHAR},
...@@ -558,7 +558,7 @@ ...@@ -558,7 +558,7 @@
trigger_code = #{triggerCode,jdbcType=VARCHAR}, trigger_code = #{triggerCode,jdbcType=VARCHAR},
</if> </if>
<if test="triggerTime != null"> <if test="triggerTime != null">
trigger_time = #{triggerTime,jdbcType=DATE}, trigger_time = #{triggerTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="jobGroupIp != null"> <if test="jobGroupIp != null">
job_group_ip = #{jobGroupIp,jdbcType=VARCHAR}, job_group_ip = #{jobGroupIp,jdbcType=VARCHAR},
......
...@@ -12,4 +12,15 @@ ...@@ -12,4 +12,15 @@
<artifactId>myth-dto-core</artifactId> <artifactId>myth-dto-core</artifactId>
<dependencies>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
</dependencies>
</project> </project>
\ No newline at end of file
package com.byit.dto.plugin; package com.byit.dto.plugin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -11,6 +13,7 @@ import java.util.Date; ...@@ -11,6 +13,7 @@ import java.util.Date;
/** /**
* @author huangfu * @author huangfu
*/ */
@ApiModel
@Data @Data
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
...@@ -19,122 +22,146 @@ public class JobTaskRunLog implements Serializable { ...@@ -19,122 +22,146 @@ public class JobTaskRunLog implements Serializable {
/** /**
* 日志ID * 日志ID
*/ */
@ApiModelProperty("日志ID")
private Integer logId; private Integer logId;
/** /**
* 当前节点的失败剩余重试次数 初始阶段为初始的重试次数 * 当前节点的失败剩余重试次数 初始阶段为初始的重试次数
*/ */
@ApiModelProperty("当前节点的失败剩余重试次数 初始阶段为初始的重试次数")
private Integer failedRemainingCount; private Integer failedRemainingCount;
/** /**
* 版本名称 * 版本名称
*/ */
@ApiModelProperty("版本名称")
private String versionName; private String versionName;
/** /**
* 任务流主键 * 任务流主键
*/ */
@ApiModelProperty("任务流主键")
private Integer flowId; private Integer flowId;
/** /**
* 所属任务流的名称 * 所属任务流的名称
*/ */
@ApiModelProperty("所属任务流的名称")
private String flowName; private String flowName;
/** /**
* 执行机主键 * 执行机主键
*/ */
@ApiModelProperty("执行机主键")
private Integer jobGroupId; private Integer jobGroupId;
/** /**
* 插件方节点key * 插件方节点key
*/ */
@ApiModelProperty("插件方节点key")
private String handlerName; private String handlerName;
/** /**
* 节点名称 * 节点名称
*/ */
@ApiModelProperty("节点名称")
private String nodeName; private String nodeName;
/** /**
* 是否是虚节点(0 是, 1 否),虚节点代表是内嵌工作流 * 是否是虚节点(0 是, 1 否),虚节点代表是内嵌工作流
*/ */
@ApiModelProperty("是否是虚节点(0 是, 1 否),虚节点代表是内嵌工作流")
private String isVirtual; private String isVirtual;
/** /**
* 运行结果 0运行中 1 成功 2 失败 3 补批成功 4 补批失败 5.kill 6.上级节点执行失败 * 运行结果 0运行中 1 成功 2 失败 3 补批成功 4 补批失败 5.kill 6.上级节点执行失败
*/ */
@ApiModelProperty("运行结果 0运行中 1 成功 2 失败 3 补批成功 4 补批失败 5.kill 6.上级节点执行失败")
private String runCode; private String runCode;
/** /**
* 运行参数 * 运行参数
*/ */
@ApiModelProperty("运行参数")
private String runParams; private String runParams;
/** /**
* 运行方式 1执行机运行,2插件运行 * 运行方式 1执行机运行,2插件运行
*/ */
@ApiModelProperty("运行方式 1执行机运行,2插件运行")
private String runType; private String runType;
/** /**
* 调度结果 1成功 2失败 * 调度结果 1成功 2失败
*/ */
@ApiModelProperty("调度结果 1成功 2失败")
private String triggerCode; private String triggerCode;
/** /**
* 触发时间 * 触发时间
*/ */
@ApiModelProperty("触发时间")
private Date triggerTime; private Date triggerTime;
/** /**
* 执行机的IP地址 * 执行机的IP地址
*/ */
@ApiModelProperty("执行机的IP地址")
private String jobGroupIp; private String jobGroupIp;
/** /**
* 映射的工作流id(当节点为虚节点,有意义) * 映射的工作流id(当节点为虚节点,有意义)
*/ */
@ApiModelProperty("映射的工作流id(当节点为虚节点,有意义)")
private Integer mapFlowId; private Integer mapFlowId;
/** /**
* 运行命令 * 运行命令
*/ */
@ApiModelProperty("运行命令")
private String runCommand; private String runCommand;
/** /**
* 结束时间 * 结束时间
*/ */
@ApiModelProperty("结束时间")
private Date endTime; private Date endTime;
/** /**
* 开始时间 * 开始时间
*/ */
@ApiModelProperty("开始时间")
private Date startTime; private Date startTime;
/** /**
* 节点id * 节点id
*/ */
@ApiModelProperty("节点id")
private Integer nodeId; private Integer nodeId;
/** /**
* 节点任务类型 * 节点任务类型
*/ */
@ApiModelProperty("节点任务类型")
private String jobType; private String jobType;
/** /**
* 是否已完成告警(0未完成 1完成) * 是否已完成告警(0未完成 1完成)
*/ */
@ApiModelProperty("是否已完成告警(0未完成 1完成)")
private String alertEnd; private String alertEnd;
/** /**
* 运行标识 * 运行标识
*/ */
@ApiModelProperty("运行标识")
private String runId; private String runId;
/** /**
* 重跑的运行标识 * 重跑的运行标识
*/ */
@ApiModelProperty("重跑的运行标识")
private String reRunId; private String reRunId;
/** /**
* 日志文件的地址 * 日志文件的地址
...@@ -144,31 +171,40 @@ public class JobTaskRunLog implements Serializable { ...@@ -144,31 +171,40 @@ public class JobTaskRunLog implements Serializable {
/** /**
* 是否上级运行成功时运行(0 是 1 否) * 是否上级运行成功时运行(0 是 1 否)
*/ */
@ApiModelProperty("是否上级运行成功时运行(0 是 1 否)")
private String superSuccessRun; private String superSuccessRun;
/** /**
* 执行次数 * 执行次数
*/ */
@ApiModelProperty("执行次数")
private Integer runCount; private Integer runCount;
/** /**
* 日志文件的远程路径 * 日志文件的远程路径
*/ */
@ApiModelProperty("日志的远程路径")
private String logRemotelyPath; private String logRemotelyPath;
/** /**
* 依赖节点id集合 * 依赖节点id集合
*/ */
@ApiModelProperty("依赖节点id集合")
private String nodeDepend; private String nodeDepend;
/** /**
* 重跑和补批的操作人 * 重跑和补批的操作人
*/ */
@ApiModelProperty("重跑和补批的操作人")
private String operator; private String operator;
/** /**
* 跑批类型 1 正常跑批 2 重跑 3 补批 * 跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行 5 类quartz任务执行
*/ */
@ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行 5 类quartz任务执行")
private Integer scheduleType; private Integer scheduleType;
@ApiModelProperty("脚本路径")
private String scriptUrls;
/** /**
* *
*/ */
......
...@@ -28,7 +28,7 @@ public class ExceptionHandle { ...@@ -28,7 +28,7 @@ public class ExceptionHandle {
}else if(e instanceof DataValidationException){ }else if(e instanceof DataValidationException){
return ResponseResult.error("500",e.getMessage()); return ResponseResult.error("500",e.getMessage());
} }
return ResponseResult.error("未知错误"); return ResponseResult.error(e.getMessage());
} }
/** /**
......
...@@ -143,6 +143,10 @@ public class JobUtils { ...@@ -143,6 +143,10 @@ public class JobUtils {
*/ */
private static final String REQUEST_RUN_JAVATASK = "/api/node/runJavaTask"; private static final String REQUEST_RUN_JAVATASK = "/api/node/runJavaTask";
/** /**
* 立即运行quartz任务
*/
private static final String REQUEST_RUN_TASK = "/api/node/runTask";
/**
* 获取当前的运行状态 * 获取当前的运行状态
*/ */
private static final String REQUEST_LOADSTATUS_JAVATASK = "/api/node/loadCurrentStatusByJobName"; private static final String REQUEST_LOADSTATUS_JAVATASK = "/api/node/loadCurrentStatusByJobName";
...@@ -616,6 +620,18 @@ public class JobUtils { ...@@ -616,6 +620,18 @@ public class JobUtils {
} }
/** /**
* 立即运行quartz任务 不验证是否存在数据库中
* @param javaTask
* @return
*/
public static ResponseResult runTask(JavaTask javaTask){
log.info("-------------立即运行quartz任务----------------------");
String response = createHttpRequest(REQUEST_RUN_TASK, "param=" + JSON.toJSONString(javaTask,WriteClassName));
log.info("--------------------立即运行quartz任务,结果为:{}------------------------",response);
return JSON.parseObject(response, ResponseResult.class);
}
/**
* 获取当前的运行状态 * 获取当前的运行状态
* @param jobNames * @param jobNames
* @return * @return
......
...@@ -32,7 +32,7 @@ public class LoginFilter extends ZuulFilter { ...@@ -32,7 +32,7 @@ public class LoginFilter extends ZuulFilter {
@Override @Override
public boolean shouldFilter() { public boolean shouldFilter() {
return true; return false;
} }
@Override @Override
......
package com.byit.factory; package com.byit.factory;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.net.NetUtil; import cn.hutool.core.util.NetUtil;
import com.byit.callback.DefaultRemainingOperationsCallBack; import com.byit.callback.DefaultRemainingOperationsCallBack;
import com.byit.callback.RemainingOperationsCallBack; import com.byit.callback.RemainingOperationsCallBack;
import com.byit.registry.DataSourceServiceRegistry; import com.byit.registry.DataSourceServiceRegistry;
......
...@@ -13,11 +13,13 @@ import java.util.concurrent.TimeUnit; ...@@ -13,11 +13,13 @@ import java.util.concurrent.TimeUnit;
*/ */
public class AddComplexPy1 { public class AddComplexPy1 {
public static void main(String[] args) { public static void main(String[] args) {
PluginPackage pluginPackage = new PluginPackage(); PluginPackage pluginPackage = new PluginPackage();
pluginPackage.setWorkspaceName("test"); pluginPackage.setWorkspaceName("test");
pluginPackage.setFlow(createFlow()); pluginPackage.setFlow(createFlow());
JobUtils.setRequestUrl("http://127.0.0.1:8081/myth-job-admin"); JobUtils.setRequestUrl("http://127.0.0.1:8081/myth-job-admin");
JobUtils.setTOKEN("test"); JobUtils.setTOKEN("test");
//JobUtils.addWorkspace("test");
JobUtils.publish(pluginPackage); JobUtils.publish(pluginPackage);
} }
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<!--<spring-cloud.version>Finchley.SR2</spring-cloud.version>--> <!--<spring-cloud.version>Finchley.SR2</spring-cloud.version>-->
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version> <spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
<lombok.version>1.18.4</lombok.version> <lombok.version>1.18.4</lombok.version>
<hutool.version>4.5.11</hutool.version> <hutool.version>4.1.8</hutool.version>
<spring.boot.starter.mail.version>2.2.2.RELEASE</spring.boot.starter.mail.version> <spring.boot.starter.mail.version>2.2.2.RELEASE</spring.boot.starter.mail.version>
<mybatis.spring.boot.starter>2.1.1</mybatis.spring.boot.starter> <mybatis.spring.boot.starter>2.1.1</mybatis.spring.boot.starter>
<commons.lang3.version>3.9</commons.lang3.version> <commons.lang3.version>3.9</commons.lang3.version>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment