Merge remote-tracking branch 'origin/server_five_dongxiaodong' into server_five
# Conflicts: # couplet-modules/couplet-business/src/main/resources/bootstrap.ymlserver_five_liuyunhu
commit
8803a91628
|
@ -46,12 +46,6 @@ public class CoupletTroubleCode {
|
||||||
@Excel(name = "vin")
|
@Excel(name = "vin")
|
||||||
private String troubleVin;
|
private String troubleVin;
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障标签
|
|
||||||
*/
|
|
||||||
@Excel(name = "故障标签")
|
|
||||||
private Integer troubleTag;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障开始时间
|
* 故障开始时间
|
||||||
*/
|
*/
|
||||||
|
@ -65,4 +59,10 @@ public class CoupletTroubleCode {
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date troubleEndTime;
|
private Date troubleEndTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障位置
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障位置")
|
||||||
|
private String troublePosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
public class CoupletMsgApplication {
|
public class CoupletMsgApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(CoupletMsgApplication.class);
|
SpringApplication.run(CoupletMsgApplication.class);
|
||||||
|
System.out.println("解析系统启动成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.couplet.analyze.msg.contents.StateConstant;
|
import com.couplet.analyze.msg.contents.StateConstant;
|
||||||
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.analyze.msg.utils.MsgUtils;
|
||||||
import com.couplet.common.domain.CoupletTroubleCode;
|
import com.couplet.common.domain.CoupletTroubleCode;
|
||||||
import com.couplet.remote.RemoteTroubleService;
|
import com.couplet.remote.RemoteTroubleService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -107,9 +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();
|
||||||
|
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;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DongXiaoDong
|
* @author DongXiaoDong
|
||||||
|
@ -18,6 +19,26 @@ import java.util.List;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MsgUtils {
|
public class MsgUtils {
|
||||||
|
|
||||||
|
public static String generateGTA() {
|
||||||
|
// 生成四位以"GTA"开头的字符串
|
||||||
|
String prefix = "GTA";
|
||||||
|
// 生成三位随机数字
|
||||||
|
String randomNumber = generateRandomNumber(4);
|
||||||
|
// 拼接字符串
|
||||||
|
return prefix + randomNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String generateRandomNumber(int length) {
|
||||||
|
// 生成随机数
|
||||||
|
Random random = new Random();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
// 生成0到9之间的随机数字,并转换为字符串
|
||||||
|
sb.append(random.nextInt(10));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将16进制字符串转换为ASCII字符串
|
* 将16进制字符串转换为ASCII字符串
|
||||||
* @param s 16进制字符串
|
* @param s 16进制字符串
|
||||||
|
|
|
@ -29,12 +29,4 @@ public interface SysTroubleMapper extends BaseMapper<CoupletTroubleCode> {
|
||||||
void newFaultData(CoupletTroubleCode code);
|
void newFaultData(CoupletTroubleCode code);
|
||||||
|
|
||||||
void cleanTroubleCode();
|
void cleanTroubleCode();
|
||||||
|
|
||||||
int insertMsgResq(CoupletTroubleCode coupletTroubleCode);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// int addTrouble(TroubleAddReq troubleAddReq);
|
|
||||||
|
|
||||||
// int updateTrouble(TroubleUpdReq troubleUpdReq);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,17 +14,17 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectTroubleVo">
|
<sql id="selectTroubleVo">
|
||||||
select * from couplet_trouble_code
|
select t.*,f.trouble_fault_type,f.trouble_fault_tag from couplet_trouble_code t
|
||||||
|
LEFT JOIN couplet_trouble_fault f on t.trouble_position = f.trouble_fault_position
|
||||||
</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