From 3e90aba9f6a481bb27b936d9df14dc9103db586c Mon Sep 17 00:00:00 2001 From: sikadi <13315935+sikadi_love@user.noreply.gitee.com> Date: Fri, 1 Dec 2023 20:59:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/VehiclelaunchServiceimpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fate-launch-server/src/main/java/com/shiyi/launch/service/impl/VehiclelaunchServiceimpl.java b/fate-launch-server/src/main/java/com/shiyi/launch/service/impl/VehiclelaunchServiceimpl.java index 4490cc2..cdb06e7 100644 --- a/fate-launch-server/src/main/java/com/shiyi/launch/service/impl/VehiclelaunchServiceimpl.java +++ b/fate-launch-server/src/main/java/com/shiyi/launch/service/impl/VehiclelaunchServiceimpl.java @@ -4,6 +4,8 @@ import com.fate.common.core.utils.StringUtils; import com.shiyi.launch.domain.VehicleConnectionReq; import com.shiyi.launch.mapper.VehicleaunchMapper; import com.shiyi.launch.service.VehiclelaunchService; +import lombok.extern.log4j.Log4j2; +import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,11 +18,22 @@ import java.util.UUID; * @Date: 2023-11-30 20:02 */ @Service +@Log4j2 public class VehiclelaunchServiceimpl implements VehiclelaunchService { @Autowired private VehicleaunchMapper vehicleaunchMapper; + @Autowired + private RabbitTemplate rabbitTemplate; + + + // 主题 + private static final String FATE = "fate"; + + // 队列 + private static final String STREAM_QUEUE = "fate_queue"; + @Override public String vehicleConnection(VehicleConnectionReq vehicleConnectionReq) { // 先去查询车辆的vin 在不在 ,如果不在就连接不上 @@ -45,6 +58,8 @@ public class VehiclelaunchServiceimpl implements VehiclelaunchService { String fate = "fate" + vehicleConnectionReq.getVehicleVin().substring(3,7) + vehicleConnectionReq.getNonce(); + rabbitTemplate.convertAndSend(FATE,STREAM_QUEUE,fate); + log.info("发送消息成功"); return fate; } }