kafka代码
parent
1e08ce9bd7
commit
165583d024
|
@ -46,12 +46,6 @@ public class CoupletTroubleCode {
|
||||||
@Excel(name = "vin")
|
@Excel(name = "vin")
|
||||||
private String troubleVin;
|
private String troubleVin;
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障标签
|
|
||||||
*/
|
|
||||||
@Excel(name = "故障标签")
|
|
||||||
private Integer troubleTag;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障开始时间
|
* 故障开始时间
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -71,95 +71,6 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl
|
||||||
|| StateConstant.DCDC_STATUS != coupletMsgData.getDcdcStatus()
|
|| StateConstant.DCDC_STATUS != coupletMsgData.getDcdcStatus()
|
||||||
|| StateConstant.CHG_STATUS != coupletMsgData.getChgStatus()){
|
|| StateConstant.CHG_STATUS != coupletMsgData.getChgStatus()){
|
||||||
//获取过期的key
|
//获取过期的key
|
||||||
|
|
||||||
// 定义一个CoupletTroubleCode对象,用于记录故障位置信息
|
|
||||||
CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
|
||||||
|
|
||||||
// 检查车辆状态,若为0,则设置故障位置为"190"
|
|
||||||
if(coupletMsgData.getVehicleStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("190");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查充电状态,若为0,则设置故障位置为"191"
|
|
||||||
if (coupletMsgData.getChargingStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("191");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查运行状态,若为0,则设置故障位置为"192"
|
|
||||||
if (coupletMsgData.getOperatingStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("192");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查电池荷电状态(SOC), 若为0,则设置故障位置为"193"
|
|
||||||
if (coupletMsgData.getSocStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("193");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查充电能源存储状态,若为0,则设置故障位置为"194"
|
|
||||||
if (coupletMsgData.getChargingEnergyStorageStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("194");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查驱动电机状态,若为0,则设置故障位置为"195"
|
|
||||||
if (coupletMsgData.getDriveMotorStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("195");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查定位状态,若为0,则设置故障位置为"196"
|
|
||||||
if (coupletMsgData.getPositionStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("196");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查电子驻车系统(EAS)状态,若为0,则设置故障位置为"197"
|
|
||||||
if (coupletMsgData.getEasStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("197");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查PTC(正温度系数热敏电阻)状态,若为0,则设置故障位置为"198"
|
|
||||||
if (coupletMsgData.getPtcStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("198");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查电动助力转向系统(EPS)状态,若为0,则设置故障位置为"199"
|
|
||||||
if (coupletMsgData.getEpsStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("199");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查防抱死制动系统(ABS)状态,若为0,则设置故障位置为"200"
|
|
||||||
if (coupletMsgData.getAbsStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("200");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查主控制器(MCU)状态,若为0,则设置故障位置为"201"
|
|
||||||
if (coupletMsgData.getMcuStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("201");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查加热状态,若为0,则设置故障位置为"202"
|
|
||||||
if (coupletMsgData.getHeatingStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("202");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查电池状态,若为0,则设置故障位置为"203"
|
|
||||||
if (coupletMsgData.getBatteryStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("203");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查电池绝缘状态,若为0,则设置故障位置为"204"
|
|
||||||
if (coupletMsgData.getBatteryInsulationStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("204");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查直流-直流转换器(DC/DC)状态,若为0,则设置故障位置为"205"
|
|
||||||
if (coupletMsgData.getDcdcStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("205");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查充电机(CHG)状态,若为0,则设置故障位置为"206"
|
|
||||||
if (coupletMsgData.getChgStatus() == 0) {
|
|
||||||
troubleCode.setTroublePosition("206");
|
|
||||||
}
|
|
||||||
|
|
||||||
String key = "breakdown";
|
String key = "breakdown";
|
||||||
log.debug("失效+key is:"+ key);
|
log.debug("失效+key is:"+ key);
|
||||||
String value = JSON.toJSONString(coupletMsgData);
|
String value = JSON.toJSONString(coupletMsgData);
|
||||||
|
@ -197,12 +108,95 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl
|
||||||
if (breakdownIds.size()==0){
|
if (breakdownIds.size()==0){
|
||||||
CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
||||||
troubleCode.setTroubleStartTime(new Date());
|
troubleCode.setTroubleStartTime(new Date());
|
||||||
// 插入数据库
|
|
||||||
troubleCode.setTroubleTag(0);
|
|
||||||
troubleCode.setTroubleVin(code.getVin());
|
troubleCode.setTroubleVin(code.getVin());
|
||||||
// 随机生成故障码
|
// 随机生成故障码
|
||||||
String faultCode = MsgUtils.generateGTA();
|
String faultCode = MsgUtils.generateGTA();
|
||||||
troubleCode.setTroubleCode(faultCode);
|
troubleCode.setTroubleCode(faultCode);
|
||||||
|
|
||||||
|
// 检查车辆状态,若为0,则设置故障位置为"190"
|
||||||
|
if(code.getVehicleStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("190");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查充电状态,若为0,则设置故障位置为"191"
|
||||||
|
if (code.getChargingStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("191");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查运行状态,若为0,则设置故障位置为"192"
|
||||||
|
if (code.getOperatingStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("192");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查电池荷电状态(SOC), 若为0,则设置故障位置为"193"
|
||||||
|
if (code.getSocStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("193");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查充电能源存储状态,若为0,则设置故障位置为"194"
|
||||||
|
if (code.getChargingEnergyStorageStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("194");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查驱动电机状态,若为0,则设置故障位置为"195"
|
||||||
|
if (code.getDriveMotorStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("195");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查定位状态,若为0,则设置故障位置为"196"
|
||||||
|
if (code.getPositionStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("196");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查电子驻车系统(EAS)状态,若为0,则设置故障位置为"197"
|
||||||
|
if (code.getEasStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("197");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查PTC(正温度系数热敏电阻)状态,若为0,则设置故障位置为"198"
|
||||||
|
if (code.getPtcStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("198");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查电动助力转向系统(EPS)状态,若为0,则设置故障位置为"199"
|
||||||
|
if (code.getEpsStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("199");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查防抱死制动系统(ABS)状态,若为0,则设置故障位置为"200"
|
||||||
|
if (code.getAbsStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("200");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查主控制器(MCU)状态,若为0,则设置故障位置为"201"
|
||||||
|
if (code.getMcuStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("201");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查加热状态,若为0,则设置故障位置为"202"
|
||||||
|
if (code.getHeatingStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("202");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查电池状态,若为0,则设置故障位置为"203"
|
||||||
|
if (code.getBatteryStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("203");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查电池绝缘状态,若为0,则设置故障位置为"204"
|
||||||
|
if (code.getBatteryInsulationStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("204");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查直流-直流转换器(DC/DC)状态,若为0,则设置故障位置为"205"
|
||||||
|
if (code.getDcdcStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("205");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查充电机(CHG)状态,若为0,则设置故障位置为"206"
|
||||||
|
if (code.getChgStatus() == 0) {
|
||||||
|
troubleCode.setTroublePosition("206");
|
||||||
|
}
|
||||||
remoteTroubleService.newFaultData(troubleCode);
|
remoteTroubleService.newFaultData(troubleCode);
|
||||||
redisTemplate.opsForSet().add(code.getVin(), code.getVin()+":"+code);
|
redisTemplate.opsForSet().add(code.getVin(), code.getVin()+":"+code);
|
||||||
long expireTime = 30;
|
long expireTime = 30;
|
||||||
|
|
|
@ -18,13 +18,12 @@
|
||||||
</sql>
|
</sql>
|
||||||
<insert id="newFaultData">
|
<insert id="newFaultData">
|
||||||
INSERT INTO `couplet-cloud`.`couplet_trouble_code`
|
INSERT INTO `couplet-cloud`.`couplet_trouble_code`
|
||||||
(`trouble_vin`, `trouble_tag`,
|
(`trouble_code`,`trouble_vin`,`trouble_position`,`trouble_start_time`)
|
||||||
`trouble_start_time`)
|
|
||||||
VALUES
|
VALUES
|
||||||
(#{troubleVin}, #{troubleTag}, #{troubleStartTime})
|
(#{troubleCode},#{troubleVin}, #{troublePosition},#{troubleStartTime})
|
||||||
</insert>
|
</insert>
|
||||||
<update id="cleanTroubleCode">
|
<update id="cleanTroubleCode">
|
||||||
|
truncate table couplet_trouble_code
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectTroubleList" parameterType="com.couplet.business.server.mapper.SysTroubleMapper" resultMap="SysTroubleResult">
|
<select id="selectTroubleList" parameterType="com.couplet.business.server.mapper.SysTroubleMapper" resultMap="SysTroubleResult">
|
||||||
|
|
Loading…
Reference in New Issue