All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rexsheng.springboot.faster.system.job.domain.SysJob Maven / Gradle / Ivy

The newest version!
package com.github.rexsheng.springboot.faster.system.job.domain;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.rexsheng.springboot.faster.system.job.application.dto.JobParameterDTO;
import com.github.rexsheng.springboot.faster.system.utils.AuthenticationUtil;
import com.github.rexsheng.springboot.faster.util.DateUtil;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class SysJob {

    private Long jobId;

    private String jobName;

    private String jobGroup;

    private String remark;

    private String executeClass;

    private String executeMethod;

    private Map executeParameter;

    private Boolean concurrency;

    private Integer status;

    private String statusName;

    private Boolean isDel;

    private LocalDateTime createTime;

    private Long createUserId;

    private LocalDateTime updateTime;

    private Long updateUserId;

    private String errorMail;

    private List triggerList;

    private SysJobLog jobLog;

    public static List of(List ids, Boolean isDel){
        return ids.stream().map(a->{
            SysJob sysJob=new SysJob();
            sysJob.setJobId(a);
            sysJob.setDel(isDel);
            sysJob.setUpdateTime(DateUtil.currentDateTime());
            sysJob.setUpdateUserId(AuthenticationUtil.currentUserId());
            return sysJob;
        }).collect(Collectors.toList());
    }

    public static Map toParameterMap(List parameters){
        if(parameters != null){
            return parameters.stream().collect(Collectors.toMap(a->a.getLabel(),a->a.getValue(),(a,b)->a));
        }
        return null;
    }

    public static List toParameterList(Map parameters){
        if(parameters != null){
            List list=new ArrayList<>();
            parameters.entrySet().forEach(a->{list.add(new JobParameterDTO(a.getKey(),a.getValue()));});
            return list;
        }
        return null;
    }

    public static String mapToJson(Map map){
        if(map != null){
            try {
                return new ObjectMapper().writeValueAsString(map);
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    public static Map jsonToMap(String str){
        if(str != null){
            try {
                return new ObjectMapper().readValue(str,Map.class);
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    public Long getJobId() {
        return jobId;
    }

    public void setJobId(Long jobId) {
        this.jobId = jobId;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public String getJobGroup() {
        return jobGroup;
    }

    public void setJobGroup(String jobGroup) {
        this.jobGroup = jobGroup;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getExecuteClass() {
        return executeClass;
    }

    public void setExecuteClass(String executeClass) {
        this.executeClass = executeClass;
    }

    public String getExecuteMethod() {
        return executeMethod;
    }

    public void setExecuteMethod(String executeMethod) {
        this.executeMethod = executeMethod;
    }

    public Map getExecuteParameter() {
        return executeParameter;
    }

    public void setExecuteParameter(Map executeParameter) {
        this.executeParameter = executeParameter;
    }

    public Boolean getConcurrency() {
        return concurrency;
    }

    public void setConcurrency(Boolean concurrency) {
        this.concurrency = concurrency;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public Boolean getDel() {
        return isDel;
    }

    public void setDel(Boolean del) {
        isDel = del;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Long getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(Long createUserId) {
        this.createUserId = createUserId;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Long getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateUserId(Long updateUserId) {
        this.updateUserId = updateUserId;
    }

    public String getErrorMail() {
        return errorMail;
    }

    public void setErrorMail(String errorMail) {
        this.errorMail = errorMail;
    }

    public List getTriggerList() {
        return triggerList;
    }

    public void setTriggerList(List triggerList) {
        this.triggerList = triggerList;
    }

    public SysJobLog getJobLog() {
        return jobLog;
    }

    public void setJobLog(SysJobLog jobLog) {
        this.jobLog = jobLog;
    }

    public static class SysJobTrigger{

        private Long triggerId;

        private Long jobId;

        private String triggerName;

        private String triggerGroup;

        private LocalDateTime startTime;

        private LocalDateTime endTime;

        private Integer executeType;

        private String executeExpression;

        private Map triggerInterval;

        private Integer misfireStrategy;

        private Integer priority;

        private Integer status;

        private String statusName;

        private Boolean isDel;

        private LocalDateTime createTime;

        private Long createUserId;

        private LocalDateTime updateTime;

        private Long updateUserId;

        public static List of(List ids, Boolean isDel){
            return ids.stream().map(a->{
                SysJob.SysJobTrigger sysJob=new SysJob.SysJobTrigger();
                sysJob.setTriggerId(a);
                sysJob.setDel(isDel);
                sysJob.setUpdateTime(DateUtil.currentDateTime());
                sysJob.setUpdateUserId(AuthenticationUtil.currentUserId());
                return sysJob;
            }).collect(Collectors.toList());
        }

        public Long getTriggerId() {
            return triggerId;
        }

        public void setTriggerId(Long triggerId) {
            this.triggerId = triggerId;
        }

        public Long getJobId() {
            return jobId;
        }

        public void setJobId(Long jobId) {
            this.jobId = jobId;
        }

        public String getTriggerName() {
            return triggerName;
        }

        public void setTriggerName(String triggerName) {
            this.triggerName = triggerName;
        }

        public String getTriggerGroup() {
            return triggerGroup;
        }

        public void setTriggerGroup(String triggerGroup) {
            this.triggerGroup = triggerGroup;
        }

        public LocalDateTime getStartTime() {
            return startTime;
        }

        public void setStartTime(LocalDateTime startTime) {
            this.startTime = startTime;
        }

        public LocalDateTime getEndTime() {
            return endTime;
        }

        public void setEndTime(LocalDateTime endTime) {
            this.endTime = endTime;
        }

        public Integer getExecuteType() {
            return executeType;
        }

        public void setExecuteType(Integer executeType) {
            this.executeType = executeType;
        }

        public String getExecuteExpression() {
            return executeExpression;
        }

        public void setExecuteExpression(String executeExpression) {
            this.executeExpression = executeExpression;
        }

        public Map getTriggerInterval() {
            return triggerInterval;
        }

        public void setTriggerInterval(Map triggerInterval) {
            this.triggerInterval = triggerInterval;
        }

        public Integer getMisfireStrategy() {
            return misfireStrategy;
        }

        public void setMisfireStrategy(Integer misfireStrategy) {
            this.misfireStrategy = misfireStrategy;
        }

        public Integer getPriority() {
            return priority;
        }

        public void setPriority(Integer priority) {
            this.priority = priority;
        }

        public Integer getStatus() {
            return status;
        }

        public void setStatus(Integer status) {
            this.status = status;
        }

        public String getStatusName() {
            return statusName;
        }

        public void setStatusName(String statusName) {
            this.statusName = statusName;
        }

        public Boolean getDel() {
            return isDel;
        }

        public void setDel(Boolean del) {
            isDel = del;
        }

        public LocalDateTime getCreateTime() {
            return createTime;
        }

        public void setCreateTime(LocalDateTime createTime) {
            this.createTime = createTime;
        }

        public Long getCreateUserId() {
            return createUserId;
        }

        public void setCreateUserId(Long createUserId) {
            this.createUserId = createUserId;
        }

        public LocalDateTime getUpdateTime() {
            return updateTime;
        }

        public void setUpdateTime(LocalDateTime updateTime) {
            this.updateTime = updateTime;
        }

        public Long getUpdateUserId() {
            return updateUserId;
        }

        public void setUpdateUserId(Long updateUserId) {
            this.updateUserId = updateUserId;
        }
    }

    public static class SysJobLog{

        private Long jobLogId;

        private String triggerId;

        private LocalDateTime startTime;

        private LocalDateTime endTime;

        private Integer costTime;

        private String hostIp;

        private String hostName;

        private String executeClass;

        private String executeMethod;

        private String executeParameter;

        private String jobResult;

        private Integer state;

        private List logDetails=new ArrayList();


        public Long getJobLogId() {
            return jobLogId;
        }

        public void setJobLogId(Long jobLogId) {
            this.jobLogId = jobLogId;
        }

        public String getTriggerId() {
            return triggerId;
        }

        public void setTriggerId(String triggerId) {
            this.triggerId = triggerId;
        }

        public LocalDateTime getStartTime() {
            return startTime;
        }

        public void setStartTime(LocalDateTime startTime) {
            this.startTime = startTime;
        }

        public LocalDateTime getEndTime() {
            return endTime;
        }

        public void setEndTime(LocalDateTime endTime) {
            this.endTime = endTime;
        }

        public Integer getCostTime() {
            return costTime;
        }

        public void setCostTime(Integer costTime) {
            this.costTime = costTime;
        }

        public String getHostIp() {
            return hostIp;
        }

        public void setHostIp(String hostIp) {
            this.hostIp = hostIp;
        }

        public String getHostName() {
            return hostName;
        }

        public void setHostName(String hostName) {
            this.hostName = hostName;
        }

        public String getExecuteClass() {
            return executeClass;
        }

        public void setExecuteClass(String executeClass) {
            this.executeClass = executeClass;
        }

        public String getExecuteMethod() {
            return executeMethod;
        }

        public void setExecuteMethod(String executeMethod) {
            this.executeMethod = executeMethod;
        }

        public String getExecuteParameter() {
            return executeParameter;
        }

        public void setExecuteParameter(String executeParameter) {
            this.executeParameter = executeParameter;
        }

        public String getJobResult() {
            return jobResult;
        }

        public void setJobResult(String jobResult) {
            this.jobResult = jobResult;
        }

        public Integer getState() {
            return state;
        }

        public void setState(Integer state) {
            this.state = state;
        }

        public List getLogDetails() {
            return logDetails;
        }

        public void setLogDetails(List logDetails) {
            this.logDetails = logDetails;
        }
    }

    public static class SysJobLogDetail{

        private Long logDetailId;

        private Integer level;

        private String msg;

        private LocalDateTime createTime;

        public Long getLogDetailId() {
            return logDetailId;
        }

        public void setLogDetailId(Long logDetailId) {
            this.logDetailId = logDetailId;
        }

        public Integer getLevel() {
            return level;
        }

        public void setLevel(Integer level) {
            this.level = level;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public LocalDateTime getCreateTime() {
            return createTime;
        }

        public void setCreateTime(LocalDateTime createTime) {
            this.createTime = createTime;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy