package com.zteits.park.configuration.schedule; import com.alibaba.fastjson.JSONObject; import com.zteits.clouds.api.apibase.bean.BizResult; import com.zteits.clouds.api.dto.park.dto.BerthsDTO; import com.zteits.clouds.api.dto.park.dto.TpPEqpDTO; import com.zteits.park.quene.EqpOutDelayQueueService; import com.zteits.park.service.queuemsg.park.EqpOutDelayQueueExecuteService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * 地磁上报出场,延迟队列定时任务 * Copyright: Copyright (c) 2018 zteits * * @Description: * @version: v1.0.0 * @author: xiejianpeng * @date: 2019/8/14 23:55 * Modification History: * Date Author Version Description *---------------------------------------------------------* * 2019/8/14 xiejianpeng v1.0.0 创建 */ @Component public class EqpOutDelayQueueMsgSchedule { Logger logger = LoggerFactory.getLogger(EqpOutDelayQueueMsgSchedule.class); @Autowired private EqpOutDelayQueueService eqpOutDelayQueueService; @Autowired private EqpOutDelayQueueExecuteService eqpOutDelayQueueExecuteService; @Scheduled(fixedDelay = 10*1000 )//每 10秒获取一次队列消息 // @Async public void getOrderQueueMsg() { while (true) { logger.info("延迟队列开始取数据......"); BerthsDTO berthsDTO = eqpOutDelayQueueService.getNotice(); logger.info("延迟队列处理数据入参:"+JSONObject.toJSONString(berthsDTO)); if (berthsDTO == null) { break; }else{ //开始处理 BizResult result = eqpOutDelayQueueExecuteService.execute(berthsDTO); logger.info("处理地磁上报出场延迟队列任务返回:{}",JSONObject.toJSON(result)); } } } }