upd commit
parent
73546a7a5a
commit
4a6124d181
|
@ -0,0 +1,117 @@
|
|||
package com.couplet.common.domain;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 车辆实时数据
|
||||
* @date 2024/4/5 9:31
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class CoupletVehicleData {
|
||||
|
||||
|
||||
//报文主键ID
|
||||
private Long id;
|
||||
//VIN 车辆编码
|
||||
private String vin;
|
||||
//报文创建时间
|
||||
private Date createTime;
|
||||
//经度
|
||||
private String longitude;
|
||||
//维度
|
||||
private String latitude;
|
||||
//速度
|
||||
private String speed;
|
||||
//里程
|
||||
private Double mileage;
|
||||
//总电压
|
||||
private String voltage;
|
||||
//总电流
|
||||
private String current;
|
||||
//绝缘电阻
|
||||
private String resistance;
|
||||
//档位 P:停车 D:运行
|
||||
private String gear;
|
||||
//加速踏板行驶值
|
||||
private String accelerationPedal;
|
||||
//燃料消耗率
|
||||
private String fuelConsumptionRate;
|
||||
//电机控制器温度
|
||||
private String motorControllerTemperature;
|
||||
//电机转速
|
||||
private String motorSpeed;
|
||||
//电机转矩
|
||||
private String motorTorque;
|
||||
//电机温度
|
||||
private String motorTemperature;
|
||||
//电机电压
|
||||
private String motorVoltage;
|
||||
//电机电流
|
||||
private String motorCurrent;
|
||||
//动力电池剩余电量SOC
|
||||
private Double remainingBattery;
|
||||
//当前状态允许的最大反馈功率
|
||||
private String maximumFeedbackPower;
|
||||
//当前状态允许的最大放电功率
|
||||
private String maximumDischargePower;
|
||||
//BMS自检计数器
|
||||
private String selfCheckCounter;
|
||||
//动力电池充放电电流
|
||||
private String totalBatteryCurrent;
|
||||
//动力电池负载端电压V3
|
||||
private String totalBatteryVoltage;
|
||||
//单次最大电压
|
||||
private String singleBatteryMaxVoltage;
|
||||
//单体电池最低电压
|
||||
private String singleBatteryMinVoltage;
|
||||
//单体电池最高温度
|
||||
private String singleBatteryMaxTemperature;
|
||||
//单体电池最低温度
|
||||
private String singleBatteryMinTemperature;
|
||||
//动力电池可用容量
|
||||
private String availableBatteryCapacity;
|
||||
//车辆状态 1:正常 0:故障
|
||||
private Long vehicleStatus;
|
||||
//充电状态 1:正常 0:故障
|
||||
private Long chargingStatus;
|
||||
//运行状态 1:正常 0:故障
|
||||
private Long operatingStatus;
|
||||
//SOC 状态 1:正常 0:故障
|
||||
private Long socStatus;
|
||||
//可充电储能装置工作状态 1:正常 0:故障
|
||||
private Long chargingEnergyStorageStatus;
|
||||
//驱动电机状态 1:正常 0:故障
|
||||
private Long driveMotorStatus;
|
||||
//定位是否有效 1:有效 0:无效
|
||||
private Long positionStatus;
|
||||
//EAS(汽车防盗系统)状态 1:正常 0:故障
|
||||
private Long easStatus;
|
||||
//PTC(电动加热器)状态 1:正常 0:故障
|
||||
private Long ptcStatus;
|
||||
//EPS(电动助力系统)状态 1:正常 0:故障
|
||||
private Long epsStatus;
|
||||
//ABS(防抱死)状态 1:正常 0:故障
|
||||
private Long absStatus;
|
||||
//MCU(电机/逆变器)状态 1:正常 0:故障
|
||||
private Long mcuStatus;
|
||||
//动力电池加热状态 1:正常 0:故障
|
||||
private Long heatingStatus;
|
||||
//动力电池当前状态 1:正常 0:故障
|
||||
private Long batteryStatus;
|
||||
//动力电池保温状态 1:正常 0:故障
|
||||
private Long batteryInsulationStatus;
|
||||
//DCDC(电力交换系统) 状态 1:正常 0:故障
|
||||
private Long dcdcStatus;
|
||||
//CHG(充电机)状态 1:正常 0:故障
|
||||
private Long chgStatus;
|
||||
//制动踏板行驶值
|
||||
private Double brakePedal;
|
||||
|
||||
}
|
|
@ -18,7 +18,7 @@ import lombok.ToString;
|
|||
public class RealTimeDataRequest {
|
||||
|
||||
|
||||
private Integer userId;
|
||||
private Long userId;
|
||||
|
||||
private String vin;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
|
||||
@FeignClient(contextId = "remoteVehicleService" ,
|
||||
value = ServiceNameConstants.BUSINESS_SERVICE,
|
||||
value = ServiceNameConstants.VEHICLE_SERVICE,
|
||||
fallbackFactory = RemoteVehicleFallbackFactory.class,
|
||||
path = "/vehicle"
|
||||
)
|
||||
|
|
|
@ -48,7 +48,6 @@ public class RemoteVehicleFallbackFactory implements FallbackFactory<RemoteVehic
|
|||
|
||||
@Override
|
||||
public Result<List<Vehicle>> findByVIN(String vin) {
|
||||
log.error("车辆服务调用失败:"+cause.getMessage());
|
||||
return Result.error("车辆服务调用失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
com.couplet.remote.factory.RemoteVehicleFallbackFactory
|
|
@ -1,39 +0,0 @@
|
|||
package com.couplet.analyze.msg.contents;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/4
|
||||
* @Description:
|
||||
*/
|
||||
@Component
|
||||
public class StateConstant {
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
public static final Integer VEHICLE_STATUS = 0;
|
||||
|
||||
/**
|
||||
* 充电状态
|
||||
*/
|
||||
public static final Integer CHARGING_STATUS = 0;
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
public static final Integer OPERATING_STATUS = 0;
|
||||
|
||||
/**
|
||||
* soc状态
|
||||
*/
|
||||
public static final Integer SOC_STATUS = 0;
|
||||
|
||||
/**
|
||||
* 可充电储能装置工作状态
|
||||
*/
|
||||
public static final Integer CHARGING_ENERGY_STORAGE_STATUS = 0 ;
|
||||
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package com.couplet.analyze.msg.model;
|
|||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.analyze.msg.service.IncidentService;
|
||||
import com.couplet.common.core.exception.analyze.AnalyzeException;
|
||||
import com.couplet.common.core.utils.SpringUtils;
|
||||
import com.couplet.common.core.utils.uuid.IdUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -111,7 +110,7 @@ public class ModelMessage {
|
|||
|
||||
Thread.sleep(1000*6*10);
|
||||
} catch (Exception e) {
|
||||
throw new AnalyzeException("连接断开:"+ e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ public class BreakdownServiceImpl implements IncidentService {
|
|||
public void incident(CoupletMsgData coupletMsgData) {
|
||||
|
||||
log.info("故障事件开始.....");
|
||||
|
||||
log.info("故障事件结束.....");
|
||||
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ public class RealTimeDataServiceImpl implements IncidentService {
|
|||
public void incident(CoupletMsgData coupletMsgData) {
|
||||
|
||||
log.info("实时数据事件开始.....");
|
||||
|
||||
|
||||
|
||||
log.info("实时数据事件结束.....");
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
`single_battery_max_voltage`, `single_battery_min_voltage`,
|
||||
`single_battery_max_temperature`, `single_battery_min_temperature`,
|
||||
`available_battery_capacity`, `vehicle_status`, `charging_status`,
|
||||
`operating_status`, `soc_status`, `charging_energy_storage_status`,
|
||||
`operatingStatus`, `soc_status`, `charging_energy_storage_status`,
|
||||
`drive_motor_status`, `position_status`, `eas_status`, `ptc_status`,
|
||||
`eps_status`, `abs_status`, `mcu_status`, `heating_status`, `battery_status`,
|
||||
`battery_insulation_status`, `dcdc_status`, `chg_status`, `brake_pedal`)
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.couplet.business.server.controller;
|
||||
|
||||
import com.couplet.business.server.service.OnLineVehicleService;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 上线车辆列表
|
||||
* @date 2024/4/5 9:37
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("online")
|
||||
public class OnLineVehicleController {
|
||||
|
||||
@Autowired
|
||||
private OnLineVehicleService onLineVehicleService;
|
||||
|
||||
@PostMapping("onlineList")
|
||||
public Result<List<Vehicle>> onlineList(){
|
||||
List<Vehicle> onlineList = onLineVehicleService.onlineList();
|
||||
Result<List<Vehicle>> success = Result.success(onlineList);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.couplet.business.server.mapper;
|
||||
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface OnLineVehicleMapper {
|
||||
List<Vehicle> onlineList();
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.couplet.business.server.service;
|
||||
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OnLineVehicleService {
|
||||
List<Vehicle> onlineList();
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.couplet.business.server.service.impl;
|
||||
|
||||
import com.couplet.business.server.mapper.OnLineVehicleMapper;
|
||||
import com.couplet.business.server.service.OnLineVehicleService;
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 上线车辆实现类
|
||||
* @date 2024/4/5 9:38
|
||||
*/
|
||||
@Service
|
||||
public class OnLineVehicleImpl implements OnLineVehicleService {
|
||||
@Autowired
|
||||
private OnLineVehicleMapper onLineVehicleMapper;
|
||||
@Override
|
||||
public List<Vehicle> onlineList() {
|
||||
return onLineVehicleMapper.onlineList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?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.couplet.business.server.mapper.OnLineVehicleMapper">
|
||||
<sql id="selectOnlineVehicle">
|
||||
SELECT
|
||||
v.vehicle_id,
|
||||
v.vehicle_type,
|
||||
v.motor_manufacturer,
|
||||
v.battery_manufacturer,
|
||||
v.motor_number,
|
||||
v.battery_number,
|
||||
v.vin,
|
||||
v.vehicle_state,
|
||||
v.isdelete,
|
||||
t.vehicle_type_id,
|
||||
t.vehicle_type_name
|
||||
FROM
|
||||
couplet_vehicle v
|
||||
LEFT JOIN couplet_vehicle_type t ON v.vehicle_type = t.vehicle_type_id
|
||||
WHERE
|
||||
isdelete = 0
|
||||
</sql>
|
||||
<select id="onlineList" resultType="com.couplet.common.domain.Vehicle">
|
||||
<include refid="selectOnlineVehicle"/>
|
||||
AND v.vehicle_state = 1
|
||||
</select>
|
||||
</mapper>
|
|
@ -102,6 +102,10 @@
|
|||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-business</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -19,6 +19,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
public class CoupletMqApplatcaion {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CoupletMqApplatcaion.class, args);
|
||||
System.out.println("RabbitMQ模块启动成功");
|
||||
System.out.println("获取报文、RabbitMQ模块启动成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.couplet.mq.controller;
|
||||
|
||||
import com.couplet.common.core.utils.uuid.IdUtils;
|
||||
import com.couplet.common.domain.request.RealTimeDataRequest;
|
||||
import com.couplet.common.security.utils.SecurityUtils;
|
||||
import com.couplet.mq.domain.User;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
|
@ -23,7 +25,8 @@ public class MqController {
|
|||
//队列名
|
||||
@Value("${mq.queueName}")
|
||||
public String queueName;
|
||||
|
||||
@Value("${mq.VinQueueName}")
|
||||
public String finByVinQueueName;
|
||||
//交换机
|
||||
@Value("${mq.exchangeName}")
|
||||
public String exchangeName;
|
||||
|
@ -52,4 +55,16 @@ public class MqController {
|
|||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("findByVin")
|
||||
public void postFindByVin(@RequestBody RealTimeDataRequest request){
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
request.setUserId(userId);
|
||||
rabbitTemplate.convertAndSend(exchangeName, routingKey, request, message -> {
|
||||
message.getMessageProperties().setMessageId(IdUtils.randomUUID());
|
||||
return message;
|
||||
}, new CorrelationData(IdUtils.randomUUID())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
//@EnableFeignClients
|
||||
public class CoupletOnlineApplication {
|
||||
public class OnlineApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CoupletOnlineApplication.class);
|
||||
SpringApplication.run(OnlineApplication.class);
|
||||
System.out.println("车辆上线模块启动成功");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue