You've already forked FrameTour-BE
feat(kafka): 新增ZT-Source Kafka消息处理功能
- 新增ZTSourceMessage实体类用于接收Kafka消息 - 新增ZTSourceConsumerService监听zt-source主题 - 新增ZTSourceDataService处理消息并保存至数据库- 扩展SourceMapper支持从ZT-Source消息新增素材 - 实现照片类型素材的解析、校验与存储逻辑 - 添加Kafka手动ACK确认机制确保消息可靠处理
This commit is contained in:
62
src/main/java/com/ycwl/basic/dto/ZTSourceMessage.java
Normal file
62
src/main/java/com/ycwl/basic/dto/ZTSourceMessage.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.ycwl.basic.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* ZT-Source Kafka消息实体
|
||||
* 用于接收素材数据(照片和视频片段)
|
||||
*
|
||||
* @author system
|
||||
* @date 2024/12/27
|
||||
*/
|
||||
@Data
|
||||
public class ZTSourceMessage {
|
||||
@JsonProperty("sourceId")
|
||||
private Long sourceId;
|
||||
|
||||
@JsonProperty("sourceType")
|
||||
private Integer sourceType;
|
||||
|
||||
@JsonProperty("scenicId")
|
||||
private Long scenicId;
|
||||
|
||||
@JsonProperty("deviceId")
|
||||
private Long deviceId;
|
||||
|
||||
@JsonProperty("shootTime")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date shootTime;
|
||||
|
||||
@JsonProperty("thumbnailUrl")
|
||||
private String thumbnailUrl;
|
||||
|
||||
@JsonProperty("sourceUrl")
|
||||
private String sourceUrl;
|
||||
|
||||
@JsonProperty("resolution")
|
||||
private String resolution;
|
||||
|
||||
@JsonProperty("faceSampleId")
|
||||
private Long faceSampleId;
|
||||
|
||||
/**
|
||||
* 判断是否为视频片段
|
||||
*/
|
||||
public boolean isVideo() {
|
||||
return sourceType != null && sourceType == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为照片
|
||||
*/
|
||||
public boolean isPhoto() {
|
||||
return sourceType != null && sourceType == 2;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user