车辆列表更新
parent
8a594acd61
commit
f655f23f23
|
@ -10,83 +10,83 @@ public enum BreakConstant {
|
|||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
GET001("GTX001","vehicleStatus",0),
|
||||
GET001("GTX001","vehicleStatus","车辆状态预警"),
|
||||
/**
|
||||
* 充点状态
|
||||
*/
|
||||
GTX002("GTX002","chargingStatus",0),
|
||||
GTX002("GTX002","chargingStatus","充电状态预警"),
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
GTX003("GTX003","operatingStatus",0),
|
||||
GTX003("GTX003","operatingStatus","运行状态预警"),
|
||||
/**
|
||||
* SOC
|
||||
*/
|
||||
GTX004("GTX004","socStatus",0),
|
||||
GTX004("GTX004","socStatus","SOC预警"),
|
||||
/**
|
||||
* 可充电储能装置工作状态
|
||||
*/
|
||||
GTX005("GTX005","chargingEnergyStorageStatus",0),
|
||||
GTX005("GTX005","chargingEnergyStorageStatus","可充电储能装置工作状态预警"),
|
||||
/**
|
||||
* 驱动电机状态
|
||||
*/
|
||||
GTX006("GTX006","driveMotorStatus",0),
|
||||
GTX006("GTX006","driveMotorStatus","驱动电机状态预警"),
|
||||
/**
|
||||
* 定位是否有效
|
||||
*/
|
||||
GTX007("GTX007","positionStatus",0),
|
||||
GTX007("GTX007","positionStatus","定位是否有效预警"),
|
||||
/**
|
||||
* EPS工作状态
|
||||
*/
|
||||
GTO0001("GTO001","epsStatus",0),
|
||||
GTO0001("GTO001","epsStatus","EPS工作状态预警"),
|
||||
/**
|
||||
* EAS工作状态
|
||||
*/
|
||||
GTO0002("GTO002","easStatus",0),
|
||||
GTO0002("GTO002","easStatus","EAS工作状态预警"),
|
||||
/**
|
||||
* PTC工作状态
|
||||
*/
|
||||
GTO003("GTO003","ptcStatus",0),
|
||||
GTO003("GTO003","ptcStatus","PTC工作状态预警"),
|
||||
/**
|
||||
* DCDC工作状态
|
||||
*/
|
||||
GTO004("GTO004","dcdcStatus",0),
|
||||
GTO004("GTO004","dcdcStatus","DCDC工作状态预警"),
|
||||
/**
|
||||
* EPS工作状态
|
||||
*/
|
||||
GTO005("GTO005","epsStatus",0),
|
||||
GTO005("GTO005","epsStatus","EPS工作状态预警"),
|
||||
/**
|
||||
* CHG工作状态
|
||||
*/
|
||||
GTO006("GTO006","chgStatus",0),
|
||||
GTO006("GTO006","chgStatus","CHG工作状态预警"),
|
||||
/**
|
||||
* ABS工作状态
|
||||
*/
|
||||
GTO007("GTO007","absStatus",0),
|
||||
GTO007("GTO007","absStatus","ABS工作状态预警"),
|
||||
/**
|
||||
* MCU工作状态
|
||||
*/
|
||||
GTO008("GTO008","mcuStatus",0),
|
||||
GTO008("GTO008","mcuStatus","MCU工作状态预警"),
|
||||
/**
|
||||
* 动力电池加热状态
|
||||
*/
|
||||
GTB001("GTB001","heatingStatus",0),
|
||||
GTB001("GTB001","heatingStatus","动力电池加热状态预警"),
|
||||
/**
|
||||
* 动力电池当前状态
|
||||
*/
|
||||
GTB002("GTB002","batteryStatus",0),
|
||||
GTB002("GTB002","batteryStatus","动力电池当前状态预警"),
|
||||
/**
|
||||
* 动力电池保温状态
|
||||
*/
|
||||
GTB003("GTB003","batteryInsulationStatus",0);
|
||||
GTB003("GTB003","batteryInsulationStatus","动力电池保温状态预警");
|
||||
private String key;
|
||||
private String value;
|
||||
private Integer status;
|
||||
private String info;
|
||||
public String key(){
|
||||
return key;
|
||||
}
|
||||
public Integer status(){
|
||||
return status;
|
||||
public String info(){
|
||||
return info;
|
||||
}
|
||||
public String value(){
|
||||
return value;
|
||||
|
@ -94,9 +94,9 @@ public enum BreakConstant {
|
|||
public void value(String value){
|
||||
this.value=value;
|
||||
}
|
||||
BreakConstant(String key,String value,Integer status){
|
||||
BreakConstant(String key,String value,String info){
|
||||
this.key=key;
|
||||
this.value=value;
|
||||
this.status=status;
|
||||
this.info=info;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.god.base.server.consumer;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.god.base.server.service.FaultService;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
*
|
||||
* @Author: sun-cool-boy
|
||||
* @Date: 2023/12/6
|
||||
* @info: 故障预警消息接收
|
||||
*/
|
||||
@Component
|
||||
public class FaultAlarmConsumer {
|
||||
|
||||
/**
|
||||
* 预警业务层
|
||||
*/
|
||||
@Resource
|
||||
private FaultService faultService;
|
||||
|
||||
/**
|
||||
* 预警处理监听
|
||||
* @param msg
|
||||
* @param message
|
||||
* @param channel
|
||||
*/
|
||||
@RabbitListener(queuesToDeclare = { @Queue("FaultAlarm")})
|
||||
public void FaultAlarmInfo(String msg, Message message, Channel channel) {
|
||||
try {
|
||||
//转换发送来的消息
|
||||
HashMap<String, List<String>> map = JSON.parseObject(msg, HashMap.class);
|
||||
//前往逻辑层处理
|
||||
faultService.faultAlarmHandler(map);
|
||||
//消息确认
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,6 +5,9 @@ import com.god.base.domain.Fault;
|
|||
import com.god.base.domain.request.FaultRequest;
|
||||
import com.god.common.core.web.page.TableDataInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 故障service
|
||||
*
|
||||
|
@ -19,4 +22,10 @@ public interface FaultService extends IService<Fault> {
|
|||
* @return
|
||||
*/
|
||||
TableDataInfo<Fault> faultList(FaultRequest faultRequest);
|
||||
|
||||
/**
|
||||
* 故障预警处理
|
||||
* @param map
|
||||
*/
|
||||
void faultAlarmHandler(HashMap<String, List<String>> map);
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ public interface FenceService extends IService<Fence> {
|
|||
* @return
|
||||
*/
|
||||
TableDataInfo<Fence> fenceListAndPage(FenceQueryRequest fenceQueryRequest);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.god.base.common.constant.BreakConstant;
|
||||
import com.god.base.domain.Fault;
|
||||
import com.god.base.domain.request.FaultRequest;
|
||||
import com.god.base.server.mapper.FaultMapper;
|
||||
|
@ -13,6 +14,8 @@ import lombok.extern.log4j.Log4j2;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 故障serviceImpl
|
||||
|
@ -25,6 +28,26 @@ import java.io.Serializable;
|
|||
@Log4j2
|
||||
public class FaultServiceImpl extends ServiceImpl<FaultMapper, Fault> implements FaultService {
|
||||
|
||||
/**
|
||||
* 故障预警信息处理
|
||||
* @param map
|
||||
*/
|
||||
@Override
|
||||
public void faultAlarmHandler(HashMap<String, List<String>> map) {
|
||||
map.forEach((key, value) -> {
|
||||
List<BreakConstant> list = value
|
||||
.stream()
|
||||
.map(BreakConstant::valueOf)
|
||||
.toList();
|
||||
log.info("车辆 {} 故障 , 具体信息{}",key,list);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障列表
|
||||
* @param faultRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<Fault> faultList(FaultRequest faultRequest) {
|
||||
LambdaQueryWrapper<Fault> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -37,6 +60,7 @@ public class FaultServiceImpl extends ServiceImpl<FaultMapper, Fault> implements
|
|||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean save(Fault fault){
|
||||
boolean save = super.save(fault);
|
||||
|
|
|
@ -11,7 +11,7 @@ import lombok.extern.log4j.Log4j2;
|
|||
@Log4j2
|
||||
public class Md5Util {
|
||||
|
||||
public static String md5(GetTopicReq getTopicReq) {
|
||||
public static String md5(GetTopicReq getTopicReq) {
|
||||
try {
|
||||
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
|
||||
String str = getTopicReq.getTimestamp() + getTopicReq.getUsername() + getTopicReq.getNonce() + getTopicReq.getVehicleVin();
|
||||
|
|
Loading…
Reference in New Issue