master
sikadi 2023-12-01 11:12:48 +08:00
parent e453a5e13c
commit afcaaaed10
8 changed files with 160 additions and 4 deletions

View File

@ -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;
}

View File

@ -24,6 +24,44 @@
<artifactId>fate-launch-common</artifactId> <artifactId>fate-launch-common</artifactId>
<version>3.6.3</version> <version>3.6.3</version>
</dependency> </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> </dependencies>
</project> </project>

View File

@ -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);
}
}

View File

@ -28,11 +28,11 @@ public class VehiclelaunchController {
* 线 * 线
*/ */
@PostMapping("vehiclelaunch") @PostMapping("vehiclelaunch")
public String vehiclelaunchs(@RequestBody Vehiclelaunch vehiclelaunch){ public Result vehiclelaunchs(@RequestBody Vehiclelaunch vehiclelaunch){
String topic = vehiclelaunchService.vehiclelaunch(vehiclelaunch); String topic = vehiclelaunchService.vehiclelaunch(vehiclelaunch);
return topic; return Result.success(topic);
} }
} }

View File

@ -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);
}

View File

@ -1,7 +1,11 @@
package com.shiyi.launch.service.impl; 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.domain.Vehiclelaunch;
import com.shiyi.launch.mapper.VehicleaunchMapper;
import com.shiyi.launch.service.VehiclelaunchService; import com.shiyi.launch.service.VehiclelaunchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -11,9 +15,27 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class VehiclelaunchServiceimpl implements VehiclelaunchService { public class VehiclelaunchServiceimpl implements VehiclelaunchService {
@Autowired
private VehicleaunchMapper vehicleaunchMapper;
@Override @Override
public String vehiclelaunch(Vehiclelaunch vehiclelaunch) { 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;
} }
} }

View File

@ -1,6 +1,6 @@
# Tomcat # Tomcat
server: server:
port: 10000 port: 9999
# Spring # Spring
spring: spring:

View File

@ -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>