master
parent
e453a5e13c
commit
afcaaaed10
|
@ -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;
|
||||
}
|
|
@ -24,6 +24,44 @@
|
|||
<artifactId>fate-launch-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 10000
|
||||
port: 9999
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.shiyi.launch.mapper.VehicleaunchMapper">
|
||||
|
||||
|
||||
<select id="save" resultType="com.shiyi.launch.domain.Car">
|
||||
select * from t_car where car_vin = #{vin}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue