Blame view

parking-module-park/src/main/java/com/zteits/park/configuration/schedule/EqpOutDelayQueueMsgSchedule.java 1.97 KB
9af4a544   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  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<Boolean> result = eqpOutDelayQueueExecuteService.execute(berthsDTO);
  				logger.info("处理地磁上报出场延迟队列任务返回:{}",JSONObject.toJSON(result));
              }
          }
  
      }
  }