fix(订单中心):新版UI订单素材接口逻辑
This commit is contained in:
+81
@@ -723,6 +723,87 @@ public class OrderController {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新版:查询用户订单详情列表(含视频/图片/一键成片)
|
||||
*/
|
||||
@Operation(summary = "新版-查询用户订单详情列表(含视频/图片/一键成片)")
|
||||
@Parameters({
|
||||
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
|
||||
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
|
||||
})
|
||||
@GetMapping("/user/v2")
|
||||
public PageResult<Map> listInfoByUserV2(@RequestParam Map<String, Object> params) {
|
||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||
params.put("userId", user.getId());
|
||||
List<Integer> orderStatusList = List.of(OrderStatus.COMPLETE.getId(), OrderStatus.UPLOADING.getId(), OrderStatus.UPLOADED.getId());
|
||||
params.put("orderStatusList", orderStatusList);
|
||||
|
||||
PageResult<Order> result = orderService.findListByUser(params);
|
||||
if (result.getCount() > 0){
|
||||
List<Map> page = new ArrayList<>();
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
fileMap.put("style", fileStyle);
|
||||
for(Order order : result.getData()){
|
||||
Map<String,Object> orderFileMap = new HashMap<>();
|
||||
orderFileMap.put("time", sdf.format(order.getCreateTime()));
|
||||
orderFileMap.put("addr", tourismService.getTourismById(order.getTourismId()).getTourismAddress());
|
||||
orderFileMap.put("orderNo", order.getOrderNo());
|
||||
|
||||
// 只查一次所有文件
|
||||
List<OrderFile> allFiles = orderFileService.getOrderFileByOrderNo(order.getOrderNo());
|
||||
|
||||
// aiVideo
|
||||
List<OrderFile> aiVideoFiles = allFiles.stream()
|
||||
.filter(f -> "ai_video".equals(f.getFileTag()))
|
||||
.toList();
|
||||
String aiVideoUrl = null;
|
||||
if (!aiVideoFiles.isEmpty()) {
|
||||
fileMap.put("path", aiVideoFiles.get(0).getFilePath());
|
||||
aiVideoUrl = fileCenterService.getViewUrlByPathStyle(fileMap);
|
||||
}
|
||||
orderFileMap.put("aiVideo", aiVideoUrl);
|
||||
|
||||
// 图片素材
|
||||
List<OrderFile> imgFiles = allFiles.stream()
|
||||
.filter(f -> "image/jpeg".equals(f.getFileType()))
|
||||
.toList();
|
||||
List<Map<String,String>> imgList = new ArrayList<>();
|
||||
for (OrderFile orderFile : imgFiles){
|
||||
Map<String,String> imgMap = new HashMap<>();
|
||||
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
|
||||
imgMap.put("url", url.replace(cdnOssUrl, cdnUrl));
|
||||
imgMap.put("contentType", orderFile.getFileType());
|
||||
imgMap.put("path", orderFile.getFilePath());
|
||||
fileMap.put("path",orderFile.getFilePath());
|
||||
imgMap.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
|
||||
imgList.add(imgMap);
|
||||
}
|
||||
orderFileMap.put("imgList", imgList);
|
||||
|
||||
// 视频素材
|
||||
List<OrderFile> videoFiles = allFiles.stream()
|
||||
.filter(f -> "raw_video".equals(f.getFileTag()))
|
||||
.toList();
|
||||
List<Map<String,String>> videoList = new ArrayList<>();
|
||||
for (OrderFile orderFile : videoFiles){
|
||||
Map<String,String> videoMap = new HashMap<>();
|
||||
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
|
||||
videoMap.put("url", url.replace(cdnOssUrl, cdnUrl));
|
||||
videoMap.put("contentType", orderFile.getFileType());
|
||||
videoMap.put("path", orderFile.getFilePath());
|
||||
fileMap.put("path",orderFile.getFilePath());
|
||||
videoMap.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
|
||||
videoList.add(videoMap);
|
||||
}
|
||||
orderFileMap.put("videoList", videoList);
|
||||
|
||||
page.add(orderFileMap);
|
||||
}
|
||||
return PageResult.<Map>builder().data(page).resp_code(0).count(result.getCount()).build();
|
||||
}
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除URL中的参数
|
||||
* @param url 原始URL
|
||||
|
||||
+4
@@ -220,6 +220,10 @@ public class OrderFileController {
|
||||
orderFile.setFilePath(fileInfo.getPath());
|
||||
orderFile.setFileType(fileInfo.getContentType());
|
||||
orderFile.setTourismId(order.getTourismId());
|
||||
// 新增:如果是视频素材且未指定fileTag,默认标记为raw_video
|
||||
if ("video/mp4".equals(orderFile.getFileType()) && (orderFile.getFileTag() == null || orderFile.getFileTag().isEmpty())) {
|
||||
orderFile.setFileTag("raw_video");
|
||||
}
|
||||
|
||||
// 保存记录
|
||||
boolean saved = orderFileService.save(orderFile);
|
||||
|
||||
+3
-1
@@ -14,7 +14,9 @@ public enum HomeCarouselType implements ZltEnum {
|
||||
ACTIVITY(1, "活动"),
|
||||
SHOOTING_ANGLE(2,"拍照角度"),
|
||||
GUIDANCE(3,"引导"),
|
||||
BIG_PICTURE(4,"大图");
|
||||
BIG_PICTURE(4,"大图"),
|
||||
VIDEO(5,"景区视频"),
|
||||
ORDER_SHOW(6,"订单展示图");
|
||||
|
||||
private Integer id;
|
||||
private String content;
|
||||
|
||||
@@ -46,4 +46,8 @@ public class OrderFile extends SuperEntity {
|
||||
private String tenantId;
|
||||
private Integer isDel;
|
||||
|
||||
/**
|
||||
* 文件标签,如ai_video、raw_video等
|
||||
*/
|
||||
private String fileTag;
|
||||
}
|
||||
|
||||
+1
@@ -153,6 +153,7 @@ public class VideoEditServiceImpl implements IVideoEditService {
|
||||
orderFile.setFileId(fileInfo.getId());
|
||||
orderFile.setOrderNo(orderNo);
|
||||
orderFile.setFileType("video/mp4");
|
||||
orderFile.setFileTag("ai_video");
|
||||
orderFile.setFilePath(extractFilePath(outputUrl));
|
||||
orderFile.setUserId(order.getUserId());
|
||||
orderFile.setTourismId(order.getTourismId());
|
||||
|
||||
Reference in New Issue
Block a user