Commit b4d530ac by huangfusuper

【调整对任务表的表操作】调整对任务表的表操作

parent 7c734b57
......@@ -5,7 +5,9 @@ import com.byit.job.dto.JobRunResultDto;
import com.byit.job.dto.PluginBeanJobInfo;
import com.byit.job.model.MythJobReadAhead;
import com.byit.job.utils.SourceObj2TargetObjUtil;
import com.byit.model.MythJobTask;
import com.byit.service.JobReadAheadService;
import com.byit.service.MythJobTaskService;
import com.byit.thread.LogCallbackThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -23,6 +25,8 @@ import java.util.List;
public class JobController {
@Autowired
private JobReadAheadService jobReadAheadService;
@Autowired
private MythJobTaskService mythJobTaskService;
@PostMapping(value = "addJob")
public String addJob(@RequestBody PluginBeanJobInfo pluginBeanJobInfo){
......@@ -36,8 +40,8 @@ public class JobController {
MythJobAutoConfigure.LOG_CALLBACK.execute(new LogCallbackThread(jobRunResultDto));
}
@GetMapping(value = "getJobInfo")
public List<MythJobReadAhead> getJobInfo(){
return jobReadAheadService.findMythJobReadAheadByTriggerNextTime(11);
@GetMapping(value = "getJobTask")
public List<MythJobTask> getJobInfo(){
return mythJobTaskService.findMythJobTaskByTriggerNextTimeLessThanEqual(11);
}
}
package com.byit.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import javax.persistence.*;
......@@ -116,6 +117,7 @@ public class MythJobTask {
* 源码的修改时间
*/
@Column(columnDefinition = "DATE COMMENT '源码的修改时间' " )
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mms:s")
private Date sourceUpdateTime;
/**
* 源码负责人
......
package com.byit.repository;
import com.byit.model.MythJobTask;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @program: byit-myth-job->MythJobTaskRepository
* @description: 对于即将执行人任务进行操作JobTask
* @author: huangfu
* @date: 2019/12/20 15:07
**/
public interface MythJobTaskRepository extends JpaRepository<MythJobTask,Integer> {
/**
* 根据下次执行时间+7000毫秒 查询所有任务节点
* @param maxNextTime
* @return
*/
List<MythJobTask> findMythJobTaskByTriggerNextTimeLessThanEqual(long maxNextTime);
}
package com.byit.service;
import com.byit.job.model.MythJobReadAhead;
import com.byit.model.MythJobTask;
import java.util.List;
/**
* @program: byit-myth-job->MythJobTaskService
* @description: 对于任务表的操作
* @author: huangfu
* @date: 2019/12/20 15:13
**/
public interface MythJobTaskService {
/**
* 根据下次执行时间+7000毫秒 查询所有任务节点
* @param maxNextTime
* @return
*/
List<MythJobTask> findMythJobTaskByTriggerNextTimeLessThanEqual(long maxNextTime);
/**
* 添加单个任务节点
* @param mythJobTask
*/
void addMythJobTask(MythJobTask mythJobTask);
/**
* 删除已经被调度的任务根据ID
* @param id
*/
void removeMythJobTaskById(Integer id);
}
package com.byit.service.impl;
import com.byit.model.MythJobTask;
import com.byit.repository.MythJobTaskRepository;
import com.byit.service.MythJobTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @program: byit-myth-job->MythJobTaskService
* @description: 对于任务表的操作
* @author: huangfu
* @date: 2019/12/20 15:13
**/
@Service
public class MythJobTaskServiceImpl implements MythJobTaskService {
@Autowired
private MythJobTaskRepository mythJobTaskRepository;
@Override
public List<MythJobTask> findMythJobTaskByTriggerNextTimeLessThanEqual(long maxNextTime) {
return mythJobTaskRepository.findMythJobTaskByTriggerNextTimeLessThanEqual(maxNextTime);
}
@Override
public void addMythJobTask(MythJobTask mythJobTask) {
mythJobTaskRepository.save(mythJobTask);
}
@Override
public void removeMythJobTaskById(Integer id) {
mythJobTaskRepository.delete(id);
}
}
package com.byit.job.model;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.*;
import java.util.Date;
......@@ -118,6 +119,7 @@ public class MythJobReadAhead {
/**
* 源码的修改时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date glueUpdateTime;
/**
* 任务下次调度时间
......
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