You've already forked FrameTour-BE
Compare commits
6 Commits
56e1081304
...
19ca91778f
| Author | SHA1 | Date | |
|---|---|---|---|
| 19ca91778f | |||
| e5a58ae757 | |||
| 602eb84f9c | |||
| 8d24e7f9e5 | |||
| 8eed685373 | |||
| 2b79302874 |
@@ -22,7 +22,6 @@ public class SourceController {
|
||||
@Autowired
|
||||
private SourceService sourceService;
|
||||
|
||||
@Deprecated
|
||||
// 分页查询视频源
|
||||
@PostMapping("/page")
|
||||
public ApiResponse pageQuery(@RequestBody SourceReqQuery sourceReqQuery) {
|
||||
|
||||
@@ -41,6 +41,10 @@ public class SourceEntity {
|
||||
* 视频文件存储地址
|
||||
*/
|
||||
private String videoUrl;
|
||||
/**
|
||||
* 缩略图存储地址
|
||||
*/
|
||||
private String thumbUrl;
|
||||
/**
|
||||
* 是否被购买 0未购买 1已购买
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,7 @@ public class SourceRespVO {
|
||||
private Long faceId;
|
||||
// 原素材类型:1视频,2图像
|
||||
private Integer type;
|
||||
private String thumbUrl;
|
||||
/**
|
||||
* 文件存储地址
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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处理
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
// 删除中间的横图水印文件
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user