diff --git a/src/main/java/com/ycwl/basic/model/pc/source/entity/SourceEntity.java b/src/main/java/com/ycwl/basic/model/pc/source/entity/SourceEntity.java index 8697bad5..40b4271f 100644 --- a/src/main/java/com/ycwl/basic/model/pc/source/entity/SourceEntity.java +++ b/src/main/java/com/ycwl/basic/model/pc/source/entity/SourceEntity.java @@ -41,6 +41,10 @@ public class SourceEntity { * 视频文件存储地址 */ private String videoUrl; + /** + * 缩略图存储地址 + */ + private String thumbUrl; /** * 是否被购买 0未购买 1已购买 */ diff --git a/src/main/java/com/ycwl/basic/service/ZTSourceDataService.java b/src/main/java/com/ycwl/basic/service/ZTSourceDataService.java index 38ac0b4d..c7143b7a 100644 --- a/src/main/java/com/ycwl/basic/service/ZTSourceDataService.java +++ b/src/main/java/com/ycwl/basic/service/ZTSourceDataService.java @@ -56,6 +56,7 @@ public class ZTSourceDataService { DeviceConfigManager configManager = deviceRepository.getDeviceConfigManager(sourceEntity.getDeviceId()); if (configManager != null) { if (Strings.isNotBlank(configManager.getString("crop_config"))) { + // 如果有裁剪配置,主URL使用缩略图,同时保持缩略图字段 sourceEntity.setUrl(message.getThumbnailUrl()); } } @@ -114,6 +115,7 @@ public class ZTSourceDataService { entity.setScenicId(message.getScenicId()); entity.setDeviceId(message.getDeviceId()); entity.setUrl(message.getSourceUrl()); // 使用sourceUrl,不使用缩略图 + entity.setThumbUrl(message.getThumbnailUrl()); // 设置缩略图URL entity.setType(2); // 照片类型 // 人脸样本ID处理 diff --git a/src/main/resources/mapper/SourceMapper.xml b/src/main/resources/mapper/SourceMapper.xml index e61f9b57..0cdf3ddb 100644 --- a/src/main/resources/mapper/SourceMapper.xml +++ b/src/main/resources/mapper/SourceMapper.xml @@ -2,12 +2,12 @@ - insert into source(id, scenic_id, device_id, url, video_url, `type`, face_sample_id, pos_json, create_time) - values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{videoUrl}, #{type}, #{faceSampleId}, #{posJson}, #{createTime}) + insert into source(id, scenic_id, device_id, url, video_url, thumb_url, `type`, face_sample_id, pos_json, create_time) + values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{videoUrl}, #{thumbUrl}, #{type}, #{faceSampleId}, #{posJson}, #{createTime}) - insert into source(id, scenic_id, device_id, url, `type`, face_sample_id, pos_json, create_time) - values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{type}, #{faceSampleId}, #{posJson}, #{createTime}) + insert into source(id, scenic_id, device_id, url, thumb_url, `type`, face_sample_id, pos_json, create_time) + values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{thumbUrl}, #{type}, #{faceSampleId}, #{posJson}, #{createTime}) replace member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id, is_free) @@ -130,6 +130,7 @@ device_id = #{deviceId}, url = #{url}, video_url = #{videoUrl}, + thumb_url = #{thumbUrl}, is_buy = #{isBuy}, `type` = #{type}, face_sample_id = #{faceSampleId}, @@ -180,7 +181,6 @@ and so.scenic_id = #{scenicId} and device_id = #{deviceId} - and url = #{url} and is_buy = #{isBuy}