Browse Source

add history task record

pull/2/head
baoliang 6 years ago
parent
commit
7837a3fe19
  1. 34
      escheduler-api/src/main/java/cn/escheduler/api/controller/TaskRecordController.java
  2. 4
      escheduler-api/src/main/java/cn/escheduler/api/service/TaskRecordService.java

34
escheduler-api/src/main/java/cn/escheduler/api/controller/TaskRecordController.java

@ -68,7 +68,39 @@ public class TaskRecordController extends BaseController{
try{ try{
logger.info("query task record list, task name:{}, state :{}, taskDate: {}, start:{}, end:{}", logger.info("query task record list, task name:{}, state :{}, taskDate: {}, start:{}, end:{}",
taskName, state, taskDate, startTime, endTime); taskName, state, taskDate, startTime, endTime);
Map<String, Object> result = taskRecordService.queryTaskRecordListPaging(taskName, startTime, taskDate, sourceTable, destTable, endTime,state, pageNo, pageSize); Map<String, Object> result = taskRecordService.queryTaskRecordListPaging(false, taskName, startTime, taskDate, sourceTable, destTable, endTime,state, pageNo, pageSize);
return returnDataListPaging(result);
}catch (Exception e){
logger.error(QUERY_TASK_RECORD_LIST_PAGING_ERROR.getMsg(),e);
return error(QUERY_TASK_RECORD_LIST_PAGING_ERROR.getCode(), QUERY_TASK_RECORD_LIST_PAGING_ERROR.getMsg());
}
}
/**
* query history task record list paging
*
* @param loginUser
* @return
*/
@GetMapping("/history-list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryHistoryTaskRecordListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "state", required = false) String state,
@RequestParam(value = "sourceTable", required = false) String sourceTable,
@RequestParam(value = "destTable", required = false) String destTable,
@RequestParam(value = "taskDate", required = false) String taskDate,
@RequestParam(value = "startDate", required = false) String startTime,
@RequestParam(value = "endDate", required = false) String endTime,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize
){
try{
logger.info("query hisotry task record list, task name:{}, state :{}, taskDate: {}, start:{}, end:{}",
taskName, state, taskDate, startTime, endTime);
Map<String, Object> result = taskRecordService.queryTaskRecordListPaging(true, taskName, startTime, taskDate, sourceTable, destTable, endTime,state, pageNo, pageSize);
return returnDataListPaging(result); return returnDataListPaging(result);
}catch (Exception e){ }catch (Exception e){
logger.error(QUERY_TASK_RECORD_LIST_PAGING_ERROR.getMsg(),e); logger.error(QUERY_TASK_RECORD_LIST_PAGING_ERROR.getMsg(),e);

4
escheduler-api/src/main/java/cn/escheduler/api/service/TaskRecordService.java

@ -53,7 +53,7 @@ public class TaskRecordService extends BaseService{
* @param pageSize * @param pageSize
* @return * @return
*/ */
public Map<String,Object> queryTaskRecordListPaging(String taskName, String startDate, public Map<String,Object> queryTaskRecordListPaging(boolean isHistory, String taskName, String startDate,
String taskDate, String sourceTable, String taskDate, String sourceTable,
String destTable, String endDate, String destTable, String endDate,
String state, Integer pageNo, Integer pageSize) { String state, Integer pageNo, Integer pageSize) {
@ -71,7 +71,7 @@ public class TaskRecordService extends BaseService{
map.put("offset", pageInfo.getStart().toString()); map.put("offset", pageInfo.getStart().toString());
map.put("pageSize", pageInfo.getPageSize().toString()); map.put("pageSize", pageInfo.getPageSize().toString());
String table =TASK_RECORD_TABLE_HIVE_LOG; String table = isHistory ? TASK_RECORD_TABLE_HISTORY_HIVE_LOG : TASK_RECORD_TABLE_HIVE_LOG;
int count = TaskRecordDao.countTaskRecord(map, table); int count = TaskRecordDao.countTaskRecord(map, table);
List<TaskRecord> recordList = TaskRecordDao.queryAllTaskRecord(map, table); List<TaskRecord> recordList = TaskRecordDao.queryAllTaskRecord(map, table);
pageInfo.setTotalCount(count); pageInfo.setTotalCount(count);

Loading…
Cancel
Save