diff --git a/fate-launch-common/src/main/java/com/shiyi/launch/domain/Car.java b/fate-launch-common/src/main/java/com/shiyi/launch/domain/Car.java new file mode 100644 index 0000000..ecf1f43 --- /dev/null +++ b/fate-launch-common/src/main/java/com/shiyi/launch/domain/Car.java @@ -0,0 +1,40 @@ +package com.shiyi.launch.domain; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 车辆的表 + * + * @description: TODO + * @author: ZHUOXIN + * @date: 2023/12/1 10:16 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Car { + + private Integer catId; + + private String carName; + + private String carLicense; + + private String carVin; + + private Integer carStatus; + + private Integer typeId; + + private Integer fenceId; + + private Integer driveId; + + private Integer batteryId; + + private String carAddress; +} diff --git a/fate-launch-server/pom.xml b/fate-launch-server/pom.xml index 0959b4d..e3f9a45 100644 --- a/fate-launch-server/pom.xml +++ b/fate-launch-server/pom.xml @@ -24,6 +24,44 @@ fate-launch-common 3.6.3 + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + com.mysql + mysql-connector-j + 8.0.33 + diff --git a/fate-launch-server/src/main/java/com/shiyi/launch/VehiclelaunchApplication.java b/fate-launch-server/src/main/java/com/shiyi/launch/VehiclelaunchApplication.java new file mode 100644 index 0000000..6b02abc --- /dev/null +++ b/fate-launch-server/src/main/java/com/shiyi/launch/VehiclelaunchApplication.java @@ -0,0 +1,28 @@ +package com.shiyi.launch; + +import com.fate.common.security.annotation.EnableCustomConfig; +import com.fate.common.security.annotation.EnableMyFeignClients; +import com.fate.common.swagger.annotation.EnableCustomSwagger2; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 启动 + * + * @description: TODO + * @author: ZHUOXIN + * @date: 2023/12/1 10:30 + **/ +@EnableCustomConfig +@EnableCustomSwagger2 +@EnableMyFeignClients +@SpringBootApplication +@MapperScan("com.shiyi.launch.mapper") +public class VehiclelaunchApplication { + public static void main(String[] args) { + SpringApplication.run(VehiclelaunchApplication.class, args); + } +} diff --git a/fate-launch-server/src/main/java/com/shiyi/launch/controller/VehiclelaunchController.java b/fate-launch-server/src/main/java/com/shiyi/launch/controller/VehiclelaunchController.java index 34180a5..e02643b 100644 --- a/fate-launch-server/src/main/java/com/shiyi/launch/controller/VehiclelaunchController.java +++ b/fate-launch-server/src/main/java/com/shiyi/launch/controller/VehiclelaunchController.java @@ -28,11 +28,11 @@ public class VehiclelaunchController { * 车辆上线 */ @PostMapping("vehiclelaunch") - public String vehiclelaunchs(@RequestBody Vehiclelaunch vehiclelaunch){ + public Result vehiclelaunchs(@RequestBody Vehiclelaunch vehiclelaunch){ String topic = vehiclelaunchService.vehiclelaunch(vehiclelaunch); - return topic; + return Result.success(topic); } } diff --git a/fate-launch-server/src/main/java/com/shiyi/launch/mapper/VehicleaunchMapper.java b/fate-launch-server/src/main/java/com/shiyi/launch/mapper/VehicleaunchMapper.java new file mode 100644 index 0000000..dc8b48b --- /dev/null +++ b/fate-launch-server/src/main/java/com/shiyi/launch/mapper/VehicleaunchMapper.java @@ -0,0 +1,17 @@ +package com.shiyi.launch.mapper; + +import com.shiyi.launch.domain.Car; +import com.shiyi.launch.domain.Vehiclelaunch; +import org.apache.ibatis.annotations.Mapper; + +/** + * 数据管理层 + * + * @description: TODO + * @author: ZHUOXIN + * @date: 2023/12/1 10:12 + **/ +@Mapper +public interface VehicleaunchMapper { + Car save(Vehiclelaunch vehiclelaunch); +} 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 25aa1ad..6885a92 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 @@ -1,7 +1,11 @@ package com.shiyi.launch.service.impl; +import com.fate.common.core.utils.StringUtils; +import com.shiyi.launch.domain.Car; import com.shiyi.launch.domain.Vehiclelaunch; +import com.shiyi.launch.mapper.VehicleaunchMapper; import com.shiyi.launch.service.VehiclelaunchService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -11,9 +15,27 @@ import org.springframework.stereotype.Service; */ @Service public class VehiclelaunchServiceimpl implements VehiclelaunchService { + + @Autowired + private VehicleaunchMapper vehicleaunchMapper; + @Override public String vehiclelaunch(Vehiclelaunch vehiclelaunch) { + // 先去查询车辆的vin 在不在 ,如果不在就连接不上 + if (StringUtils.isEmpty(vehiclelaunch.getVin())){ + return "vin为空"; + } + Car car = vehicleaunchMapper.save(vehiclelaunch); - return null; + if( null == car){ + + return "连接不上,没有该车辆"; + } + + String carVin = car.getCarVin(); + + String fate = "fate" + carVin.substring(3,7) + vehiclelaunch.getNonce(); + + return fate; } } diff --git a/fate-launch-server/src/main/resources/bootstrap.yml b/fate-launch-server/src/main/resources/bootstrap.yml index 20783b0..611f2b8 100644 --- a/fate-launch-server/src/main/resources/bootstrap.yml +++ b/fate-launch-server/src/main/resources/bootstrap.yml @@ -1,6 +1,6 @@ # Tomcat server: - port: 10000 + port: 9999 # Spring spring: diff --git a/fate-launch-server/src/main/resources/mapper/launch/VehiclelaunchMapper.xml b/fate-launch-server/src/main/resources/mapper/launch/VehiclelaunchMapper.xml new file mode 100644 index 0000000..ec2058a --- /dev/null +++ b/fate-launch-server/src/main/resources/mapper/launch/VehiclelaunchMapper.xml @@ -0,0 +1,11 @@ + + + + + + +