Search in sources :

Example 6 with XxlJobLog

use of com.xxl.job.admin.core.model.XxlJobLog in project xxl-job by xuxueli.

the class JobLogController method logDetailCat.

@RequestMapping("/logDetailCat")
@ResponseBody
public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, int logId, int fromLineNum) {
    try {
        ExecutorBiz executorBiz = XxlJobDynamicScheduler.getExecutorBiz(executorAddress);
        ReturnT<LogResult> logResult = executorBiz.log(triggerTime, logId, fromLineNum);
        // is end
        if (logResult.getContent() != null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
            XxlJobLog jobLog = xxlJobLogDao.load(logId);
            if (jobLog.getHandleCode() > 0) {
                logResult.getContent().setEnd(true);
            }
        }
        return logResult;
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        return new ReturnT<LogResult>(ReturnT.FAIL_CODE, e.getMessage());
    }
}
Also used : ExecutorBiz(com.xxl.job.core.biz.ExecutorBiz) LogResult(com.xxl.job.core.biz.model.LogResult) XxlJobLog(com.xxl.job.admin.core.model.XxlJobLog) ParseException(java.text.ParseException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 7 with XxlJobLog

use of com.xxl.job.admin.core.model.XxlJobLog in project xxl-job by xuxueli.

the class JobLogController method pageList.

@RequestMapping("/pageList")
@ResponseBody
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start, @RequestParam(required = false, defaultValue = "10") int length, int jobGroup, int jobId, int logStatus, String filterTime) {
    // parse param
    Date triggerTimeStart = null;
    Date triggerTimeEnd = null;
    if (StringUtils.isNotBlank(filterTime)) {
        String[] temp = filterTime.split(" - ");
        if (temp != null && temp.length == 2) {
            try {
                triggerTimeStart = DateUtils.parseDate(temp[0], new String[] { "yyyy-MM-dd HH:mm:ss" });
                triggerTimeEnd = DateUtils.parseDate(temp[1], new String[] { "yyyy-MM-dd HH:mm:ss" });
            } catch (ParseException e) {
            }
        }
    }
    // page query
    List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
    int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
    // package result
    Map<String, Object> maps = new HashMap<String, Object>();
    // 总记录数
    maps.put("recordsTotal", list_count);
    // 过滤后的总记录数
    maps.put("recordsFiltered", list_count);
    // 分页列表
    maps.put("data", list);
    return maps;
}
Also used : HashMap(java.util.HashMap) XxlJobLog(com.xxl.job.admin.core.model.XxlJobLog) ParseException(java.text.ParseException) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 8 with XxlJobLog

use of com.xxl.job.admin.core.model.XxlJobLog in project xxl-job by xuxueli.

the class JobLogController method logDetailPage.

@RequestMapping("/logDetailPage")
public String logDetailPage(int id, Model model) {
    // base check
    ReturnT<String> logStatue = ReturnT.SUCCESS;
    XxlJobLog jobLog = xxlJobLogDao.load(id);
    if (jobLog == null) {
        throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid"));
    }
    model.addAttribute("triggerCode", jobLog.getTriggerCode());
    model.addAttribute("handleCode", jobLog.getHandleCode());
    model.addAttribute("executorAddress", jobLog.getExecutorAddress());
    model.addAttribute("triggerTime", jobLog.getTriggerTime().getTime());
    model.addAttribute("logId", jobLog.getId());
    return "joblog/joblog.detail";
}
Also used : XxlJobLog(com.xxl.job.admin.core.model.XxlJobLog) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

XxlJobLog (com.xxl.job.admin.core.model.XxlJobLog)8 Date (java.util.Date)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 XxlJobInfo (com.xxl.job.admin.core.model.XxlJobInfo)3 ReturnT (com.xxl.job.core.biz.model.ReturnT)3 ParseException (java.text.ParseException)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 ExecutorBiz (com.xxl.job.core.biz.ExecutorBiz)2 ExecutorFailStrategyEnum (com.xxl.job.admin.core.enums.ExecutorFailStrategyEnum)1 XxlJobGroup (com.xxl.job.admin.core.model.XxlJobGroup)1 ExecutorRouteStrategyEnum (com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum)1 LogResult (com.xxl.job.core.biz.model.LogResult)1 TriggerParam (com.xxl.job.core.biz.model.TriggerParam)1 ExecutorBlockStrategyEnum (com.xxl.job.core.enums.ExecutorBlockStrategyEnum)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Test (org.junit.Test)1