# Conflicts:
#	zhilian-common/zhilian-common-business/src/main/java/com/zhilian/business/remote/RemoteVehicleService.java
#	zhilian-common/zhilian-common-business/src/main/java/com/zhilian/business/remote/factory/RemoteVehicleFallbackFactory.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/controller/VehicleMarkersController.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/controller/VehicleTypeController.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/mapper/VehicleTypeMapper.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/VehicleMarkersService.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/MarkersFenceServiceImpl.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/VehicleMarkersServiceImpl.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/VehicleServiceImpl.java
master_suzejing
xiaoSu 2024-04-10 10:50:16 +08:00
commit 3c1b9cef33
24 changed files with 1061 additions and 686 deletions

View File

@ -0,0 +1,43 @@
package com.zhilian.business.domain;
import lombok.Data;
import java.util.Date;
/**
* @ClassName Break
* @Description
* @Author YuanYongH
* @Date 2024/4/4 9:40
*/
@Data
public class Break {
/**
* id
**/
private Integer breakId;
/**
*
**/
private String breakCode;
/**
* VIN
**/
private String breakVin;
/**
*
**/
private Date breakDate;
/**
*
**/
private Date breakTime;
/**
*
**/
private String breakType;
/**
*
**/
private Integer breakState;
}

View File

@ -0,0 +1,28 @@
package com.zhilian.business.domain;
import lombok.Data;
/**
* @ClassName BreakLog
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/8 15:07
*/
@Data
public class BreakLog {
/** 故障日志id */
private Integer breakLogId;
/** 故障码 */
private String breakCode;
/** 车辆VIN */
private String breakVin;
/** 故障类型 */
private String breakType;
/** 结束报警时间 */
private String breakTime;
/** 开始报警时间 */
private String breakDate;
/** 是否报警 */
private String breakState;
}

View File

@ -0,0 +1,113 @@
package com.zhilian.business.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhilian.common.core.annotation.Excel;
import com.zhilian.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* business_break
*
* @author Yy
* @date 2024-04-07
*/
@Data
public class BusinessBreak extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long breakId;
/** 故障码 */
@Excel(name = "故障码")
private String breakCode;
/** 车辆VIN */
@Excel(name = "车辆VIN")
private String breakVin;
/** 结束报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date breakTime;
/** 故障类型 */
@Excel(name = "故障类型")
private String breakType;
/** 开始报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date breakDate;
/** 是否警告 */
@Excel(name = "是否警告")
private String breakState;
public void setBreakId(Long breakId)
{
this.breakId = breakId;
}
public Long getBreakId()
{
return breakId;
}
public void setBreakCode(String breakCode)
{
this.breakCode = breakCode;
}
public String getBreakCode()
{
return breakCode;
}
public void setBreakVin(String breakVin)
{
this.breakVin = breakVin;
}
public String getBreakVin()
{
return breakVin;
}
public void setBreakType(String breakType)
{
this.breakType = breakType;
}
public String getBreakType()
{
return breakType;
}
public void setBreakState(String breakState)
{
this.breakState = breakState;
}
public String getBreakState()
{
return breakState;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("breakId", getBreakId())
.append("breakCode", getBreakCode())
.append("breakVin", getBreakVin())
.append("breakTime", getBreakTime())
.append("breakType", getBreakType())
.append("breakDate", getBreakDate())
.append("breakState", getBreakState())
.toString();
}
}

View File

@ -0,0 +1,22 @@
package com.zhilian.business.remote;
import com.zhilian.business.domain.Break;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.remote.factory.RemoteBreakFallbackFactory;
import com.zhilian.common.core.constant.ServiceNameConstants;
import com.zhilian.common.core.domain.Result;
import lombok.extern.java.Log;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(contextId = "remoteBreakService", value = ServiceNameConstants.BUSINESS_SERVICE, fallbackFactory = RemoteBreakFallbackFactory.class)
public interface RemoteBreakService {
/**
*
*/
@PostMapping
public Result add(@RequestBody BusinessBreak businessBreak);
}

View File

@ -0,0 +1,32 @@
package com.zhilian.business.remote;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory;
import com.zhilian.common.core.constant.ServiceNameConstants;
import com.zhilian.common.core.domain.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(contextId = "remoteVehicleService", value = ServiceNameConstants.VIEHICLE_SERVICE, fallbackFactory = RemoteVehicleFallbackFactory.class)
public interface RemoteVehicleService {
// @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
// public Result<SysFile> upload (@RequestPart(value = "file") MultipartFile file);
/**
* VIN
* @param vehicleVIN
* @return
*/
@PostMapping("/vehicle/getMarkersByVIN/{vehicleVIN}")
public Result<Vehicle> getVehicleByVIN(@PathVariable("vehicleVIN") String vehicleVIN);
/**
*
* @param vehicle
* @return
*/
@PostMapping("/vehicle/updateState")
public Result updateState(@RequestBody Vehicle vehicle);
}

View File

@ -0,0 +1,22 @@
package com.zhilian.business.remote.factory;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.remote.RemoteBreakService;
import com.zhilian.common.core.domain.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RemoteBreakFallbackFactory implements FallbackFactory<RemoteBreakService> {
@Override
public RemoteBreakService create(Throwable cause) {
return new RemoteBreakService() {
@Override
public Result add(BusinessBreak businessBreak) {
log.error("故障日志服务调用失败");
return Result.error("故障日志服务调用失败");
}
};
}
}

View File

@ -0,0 +1,31 @@
package com.zhilian.business.remote.factory;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.remote.RemoteVehicleService;
import com.zhilian.common.core.domain.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
@Component
public class RemoteVehicleFallbackFactory implements FallbackFactory<RemoteVehicleService> {
private static final Logger log = LoggerFactory.getLogger(RemoteVehicleFallbackFactory.class);
@Override
public RemoteVehicleService create(Throwable throwable) {
log.error("用户服务调用失败:{}", throwable.getMessage());
return new RemoteVehicleService() {
@Override
public Result<Vehicle> getVehicleByVIN(String vehicleVIN) {
return Result.error("获取车辆信息失败:" + throwable.getMessage());
}
@Override
public Result updateState(Vehicle vehicle) {
return Result.error("更新车辆状态失败:" + throwable.getMessage());
}
};
}
}

View File

@ -1 +1,3 @@
com.zhilian.common.business.remote.factory.RemoteVehicleFallbackFactory
com.zhilian.business.remote.factory.RemoteBreakFallbackFactory
com.zhilian.business.remote.factory.RemoteFenceFallbackFactory
com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory

View File

@ -20,6 +20,11 @@ public class ServiceNameConstants {
* serviceid
*/
public static final String FILE_SERVICE = "zhilian-file";
/**
* serviceid
*/
public static final String BUSINESS_SERVICE = "zhilian-business";
/**
* serviceid
*/

View File

@ -1,5 +1,6 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.service.VehicleMarkersService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;

View File

@ -1,5 +1,4 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.Fence;
import org.apache.ibatis.annotations.Mapper;

View File

@ -1,5 +1,4 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.middle.MarkersFence;
import org.apache.ibatis.annotations.Mapper;

View File

@ -1,5 +1,4 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.Markers;
import org.apache.ibatis.annotations.Mapper;

View File

@ -1,5 +1,4 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.middle.VehicleMarkers;
import org.apache.ibatis.annotations.Mapper;

View File

@ -1,5 +1,6 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.domain.middle.MarkersFence;

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import org.springframework.stereotype.Service;
@Service

View File

@ -1,5 +1,6 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.VehicleType;

View File

@ -10,11 +10,12 @@ import com.zhilian.business.service.MarkersFenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class MarkersFenceServiceImpl extends ServiceImpl<MarkersFenceMapper, MarkersFence> implements MarkersFenceService {
@Autowired
private MarkersFenceMapper markersFenceMapper;
@Override public boolean insert(Markers markers) {
ArrayList<MarkersFence> markersFences = new ArrayList<>();

View File

@ -38,7 +38,6 @@ public class VehicleMarkersServiceImpl extends ServiceImpl<VehicleMarkersMapper,
@Transactional(rollbackFor=Exception.class)
@Override
public boolean insert(Vehicle vehicle) {
ArrayList<VehicleMarkers> list = new ArrayList<>();
vehicle.getMarkersIds().forEach(markerId -> {
VehicleMarkers vehicleMarkers = new VehicleMarkers();
vehicleMarkers.setVehicleId(vehicle.getVehicleId());

View File

@ -130,6 +130,7 @@
<artifactId>spring-kafka</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -7,6 +7,7 @@ import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
@ -18,9 +19,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableCustomConfig
@EnableCustomSwagger2
@EnableScheduling
@EnableMyFeignClients
@EnableMyFeignClients(basePackages = {"com.zhilian.business.remote","com.zhilian.common.system.remote"})
@MapperScan({"com.zhilian.resolver.mapper", "com.zhilian.resolver.resolverReport"})
@SpringBootApplication
//com.zhilian.business.remote.factory.RemoteBreakFallbackFactory
//com.zhilian.business.remote.factory.RemoteFenceFallbackFactory
//com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory
public class ZhiLianResolverApplication {
public static void main(String[] args) {
SpringApplication.run(ZhiLianResolverApplication.class,args);

View File

@ -1,97 +1,97 @@
package com.zhilian.resolver.model;
import com.zhilian.common.core.utils.SpringUtils;
import com.zhilian.common.redis.service.RedisService;
import com.zhilian.common.resolver.domain.ResolverReportData;
import com.zhilian.resolver.service.ResolverEventService;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.time.Duration;
import java.util.*;
import java.util.stream.Collectors;
import static com.zhilian.resolver.utils.ConvertUtils.hexStringToString;
import static com.zhilian.resolver.utils.ConvertUtils.parseVehicleData;
/**
* @ClassName ModelsKafkaMessage
* @Description
* @Author Can.J
* @Date 2024/4/8
*/
@Component
@Slf4j
public class ModelsKafkaMessage {
@Autowired
private RedisService redisService;
private static final String TOPIC_NAME = "vehicle-topic";
private static final String BOOTSTRAP_SERVERS = "10.10.25.5:9092";
/**
*
* @return
*/
@PostConstruct
private void consumerMessages() {
Thread kafkaConsumerThread = new Thread(() -> {
log.info("启动线程");
Properties props = new Properties();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS);
props.put(ConsumerConfig.GROUP_ID_CONFIG, "my-consumer-group");
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
//创建消费者
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
try {
//订阅主题
consumer.subscribe(Collections.singletonList(TOPIC_NAME));
//持续消费消息
while (true) {
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
records.forEach(record -> {
System.out.println("接收到的数据:" + record.value());
String str = hexStringToString(record.value());
List<ResolverReportData> resolverReportDataList = parseVehicleData(str);
for (ResolverReportData vehicleData : resolverReportDataList) {
log.info("解析到车辆数据:{}", vehicleData);
//获取vin
String vin = vehicleData.getVin();
//获取事件集
Set<Object> cacheSet = redisService.getCacheSet("vehicle-event:" + vin);
List<String> events = cacheSet.stream().map(item -> {
return String.valueOf(item);
}).collect(Collectors.toList());
log.info("事件集合:{}",events);
log.info("解析到车辆数据:{}", vehicleData);
for (String stringEvent : events) {
ResolverEventService resolverEventService =SpringUtils.getBean(stringEvent);
resolverEventService.execute(vehicleData);
}
}
});
}
} catch (Exception e) {
log.error("Error occurred in Kafka consumer thread", e);
} finally {
consumer.close();
}
});
kafkaConsumerThread.start();
}
}
//package com.zhilian.resolver.model;
//import com.zhilian.common.core.utils.SpringUtils;
//import com.zhilian.common.redis.service.RedisService;
//import com.zhilian.common.resolver.domain.ResolverReportData;
//import com.zhilian.resolver.service.ResolverEventService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.kafka.clients.consumer.ConsumerConfig;
//import org.apache.kafka.clients.consumer.ConsumerRecords;
//import org.apache.kafka.clients.consumer.KafkaConsumer;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.time.Duration;
//import java.util.*;
//import java.util.stream.Collectors;
//
//import static com.zhilian.resolver.utils.ConvertUtils.hexStringToString;
//import static com.zhilian.resolver.utils.ConvertUtils.parseVehicleData;
//
///**
// * @ClassName ModelsKafkaMessage
// * @Description 描述
// * @Author Can.J
// * @Date 2024/4/8
// */
//@Component
//@Slf4j
//public class ModelsKafkaMessage {
// @Autowired
// private RedisService redisService;
// private static final String TOPIC_NAME = "vehicle-topic";
// private static final String BOOTSTRAP_SERVERS = "10.10.25.5:9092";
//
//
//
// /**
// * 消费者配置
// * @return
// */
// @PostConstruct
// private void consumerMessages() {
// Thread kafkaConsumerThread = new Thread(() -> {
// log.info("启动线程");
// Properties props = new Properties();
// props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS);
// props.put(ConsumerConfig.GROUP_ID_CONFIG, "my-consumer-group");
// props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
// props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
//
// //创建消费者
// KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
//
// try {
//
// //订阅主题
// consumer.subscribe(Collections.singletonList(TOPIC_NAME));
//
// //持续消费消息
// while (true) {
// ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
// records.forEach(record -> {
// System.out.println("接收到的数据:" + record.value());
// String str = hexStringToString(record.value());
// List<ResolverReportData> resolverReportDataList = parseVehicleData(str);
// for (ResolverReportData vehicleData : resolverReportDataList) {
// log.info("解析到车辆数据:{}", vehicleData);
//
// //获取vin
// String vin = vehicleData.getVin();
// //获取事件集
// Set<Object> cacheSet = redisService.getCacheSet("vehicle-event:" + vin);
// List<String> events = cacheSet.stream().map(item -> {
// return String.valueOf(item);
// }).collect(Collectors.toList());
// log.info("事件集合:{}",events);
//
// log.info("解析到车辆数据:{}", vehicleData);
// for (String stringEvent : events) {
// ResolverEventService resolverEventService =SpringUtils.getBean(stringEvent);
// resolverEventService.execute(vehicleData);
// }
// }
// });
// }
// } catch (Exception e) {
// log.error("Error occurred in Kafka consumer thread", e);
// } finally {
// consumer.close();
// }
// });
// kafkaConsumerThread.start();
// }
//
//
//}

View File

@ -1,8 +1,9 @@
package com.zhilian.resolver.service.impl.eventMalfunction;
import com.alibaba.fastjson.JSON;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.remote.RemoteBreakService;
import com.zhilian.common.redis.service.RedisService;
import com.zhilian.common.resolver.domain.ErrorCar;
import com.zhilian.common.resolver.domain.ResolverReportData;
import com.zhilian.resolver.mapper.UserMapper;
import com.zhilian.resolver.service.ResolverEventService;
@ -11,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
@ -37,109 +39,179 @@ public class MalfunctionEventServiceImpl implements ResolverEventService {
@Autowired
private ResolverReportInfoService resolverReportInfoService;
@Autowired
private RemoteBreakService remoteBreakService;
@Override
public void execute(ResolverReportData vehicleData) {
log.info("故障事件开始执行");
if(isAnyFieldZero(vehicleData)){
resolverReportInfoService.saveDataToDatabaseByMalfunction(vehicleData);
ErrorCar errorCar = new ErrorCar();
errorCar.setVin(vehicleData.getVin());
BusinessBreak businessBreak = new BusinessBreak();
businessBreak.setBreakVin(vehicleData.getVin());
// * 车辆状态 1正常 0故障
if(vehicleData.getVehicleStatus()==0){
errorCar.setCode("GZ001");
errorCar.setLevel(1);
businessBreak.setBreakCode("CL001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("车体故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 充电状态 1正常 0故障
// private int chargingStatus;
if(vehicleData.getChargingStatus()==0){
errorCar.setCode("GZ001");
errorCar.setLevel(1);
businessBreak.setBreakCode("CD001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 运行状态 1正常 0故障
if(vehicleData.getOperatingStatus()==0){
errorCar.setCode("GZ002");
errorCar.setLevel(3);
businessBreak.setBreakCode("DW001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("行驶故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * SOC 状态 1正常 0故障
if(vehicleData.getSocStatus()==0){
errorCar.setCode("GZ003");
errorCar.setLevel(3);
businessBreak.setBreakCode("SOC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
//
// /**
// * 可充电储能装置工作状态 1正常 0故障
// */
// private int chargingEnergyStorageStatus;
//
// /**
// * 驱动电机状态 1正常 0故障
// */
// private int driveMotorStatus;
//
// /**
// * 定位是否有效 1有效 0无效
// */
// private int positionStatus;
//
// /**
// 可充电储能装置工作状态 1正常 0故障;
if(vehicleData.getChargingEnergyStorageStatus()==0){
businessBreak.setBreakCode("CDC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// 驱动电机状态 1正常 0故障
if(vehicleData.getDriveMotorStatus()==0){
businessBreak.setBreakCode("DJ001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电机故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// 定位是否有效 1有效 0无效
if(vehicleData.getPositionStatus()==0){
businessBreak.setBreakCode("SOC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("定位故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * EAS(汽车防盗系统)状态 1正常 0故障
// */
// private int easStatus;
//
// /**
if(vehicleData.getEasStatus()==0){
businessBreak.setBreakCode("EAS001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("EAS故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * PTC(电动加热器)状态 1正常 0故障
// */
// private int ptcStatus;
//
// /**
if(vehicleData.getPtcStatus()==0){
businessBreak.setBreakCode("PTC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("加热故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * EPS(电动助力系统)状态 1正常 0故障
// */
// private int epsStatus;
//
// /**
if(vehicleData.getEpsStatus()==0){
businessBreak.setBreakCode("EPS001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电动助力故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * ABS(防抱死)状态 1正常 0故障
// */
// private int absStatus;
//
// /**
if(vehicleData.getAbsStatus()==0){
businessBreak.setBreakCode("ABS001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("ABS故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * MCU(电机/逆变器)状态 1正常 0故障
// */
// private int mcuStatus;
//
// /**
if(vehicleData.getMcuStatus()==0){
businessBreak.setBreakCode("MCU001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("MCU故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 动力电池加热状态 1正常 0故障
// */
// private int heatingStatus;
//
// /**
if(vehicleData.getHeatingStatus()==0){
businessBreak.setBreakCode("DC002");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 动力电池当前状态 1正常 0故障
// */
// private int batteryStatus;
//
// /**
if(vehicleData.getBatteryStatus()==0){
businessBreak.setBreakCode("DC003");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 动力电池保温状态 1正常 0故障
// */
// private int batteryInsulationStatus;
//
// /**
if(vehicleData.getBatteryInsulationStatus()==0){
businessBreak.setBreakCode("DC004");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * DCDC(电力交换系统) 状态 1正常 0故障
// */
// private int dcdcStatus;
//
// /**
if(vehicleData.getDcdcStatus()==0){
businessBreak.setBreakCode("DCDC005");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电力故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * CHG(充电机)状态 1正常 0故障
// */
// private int chgStatus;
String key = "breakdown";
String value = JSON.toJSONString(errorCar);
redisService.setCacheObject(key,value);
if(vehicleData.getChgStatus()==0){
businessBreak.setBreakCode("CDJ005");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电力故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// String key = "breakdown";
String value = JSON.toJSONString(businessBreak);
redisService.setCacheObject("breakdown:gz:"+vehicleData.getVin(),value);
long expireTime = 30;
redisService.expire(key, expireTime, TimeUnit.MINUTES);
redisService.expire("breakdown:gz:"+vehicleData.getVin(), expireTime, TimeUnit.MINUTES);
}