判断异常
parent
371c80d110
commit
71f1bc84e2
|
@ -3,12 +3,15 @@ package com.couplet.common.domain;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.couplet.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
|
@ -37,6 +40,12 @@ public class CoupletTroubleCode {
|
|||
@NotEmpty(message = "故障码不能为空")
|
||||
private String troubleCode;
|
||||
|
||||
/**
|
||||
* vin
|
||||
*/
|
||||
@Excel(name = "vin")
|
||||
private String troubleVin;
|
||||
|
||||
/**
|
||||
* 故障位
|
||||
*/
|
||||
|
@ -60,12 +69,19 @@ public class CoupletTroubleCode {
|
|||
*/
|
||||
@Excel(name = "故障类型Id")
|
||||
@NotEmpty(message = "故障类型Id不能为空")
|
||||
private Integer typeId;
|
||||
private String troubleType;
|
||||
|
||||
/**
|
||||
* 故障等级Id
|
||||
* 故障开始时间
|
||||
*/
|
||||
@Excel(name = "故障等级Id")
|
||||
@NotEmpty(message = "故障等级Id不能为空")
|
||||
private Integer gradeId;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date troubleStartTime;
|
||||
|
||||
/**
|
||||
* 故障结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date troubleEndTime;
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package com.couplet.common.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
* @version 1.0
|
||||
* @date 2024/3/26 21:50
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class CoupletTroubleType {
|
||||
private Integer typeId;
|
||||
private String typeName;
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.couplet.common.system.remote;
|
|||
|
||||
import com.couplet.common.core.constant.ServiceNameConstants;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.domain.CoupletTroubleCode;
|
||||
import com.couplet.common.domain.CoupletTroubleLog;
|
||||
import com.couplet.common.system.remote.factory.RemoteCodeFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
@ -18,5 +19,5 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
public interface RemoteCodeService {
|
||||
|
||||
@PostMapping("trouble/insertCode")
|
||||
public Result<Integer> insertCode(@RequestBody CoupletTroubleLog coupletTroubleLog);
|
||||
public Result<Integer> insertCode(@RequestBody CoupletTroubleCode coupletTroubleCode);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.couplet.common.system.remote.factory;
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.domain.CoupletTroubleCode;
|
||||
import com.couplet.common.domain.CoupletTroubleLog;
|
||||
import com.couplet.common.system.remote.RemoteCodeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -24,7 +25,7 @@ public class RemoteCodeFallbackFactory implements FallbackFactory<RemoteCodeServ
|
|||
return new RemoteCodeService()
|
||||
{
|
||||
@Override
|
||||
public Result<Integer> insertCode(CoupletTroubleLog coupletTroubleLog) {
|
||||
public Result<Integer> insertCode(CoupletTroubleCode coupletTroubleCode) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
@Log4j2
|
||||
@Component
|
||||
@RabbitListener(queues = "vinQueue")
|
||||
//@RabbitListener(queues = "vinQueue")
|
||||
public class MsgConsumer {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -5,6 +5,9 @@ import com.couplet.analyze.msg.service.IncidentService;
|
|||
import com.couplet.common.core.exception.analyze.AnalyzeException;
|
||||
import com.couplet.common.core.utils.SpringUtils;
|
||||
import com.couplet.common.core.utils.uuid.IdUtils;
|
||||
import com.couplet.common.domain.CoupletTroubleCode;
|
||||
import com.couplet.common.domain.CoupletTroubleLog;
|
||||
import com.couplet.common.system.remote.RemoteCodeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
|
@ -15,10 +18,8 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -48,6 +49,9 @@ public class ModelMessage {
|
|||
}
|
||||
};
|
||||
|
||||
@Autowired
|
||||
private RemoteCodeService remoteCodeService;
|
||||
|
||||
// @Value("${mq.queueName}")
|
||||
// public String queueName;
|
||||
//
|
||||
|
@ -84,11 +88,33 @@ public class ModelMessage {
|
|||
|
||||
for (CoupletMsgData msgData : coupletMsgDataList) {
|
||||
log.info("解析到车辆数据:{}", msgData);
|
||||
//发送消息到MQ
|
||||
// rabbitTemplate.convertAndSend("send-couplet-code",msgData,message -> {
|
||||
// message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||
// return message;
|
||||
// });
|
||||
// 使用CompletableFuture.runAsync()方法创建一个异步任务,该任务会在一个新的线程中执行
|
||||
CompletableFuture.runAsync(() ->{
|
||||
// 创建一个CoupletTroubleLog对象用于记录故障日志
|
||||
CoupletTroubleCode troubleCode = new CoupletTroubleCode();
|
||||
//判断状态是否为异常
|
||||
if (msgData.getVehicleStatus() !=1 || msgData.getEasStatus() !=1 || msgData.getHeatingStatus() !=1){
|
||||
String code = generateGTA();
|
||||
troubleCode.setTroubleCode(code);
|
||||
String vin = msgData.getVin();
|
||||
troubleCode.setTroubleVin(vin);
|
||||
String position = getPosition();
|
||||
troubleCode.setTroublePosition(position);
|
||||
troubleCode.setTroubleValue("00");
|
||||
String tag = getTag();
|
||||
troubleCode.setTroubleTag(tag);
|
||||
String type = getType();
|
||||
troubleCode.setTroubleType(type);
|
||||
troubleCode.setTroubleStartTime(new Date());
|
||||
// 如果车辆状态为正常(状态为1),则添加结束时间为当前时间
|
||||
if (msgData.getVehicleStatus() == 1){
|
||||
troubleCode.setTroubleEndTime(new Date());
|
||||
}
|
||||
}
|
||||
// 调用远程服务插入故障日志信息
|
||||
remoteCodeService.insertCode(troubleCode);
|
||||
});
|
||||
log.info("记录异常成功");
|
||||
for (String string : strings) {
|
||||
IncidentService incidentService = SpringUtils.getBean(string);
|
||||
incidentService.incident(msgData);
|
||||
|
@ -115,6 +141,78 @@ public class ModelMessage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 拼接GTA字符串
|
||||
* @return
|
||||
*/
|
||||
public static String generateGTA() {
|
||||
// 生成以GTA开头的字符串
|
||||
String codefix = "GTA";
|
||||
// 删除4位数随机数字
|
||||
String s = generateRandomNumber(4);
|
||||
//拼接
|
||||
return codefix + s;
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机生成1到10位的数字
|
||||
* @param length
|
||||
* @return
|
||||
*/
|
||||
public static String generateRandomNumber(int length) {
|
||||
Random random = new Random();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
builder.append(random.nextInt(10));
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 190 到 209 之间的随机数
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPosition() {
|
||||
// 生成随机数对象
|
||||
Random rand = new Random();
|
||||
|
||||
// 生成 190 到 209 之间的随机数
|
||||
int randomNumber = rand.nextInt(20) + 190;
|
||||
|
||||
// 将随机数转换为字符串形式
|
||||
return String.valueOf(randomNumber);
|
||||
}
|
||||
|
||||
public static String getTag() {
|
||||
// 创建一个字符串数组存储三个状态
|
||||
String[] statuses = {"车辆状态", "EAS(汽车防盗系统)状态", "DCDC(电力交换系统)"};
|
||||
|
||||
// 生成随机数对象
|
||||
Random rand = new Random();
|
||||
|
||||
// 生成一个范围在 0 到 2 之间的随机整数
|
||||
int randomIndex = rand.nextInt(3);
|
||||
|
||||
return statuses[randomIndex];
|
||||
}
|
||||
|
||||
public static String getType() {
|
||||
// 创建一个字符串数组存储三个状态
|
||||
String[] statuses = {"电池故障", "车体故障", "车尾故障","抽轮故障"};
|
||||
|
||||
// 生成随机数对象
|
||||
Random rand = new Random();
|
||||
|
||||
// 生成一个范围在 0 到 2 之间的随机整数
|
||||
int randomIndex = rand.nextInt(4);
|
||||
|
||||
return statuses[randomIndex];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将16进制字符串转换为ASCII字符串
|
||||
* @param s 16进制字符串
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.couplet.msg;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -11,18 +12,17 @@ import java.util.regex.Pattern;
|
|||
*/
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
String msgString = "VIN123456789DIJE41711764104506116.664380039.531990072.00031.3760000022000022000852000000D00809.600940000589066790930000203002030000044282.55000014000080700007440003000400095000058000054000011111111111111111";
|
||||
// 创建一个字符串数组存储三个状态
|
||||
String[] statuses = {"电池故障", "车体故障", "车尾故障","抽轮故障"};
|
||||
|
||||
//使用正则表达式匹配需要的部分
|
||||
String pattern = "(.{17})(.{10})(.{4})(.{2})(.{2})";
|
||||
Pattern compile = Pattern.compile(pattern);
|
||||
Matcher matcher = compile.matcher(msgString);
|
||||
// 生成随机数对象
|
||||
Random rand = new Random();
|
||||
|
||||
if (matcher.find()) {
|
||||
for (int i = 1; i <= matcher.groupCount(); i++) {
|
||||
System.out.println("Group "+ i + ":" + matcher.group(i));
|
||||
}
|
||||
}
|
||||
// 生成一个范围在 0 到 2 之间的随机整数
|
||||
int randomIndex = rand.nextInt(4);
|
||||
|
||||
// 随机选择一个字符串并输出
|
||||
String randomStatus = statuses[randomIndex];
|
||||
System.out.println("随机输出的字符串:" + randomStatus);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
//package com.couplet.business.server.consumer;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
//import com.couplet.common.domain.CoupletTroubleLog;
|
||||
//import com.couplet.common.system.remote.RemoteCodeService;
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.data.redis.core.RedisTemplate;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.Date;
|
||||
//import java.util.Random;
|
||||
//import java.util.concurrent.CompletableFuture;
|
||||
//
|
||||
///**
|
||||
// * @author DongXiaoDong
|
||||
// * @version 1.0
|
||||
// * @date 2024/3/14 22:09
|
||||
// * @description
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class SendCodeQueueConsumer {
|
||||
// @Autowired
|
||||
// private RedisTemplate<String, String> redisTemplate;
|
||||
//
|
||||
// @Autowired
|
||||
// private RemoteCodeService remoteCodeService;
|
||||
//
|
||||
// @RabbitListener(queuesToDeclare = {@Queue("send-couplet-code")})
|
||||
// public void sendLogQueueConsumer(Message message, CoupletMsgData msgData, Channel channel) {
|
||||
// log.info("日志队列:{},接收到的消息:{},开始消费...","send-couplet-code", JSONObject.toJSONString(msgData));
|
||||
// long start = System.currentTimeMillis();
|
||||
//
|
||||
// String messageId = message.getMessageProperties().getMessageId();
|
||||
//
|
||||
// try {
|
||||
// Long aLong = redisTemplate.opsForSet().add("send-log-queue", messageId);
|
||||
// if (aLong==1) {
|
||||
// //异步保存日志
|
||||
// CompletableFuture.runAsync(() -> {
|
||||
// CoupletTroubleLog coupletTroubleLog = new CoupletTroubleLog();
|
||||
// //判断状态是否为异常
|
||||
// if (msgData.getVehicleStatus() !=1){
|
||||
// String code = generateGTA();
|
||||
// coupletTroubleLog.setTroubleLogCode(code);
|
||||
// coupletTroubleLog.setTroubleLogStart(new Date());
|
||||
// String vin = msgData.getVin();
|
||||
// coupletTroubleLog.setTroubleLogVin(vin);
|
||||
// // 如果状态为正常1时添加结束时间
|
||||
// if (msgData.getVehicleStatus() == 1){
|
||||
// coupletTroubleLog.setTroubleLogEnd(new Date());
|
||||
// }
|
||||
// }
|
||||
// remoteCodeService.insertCode(coupletTroubleLog);
|
||||
// });
|
||||
// log.info("记录异常成功");
|
||||
// }
|
||||
// long end = System.currentTimeMillis();
|
||||
// log.info("日志队列:{},接收到的消息:{},消费完成,耗时:{}毫秒","send-log-queue", JSONObject.toJSONString(msgData), (end-start));
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// *
|
||||
// * 拼接GTA字符串
|
||||
// * @return
|
||||
// */
|
||||
// public static String generateGTA() {
|
||||
// // 生成以GTA开头的字符串
|
||||
// String codefix = "GTA";
|
||||
// // 删除4位数随机数字
|
||||
// String s = generateRandomNumber(4);
|
||||
// //拼接
|
||||
// return codefix + s;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 随机生成1到10位的数字
|
||||
// * @param length
|
||||
// * @return
|
||||
// */
|
||||
// public static String generateRandomNumber(int length) {
|
||||
// Random random = new Random();
|
||||
// StringBuilder builder = new StringBuilder();
|
||||
// for (int i = 0; i < length; i++) {
|
||||
// builder.append(random.nextInt(10));
|
||||
// }
|
||||
// return builder.toString();
|
||||
// }
|
||||
//}
|
|
@ -7,7 +7,6 @@ import com.couplet.common.core.web.controller.BaseController;
|
|||
import com.couplet.common.domain.CoupletTroubleCode;
|
||||
import com.couplet.common.domain.CoupletTroubleGrade;
|
||||
import com.couplet.common.domain.CoupletTroubleLog;
|
||||
import com.couplet.common.domain.CoupletTroubleType;
|
||||
import com.couplet.common.domain.request.TroubleResp;
|
||||
import com.couplet.common.log.annotation.Log;
|
||||
import com.couplet.common.log.enums.BusinessType;
|
||||
|
@ -40,14 +39,6 @@ public class SysTroubleController extends BaseController {
|
|||
return Result.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障类型信息
|
||||
*/
|
||||
@GetMapping("/troubleTypeList")
|
||||
public List<CoupletTroubleType> listType() {
|
||||
return troubleService.selectTroubleListByType();
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障等级信息
|
||||
*/
|
||||
|
@ -84,10 +75,15 @@ public class SysTroubleController extends BaseController {
|
|||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障数据入库
|
||||
* @param coupletTroubleLog
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("insertCode")
|
||||
public Result<Integer> insertCode(@RequestBody CoupletTroubleLog coupletTroubleLog){
|
||||
public Result<Integer> insertCode(@RequestBody CoupletTroubleCode coupletTroubleCode){
|
||||
long start = System.currentTimeMillis();
|
||||
int i = troubleService.insertMsgResq(coupletTroubleLog);
|
||||
int i = troubleService.insertMsgResq(coupletTroubleCode);
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
log.info("记录异常信息成功,耗时:{}",(end-start));
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package com.couplet.business.server.controller;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
* @version 1.0
|
||||
* @date 2024/4/4 10:37
|
||||
* @description
|
||||
*/
|
||||
public class TroubleLogController {
|
||||
}
|
|
@ -5,7 +5,6 @@ import com.couplet.analyze.msg.domain.CoupletMsgData;
|
|||
import com.couplet.common.domain.CoupletTroubleCode;
|
||||
import com.couplet.common.domain.CoupletTroubleGrade;
|
||||
import com.couplet.common.domain.CoupletTroubleLog;
|
||||
import com.couplet.common.domain.CoupletTroubleType;
|
||||
import com.couplet.common.domain.request.TroubleResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
@ -21,11 +20,7 @@ import java.util.List;
|
|||
public interface SysTroubleMapper extends BaseMapper<CoupletTroubleCode> {
|
||||
List<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq);
|
||||
|
||||
List<CoupletTroubleType> selectTroubleListByType();
|
||||
|
||||
List<CoupletTroubleGrade> selectTroubleListByGrade();
|
||||
|
||||
List<CoupletMsgData> selectTroubleListByMsg();
|
||||
|
||||
int insertMsgResq(CoupletTroubleLog coupletTroubleLog);
|
||||
int insertMsgResq(CoupletTroubleCode coupletTroubleCode);
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package com.couplet.business.server.mapper;
|
||||
|
||||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
* @version 1.0
|
||||
* @date 2024/4/4 10:38
|
||||
* @description
|
||||
*/
|
||||
@Mapper
|
||||
public interface TroubleLogMapper {
|
||||
|
||||
}
|
|
@ -6,7 +6,6 @@ import com.couplet.common.core.domain.PageResult;
|
|||
import com.couplet.common.domain.CoupletTroubleCode;
|
||||
import com.couplet.common.domain.CoupletTroubleGrade;
|
||||
import com.couplet.common.domain.CoupletTroubleLog;
|
||||
import com.couplet.common.domain.CoupletTroubleType;
|
||||
import com.couplet.common.domain.request.TroubleResp;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
|
@ -22,11 +21,7 @@ import java.util.List;
|
|||
public interface SysTroubleService extends IService<CoupletTroubleCode> {
|
||||
PageResult<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq);
|
||||
|
||||
List<CoupletTroubleType> selectTroubleListByType();
|
||||
|
||||
List<CoupletTroubleGrade> selectTroubleListByGrade();
|
||||
|
||||
List<CoupletMsgData> selectTroubleListByMsg();
|
||||
|
||||
int insertMsgResq(CoupletTroubleLog coupletTroubleLog);
|
||||
int insertMsgResq(CoupletTroubleCode coupletTroubleCode);
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package com.couplet.business.server.service;
|
||||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
* @version 1.0
|
||||
* @date 2024/4/4 10:38
|
||||
* @description
|
||||
*/
|
||||
public interface TroubleLogService {
|
||||
|
||||
}
|
|
@ -8,7 +8,6 @@ import com.couplet.common.core.domain.PageResult;
|
|||
import com.couplet.common.domain.CoupletTroubleCode;
|
||||
import com.couplet.common.domain.CoupletTroubleGrade;
|
||||
import com.couplet.common.domain.CoupletTroubleLog;
|
||||
import com.couplet.common.domain.CoupletTroubleType;
|
||||
import com.couplet.common.domain.request.TroubleResp;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
@ -44,33 +43,18 @@ public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, Couplet
|
|||
return PageResult.toPageResult(info.getTotal(),troubleList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CoupletTroubleType> selectTroubleListByType() {
|
||||
return sysTroubleMapper.selectTroubleListByType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CoupletTroubleGrade> selectTroubleListByGrade() {
|
||||
return sysTroubleMapper.selectTroubleListByGrade();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报文信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CoupletMsgData> selectTroubleListByMsg() {
|
||||
return sysTroubleMapper.selectTroubleListByMsg();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加异常信息
|
||||
* @param coupletTroubleLog
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int insertMsgResq(CoupletTroubleLog coupletTroubleLog) {
|
||||
return sysTroubleMapper.insertMsgResq(coupletTroubleLog);
|
||||
public int insertMsgResq(CoupletTroubleCode coupletTroubleCode) {
|
||||
return sysTroubleMapper.insertMsgResq(coupletTroubleCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package com.couplet.business.server.service.impl;
|
||||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.business.server.mapper.TroubleLogMapper;
|
||||
import com.couplet.business.server.service.TroubleLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
* @version 1.0
|
||||
* @date 2024/4/4 10:38
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class TroubleLogServiceImpl implements TroubleLogService {
|
||||
@Autowired
|
||||
private TroubleLogMapper troubleLogMapper;
|
||||
|
||||
|
||||
}
|
|
@ -7,23 +7,18 @@
|
|||
<resultMap type="com.couplet.common.domain.CoupletTroubleCode" id="SysTroubleResult">
|
||||
<id property="troubleId" column="trouble_id"/>
|
||||
<result property="troubleCode" column="trouble_code"/>
|
||||
<result property="troubleVin" column="trouble_vin"/>
|
||||
<result property="troubleValue" column="trouble_value"/>
|
||||
<result property="troublePosition" column="trouble_position"/>
|
||||
<result property="troubleTag" column="trouble_tag"/>
|
||||
<result property="typeId" column="type_id"/>
|
||||
<result property="gradeId" column="grade_id"/>
|
||||
<result property="troubleType" column="trouble_type"/>
|
||||
<result property="troubleStartTime" column="trouble_start_time"/>
|
||||
<result property="troubleEndTime" column="trouble_end_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTroubleVo">
|
||||
select t.*,g.grade_name,y.type_name from couplet_trouble_code t
|
||||
LEFT JOIN couplet_trouble_grade g on t.grade_id = g.grade_id
|
||||
LEFT JOIN couplet_trouble_type y on t.type_id= y.type_id
|
||||
select * from couplet_trouble_code
|
||||
</sql>
|
||||
<insert id="insertMsgResq">
|
||||
insert into couplet_trouble_log(trouble_log_code,trouble_log_vin,trouble_log_start,trouble_log_end)
|
||||
values(#{troubleLogCode},#{troubleLogVin},#{troubleLogStart},#{troubleLogEnd})
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectTroubleList" parameterType="com.couplet.business.server.mapper.SysTroubleMapper" resultMap="SysTroubleResult">
|
||||
<include refid="selectTroubleVo"/>
|
||||
|
@ -36,15 +31,17 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectTroubleListByType" resultType="com.couplet.common.domain.CoupletTroubleType">
|
||||
select * from couplet_trouble_type
|
||||
</select>
|
||||
<select id="selectTroubleListByGrade" resultType="com.couplet.common.domain.CoupletTroubleGrade">
|
||||
select * from couplet_trouble_grade
|
||||
</select>
|
||||
<select id="selectTroubleListByMsg" resultType="com.couplet.analyze.msg.domain.CoupletMsgData">
|
||||
select * from couplet_msg_data
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertMsgResq">
|
||||
insert into couplet_trouble_code(
|
||||
trouble_code,
|
||||
trouble_vin,
|
||||
trouble_position,trouble_value,trouble_tag,trouble_type,trouble_start_time,trouble_end_time)
|
||||
values(#{troubleCode},#{troubleVin},#{troublePosition},#{troubleValue},#{troubleTag},#{troubleType},#{troubleStartTime},#{troubleEndTime})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.couplet.business.server.mapper.TroubleLogMapper">
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue