对车辆故障接口进行修改
parent
f6c9db3a2a
commit
310f8023af
|
@ -5,7 +5,7 @@ import com.muyu.domain.SysCar;
|
||||||
import com.muyu.domain.SysCarFaultLog;
|
import com.muyu.domain.SysCarFaultLog;
|
||||||
import com.muyu.domain.req.SysCarReq;
|
import com.muyu.domain.req.SysCarReq;
|
||||||
|
|
||||||
import com.muyu.domain.resp.SysCarVo;
|
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||||
import com.muyu.service.SysCarService;
|
import com.muyu.service.SysCarService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -54,8 +54,8 @@ public class SysCarController {
|
||||||
* @param carVin
|
* @param carVin
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/findFenceByCarVin")
|
@PostMapping("/findFenceByCarVin/{carVin}")
|
||||||
public Result<List<SysCarFaultLog>> findFenceByCarVin(@RequestParam("carVin") String carVin){
|
public Result<List<SysCarFaultLogVo>> findFenceByCarVin(@PathVariable("carVin") String carVin){
|
||||||
return Result.success(sysCarService.findFenceByCarVin(carVin));
|
return Result.success(sysCarService.findFenceByCarVin(carVin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.domain.resp;
|
||||||
|
|
||||||
|
import com.muyu.domain.SysCarFaultLog;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.muyu.domain.resp
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:SysCarFaultLogVo
|
||||||
|
* @Date:2024/9/23 18:45
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SysCarFaultLogVo extends SysCarFaultLog{
|
||||||
|
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
private String faultName;
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import com.muyu.domain.SysCar;
|
||||||
import com.muyu.domain.SysCarFaultLog;
|
import com.muyu.domain.SysCarFaultLog;
|
||||||
import com.muyu.domain.req.SysCarReq;
|
import com.muyu.domain.req.SysCarReq;
|
||||||
|
|
||||||
|
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||||
import com.muyu.domain.resp.SysCarVo;
|
import com.muyu.domain.resp.SysCarVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -18,6 +19,6 @@ public interface SysCarMapper extends BaseMapper<SysCar> {
|
||||||
|
|
||||||
SysCarVo selectSysCarVoById(@Param("id") Long id);
|
SysCarVo selectSysCarVoById(@Param("id") Long id);
|
||||||
|
|
||||||
List<SysCarFaultLog> findFenceByCarVin(@Param("carVin") String carVin);
|
List<SysCarFaultLogVo> findFenceByCarVin(@Param("carVin") String carVin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.domain.SysCar;
|
||||||
import com.muyu.domain.SysCarFaultLog;
|
import com.muyu.domain.SysCarFaultLog;
|
||||||
import com.muyu.domain.req.SysCarReq;
|
import com.muyu.domain.req.SysCarReq;
|
||||||
|
|
||||||
|
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||||
import com.muyu.domain.resp.SysCarVo;
|
import com.muyu.domain.resp.SysCarVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -19,6 +20,6 @@ public interface SysCarService {
|
||||||
|
|
||||||
int updateSysCar(SysCar sysCar);
|
int updateSysCar(SysCar sysCar);
|
||||||
|
|
||||||
List<SysCarFaultLog> findFenceByCarVin(String carVin);
|
List<SysCarFaultLogVo> findFenceByCarVin(String carVin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.domain.SysCar;
|
||||||
import com.muyu.domain.SysCarFaultLog;
|
import com.muyu.domain.SysCarFaultLog;
|
||||||
import com.muyu.domain.req.SysCarReq;
|
import com.muyu.domain.req.SysCarReq;
|
||||||
|
|
||||||
|
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||||
import com.muyu.domain.resp.SysCarVo;
|
import com.muyu.domain.resp.SysCarVo;
|
||||||
import com.muyu.mapper.SysCarMapper;
|
import com.muyu.mapper.SysCarMapper;
|
||||||
import com.muyu.service.SysCarService;
|
import com.muyu.service.SysCarService;
|
||||||
|
@ -43,7 +44,7 @@ public class SysCarServiceImpl extends ServiceImpl<SysCarMapper,SysCar> impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultLog> findFenceByCarVin(String carVin) {
|
public List<SysCarFaultLogVo> findFenceByCarVin(String carVin) {
|
||||||
return sysCarMapper.findFenceByCarVin(carVin);
|
return sysCarMapper.findFenceByCarVin(carVin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,14 @@
|
||||||
LEFT JOIN tb_fence ON sys_car.fence_id=tb_fence.fence_id
|
LEFT JOIN tb_fence ON sys_car.fence_id=tb_fence.fence_id
|
||||||
where sys_car.id=#{id}
|
where sys_car.id=#{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="findFenceByCarVin" resultType="com.muyu.domain.SysCarFaultLog">
|
<select id="findFenceByCarVin" resultType="com.muyu.domain.resp.SysCarFaultLogVo">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
sys_car_fault_log.*,
|
||||||
|
sys_car_fault.*
|
||||||
FROM
|
FROM
|
||||||
sys_car_fault_log
|
sys_car_fault_log
|
||||||
|
LEFT JOIN sys_car_fault ON sys_car_fault_log.sys_car_fault_id = sys_car_fault.id
|
||||||
WHERE
|
WHERE
|
||||||
vin = #{carVin};
|
sys_car_fault_log.vin = #{carVin};
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!--iotdb依赖-->
|
<!--iotdb依赖-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.iotdb</groupId>
|
<groupId>org.apache.iotdb</groupId>
|
||||||
|
@ -43,7 +42,6 @@
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>2.2.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.template.controller;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.template.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ServiceController
|
||||||
|
* @Date:2024/9/22 22:12
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class ServiceController {
|
||||||
|
|
||||||
|
private final String IOTDB_DRIVER="org.apache.iotdb.jdbc.IoTDBDriver";
|
||||||
|
private static final String url="jdbc:iotdb://47.116.173.119:6667/";
|
||||||
|
private static final String userName="root";
|
||||||
|
private static final String passWord="root";
|
||||||
|
|
||||||
|
public void ToIoTDB(String url, String userName, String passWord){
|
||||||
|
log.info("Connecting to IoTDB");
|
||||||
|
log.info("地址是:"+url);
|
||||||
|
log.info("用户名是:"+userName);
|
||||||
|
log.info("密码是:"+passWord);
|
||||||
|
log.info("红红火火恍恍惚惚");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try{
|
||||||
|
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
|
||||||
|
DriverManager.getConnection(url,userName,passWord);
|
||||||
|
}catch(SQLException e){
|
||||||
|
log.error("SQLException: " + e.getMessage());
|
||||||
|
log.error("SQLState: " + e.getSQLState());
|
||||||
|
log.error("VendorError: " + e.getErrorCode());
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createConnection() throws ClassNotFoundException, SQLException {
|
||||||
|
|
||||||
|
try{
|
||||||
|
Class.forName(IOTDB_DRIVER);
|
||||||
|
DriverManager.getConnection(url,userName,passWord);
|
||||||
|
}catch(SQLException e){
|
||||||
|
log.error("SQLException: " + e.getMessage());
|
||||||
|
log.error("SQLState: " + e.getSQLState());
|
||||||
|
log.error("VendorError: " + e.getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -34,22 +34,73 @@ public class MessageTemplate {
|
||||||
* 时间戳
|
* 时间戳
|
||||||
*/
|
*/
|
||||||
private Date timeStamp;
|
private Date timeStamp;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
private String longItude;
|
private String longItude;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
private String latitude;
|
private String latitude;
|
||||||
|
/**
|
||||||
|
* 车速
|
||||||
|
*/
|
||||||
private String speedVehicle;
|
private String speedVehicle;
|
||||||
|
/**
|
||||||
|
* 总里程
|
||||||
|
*/
|
||||||
private String totalMileage;
|
private String totalMileage;
|
||||||
|
/**
|
||||||
|
* 总电压
|
||||||
|
*/
|
||||||
private String totalVoltage;
|
private String totalVoltage;
|
||||||
|
/**
|
||||||
|
* 总电流
|
||||||
|
*/
|
||||||
private String combinedCurrent;
|
private String combinedCurrent;
|
||||||
|
/**
|
||||||
|
* 绝缘电阻
|
||||||
|
*/
|
||||||
private String insulationResistance;
|
private String insulationResistance;
|
||||||
|
/**
|
||||||
|
* 档位
|
||||||
|
*/
|
||||||
private String gearPosition;
|
private String gearPosition;
|
||||||
|
/**
|
||||||
|
* 加速踏板行程值
|
||||||
|
*/
|
||||||
private String acceleratorPedalTravelValue;
|
private String acceleratorPedalTravelValue;
|
||||||
|
/**
|
||||||
|
* 制动踏板行程值
|
||||||
|
*/
|
||||||
private String brakePedalTravelValue;
|
private String brakePedalTravelValue;
|
||||||
|
/**
|
||||||
|
* 燃料消耗率
|
||||||
|
*/
|
||||||
private String specificFuelConsumption;
|
private String specificFuelConsumption;
|
||||||
|
/**
|
||||||
|
* 电机控制器温度
|
||||||
|
*/
|
||||||
private String motorControllerTemperature;
|
private String motorControllerTemperature;
|
||||||
|
/**
|
||||||
|
* 电机转速
|
||||||
|
*/
|
||||||
private String motorSpeed;
|
private String motorSpeed;
|
||||||
|
/**
|
||||||
|
* 电机转矩
|
||||||
|
*/
|
||||||
private String motorTorque;
|
private String motorTorque;
|
||||||
|
/**
|
||||||
|
* 电机温度
|
||||||
|
*/
|
||||||
private String motorTemperature;
|
private String motorTemperature;
|
||||||
|
/**
|
||||||
|
* 电机电压
|
||||||
|
*/
|
||||||
private String motorVoltage;
|
private String motorVoltage;
|
||||||
|
/**
|
||||||
|
* 电机电流
|
||||||
|
*/
|
||||||
private String motorCurrent;
|
private String motorCurrent;
|
||||||
private String powerBatteryRemainingSoc;
|
private String powerBatteryRemainingSoc;
|
||||||
private String maximumFeedbackPower;
|
private String maximumFeedbackPower;
|
||||||
|
|
|
@ -83,9 +83,6 @@ public class TemplateServiceImpl implements TemplateService{
|
||||||
String url = "jdbc:iotdb://47.116.173.119:6667/";
|
String url = "jdbc:iotdb://47.116.173.119:6667/";
|
||||||
String user = "root";
|
String user = "root";
|
||||||
String password = "root";
|
String password = "root";
|
||||||
// 注册 JDBC 驱动
|
|
||||||
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
|
|
||||||
System.out.println("JDBC Driver Registered!");
|
|
||||||
try {
|
try {
|
||||||
// 注册 JDBC 驱动
|
// 注册 JDBC 驱动
|
||||||
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
|
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
|
||||||
|
@ -115,6 +112,4 @@ public class TemplateServiceImpl implements TemplateService{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
package com.template.util;
|
package com.template.util;
|
||||||
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.iotdb.rpc.StatementExecutionException;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.apache.iotdb.session.Session;
|
import java.sql.Connection;
|
||||||
import org.apache.iotdb.session.SessionDataSet;
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* @Author:liuxinyue
|
||||||
* @Package:com.template.util
|
* @Package:com.template.util
|
||||||
* @Project:cloud-server
|
* @Project:cloud-server
|
||||||
* @name:ToIoTDB
|
* @name:ToIoTDB 连接IoTDB数据库
|
||||||
* @Date:2024/9/20 19:40
|
* @Date:2024/9/20 19:40
|
||||||
*/
|
*/
|
||||||
|
@Log4j2
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ToIoTDB {
|
public class ToIoTDB {
|
||||||
|
|
||||||
// IoTDB连接信息
|
private final String IOTDB_DRIVER="org.apache.iotdb.jdbc.IoTDBDriver";
|
||||||
private static final String HOST = "127.0.0.1";
|
private static final String url="jdbc:iotdb://47.116.173.119:6667/";
|
||||||
private static final int PORT = 6667;
|
private static final String userName="root";
|
||||||
private static final String USERNAME = "root";
|
private static final String passWord="root";
|
||||||
private static final String PASSWORD = "root";
|
|
||||||
|
|
||||||
// 需要创建的schema信息
|
|
||||||
private static final String STORAGE_GROUP = "root.ln";
|
|
||||||
private static final String[] TIMESERIES_PATHS = {
|
|
||||||
"root.ln.wf01.wt01.temperature",
|
|
||||||
"root.ln.wf01.wt01.humidity"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Connection getConnection() throws ClassNotFoundException, SQLException {
|
||||||
|
Connection connection=null;
|
||||||
|
try{
|
||||||
|
Class.forName(IOTDB_DRIVER);
|
||||||
|
connection = DriverManager.getConnection(url, userName, passWord);
|
||||||
|
}catch(SQLException e){
|
||||||
|
log.error("SQLException: " + e.getMessage());
|
||||||
|
log.error("SQLState: " + e.getSQLState());
|
||||||
|
log.error("VendorError: " + e.getErrorCode());
|
||||||
|
}
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue