报文模块处理、接口定义:工单看板、主页看板,kafka主题修改(预留多品牌协议)
This commit is contained in:
parent
802bf6dcde
commit
4ad52b73c5
@ -112,10 +112,14 @@ public class MqttHandler extends ChannelInboundHandlerAdapter {
|
||||
private void processReceivedMessage(String topic, String content) {
|
||||
try {
|
||||
KafkaProducer kafkaProducer = SpringContextHolder.getBean(KafkaProducer.class);
|
||||
if (topic.contains("cdzybms")){
|
||||
if (topic.contains("rsp")) {
|
||||
kafkaProducer.send("msg_rsp",content);
|
||||
//乐摇摇响应
|
||||
kafkaProducer.send("msg_lyy_rsp",content);
|
||||
} else if (topic.contains("rpt")) {
|
||||
kafkaProducer.send("msg_rpt",content);
|
||||
//乐摇摇上报
|
||||
kafkaProducer.send("msg_lyy_rpt",content);
|
||||
}
|
||||
}
|
||||
log.info("处理MQTT消息 - 主题: {}, 内容: {}", topic, content);
|
||||
if (topic.startsWith("sensor/")) {
|
||||
|
||||
@ -28,7 +28,7 @@ public class KafkaConsumer {
|
||||
*
|
||||
* @param record 消息
|
||||
*/
|
||||
@KafkaListener(topics = {"msg_rsp"})
|
||||
@KafkaListener(topics = {"msg_lyy_rsp"})
|
||||
public void onMessage(ConsumerRecord<?, ?> record) throws JsonProcessingException {
|
||||
log.info("[KAFKA接收] 主题: {}, 内容: {}", record.topic(), record.value());
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@ -5,10 +5,7 @@ import com.cdzy.common.enums.Message;
|
||||
import com.cdzy.common.model.request.PageParam;
|
||||
import com.cdzy.common.model.response.JsonResult;
|
||||
import com.cdzy.operations.enums.BikeOrderHandleState;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBikeListDto;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderPageDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBikeInfoDto;
|
||||
import com.cdzy.operations.model.dto.*;
|
||||
import com.cdzy.operations.model.entity.EbikeRegion;
|
||||
import com.cdzy.operations.model.vo.*;
|
||||
import com.cdzy.operations.service.EbikeBikeOrderService;
|
||||
@ -277,4 +274,16 @@ public class EbikeBikeOrderController {
|
||||
EbikeOrderBikeInfoDto info = ebikeBikeOrderService.bikeInfo(bikeCode,orderType);
|
||||
return JsonResult.success(info);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工单看板
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
@GetMapping("bulletinBoard")
|
||||
public JsonResult<?> bulletinBoard() {
|
||||
EbikeOrderBulletinBoardInfo info = ebikeBikeOrderService.bulletinBoard();
|
||||
return JsonResult.success(info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.cdzy.operations.controller;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 中控基本信息 控制层。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-09-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/home")
|
||||
@Validated
|
||||
public class EbikeHomeInfoController {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
package com.cdzy.operations.model.dto;
|
||||
|
||||
import com.cdzy.operations.handler.PGpointDeserializer;
|
||||
import com.cdzy.operations.handler.PGpointSerializer;
|
||||
import com.cdzy.operations.handler.PGpointTypeHandler;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 主页详情。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EbikeHomeInfo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 车辆详情ID
|
||||
*/
|
||||
private Long bikeInfoId;
|
||||
|
||||
/**
|
||||
* 运营商ID
|
||||
*/
|
||||
private Long operatorId;
|
||||
|
||||
/**
|
||||
* 运营区ID
|
||||
*/
|
||||
private Long regionId;
|
||||
|
||||
/**
|
||||
* 运营区名称
|
||||
*/
|
||||
private String regionName;
|
||||
|
||||
/**
|
||||
* 车辆编号(与车辆二维码编号相同
|
||||
*/
|
||||
private String bikeCode;
|
||||
|
||||
/**
|
||||
* 电池ID
|
||||
*/
|
||||
private Long batteryId;
|
||||
|
||||
/**
|
||||
* 中控ID
|
||||
*/
|
||||
private Long ecuId;
|
||||
|
||||
/**
|
||||
* 头盔ID
|
||||
*/
|
||||
private Long helmetId;
|
||||
|
||||
/**
|
||||
* 定位
|
||||
*/
|
||||
@Column(typeHandler = PGpointTypeHandler.class)
|
||||
@JsonSerialize(using = PGpointSerializer.class)
|
||||
@JsonDeserialize(using = PGpointDeserializer.class)
|
||||
private PGpoint location;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 车辆使用状态
|
||||
*/
|
||||
private Integer usageStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createdBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Column(onUpdateValue = "now()")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updatedBy;
|
||||
|
||||
/**
|
||||
* 删除与否
|
||||
*/
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 是否包含头盔
|
||||
*/
|
||||
private Boolean hasHelme;
|
||||
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.cdzy.operations.model.dto;
|
||||
|
||||
import com.cdzy.operations.handler.PGpointDeserializer;
|
||||
import com.cdzy.operations.handler.PGpointSerializer;
|
||||
import com.cdzy.operations.handler.PGpointTypeHandler;
|
||||
import com.cdzy.operations.model.entity.EbikeOrderPart;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.RelationOneToMany;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工单看板详情
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-11-24
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EbikeOrderBulletinBoardInfo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 工单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
private Integer orderType;
|
||||
|
||||
/**
|
||||
* 车辆编号
|
||||
*/
|
||||
private String bikeCode;
|
||||
|
||||
/**
|
||||
* 定位
|
||||
*/
|
||||
@Column(typeHandler = PGpointTypeHandler.class)
|
||||
@JsonSerialize(using = PGpointSerializer.class)
|
||||
@JsonDeserialize(using = PGpointDeserializer.class)
|
||||
private PGpoint location;
|
||||
|
||||
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 故障内容
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* SN
|
||||
*/
|
||||
private String ecuSn;
|
||||
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private Integer soc;
|
||||
|
||||
/**
|
||||
* 故障部位
|
||||
*/
|
||||
@RelationOneToMany(selfField = "orderId", targetField = "orderId")
|
||||
private List<EbikeOrderPart> parts;
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.cdzy.operations.service;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBikeListDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBikeInfoDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBulletinBoardInfo;
|
||||
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
||||
import com.cdzy.operations.model.entity.EbikeRegion;
|
||||
import com.cdzy.operations.model.vo.*;
|
||||
@ -127,4 +128,9 @@ public interface EbikeBikeOrderService extends IService<EbikeBikeOrder> {
|
||||
* @param faultOrderVo 信息
|
||||
*/
|
||||
void doFault(DoneFaultOrderVo faultOrderVo);
|
||||
|
||||
/**
|
||||
* 工单看板
|
||||
*/
|
||||
EbikeOrderBulletinBoardInfo bulletinBoard();
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.cdzy.operations.mapper.*;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBikeInfoDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBikeListDto;
|
||||
import com.cdzy.operations.model.dto.EbikeOrderBulletinBoardInfo;
|
||||
import com.cdzy.operations.model.entity.*;
|
||||
import com.cdzy.operations.model.vo.*;
|
||||
import com.cdzy.operations.service.EbikeBikeOrderService;
|
||||
@ -620,6 +621,11 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EbikeOrderBulletinBoardInfo bulletinBoard() {
|
||||
return null;
|
||||
}
|
||||
|
||||
EbikeBikeInfo checkBikeCode(String bikeCode) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode))
|
||||
|
||||
@ -35,10 +35,10 @@ public class KafkaConsumer {
|
||||
*
|
||||
* @param record 消息
|
||||
*/
|
||||
@KafkaListener(topics = {"msg_rpt"})
|
||||
@KafkaListener(topics = {"msg_lyy_rpt"})
|
||||
public void onMessage(ConsumerRecord<?, ?> record) throws JsonProcessingException {
|
||||
log.info("[KAFKA接收] 主题: {}, 内容: {}", record.topic(), record.value());
|
||||
JsonNode jsonNode = mapper.readValue(record.value().toString(), JsonNode.class);
|
||||
reoprtHandler.reportHandler(jsonNode);
|
||||
reoprtHandler.reportHandler(jsonNode,record.topic());
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,10 +36,11 @@ public class ReoprtHandler {
|
||||
/**
|
||||
* 报文处理
|
||||
*/
|
||||
public void reportHandler(JsonNode response) {
|
||||
public void reportHandler(JsonNode response,String topic) {
|
||||
int c = response.get("c").asInt();
|
||||
JsonNode param = response.get("param");
|
||||
String deviceId = param.get("SN").asText();
|
||||
String[] parts = topic.split("/");
|
||||
String deviceId = parts[parts.length - 1];
|
||||
switch (c) {
|
||||
case 56:
|
||||
gpsMsgHandler(param, deviceId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user