Compare commits

...

6 Commits

Author SHA1 Message Date
19ca91778f fix(pricing): 调整一口价优惠默认支持逻辑
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
- 修改默认情况下不支持一口价优惠
- 更新异常处理逻辑,异常时默认返回不支持
-修复日志描述与实际逻辑不符的问题
2025-10-20 11:18:18 +08:00
e5a58ae757 feat(source): 添加缩略图URL字段支持
- 在SourceController中移除了@Deprecated注解
- 在SourceMapper.xml的多个查询SQL中增加了thumb_url字段
- 更新了list、userGetById、getById、listUserOne和queryByRelation等方法的SELECT语句- 确保所有相关接口能够返回thumb_url数据
- 改动涉及视频源分页查询及相关详情获取逻辑
2025-10-20 10:40:08 +08:00
602eb84f9c feat(video): 添加缩略图URL设置功能
- 在视频片段获取器中新增缩略图URL字段
- 完善图片源信息的处理逻辑- 提高视频资源信息的完整性
2025-10-20 10:29:44 +08:00
8d24e7f9e5 feat(source): 添加缩略图URL字段并优化商品详情展示逻辑
- 在 SourceRespVO 中新增 thumbUrl 字段用于存储缩略图地址- 修改 GoodsServiceImpl 中的商品详情封面图设置逻辑,优先使用缩略图
- 更新 SourceMapper.xml 查询语句,增加 thumb_url 字段的查询支持
2025-10-20 10:20:12 +08:00
8eed685373 feat(source): 添加缩略图字段支持
- 在SourceEntity中新增thumbUrl字段用于存储缩略图地址- 在ZTSourceDataService中设置缩略图URL并优化裁剪配置逻辑
- 更新SourceMapper.xml中的SQL语句以支持缩略图字段的插入和更新
- 移除不必要的URL查询条件以提高查询灵活性
2025-10-20 10:05:22 +08:00
2b79302874 feat(printer): 引入唯一处理标识符避免文件冲突
- 添加 UUID 依赖以生成唯一标识符
-为打印任务生成唯一处理 ID,防止多线程文件名冲突
- 更新原图、水印图及旋转图片的文件命名逻辑
- 确保每个打印任务使用独立的临时文件名
2025-10-16 15:37:51 +08:00
9 changed files with 37 additions and 20 deletions

View File

@@ -22,7 +22,6 @@ public class SourceController {
@Autowired
private SourceService sourceService;
@Deprecated
// 分页查询视频源
@PostMapping("/page")
public ApiResponse pageQuery(@RequestBody SourceReqQuery sourceReqQuery) {

View File

@@ -41,6 +41,10 @@ public class SourceEntity {
* 视频文件存储地址
*/
private String videoUrl;
/**
* 缩略图存储地址
*/
private String thumbUrl;
/**
* 是否被购买 0未购买 1已购买
*/

View File

@@ -33,6 +33,7 @@ public class SourceRespVO {
private Long faceId;
// 原素材类型:1视频,2图像
private Integer type;
private String thumbUrl;
/**
* 文件存储地址
*/

View File

@@ -213,15 +213,17 @@ public class OnePricePurchaseDiscountProvider implements IDiscountProvider {
return false;
}
} else {
// 如果既没有具体配置也没有默认配置,默认支持一口价优惠
log.debug("商品 {}({}) 未找到价格配置,默认支持一口价优惠",
// 如果既没有具体配置也没有默认配置,默认支持一口价优惠
log.debug("商品 {}({}) 未找到价格配置,默认支持一口价优惠",
product.getProductType().getCode(), product.getProductId());
return false;
}
}
} catch (Exception e) {
log.warn("检查商品 {}({}) 一口价优惠支持情况时发生异常,默认支持",
log.warn("检查商品 {}({}) 一口价优惠支持情况时发生异常,默认支持",
product.getProductType().getCode(), product.getProductId(), e);
// 异常情况下默认支持,避免影响正常业务流程
// 异常情况下默认支持,避免出现意外情况
return false;
}
}

View File

@@ -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处理

View File

@@ -237,6 +237,11 @@ public class GoodsServiceImpl implements GoodsService {
} catch (Exception e) {
goodsDetailVO.setScenicName("");
}
if (StringUtils.isNotBlank(sourceRespVO.getThumbUrl())) {
goodsDetailVO.setTemplateCoverUrl(sourceRespVO.getThumbUrl());
} else {
goodsDetailVO.setTemplateCoverUrl(sourceRespVO.getUrl());
}
goodsDetailVO.setGoodsType(sourceType);
goodsDetailVO.setFaceId(face.getId());
goodsDetailVO.setGoodsId(sourceRespVO.getId());

View File

@@ -67,6 +67,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -464,9 +465,11 @@ public class PrinterServiceImpl implements PrinterService {
// 准备水印处理器
IOperator operator = ImageWatermarkFactory.get(watermarkType);
// 生成唯一的处理标识符,避免多线程环境下的文件冲突
String processId = item.getId() + "_" + UUID.randomUUID().toString();
// 下载原图
File originalFile = new File("print_" + item.getId() + ".jpg");
File watermarkedFile = new File("print_" + item.getId() + "_" + watermarkType.getType() + "." + watermarkType.getPreferFileType());
File originalFile = new File("print_" + processId + ".jpg");
File watermarkedFile = new File("print_" + processId + "_" + watermarkType.getType() + "." + watermarkType.getPreferFileType());
File rotatedOriginalFile = null;
File rotatedWatermarkedFile = null;
boolean needRotation = false;
@@ -481,7 +484,7 @@ public class PrinterServiceImpl implements PrinterService {
if (!isLandscape) {
// 竖图需要旋转为横图
needRotation = true;
rotatedOriginalFile = new File("print_" + item.getId() + "_rotated.jpg");
rotatedOriginalFile = new File("print_" + processId + "_rotated.jpg");
ImageUtils.rotateImage90(originalFile, rotatedOriginalFile);
log.info("竖图已旋转为横图,照片ID: {}", item.getId());
}
@@ -495,7 +498,7 @@ public class PrinterServiceImpl implements PrinterService {
// 如果之前旋转了,需要将水印图片旋转回去
if (needRotation) {
rotatedWatermarkedFile = new File("print_" + item.getId() + "_final_" + watermarkType.getType() + "." + watermarkType.getPreferFileType());
rotatedWatermarkedFile = new File("print_" + processId + "_final_" + watermarkType.getType() + "." + watermarkType.getPreferFileType());
ImageUtils.rotateImage270(watermarkedFile, rotatedWatermarkedFile);
log.info("水印图片已旋转回竖图,照片ID: {}", item.getId());
// 删除中间的横图水印文件

View File

@@ -375,6 +375,7 @@ public class VideoPieceGetter {
sourceEntity.setId(SnowFlakeUtil.getLongId());
sourceEntity.setCreateTime(baseTime);
if (imgSource != null) {
sourceEntity.setThumbUrl(imgSource.getThumbUrl());
sourceEntity.setUrl(imgSource.getUrl());
sourceEntity.setPosJson(imgSource.getPosJson());
}

View File

@@ -2,12 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycwl.basic.mapper.SourceMapper">
<insert id="add">
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>
<insert id="addFromZTSource">
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})
</insert>
<insert id="addRelation">
replace member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id<if test="isFree">, is_free</if>)
@@ -130,6 +130,7 @@
<if test="deviceId!= null">device_id = #{deviceId}, </if>
<if test="url!= null">url = #{url}, </if>
<if test="videoUrl!= null">video_url = #{videoUrl}, </if>
<if test="thumbUrl!= null">thumb_url = #{thumbUrl}, </if>
<if test="isBuy!=null">is_buy = #{isBuy}, </if>
<if test="type!=null">`type` = #{type}, </if>
<if test="faceSampleId!= null">face_sample_id = #{faceSampleId}, </if>
@@ -175,12 +176,11 @@
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, so.scenic_id, device_id, url, so.create_time, so.update_time,so.video_url, so.`type`, so.face_sample_id
select so.id, so.scenic_id, device_id, thumb_url, url, so.create_time, so.update_time,so.video_url, so.`type`, so.face_sample_id
from source so
<where>
<if test="scenicId!= null">and so.scenic_id = #{scenicId} </if>
<if test="deviceId!= null">and device_id = #{deviceId} </if>
<if test="url!= null">and url = #{url} </if>
<if test="isBuy!=null">
and is_buy = #{isBuy}
</if>
@@ -191,14 +191,14 @@
order by so.create_time desc
</select>
<select id="userGetById" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, ms.scenic_id, device_id, ms.member_id, url, ms.is_free, so.create_time, so.update_time
select so.id, ms.scenic_id, device_id, ms.member_id, thumb_url, url, ms.is_free, so.create_time, so.update_time
from member_source ms
left join source so on ms.source_id = so.id
where so.id = #{id} and ms.member_id = #{userId} and so.id is not null
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, scenic_id, device_id, url, video_url, so.create_time, so.update_time
select so.id, scenic_id, device_id, thumb_url, url, video_url, so.create_time, so.update_time
from source so
where so.id = #{id}
@@ -241,7 +241,7 @@
limit 1
</select>
<select id="listUser" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, ms.scenic_id, device_id, url, ms.is_free, so.create_time, so.update_time, ms.is_buy, video_url
select so.id, ms.scenic_id, device_id, thumb_url, url, ms.is_free, so.create_time, so.update_time, ms.is_buy, video_url
from member_source ms
left join source so on ms.source_id = so.id
@@ -255,7 +255,7 @@
</select>
<select id="listUserOne" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, ms.scenic_id, device_id, url, ms.is_free, video_url, so.create_time, so.update_time,ms.is_buy
select so.id, ms.scenic_id, device_id, thumb_url, url, ms.is_free, video_url, so.create_time, so.update_time,ms.is_buy
from member_source ms
left join source so on ms.source_id = so.id
@@ -263,7 +263,7 @@
limit 1
</select>
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, ms.face_id, ms.scenic_id, ms.type, so.url, ms.is_free, so.create_time, so.update_time,ms.is_buy
select so.id, ms.face_id, ms.scenic_id, ms.type, so.thumb_url, so.url, ms.is_free, so.create_time, so.update_time,ms.is_buy
from member_source ms
left join source so on ms.source_id = so.id