parent
99dcfe8c5b
commit
ab3b53c7e8
@ -0,0 +1,35 @@ |
||||
package com.hfkj.consumer; |
||||
|
||||
import com.hfkj.entity.BsGasOilPriceTask; |
||||
import com.hfkj.entity.BsOrder; |
||||
import com.hfkj.model.order.OrderModel; |
||||
import com.hfkj.service.gas.BsGasOilPriceService; |
||||
import com.hfkj.service.gas.BsGasOilPriceTaskService; |
||||
import com.hfkj.service.order.BsOrderService; |
||||
import com.hfkj.sysenum.gas.GasTaskStatusEnum; |
||||
import com.hfkj.sysenum.order.OrderStatusEnum; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
||||
import org.apache.rocketmq.spring.core.RocketMQListener; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@Component |
||||
@Slf4j |
||||
@RocketMQMessageListener(consumerGroup = "task-oil-price-group", topic = "task-topic",selectorExpression = "oil-price") |
||||
public class TaskOilPriceConsumer implements RocketMQListener<String> { |
||||
|
||||
@Resource |
||||
private BsGasOilPriceTaskService gasOilPriceTaskService; |
||||
|
||||
@Override |
||||
public void onMessage(String oilPriceTaskId) { |
||||
// 油价任务
|
||||
BsGasOilPriceTask task = gasOilPriceTaskService.getDetailById(Long.parseLong(oilPriceTaskId)); |
||||
if (task != null && task.getStatus().equals(GasTaskStatusEnum.status1.getStatus())) { |
||||
// 任务处理
|
||||
gasOilPriceTaskService.businessHandle(task); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.hfkj.mqtopic; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
/** |
||||
* 任务主题 |
||||
* @author hurui |
||||
*/ |
||||
@Getter |
||||
public enum TaskTopic { |
||||
// 任务主题
|
||||
TASK_TOPIC("task-topic", "","任务主题"), |
||||
// 油价任务
|
||||
OIL_PRICE(TASK_TOPIC.getTopic(),"oil-price", "油价任务"), |
||||
; |
||||
|
||||
private String topic; |
||||
private String tag; |
||||
private String name; |
||||
|
||||
TaskTopic(String topic, String tag, String name) { |
||||
this.topic = topic; |
||||
this.tag = tag; |
||||
this.name = name; |
||||
} |
||||
} |
Loading…
Reference in new issue