|
|
@ -17,6 +17,7 @@ |
|
|
|
package cn.escheduler.api.controller; |
|
|
|
package cn.escheduler.api.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.escheduler.api.enums.Status; |
|
|
|
import cn.escheduler.api.service.QueueService; |
|
|
|
import cn.escheduler.api.service.QueueService; |
|
|
|
import cn.escheduler.api.utils.Constants; |
|
|
|
import cn.escheduler.api.utils.Constants; |
|
|
|
import cn.escheduler.api.utils.Result; |
|
|
|
import cn.escheduler.api.utils.Result; |
|
|
@ -29,7 +30,7 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import static cn.escheduler.api.enums.Status.QUERY_QUEUE_LIST_ERROR; |
|
|
|
import static cn.escheduler.api.enums.Status.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -63,5 +64,82 @@ public class QueueController extends BaseController{ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* query queue list paging |
|
|
|
|
|
|
|
* @param loginUser |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@GetMapping(value="/list-paging") |
|
|
|
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
public Result queryQueueListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
|
|
|
@RequestParam("pageNo") Integer pageNo, |
|
|
|
|
|
|
|
@RequestParam(value = "searchVal", required = false) String searchVal, |
|
|
|
|
|
|
|
@RequestParam("pageSize") Integer pageSize){ |
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("login user {}, query queue list,search value:{}", loginUser.getUserName(),searchVal); |
|
|
|
|
|
|
|
Map<String, Object> result = checkPageParams(pageNo, pageSize); |
|
|
|
|
|
|
|
if(result.get(Constants.STATUS) != Status.SUCCESS){ |
|
|
|
|
|
|
|
return returnDataListPaging(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = queueService.queryList(loginUser,searchVal,pageNo,pageSize); |
|
|
|
|
|
|
|
return returnDataList(result); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(QUERY_QUEUE_LIST_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(QUERY_QUEUE_LIST_ERROR.getCode(), QUERY_QUEUE_LIST_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* create queue |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param loginUser |
|
|
|
|
|
|
|
* @param queue |
|
|
|
|
|
|
|
* @param queueName |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@PostMapping(value = "/create") |
|
|
|
|
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
|
|
|
public Result createQueue(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
|
|
|
@RequestParam(value = "queue") String queue, |
|
|
|
|
|
|
|
@RequestParam(value = "queueName") String queueName) { |
|
|
|
|
|
|
|
logger.info("login user {}, create queue, queue: {}, queueName: {}", |
|
|
|
|
|
|
|
loginUser.getUserName(), queue, queueName); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Map<String, Object> result = queueService.createQueue(loginUser,queue,queueName); |
|
|
|
|
|
|
|
return returnDataList(result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(CREATE_QUEUE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(CREATE_QUEUE_ERROR.getCode(), CREATE_QUEUE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* update queue |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param loginUser |
|
|
|
|
|
|
|
* @param queue |
|
|
|
|
|
|
|
* @param queueName |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@PostMapping(value = "/update") |
|
|
|
|
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
|
|
|
public Result updateQueue(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
|
|
|
@RequestParam(value = "id") int id, |
|
|
|
|
|
|
|
@RequestParam(value = "queue") String queue, |
|
|
|
|
|
|
|
@RequestParam(value = "queueName") String queueName) { |
|
|
|
|
|
|
|
logger.info("login user {}, update queue, id: {}, queue: {}, queueName: {}", |
|
|
|
|
|
|
|
loginUser.getUserName(), id,queue, queueName); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Map<String, Object> result = queueService.updateQueue(loginUser,id,queue,queueName); |
|
|
|
|
|
|
|
return returnDataList(result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(UPDATE_QUEUE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(UPDATE_QUEUE_ERROR.getCode(), UPDATE_QUEUE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|