diff --git a/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleCode.java b/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleCode.java index dc36948..54ea5ff 100644 --- a/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleCode.java +++ b/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleCode.java @@ -46,30 +46,11 @@ public class CoupletTroubleCode { @Excel(name = "vin") private String troubleVin; - /** - * 故障位 - */ - @Excel(name = "故障位") - private String troublePosition; - - /** - * 故障值 - */ - @Excel(name = "故障值") - private String troubleValue; - /** * 故障标签 */ @Excel(name = "故障标签") - private String troubleTag; - - /** - * 故障类型Id - */ - @Excel(name = "故障类型Id") - @NotEmpty(message = "故障类型Id不能为空") - private String troubleType; + private Integer troubleTag; /** * 故障开始时间 diff --git a/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleLog.java b/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleFault.java similarity index 51% rename from couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleLog.java rename to couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleFault.java index 4fc3902..3a8f44a 100644 --- a/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleLog.java +++ b/couplet-common/couplet-common-business/src/main/java/com/couplet/common/domain/CoupletTroubleFault.java @@ -19,34 +19,34 @@ import java.util.Date; @Builder @AllArgsConstructor @NoArgsConstructor -public class CoupletTroubleLog { +public class CoupletTroubleFault { /** * 故障记录Id */ - private Integer troubleLogId; + private Integer troubleFaultId; /** * 故障码 */ - private String troubleLogCode; + private String troubleFaultCode; /** - * 故障码VIN + * 故障码类型 */ - private String troubleLogVin; + private String troubleFaultType; /** - * 开始预警时间 + * 故障标签 */ - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date troubleLogStart; + private String troubleFaultTag; /** - * 结束预警时间 + * 故障位 */ - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date troubleLogEnd; + private String troubleFaultPosition; + /** + * 故障值 + */ + private String troubleFaultValue; } diff --git a/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/RemoteCodeService.java b/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/RemoteCodeService.java index d897d69..79051a7 100644 --- a/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/RemoteCodeService.java +++ b/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/RemoteCodeService.java @@ -3,7 +3,6 @@ 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; import org.springframework.web.bind.annotation.PostMapping; diff --git a/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/factory/RemoteCodeFallbackFactory.java b/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/factory/RemoteCodeFallbackFactory.java index d6fd2b9..36a092d 100644 --- a/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/factory/RemoteCodeFallbackFactory.java +++ b/couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/remote/factory/RemoteCodeFallbackFactory.java @@ -2,11 +2,8 @@ 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; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java index f37130c..6d57e61 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java @@ -4,15 +4,12 @@ import com.couplet.analyze.msg.domain.CoupletMsgData; 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; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -20,12 +17,9 @@ import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.CompletableFuture; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import static com.couplet.analyze.msg.contents.MsgContent.BROKER_URL; import static com.couplet.analyze.msg.contents.MsgContent.CLIENT_ID; -import static io.lettuce.core.pubsub.PubSubOutput.Type.message; /** diff --git a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/controller/SysTroubleController.java b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/controller/SysTroubleController.java index 8220bed..a4a624a 100644 --- a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/controller/SysTroubleController.java +++ b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/controller/SysTroubleController.java @@ -6,7 +6,6 @@ import com.couplet.common.core.domain.Result; 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.request.TroubleResp; import com.couplet.common.log.annotation.Log; import com.couplet.common.log.enums.BusinessType; diff --git a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/mapper/SysTroubleMapper.java b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/mapper/SysTroubleMapper.java index 6986b8d..baa27f7 100644 --- a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/mapper/SysTroubleMapper.java +++ b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/mapper/SysTroubleMapper.java @@ -1,10 +1,8 @@ package com.couplet.business.server.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -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.request.TroubleResp; import org.apache.ibatis.annotations.Mapper; diff --git a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/SysTroubleService.java b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/SysTroubleService.java index 744ab5f..5333f87 100644 --- a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/SysTroubleService.java +++ b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/SysTroubleService.java @@ -1,13 +1,10 @@ package com.couplet.business.server.service; import com.baomidou.mybatisplus.extension.service.IService; -import com.couplet.analyze.msg.domain.CoupletMsgData; 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.request.TroubleResp; -import io.swagger.models.auth.In; import java.util.List; diff --git a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/impl/SysTroubleServiceImpl.java b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/impl/SysTroubleServiceImpl.java index efcfe7f..58edabe 100644 --- a/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/impl/SysTroubleServiceImpl.java +++ b/couplet-modules/couplet-business/src/main/java/com/couplet/business/server/service/impl/SysTroubleServiceImpl.java @@ -1,22 +1,18 @@ package com.couplet.business.server.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.couplet.analyze.msg.domain.CoupletMsgData; import com.couplet.business.server.mapper.SysTroubleMapper; import com.couplet.business.server.service.SysTroubleService; 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.request.TroubleResp; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Date; import java.util.List; -import java.util.Random; /** * @author DongXiaoDong diff --git a/couplet-modules/couplet-modules-mq/src/main/java/com/couplet/mq/controller/Aaa.java b/couplet-modules/couplet-modules-mq/src/main/java/com/couplet/mq/controller/Aaa.java new file mode 100644 index 0000000..fd523f6 --- /dev/null +++ b/couplet-modules/couplet-modules-mq/src/main/java/com/couplet/mq/controller/Aaa.java @@ -0,0 +1,54 @@ +package com.couplet.mq.controller; + +import org.apache.kafka.clients.consumer.ConsumerConfig; +import org.apache.kafka.clients.consumer.ConsumerRecords; +import org.apache.kafka.clients.consumer.KafkaConsumer; + +import java.time.Duration; +import java.util.Collections; +import java.util.Properties; + +/** + * @author DongXiaoDong + * @version 1.0 + * @date 2024/4/5 21:38 + * @description + */ +public class Aaa { + private static final String TOPIC_NAME = "online"; + private static final String BOOTSTRAP_SERVERS = "39.103.133.136:9092"; + + public static void main(String[] args) { + aaa(); + } + + private static void aaa() { + 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 consumer = new KafkaConsumer<>(props); + + try { + + //订阅主题 + consumer.subscribe(Collections.singletonList("online")); + + //持续消费消息 + while (true) { + ConsumerRecords records = consumer.poll(Duration.ofMillis(100)); + records.forEach(record -> { + System.out.println("消费者接受到的消息值:" + record.value()); + }); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + consumer.close(); + } + } + +}