修复不能启动的job模块
This commit is contained in:
parent
72bbf297e4
commit
0f7ea98f56
@ -1,10 +1,10 @@
|
||||
package com.xhpc.job;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import com.xhpc.common.security.annotation.EnableCustomConfig;
|
||||
import com.xhpc.common.security.annotation.EnableRyFeignClients;
|
||||
import com.xhpc.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
|
||||
@ -1,20 +1,5 @@
|
||||
package com.xhpc.job.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xhpc.job.util.CronUtils;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.xhpc.common.core.exception.job.TaskException;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.poi.ExcelUtil;
|
||||
@ -26,6 +11,14 @@ import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.security.annotation.PreAuthorize;
|
||||
import com.xhpc.job.domain.SysJob;
|
||||
import com.xhpc.job.service.ISysJobService;
|
||||
import com.xhpc.job.util.CronUtils;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度任务信息操作处理
|
||||
@ -36,8 +29,9 @@ import com.xhpc.job.service.ISysJobService;
|
||||
@RequestMapping("/job")
|
||||
public class SysJobController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private ISysJobService jobService;
|
||||
private ISysJobService sysJobService;
|
||||
|
||||
/**
|
||||
* 查询定时任务列表
|
||||
@ -47,7 +41,7 @@ public class SysJobController extends BaseController
|
||||
public TableDataInfo list(SysJob sysJob)
|
||||
{
|
||||
startPage();
|
||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||
List<SysJob> list = sysJobService.selectJobList(sysJob);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -59,7 +53,8 @@ public class SysJobController extends BaseController
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysJob sysJob) throws IOException
|
||||
{
|
||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||
|
||||
List<SysJob> list = sysJobService.selectJobList(sysJob);
|
||||
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||
util.exportExcel(response, list, "定时任务");
|
||||
}
|
||||
@ -71,7 +66,8 @@ public class SysJobController extends BaseController
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
|
||||
{
|
||||
return AjaxResult.success(jobService.selectJobById(jobId));
|
||||
|
||||
return AjaxResult.success(sysJobService.selectJobById(jobId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,7 +83,7 @@ public class SysJobController extends BaseController
|
||||
return AjaxResult.error("cron表达式不正确");
|
||||
}
|
||||
sysJob.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(jobService.insertJob(sysJob));
|
||||
return toAjax(sysJobService.insertJob(sysJob));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +99,7 @@ public class SysJobController extends BaseController
|
||||
return AjaxResult.error("cron表达式不正确");
|
||||
}
|
||||
sysJob.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(jobService.updateJob(sysJob));
|
||||
return toAjax(sysJobService.updateJob(sysJob));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,9 +110,10 @@ public class SysJobController extends BaseController
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException
|
||||
{
|
||||
SysJob newJob = jobService.selectJobById(job.getJobId());
|
||||
|
||||
SysJob newJob = sysJobService.selectJobById(job.getJobId());
|
||||
newJob.setStatus(job.getStatus());
|
||||
return toAjax(jobService.changeStatus(newJob));
|
||||
return toAjax(sysJobService.changeStatus(newJob));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +124,8 @@ public class SysJobController extends BaseController
|
||||
@PutMapping("/run")
|
||||
public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
|
||||
{
|
||||
jobService.run(job);
|
||||
|
||||
sysJobService.run(job);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ -139,7 +137,8 @@ public class SysJobController extends BaseController
|
||||
@DeleteMapping("/{jobIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException
|
||||
{
|
||||
jobService.deleteJobByIds(jobIds);
|
||||
|
||||
sysJobService.deleteJobByIds(jobIds);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package com.xhpc.job.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xhpc.job.domain.SysJobLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度任务日志信息 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysJobLogMapper
|
||||
{
|
||||
/**
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package com.xhpc.job.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xhpc.job.domain.SysJob;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度任务信息 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysJobMapper
|
||||
{
|
||||
/**
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package com.xhpc.job.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xhpc.common.core.exception.job.TaskException;
|
||||
import com.xhpc.job.domain.SysJob;
|
||||
import org.quartz.SchedulerException;
|
||||
import com.xhpc.common.core.exception.job.TaskException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务调度信息信息 服务层
|
||||
|
||||
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.job.mapper.SysJobMapper">
|
||||
|
||||
<resultMap type="SysJob" id="SysJobResult">
|
||||
<id property="jobId" column="job_id"/>
|
||||
<result property="jobName" column="job_name"/>
|
||||
<result property="jobGroup" column="job_group"/>
|
||||
<result property="invokeTarget" column="invoke_target"/>
|
||||
<result property="cronExpression" column="cron_expression"/>
|
||||
<result property="misfirePolicy" column="misfire_policy"/>
|
||||
<result property="concurrent" column="concurrent"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectJobVo">
|
||||
select job_id,
|
||||
job_name,
|
||||
job_group,
|
||||
invoke_target,
|
||||
cron_expression,
|
||||
misfire_policy,
|
||||
concurrent,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
remark
|
||||
from sys_job
|
||||
</sql>
|
||||
|
||||
<select id="selectJobList" parameterType="SysJob" resultMap="SysJobResult">
|
||||
<include refid="selectJobVo"/>
|
||||
<where>
|
||||
<if test="jobName != null and jobName != ''">
|
||||
AND job_name like concat('%', #{jobName}, '%')
|
||||
</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">
|
||||
AND job_group = #{jobGroup}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="invokeTarget != null and invokeTarget != ''">
|
||||
AND invoke_target like concat('%', #{invokeTarget}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectJobAll" resultMap="SysJobResult">
|
||||
<include refid="selectJobVo"/>
|
||||
</select>
|
||||
|
||||
<select id="selectJobById" parameterType="Long" resultMap="SysJobResult">
|
||||
<include refid="selectJobVo"/>
|
||||
where job_id = #{jobId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteJobById" parameterType="Long">
|
||||
delete
|
||||
from sys_job
|
||||
where job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteJobByIds" parameterType="Long">
|
||||
delete from sys_job where job_id in
|
||||
<foreach collection="array" item="jobId" open="(" separator="," close=")">
|
||||
#{jobId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateJob" parameterType="SysJob">
|
||||
update sys_job
|
||||
<set>
|
||||
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
|
||||
<if test="invokeTarget != null and invokeTarget != ''">invoke_target = #{invokeTarget},</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
|
||||
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
|
||||
<if test="concurrent != null and concurrent != ''">concurrent = #{concurrent},</if>
|
||||
<if test="status !=null">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where job_id = #{jobId}
|
||||
</update>
|
||||
|
||||
<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId">
|
||||
insert into sys_job(
|
||||
<if test="jobId != null and jobId != 0">job_id,</if>
|
||||
<if test="jobName != null and jobName != ''">job_name,</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
|
||||
<if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
|
||||
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if>
|
||||
<if test="concurrent != null and concurrent != ''">concurrent,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="jobId != null and jobId != 0">#{jobId},</if>
|
||||
<if test="jobName != null and jobName != ''">#{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
|
||||
<if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
|
||||
<if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if>
|
||||
<if test="concurrent != null and concurrent != ''">#{concurrent},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user