对车辆故障接口进行修改
parent
f6c9db3a2a
commit
310f8023af
|
@ -5,7 +5,7 @@ import com.muyu.domain.SysCar;
|
|||
import com.muyu.domain.SysCarFaultLog;
|
||||
import com.muyu.domain.req.SysCarReq;
|
||||
|
||||
import com.muyu.domain.resp.SysCarVo;
|
||||
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||
import com.muyu.service.SysCarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -54,8 +54,8 @@ public class SysCarController {
|
|||
* @param carVin
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findFenceByCarVin")
|
||||
public Result<List<SysCarFaultLog>> findFenceByCarVin(@RequestParam("carVin") String carVin){
|
||||
@PostMapping("/findFenceByCarVin/{carVin}")
|
||||
public Result<List<SysCarFaultLogVo>> findFenceByCarVin(@PathVariable("carVin") String 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.req.SysCarReq;
|
||||
|
||||
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||
import com.muyu.domain.resp.SysCarVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -18,6 +19,6 @@ public interface SysCarMapper extends BaseMapper<SysCar> {
|
|||
|
||||
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.req.SysCarReq;
|
||||
|
||||
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||
import com.muyu.domain.resp.SysCarVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -19,6 +20,6 @@ public interface SysCarService {
|
|||
|
||||
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.req.SysCarReq;
|
||||
|
||||
import com.muyu.domain.resp.SysCarFaultLogVo;
|
||||
import com.muyu.domain.resp.SysCarVo;
|
||||
import com.muyu.mapper.SysCarMapper;
|
||||
import com.muyu.service.SysCarService;
|
||||
|
@ -43,7 +44,7 @@ public class SysCarServiceImpl extends ServiceImpl<SysCarMapper,SysCar> impleme
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<SysCarFaultLog> findFenceByCarVin(String carVin) {
|
||||
public List<SysCarFaultLogVo> findFenceByCarVin(String carVin) {
|
||||
return sysCarMapper.findFenceByCarVin(carVin);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,13 +38,14 @@
|
|||
LEFT JOIN tb_fence ON sys_car.fence_id=tb_fence.fence_id
|
||||
where sys_car.id=#{id}
|
||||
</select>
|
||||
<select id="findFenceByCarVin" resultType="com.muyu.domain.SysCarFaultLog">
|
||||
<select id="findFenceByCarVin" resultType="com.muyu.domain.resp.SysCarFaultLogVo">
|
||||
SELECT
|
||||
*
|
||||
sys_car_fault_log.*,
|
||||
sys_car_fault.*
|
||||
FROM
|
||||
sys_car_fault_log
|
||||
LEFT JOIN sys_car_fault ON sys_car_fault_log.sys_car_fault_id = sys_car_fault.id
|
||||
WHERE
|
||||
vin = #{carVin};
|
||||
sys_car_fault_log.vin = #{carVin};
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--iotdb依赖-->
|
||||
<dependency>
|
||||
<groupId>org.apache.iotdb</groupId>
|
||||
|
@ -43,7 +42,6 @@
|
|||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<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 String longItude;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
* 车速
|
||||
*/
|
||||
private String speedVehicle;
|
||||
/**
|
||||
* 总里程
|
||||
*/
|
||||
private String totalMileage;
|
||||
/**
|
||||
* 总电压
|
||||
*/
|
||||
private String totalVoltage;
|
||||
/**
|
||||
* 总电流
|
||||
*/
|
||||
private String combinedCurrent;
|
||||
/**
|
||||
* 绝缘电阻
|
||||
*/
|
||||
private String insulationResistance;
|
||||
/**
|
||||
* 档位
|
||||
*/
|
||||
private String gearPosition;
|
||||
/**
|
||||
* 加速踏板行程值
|
||||
*/
|
||||
private String acceleratorPedalTravelValue;
|
||||
/**
|
||||
* 制动踏板行程值
|
||||
*/
|
||||
private String brakePedalTravelValue;
|
||||
/**
|
||||
* 燃料消耗率
|
||||
*/
|
||||
private String specificFuelConsumption;
|
||||
/**
|
||||
* 电机控制器温度
|
||||
*/
|
||||
private String motorControllerTemperature;
|
||||
/**
|
||||
* 电机转速
|
||||
*/
|
||||
private String motorSpeed;
|
||||
/**
|
||||
* 电机转矩
|
||||
*/
|
||||
private String motorTorque;
|
||||
/**
|
||||
* 电机温度
|
||||
*/
|
||||
private String motorTemperature;
|
||||
/**
|
||||
* 电机电压
|
||||
*/
|
||||
private String motorVoltage;
|
||||
/**
|
||||
* 电机电流
|
||||
*/
|
||||
private String motorCurrent;
|
||||
private String powerBatteryRemainingSoc;
|
||||
private String maximumFeedbackPower;
|
||||
|
|
|
@ -83,9 +83,6 @@ public class TemplateServiceImpl implements TemplateService{
|
|||
String url = "jdbc:iotdb://47.116.173.119:6667/";
|
||||
String user = "root";
|
||||
String password = "root";
|
||||
// 注册 JDBC 驱动
|
||||
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
|
||||
System.out.println("JDBC Driver Registered!");
|
||||
try {
|
||||
// 注册 JDBC 驱动
|
||||
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
|
||||
|
@ -115,6 +112,4 @@ public class TemplateServiceImpl implements TemplateService{
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
package com.template.util;
|
||||
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
||||
import org.apache.iotdb.rpc.StatementExecutionException;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.apache.iotdb.session.Session;
|
||||
import org.apache.iotdb.session.SessionDataSet;
|
||||
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.template.util
|
||||
* @Project:cloud-server
|
||||
* @name:ToIoTDB
|
||||
* @name:ToIoTDB 连接IoTDB数据库
|
||||
* @Date:2024/9/20 19:40
|
||||
*/
|
||||
@Log4j2
|
||||
@Configuration
|
||||
public class ToIoTDB {
|
||||
|
||||
// IoTDB连接信息
|
||||
private static final String HOST = "127.0.0.1";
|
||||
private static final int PORT = 6667;
|
||||
private static final String USERNAME = "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"
|
||||
};
|
||||
|
||||
|
||||
|
||||
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 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