From 449118c06d4fa0e7c715c9e516cf3e9a976532fd Mon Sep 17 00:00:00 2001 From: sikadi <13315935+sikadi_love@user.noreply.gitee.com> Date: Fri, 1 Dec 2023 16:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fate-launch-server/pom.xml | 8 ++++++++ .../service/impl/VehiclelaunchServiceimpl.java | 12 ++++++++++++ .../resources/mapper/launch/VehiclelaunchMapper.xml | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/fate-launch-server/pom.xml b/fate-launch-server/pom.xml index 24b408b..c70abbb 100644 --- a/fate-launch-server/pom.xml +++ b/fate-launch-server/pom.xml @@ -62,6 +62,14 @@ mysql-connector-j 8.0.33 + + + + org.springframework.boot + spring-boot-starter-amqp + + + ${project.artifactId} 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 c809bd5..bfb2ef5 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 @@ -8,6 +8,9 @@ import com.shiyi.launch.service.VehiclelaunchService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; +import java.util.UUID; + /** * @Description : 车辆上线业务层 * @Author : YangHaoYu @@ -25,6 +28,15 @@ public class VehiclelaunchServiceimpl implements VehiclelaunchService { if (StringUtils.isEmpty(vehiclelaunch.getVin())){ return "vin为空"; } + + long time = new Date().getTime(); + + vehiclelaunch.setTimestamp(String.valueOf(time)); + + String uuid = UUID.randomUUID().toString().replaceAll("-","").substring(0,8); + + vehiclelaunch.setNonce(uuid); + int i = vehicleaunchMapper.into(vehiclelaunch); if(i < 0){ diff --git a/fate-launch-server/src/main/resources/mapper/launch/VehiclelaunchMapper.xml b/fate-launch-server/src/main/resources/mapper/launch/VehiclelaunchMapper.xml index 5e76cdc..de202d1 100644 --- a/fate-launch-server/src/main/resources/mapper/launch/VehiclelaunchMapper.xml +++ b/fate-launch-server/src/main/resources/mapper/launch/VehiclelaunchMapper.xml @@ -4,8 +4,8 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - insert into t_car(car_vin) values - (#{vin}) + insert into t_car(car_vin,car_address,car_license,car_name) values + (#{vin},#{timestamp},#{nonce},#{userName})