若依 4.2

This commit is contained in:
RuoYi
2020-03-23 09:02:04 +08:00
parent 5c736e96c9
commit d066539616
60 changed files with 745 additions and 121 deletions

View File

@ -9,15 +9,19 @@ 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.quartz.domain.SysJob;
import com.ruoyi.quartz.domain.SysJobLog;
import com.ruoyi.quartz.service.ISysJobLogService;
import com.ruoyi.quartz.service.ISysJobService;
/**
* 调度日志操作处理
@ -30,13 +34,21 @@ public class SysJobLogController extends BaseController
{
private String prefix = "monitor/job";
@Autowired
private ISysJobService jobService;
@Autowired
private ISysJobLogService jobLogService;
@RequiresPermissions("monitor:job:view")
@GetMapping()
public String jobLog()
public String jobLog(@RequestParam(value = "jobId", required = false) Long jobId, ModelMap mmap)
{
if (StringUtils.isNotNull(jobId))
{
SysJob job = jobService.selectJobById(jobId);
mmap.put("job", job);
}
return prefix + "/jobLog";
}

View File

@ -34,15 +34,16 @@ public class SysJobServiceImpl implements ISysJobService
/**
* 项目启动时,初始化定时器
* 主要是防止手动修改数据库导致未同步到定时任务处理不能手动修改数据库ID和任务组名否则会导致脏数据
主要是防止手动修改数据库导致未同步到定时任务处理不能手动修改数据库ID和任务组名否则会导致脏数据
*/
@PostConstruct
public void init() throws SchedulerException, TaskException
{
scheduler.clear();
List<SysJob> jobList = jobMapper.selectJobAll();
for (SysJob job : jobList)
{
updateSchedulerJob(job, job.getJobGroup());
ScheduleUtils.createScheduleJob(scheduler, job);
}
}

View File

@ -65,7 +65,7 @@ public class JobInvokeUtil
/**
* 校验是否为为class包名
*
* @param str 名称
* @param invokeTarget 名称
* @return true是 false否
*/
public static boolean isValidClassName(String invokeTarget)

View File

@ -47,7 +47,7 @@
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-info" onclick="javascript:jobLog()" shiro:hasPermission="monitor:job:list">
<a class="btn btn-info" onclick="javascript:jobLog()" shiro:hasPermission="monitor:job:detail">
<i class="fa fa-list"></i> 日志
</a>
</div>
@ -129,6 +129,7 @@
var more = [];
more.push("<a class='btn btn-default btn-xs " + statusFlag + "' href='javascript:void(0)' onclick='run(" + row.jobId + ")'><i class='fa fa-play-circle-o'></i> 执行一次</a> ");
more.push("<a class='btn btn-default btn-xs " + detailFlag + "' href='javascript:void(0)' onclick='$.operate.detail(" + row.jobId + ")'><i class='fa fa-search'></i>任务详细</a> ");
more.push("<a class='btn btn-default btn-xs " + detailFlag + "' href='javascript:void(0)' onclick='jobLog(" + row.jobId + ")'><i class='fa fa-list'></i>调度日志</a>");
actions.push('<a class="btn btn-info btn-xs" role="button" data-toggle="popover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
return actions.join('');
}
@ -168,9 +169,12 @@
}
/* 调度日志查询 */
function jobLog(id) {
var url = ctx + 'monitor/jobLog';
$.modal.openTab("调度日志", url);
function jobLog(jobId) {
var url = ctx + 'monitor/jobLog';
if ($.common.isNotEmpty(jobId)) {
url += '?jobId=' + jobId;
}
$.modal.openTab("调度日志", url);
}
</script>
</body>

View File

@ -12,12 +12,13 @@
<div class="select-list">
<ul>
<li>
任务名称:<input type="text" name="jobName"/>
任务名称:<input type="text" name="jobName" th:value="${job!=null?job.jobName:''}"/>
</li>
<li>
任务分组:<select name="jobGroup" th:with="type=${@dict.getType('sys_job_group')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
<th:block th:if="${job==null}"><option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option></th:block>
<th:block th:if="${job!=null}"><option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{job.jobGroup}"></option></th:block>
</select>
</li>
<li>