Compare commits
2 Commits
adc2b87792
...
599d89b6e4
Author | SHA1 | Date |
---|---|---|
|
599d89b6e4 | |
|
adab59900a |
|
@ -65,4 +65,9 @@ public class CoupletTroubleCode {
|
||||||
*/
|
*/
|
||||||
@Excel(name = "故障位置")
|
@Excel(name = "故障位置")
|
||||||
private String troublePosition;
|
private String troublePosition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理状态
|
||||||
|
*/
|
||||||
|
private Integer processingState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@
|
||||||
<groupId>com.couplet</groupId>
|
<groupId>com.couplet</groupId>
|
||||||
<artifactId>couplet-common-event</artifactId>
|
<artifactId>couplet-common-event</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.kafka</groupId>
|
<groupId>org.springframework.kafka</groupId>
|
||||||
<artifactId>spring-kafka</artifactId>
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
@ -101,6 +103,12 @@
|
||||||
<artifactId>couplet-common-business</artifactId>
|
<artifactId>couplet-common-business</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RabbitMQ依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,150 +1,203 @@
|
||||||
//package com.couplet.analyze.msg.consumer;
|
package com.couplet.analyze.msg.consumer;
|
||||||
//
|
|
||||||
//import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
//import com.couplet.analyze.msg.domain.CoupletMsgData;
|
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||||
//import com.couplet.analyze.msg.utils.MsgUtils;
|
import com.couplet.analyze.msg.utils.MsgUtils;
|
||||||
//import com.couplet.common.domain.CoupletTroubleCode;
|
import com.couplet.common.domain.CoupletTroubleCode;
|
||||||
//import com.couplet.common.redis.service.RedisService;
|
import com.couplet.common.redis.service.RedisService;
|
||||||
//import com.couplet.remote.RemoteTroubleService;
|
import com.couplet.remote.RemoteTroubleService;
|
||||||
//import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
//import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
//import org.springframework.amqp.core.Message;
|
import org.springframework.amqp.core.Message;
|
||||||
//import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
//
|
|
||||||
//import java.util.Date;
|
import java.util.Date;
|
||||||
//import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * @author DongXiaoDong
|
* @author DongXiaoDong
|
||||||
// * @version 1.0
|
* @version 1.0
|
||||||
// * @date 2024/4/6 15:37
|
* @date 2024/4/6 15:37
|
||||||
// * @description
|
* @description
|
||||||
// */
|
*/
|
||||||
//@Component
|
@Component
|
||||||
//@Slf4j
|
@Slf4j
|
||||||
//public class CodeConsumer {
|
public class CodeConsumer {
|
||||||
//// @Autowired
|
|
||||||
//// private RedisTemplate<String, String> redisTemplate;
|
|
||||||
//
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// private RedisService redisService;
|
// private RedisTemplate<String, String> redisTemplate;
|
||||||
// @Autowired
|
|
||||||
// private RemoteTroubleService remoteTroubleService;
|
@Autowired
|
||||||
//
|
private RedisService redisService;
|
||||||
// @RabbitListener(queuesToDeclare = {@Queue("couplet-code-queue")})
|
@Autowired
|
||||||
// public void sendLogQueueConsumer(Message message, CoupletMsgData msgData, Channel channel) {
|
private RemoteTroubleService remoteTroubleService;
|
||||||
// log.info("日志队列:{},接收到的消息:{},开始消费...","couplet-code-queue", JSONObject.toJSONString(msgData));
|
|
||||||
// long start = System.currentTimeMillis();
|
@RabbitListener(queuesToDeclare = {@Queue("couplet-code-queue")})
|
||||||
//
|
public void sendLogQueueConsumer(Message message, CoupletMsgData msgData, Channel channel) {
|
||||||
// String messageId = message.getMessageProperties().getMessageId();
|
log.info("日志队列:{},接收到的消息:{},开始消费...","couplet-code-queue", JSONObject.toJSONString(msgData));
|
||||||
//
|
long start = System.currentTimeMillis();
|
||||||
// try {
|
|
||||||
// boolean addToSetIfNotExists = redisService.addToSetIfNotExists("couplet-code-queue", messageId);
|
String messageId = message.getMessageProperties().getMessageId();
|
||||||
// if (addToSetIfNotExists) {
|
|
||||||
// //异步保存记录
|
try {
|
||||||
// CompletableFuture.runAsync(() -> {
|
boolean addToSetIfNotExists = redisService.addToSetIfNotExists("couplet-code-queue", messageId);
|
||||||
// CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
if (addToSetIfNotExists) {
|
||||||
// troubleCode.setTroubleStartTime(new Date());
|
//异步保存记录
|
||||||
// troubleCode.setTroubleVin(msgData.getVin());
|
CompletableFuture.runAsync(() -> {
|
||||||
// // 随机生成故障码
|
CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
||||||
// String faultCode = MsgUtils.generateGTA();
|
troubleCode.setTroubleStartTime(new Date());
|
||||||
// troubleCode.setTroubleCode(faultCode);
|
troubleCode.setTroubleVin(msgData.getVin());
|
||||||
//
|
// 随机生成故障码
|
||||||
// // 检查车辆状态,若为0,则设置故障位置为"190"
|
String faultCode = MsgUtils.generateGTA();
|
||||||
// if(msgData.getVehicleStatus() == 0) {
|
troubleCode.setTroubleCode(faultCode);
|
||||||
// troubleCode.setTroublePosition("190");
|
|
||||||
// }
|
switch (msgData.getVehicleStatus()) {
|
||||||
//
|
case 0:
|
||||||
// // 检查充电状态,若为0,则设置故障位置为"191"
|
troubleCode.setTroublePosition("190");
|
||||||
// if (msgData.getChargingStatus() == 0) {
|
troubleCode.setProcessingState(0);
|
||||||
// troubleCode.setTroublePosition("191");
|
break;
|
||||||
// }
|
default:
|
||||||
//
|
switch (msgData.getChargingStatus()) {
|
||||||
// // 检查运行状态,若为0,则设置故障位置为"192"
|
case 0:
|
||||||
// if (msgData.getOperatingStatus() == 0) {
|
troubleCode.setTroublePosition("191");
|
||||||
// troubleCode.setTroublePosition("192");
|
troubleCode.setProcessingState(0);
|
||||||
// }
|
break;
|
||||||
//
|
default:
|
||||||
// // 检查电池荷电状态(SOC), 若为0,则设置故障位置为"193"
|
switch (msgData.getOperatingStatus()) {
|
||||||
// if (msgData.getSocStatus() == 0) {
|
case 0:
|
||||||
// troubleCode.setTroublePosition("193");
|
troubleCode.setTroublePosition("192");
|
||||||
// }
|
troubleCode.setProcessingState(0);
|
||||||
//
|
break;
|
||||||
// // 检查充电能源存储状态,若为0,则设置故障位置为"194"
|
default:
|
||||||
// if (msgData.getChargingEnergyStorageStatus() == 0) {
|
switch (msgData.getSocStatus()) {
|
||||||
// troubleCode.setTroublePosition("194");
|
case 0:
|
||||||
// }
|
troubleCode.setTroublePosition("193");
|
||||||
//
|
troubleCode.setProcessingState(0);
|
||||||
// // 检查驱动电机状态,若为0,则设置故障位置为"195"
|
break;
|
||||||
// if (msgData.getDriveMotorStatus() == 0) {
|
default:
|
||||||
// troubleCode.setTroublePosition("195");
|
switch (msgData.getChargingEnergyStorageStatus()) {
|
||||||
// }
|
case 0:
|
||||||
//
|
troubleCode.setTroublePosition("194");
|
||||||
// // 检查定位状态,若为0,则设置故障位置为"196"
|
troubleCode.setProcessingState(0);
|
||||||
// if (msgData.getPositionStatus() == 0) {
|
break;
|
||||||
// troubleCode.setTroublePosition("196");
|
default:
|
||||||
// }
|
switch (msgData.getDriveMotorStatus()) {
|
||||||
//
|
case 0:
|
||||||
// // 检查电子驻车系统(EAS)状态,若为0,则设置故障位置为"197"
|
troubleCode.setTroublePosition("195");
|
||||||
// if (msgData.getEasStatus() == 0) {
|
troubleCode.setProcessingState(0);
|
||||||
// troubleCode.setTroublePosition("197");
|
break;
|
||||||
// }
|
default:
|
||||||
//
|
switch (msgData.getPositionStatus()) {
|
||||||
// // 检查PTC(正温度系数热敏电阻)状态,若为0,则设置故障位置为"198"
|
case 0:
|
||||||
// if (msgData.getPtcStatus() == 0) {
|
troubleCode.setTroublePosition("196");
|
||||||
// troubleCode.setTroublePosition("198");
|
troubleCode.setProcessingState(0);
|
||||||
// }
|
break;
|
||||||
//
|
default:
|
||||||
// // 检查电动助力转向系统(EPS)状态,若为0,则设置故障位置为"199"
|
switch (msgData.getEasStatus()) {
|
||||||
// if (msgData.getEpsStatus() == 0) {
|
case 0:
|
||||||
// troubleCode.setTroublePosition("199");
|
troubleCode.setTroublePosition("197");
|
||||||
// }
|
troubleCode.setProcessingState(0);
|
||||||
//
|
break;
|
||||||
// // 检查防抱死制动系统(ABS)状态,若为0,则设置故障位置为"200"
|
default:
|
||||||
// if (msgData.getAbsStatus() == 0) {
|
switch (msgData.getPtcStatus()) {
|
||||||
// troubleCode.setTroublePosition("200");
|
case 0:
|
||||||
// }
|
troubleCode.setTroublePosition("198");
|
||||||
//
|
troubleCode.setProcessingState(0);
|
||||||
// // 检查主控制器(MCU)状态,若为0,则设置故障位置为"201"
|
break;
|
||||||
// if (msgData.getMcuStatus() == 0) {
|
default:
|
||||||
// troubleCode.setTroublePosition("201");
|
switch (msgData.getEpsStatus()) {
|
||||||
// }
|
case 0:
|
||||||
//
|
troubleCode.setTroublePosition("199");
|
||||||
// // 检查加热状态,若为0,则设置故障位置为"202"
|
troubleCode.setProcessingState(0);
|
||||||
// if (msgData.getHeatingStatus() == 0) {
|
break;
|
||||||
// troubleCode.setTroublePosition("202");
|
default:
|
||||||
// }
|
switch (msgData.getAbsStatus()) {
|
||||||
//
|
case 0:
|
||||||
// // 检查电池状态,若为0,则设置故障位置为"203"
|
troubleCode.setTroublePosition("200");
|
||||||
// if (msgData.getBatteryStatus() == 0) {
|
troubleCode.setProcessingState(0);
|
||||||
// troubleCode.setTroublePosition("203");
|
break;
|
||||||
// }
|
default:
|
||||||
//
|
switch (msgData.getMcuStatus()) {
|
||||||
// // 检查电池绝缘状态,若为0,则设置故障位置为"204"
|
case 0:
|
||||||
// if (msgData.getBatteryInsulationStatus() == 0) {
|
troubleCode.setTroublePosition("201");
|
||||||
// troubleCode.setTroublePosition("204");
|
troubleCode.setProcessingState(0);
|
||||||
// }
|
break;
|
||||||
//
|
default:
|
||||||
// // 检查直流-直流转换器(DC/DC)状态,若为0,则设置故障位置为"205"
|
switch (msgData.getHeatingStatus()) {
|
||||||
// if (msgData.getDcdcStatus() == 0) {
|
case 0:
|
||||||
// troubleCode.setTroublePosition("205");
|
troubleCode.setTroublePosition("202");
|
||||||
// }
|
troubleCode.setProcessingState(0);
|
||||||
//
|
break;
|
||||||
// // 检查充电机(CHG)状态,若为0,则设置故障位置为"206"
|
default:
|
||||||
// if (msgData.getChgStatus() == 0) {
|
switch (msgData.getBatteryStatus()) {
|
||||||
// troubleCode.setTroublePosition("206");
|
case 0:
|
||||||
// }
|
troubleCode.setTroublePosition("203");
|
||||||
// remoteTroubleService.newFaultData(troubleCode);
|
troubleCode.setProcessingState(0);
|
||||||
// });
|
break;
|
||||||
// }
|
default:
|
||||||
// long end = System.currentTimeMillis();
|
switch (msgData.getBatteryInsulationStatus()) {
|
||||||
// log.info("日志队列:{},接收到的消息:{},消费完成,耗时:{}毫秒","couplet-code-queue", JSONObject.toJSONString(msgData), (end-start));
|
case 0:
|
||||||
// } catch (Exception e) {
|
troubleCode.setTroublePosition("204");
|
||||||
// throw new RuntimeException(e);
|
troubleCode.setProcessingState(0);
|
||||||
// }
|
break;
|
||||||
// }
|
default:
|
||||||
//}
|
switch (msgData.getDcdcStatus()) {
|
||||||
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("205");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
switch (msgData.getChgStatus()) {
|
||||||
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("206");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// do nothing
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
remoteTroubleService.newFaultData(troubleCode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
log.info("日志队列:{},接收到的消息:{},消费完成,耗时:{}毫秒","couplet-code-queue", JSONObject.toJSONString(msgData), (end-start));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.couplet.analyze.msg.model;
|
package com.couplet.analyze.msg.model;
|
||||||
|
|
||||||
import com.couplet.analyze.common.contents.AnalyzeEventContents;
|
|
||||||
import com.couplet.analyze.common.event.AnalyzeEventCache;
|
|
||||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||||
import com.couplet.analyze.msg.service.IncidentService;
|
import com.couplet.analyze.msg.service.IncidentService;
|
||||||
import com.couplet.common.core.exception.vehicle.VehicleException;
|
import com.couplet.common.core.exception.vehicle.VehicleException;
|
||||||
|
@ -10,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||||
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,6 +104,7 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl
|
||||||
for (CoupletMsgData member : members) {
|
for (CoupletMsgData member : members) {
|
||||||
Set<String> breakdownIds = redisService.getCacheSet(member.getVin()+":"+key);
|
Set<String> breakdownIds = redisService.getCacheSet(member.getVin()+":"+key);
|
||||||
if (breakdownIds.size()==0){
|
if (breakdownIds.size()==0){
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
||||||
troubleCode.setTroubleStartTime(new Date());
|
troubleCode.setTroubleStartTime(new Date());
|
||||||
troubleCode.setTroubleVin(member.getVin());
|
troubleCode.setTroubleVin(member.getVin());
|
||||||
|
@ -110,96 +112,149 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl
|
||||||
String faultCode = MsgUtils.generateGTA();
|
String faultCode = MsgUtils.generateGTA();
|
||||||
troubleCode.setTroubleCode(faultCode);
|
troubleCode.setTroubleCode(faultCode);
|
||||||
|
|
||||||
// 检查车辆状态,若为0,则设置故障位置为"190"
|
switch (member.getVehicleStatus()) {
|
||||||
if(member.getVehicleStatus() == 0) {
|
case 0:
|
||||||
troubleCode.setTroublePosition("190");
|
troubleCode.setTroublePosition("190");
|
||||||
}
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
// 检查充电状态,若为0,则设置故障位置为"191"
|
default:
|
||||||
if (member.getChargingStatus() == 0) {
|
switch (member.getChargingStatus()) {
|
||||||
troubleCode.setTroublePosition("191");
|
case 0:
|
||||||
}
|
troubleCode.setTroublePosition("191");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
// 检查运行状态,若为0,则设置故障位置为"192"
|
break;
|
||||||
if (member.getOperatingStatus() == 0) {
|
default:
|
||||||
troubleCode.setTroublePosition("192");
|
switch (member.getOperatingStatus()) {
|
||||||
}
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("192");
|
||||||
// 检查电池荷电状态(SOC), 若为0,则设置故障位置为"193"
|
troubleCode.setProcessingState(0);
|
||||||
if (member.getSocStatus() == 0) {
|
break;
|
||||||
troubleCode.setTroublePosition("193");
|
default:
|
||||||
}
|
switch (member.getSocStatus()) {
|
||||||
|
case 0:
|
||||||
// 检查充电能源存储状态,若为0,则设置故障位置为"194"
|
troubleCode.setTroublePosition("193");
|
||||||
if (member.getChargingEnergyStorageStatus() == 0) {
|
troubleCode.setProcessingState(0);
|
||||||
troubleCode.setTroublePosition("194");
|
break;
|
||||||
}
|
default:
|
||||||
|
switch (member.getChargingEnergyStorageStatus()) {
|
||||||
// 检查驱动电机状态,若为0,则设置故障位置为"195"
|
case 0:
|
||||||
if (member.getDriveMotorStatus() == 0) {
|
troubleCode.setTroublePosition("194");
|
||||||
troubleCode.setTroublePosition("195");
|
troubleCode.setProcessingState(0);
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
// 检查定位状态,若为0,则设置故障位置为"196"
|
switch (member.getDriveMotorStatus()) {
|
||||||
if (member.getPositionStatus() == 0) {
|
case 0:
|
||||||
troubleCode.setTroublePosition("196");
|
troubleCode.setTroublePosition("195");
|
||||||
}
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
// 检查电子驻车系统(EAS)状态,若为0,则设置故障位置为"197"
|
default:
|
||||||
if (member.getEasStatus() == 0) {
|
switch (member.getPositionStatus()) {
|
||||||
troubleCode.setTroublePosition("197");
|
case 0:
|
||||||
}
|
troubleCode.setTroublePosition("196");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
// 检查PTC(正温度系数热敏电阻)状态,若为0,则设置故障位置为"198"
|
break;
|
||||||
if (member.getPtcStatus() == 0) {
|
default:
|
||||||
troubleCode.setTroublePosition("198");
|
switch (member.getEasStatus()) {
|
||||||
}
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("197");
|
||||||
// 检查电动助力转向系统(EPS)状态,若为0,则设置故障位置为"199"
|
troubleCode.setProcessingState(0);
|
||||||
if (member.getEpsStatus() == 0) {
|
break;
|
||||||
troubleCode.setTroublePosition("199");
|
default:
|
||||||
}
|
switch (member.getPtcStatus()) {
|
||||||
|
case 0:
|
||||||
// 检查防抱死制动系统(ABS)状态,若为0,则设置故障位置为"200"
|
troubleCode.setTroublePosition("198");
|
||||||
if (member.getAbsStatus() == 0) {
|
troubleCode.setProcessingState(0);
|
||||||
troubleCode.setTroublePosition("200");
|
break;
|
||||||
}
|
default:
|
||||||
|
switch (member.getEpsStatus()) {
|
||||||
// 检查主控制器(MCU)状态,若为0,则设置故障位置为"201"
|
case 0:
|
||||||
if (member.getMcuStatus() == 0) {
|
troubleCode.setTroublePosition("199");
|
||||||
troubleCode.setTroublePosition("201");
|
troubleCode.setProcessingState(0);
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
// 检查加热状态,若为0,则设置故障位置为"202"
|
switch (member.getAbsStatus()) {
|
||||||
if (member.getHeatingStatus() == 0) {
|
case 0:
|
||||||
troubleCode.setTroublePosition("202");
|
troubleCode.setTroublePosition("200");
|
||||||
}
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
// 检查电池状态,若为0,则设置故障位置为"203"
|
default:
|
||||||
if (member.getBatteryStatus() == 0) {
|
switch (member.getMcuStatus()) {
|
||||||
troubleCode.setTroublePosition("203");
|
case 0:
|
||||||
}
|
troubleCode.setTroublePosition("201");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
// 检查电池绝缘状态,若为0,则设置故障位置为"204"
|
break;
|
||||||
if (member.getBatteryInsulationStatus() == 0) {
|
default:
|
||||||
troubleCode.setTroublePosition("204");
|
switch (member.getHeatingStatus()) {
|
||||||
}
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("202");
|
||||||
// 检查直流-直流转换器(DC/DC)状态,若为0,则设置故障位置为"205"
|
troubleCode.setProcessingState(0);
|
||||||
if (member.getDcdcStatus() == 0) {
|
break;
|
||||||
troubleCode.setTroublePosition("205");
|
default:
|
||||||
}
|
switch (member.getBatteryStatus()) {
|
||||||
|
case 0:
|
||||||
// 检查充电机(CHG)状态,若为0,则设置故障位置为"206"
|
troubleCode.setTroublePosition("203");
|
||||||
if (member.getChgStatus() == 0) {
|
troubleCode.setProcessingState(0);
|
||||||
troubleCode.setTroublePosition("206");
|
break;
|
||||||
}
|
default:
|
||||||
|
switch (member.getBatteryInsulationStatus()) {
|
||||||
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("204");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
switch (member.getDcdcStatus()) {
|
||||||
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("205");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
switch (member.getChgStatus()) {
|
||||||
|
case 0:
|
||||||
|
troubleCode.setTroublePosition("206");
|
||||||
|
troubleCode.setProcessingState(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// do nothing
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
remoteTroubleService.newFaultData(troubleCode);
|
remoteTroubleService.newFaultData(troubleCode);
|
||||||
|
});
|
||||||
redisService.setCacheSet(member.getVin()+":"+key, member.getVin()+":"+member);
|
redisService.setCacheSet(member.getVin()+":"+key, member.getVin()+":"+member);
|
||||||
long expireTime = 30;
|
long expireTime = 30;
|
||||||
redisService.expire(member.getVin()+":"+key, expireTime, TimeUnit.MINUTES);
|
redisService.expire(member.getVin()+":"+key, expireTime, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,21 +25,21 @@ public class ParsingMsg {
|
||||||
String hexStringWithoutSpaces = substring.replaceAll("\\s+", "");
|
String hexStringWithoutSpaces = substring.replaceAll("\\s+", "");
|
||||||
String asciiString = hexToString(hexStringWithoutSpaces);
|
String asciiString = hexToString(hexStringWithoutSpaces);
|
||||||
System.out.println("16进制解析后的数据:"+asciiString);
|
System.out.println("16进制解析后的数据:"+asciiString);
|
||||||
//截取前17位
|
// //截取前17位
|
||||||
String substring1 = asciiString.substring(0, 17);
|
// String substring1 = asciiString.substring(0, 17);
|
||||||
System.out.println("VIN:"+substring1);
|
// System.out.println("VIN:"+substring1);
|
||||||
String substring2 = asciiString.substring(17, 30);
|
// String substring2 = asciiString.substring(17, 30);
|
||||||
System.out.println("时间戳:"+substring2);
|
// System.out.println("时间戳:"+substring2);
|
||||||
String substring3 = asciiString.substring(30, 40);
|
// String substring3 = asciiString.substring(30, 40);
|
||||||
System.out.println("经度:" +substring3);
|
// System.out.println("经度:" +substring3);
|
||||||
String substring4 = asciiString.substring(41, 50);
|
// String substring4 = asciiString.substring(41, 50);
|
||||||
System.out.println("纬度:"+ substring4);
|
// System.out.println("纬度:"+ substring4);
|
||||||
String substring5 = asciiString.substring(51, 56);
|
// String substring5 = asciiString.substring(51, 56);
|
||||||
System.out.println("车速:"+ substring5);
|
// System.out.println("车速:"+ substring5);
|
||||||
String substring6 = asciiString.substring(57, 67);
|
// String substring6 = asciiString.substring(57, 67);
|
||||||
System.out.println("总里程:"+ substring6);
|
// System.out.println("总里程:"+ substring6);
|
||||||
String substring7 = asciiString.substring(68, 73);
|
// String substring7 = asciiString.substring(68, 73);
|
||||||
System.out.println("总电压:"+ substring7);
|
// System.out.println("总电压:"+ substring7);
|
||||||
String pattern = "(.{17})(.{10})(.{9})(.{8})(.{2})";
|
String pattern = "(.{17})(.{10})(.{9})(.{8})(.{2})";
|
||||||
Pattern compile = Pattern.compile(pattern);
|
Pattern compile = Pattern.compile(pattern);
|
||||||
Matcher matcher = compile.matcher(asciiString);
|
Matcher matcher = compile.matcher(asciiString);
|
||||||
|
|
|
@ -16,9 +16,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
|
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
|
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
<id property="troubleId" column="trouble_id"/>
|
<id property="troubleId" column="trouble_id"/>
|
||||||
<result property="troubleCode" column="trouble_code"/>
|
<result property="troubleCode" column="trouble_code"/>
|
||||||
<result property="troubleVin" column="trouble_vin"/>
|
<result property="troubleVin" column="trouble_vin"/>
|
||||||
<result property="troubleTag" column="trouble_tag"/>
|
|
||||||
<result property="troubleStartTime" column="trouble_start_time"/>
|
<result property="troubleStartTime" column="trouble_start_time"/>
|
||||||
<result property="troubleEndTime" column="trouble_end_time"/>
|
<result property="troubleEndTime" column="trouble_end_time"/>
|
||||||
|
<result property="processingState" column="processing_state"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectTroubleVo">
|
<sql id="selectTroubleVo">
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
</sql>
|
</sql>
|
||||||
<insert id="newFaultData">
|
<insert id="newFaultData">
|
||||||
INSERT INTO `couplet-cloud`.`couplet_trouble_code`
|
INSERT INTO `couplet-cloud`.`couplet_trouble_code`
|
||||||
(`trouble_code`,`trouble_vin`,`trouble_position`,`trouble_start_time`)
|
(`trouble_code`,`trouble_vin`,`trouble_position`,`trouble_start_time`,`processing_state`)
|
||||||
VALUES
|
VALUES
|
||||||
(#{troubleCode},#{troubleVin}, #{troublePosition},#{troubleStartTime})
|
(#{troubleCode},#{troubleVin}, #{troublePosition},#{troubleStartTime},#{processingState})
|
||||||
</insert>
|
</insert>
|
||||||
<update id="cleanTroubleCode">
|
<update id="cleanTroubleCode">
|
||||||
truncate table couplet_trouble_code
|
truncate table couplet_trouble_code
|
||||||
|
|
|
@ -15,6 +15,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
|
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
|
@ -23,6 +24,7 @@ spring:
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
logging:
|
logging:
|
||||||
|
@ -36,7 +38,7 @@ mqtt:
|
||||||
# broker: mqtt://115.159.47.13:1883
|
# broker: mqtt://115.159.47.13:1883
|
||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
clientId: xiaoYao
|
clientId: fluxMq
|
||||||
qos: 0
|
qos: 0
|
||||||
topic: xiaoYao
|
topic: test
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue