From ec04ebe97a37c27b6e1c2cbeb70a17006fadce88 Mon Sep 17 00:00:00 2001 From: Iamasoldier <1272745473@qq.com> Date: Tue, 15 Apr 2025 23:43:17 +0800 Subject: [PATCH] Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. On branch develop Your branch is up to date with 'goflyapp/develop'. Changes to be committed: modified: zlt-business/order-center/src/main/java/com/central/order/config/AliyunImsConfig.java modified: zlt-business/order-center/src/main/java/com/central/order/controller/AutoCutVideoController.java modified: zlt-business/order-center/src/main/java/com/central/order/feign/DeviceCenterService.java new file: zlt-business/order-center/src/main/java/com/central/order/model/params/EditTaskQueryParams.java modified: zlt-business/order-center/src/main/java/com/central/order/service/IEditTaskService.java modified: zlt-business/order-center/src/main/java/com/central/order/service/impl/EditTaskServiceImpl.java modified: zlt-business/order-center/src/main/java/com/central/order/service/impl/MediaServiceImpl.java modified: zlt-business/order-center/src/main/resources/application.yml modified: zlt-business/order-center/src/main/resources/bootstrap.yml modified: zlt-config/src/main/resources/bootstrap.properties modified: zlt-web/react-web/src/main/frontend/config/proxy.ts modified: zlt-web/react-web/src/main/frontend/config/routes.ts new file: zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/CreateForm.tsx new file: zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/UpdateForm.tsx new file: zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/index.tsx modified: zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx modified: zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/components/UpdateForm.tsx modified: zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/index.tsx modified: zlt-web/react-web/src/main/frontend/src/services/orders/api.ts modified: zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts --- .../central/order/config/AliyunImsConfig.java | 4 +- .../controller/AutoCutVideoController.java | 56 ++++ .../order/feign/DeviceCenterService.java | 2 +- .../model/params/EditTaskQueryParams.java | 18 + .../order/service/IEditTaskService.java | 17 + .../service/impl/EditTaskServiceImpl.java | 95 ++++++ .../order/service/impl/MediaServiceImpl.java | 179 ++++++---- .../src/main/resources/application.yml | 14 +- .../src/main/resources/bootstrap.yml | 8 +- .../src/main/resources/bootstrap.properties | 10 +- .../src/main/frontend/config/proxy.ts | 32 +- .../src/main/frontend/config/routes.ts | 10 + .../orders/EditTask/components/CreateForm.tsx | 88 +++++ .../orders/EditTask/components/UpdateForm.tsx | 90 +++++ .../src/pages/orders/EditTask/index.tsx | 310 ++++++++++++++++++ .../src/pages/orders/Qrcode/index.tsx | 3 +- .../orders/Tourism/components/UpdateForm.tsx | 29 +- .../src/pages/orders/Tourism/index.tsx | 27 +- .../main/frontend/src/services/orders/api.ts | 29 ++ .../frontend/src/services/orders/typings.d.ts | 13 + 20 files changed, 933 insertions(+), 101 deletions(-) create mode 100644 zlt-business/order-center/src/main/java/com/central/order/model/params/EditTaskQueryParams.java create mode 100644 zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/CreateForm.tsx create mode 100644 zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/UpdateForm.tsx create mode 100644 zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/index.tsx diff --git a/zlt-business/order-center/src/main/java/com/central/order/config/AliyunImsConfig.java b/zlt-business/order-center/src/main/java/com/central/order/config/AliyunImsConfig.java index 2ac71adb..4f4d3e3b 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/config/AliyunImsConfig.java +++ b/zlt-business/order-center/src/main/java/com/central/order/config/AliyunImsConfig.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; @Configuration @ConfigurationProperties(prefix = "aliyun.ims") public class AliyunImsConfig { - private String endpoint; + private String endpoint = "ice.cn-beijing.aliyuncs.com"; private String accessKeyId; private String accessKeySecret; private String region; @@ -29,4 +29,4 @@ public class AliyunImsConfig { .setEndpoint(endpoint); return new Client(config); } -} \ No newline at end of file +} diff --git a/zlt-business/order-center/src/main/java/com/central/order/controller/AutoCutVideoController.java b/zlt-business/order-center/src/main/java/com/central/order/controller/AutoCutVideoController.java index 3c56a78b..2d056211 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/controller/AutoCutVideoController.java +++ b/zlt-business/order-center/src/main/java/com/central/order/controller/AutoCutVideoController.java @@ -1,11 +1,13 @@ package com.central.order.controller; +import com.central.common.model.PageResult; import com.central.common.model.Result; import com.central.order.constants.EditTaskStatus; import com.central.order.enums.OrderStatus; import com.central.order.feign.FileCenterService; import com.central.order.model.*; import com.central.order.model.dto.CallbackDTO; +import com.central.order.model.params.EditTaskQueryParams; import com.central.order.service.*; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -246,4 +248,58 @@ public class AutoCutVideoController { private void notifyUser(String userId, String message) { // Implementation of notifyUser method } + + + @Operation(summary = "获取剪辑任务列表") + @GetMapping("/list") + public Result> getTaskList( + @RequestParam(defaultValue = "1") Integer page, + @RequestParam(defaultValue = "10") Integer limit, + @RequestParam(required = false) String orderSn, + @RequestParam(required = false) String jobId, + @RequestParam(required = false) Integer status) { + try { + EditTaskQueryParams params = EditTaskQueryParams.builder() + .page(page) + .limit(limit) + .orderSn(orderSn) + .jobId(jobId) + .status(status) + .build(); + + PageResult result = editTaskService.getTaskList(params); + return Result.succeed(result); + + } catch (Exception e) { + log.error("查询剪辑任务列表失败", e); + return Result.failed("查询任务列表失败"); + } + } + + @Operation(summary = "保存或更新剪辑任务") + @PostMapping("/save") + public Result saveOrUpdateTask(@RequestBody EditTask task) { + try { + boolean success = editTaskService.saveOrUpdateTask(task); + return Result.succeed(success); + + } catch (Exception e) { + log.error("保存剪辑任务失败: task={}", task, e); + return Result.failed("保存任务失败: " + e.getMessage()); + } + } + + @Operation(summary = "删除剪辑任务") + @DeleteMapping("/delete/{id}") + public Result deleteTask(@PathVariable Integer id) { + try { + boolean success = editTaskService.deleteTask(id); + return Result.succeed(success); + + } catch (Exception e) { + log.error("删除剪辑任务失败: id={}", id, e); + return Result.failed("删除任务失败: " + e.getMessage()); + } + } + } diff --git a/zlt-business/order-center/src/main/java/com/central/order/feign/DeviceCenterService.java b/zlt-business/order-center/src/main/java/com/central/order/feign/DeviceCenterService.java index 17a29f04..fdf4b673 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/feign/DeviceCenterService.java +++ b/zlt-business/order-center/src/main/java/com/central/order/feign/DeviceCenterService.java @@ -25,5 +25,5 @@ public interface DeviceCenterService { */ @GetMapping("/wayline/sign/{id}") String getLineFileSign(@PathVariable("id") String id); - + } diff --git a/zlt-business/order-center/src/main/java/com/central/order/model/params/EditTaskQueryParams.java b/zlt-business/order-center/src/main/java/com/central/order/model/params/EditTaskQueryParams.java new file mode 100644 index 00000000..12cdd010 --- /dev/null +++ b/zlt-business/order-center/src/main/java/com/central/order/model/params/EditTaskQueryParams.java @@ -0,0 +1,18 @@ +package com.central.order.model.params; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EditTaskQueryParams { + private Integer page = 1; + private Integer limit = 10; + private String orderSn; + private String jobId; + private Integer status; +} diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/IEditTaskService.java b/zlt-business/order-center/src/main/java/com/central/order/service/IEditTaskService.java index b84d990b..6c1ba566 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/IEditTaskService.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/IEditTaskService.java @@ -1,7 +1,9 @@ package com.central.order.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.central.common.model.PageResult; import com.central.order.model.EditTask; +import com.central.order.model.params.EditTaskQueryParams; /** * 视频编辑任务服务接口 @@ -41,4 +43,19 @@ public interface IEditTaskService extends IService { * @return 任务实体 */ EditTask getTaskByOrderSn(String orderSn); + + /** + * 分页查询剪辑任务 + */ + PageResult getTaskList(EditTaskQueryParams params); + + /** + * 保存或更新剪辑任务 + */ + boolean saveOrUpdateTask(EditTask task); + + /** + * 删除剪辑任务 + */ + boolean deleteTask(Integer id); } diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/EditTaskServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/EditTaskServiceImpl.java index 35ee6d94..26c4a7a7 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/EditTaskServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/EditTaskServiceImpl.java @@ -2,14 +2,20 @@ package com.central.order.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.central.common.exception.BusinessException; +import com.central.common.model.PageResult; +import com.central.order.constants.EditTaskStatus; import com.central.order.mapper.EditTaskMapper; import com.central.order.model.EditTask; +import com.central.order.model.params.EditTaskQueryParams; import com.central.order.service.IEditTaskService; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; import java.util.Date; @@ -18,6 +24,7 @@ import java.util.Date; */ @Slf4j @Service +@RequiredArgsConstructor public class EditTaskServiceImpl extends ServiceImpl implements IEditTaskService { @Override @@ -81,4 +88,92 @@ public class EditTaskServiceImpl extends ServiceImpl i throw new BusinessException("查询订单任务失败: " + e.getMessage()); } } + + @Override + public PageResult getTaskList(EditTaskQueryParams params) { + try { + // 构建查询条件 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(StringUtils.hasText(params.getOrderSn()), EditTask::getOrderSn, params.getOrderSn()) + .eq(StringUtils.hasText(params.getJobId()), EditTask::getJobId, params.getJobId()) + .eq(params.getStatus() != null, EditTask::getStatus, params.getStatus()) + .orderByDesc(EditTask::getId); + + // 执行分页查询 + Page page = new Page<>(params.getPage(), params.getLimit()); + Page resultPage = page(page, wrapper); + + // 转换为PageResult + return PageResult.builder() + .data(resultPage.getRecords()) + .resp_code(0) + .count(resultPage.getTotal()) + .build(); + + } catch (Exception e) { + log.error("查询剪辑任务列表失败", e); + throw new BusinessException("查询任务列表失败: " + e.getMessage()); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveOrUpdateTask(EditTask task) { + try { + // 参数验证 + validateTask(task); + + // 如果是新增任务 + if (task.getId() == null) { + task.setCreateTime(new Date()); + task.setStatus(EditTaskStatus.PENDING); + } + + // 更新任务 + task.setUpdateTime(new Date()); + return saveOrUpdate(task); + + } catch (Exception e) { + log.error("保存剪辑任务失败: task={}", task, e); + throw new BusinessException("保存任务失败: " + e.getMessage()); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean deleteTask(Integer id) { + try { + // 查询任务 + EditTask task = getById(id); + if (task == null) { + throw new BusinessException("任务不存在"); + } + + // 检查任务状态 + if (EditTaskStatus.isProcessing(task.getStatus())) { + throw new BusinessException("任务处理中,不能删除"); + } + + return removeById(id); + + } catch (Exception e) { + log.error("删除剪辑任务失败: id={}", id, e); + throw new BusinessException("删除任务失败: " + e.getMessage()); + } + } + + /** + * 验证任务参数 + */ + private void validateTask(EditTask task) { + if (task == null) { + throw new BusinessException("任务参数不能为空"); + } + if (!StringUtils.hasText(task.getOrderSn())) { + throw new BusinessException("订单编号不能为空"); + } + if (task.getUserId() == null) { + throw new BusinessException("用户ID不能为空"); + } + } } diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/MediaServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/MediaServiceImpl.java index 412e1dea..6553a5f8 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/MediaServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/MediaServiceImpl.java @@ -1,7 +1,11 @@ package com.central.order.service.impl; +import com.alibaba.fastjson.JSON; import com.aliyun.ice20201109.Client; -import com.aliyun.ice20201109.models.*; +import com.aliyun.ice20201109.models.GetMediaProducingJobRequest; +import com.aliyun.ice20201109.models.GetMediaProducingJobResponse; +import com.aliyun.ice20201109.models.SubmitMediaProducingJobRequest; +import com.aliyun.ice20201109.models.SubmitMediaProducingJobResponse; import com.central.common.exception.BusinessException; import com.central.order.config.AliyunImsConfig; import com.central.order.model.OrderFile; @@ -12,7 +16,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Slf4j @Service @@ -25,30 +31,39 @@ public class MediaServiceImpl implements IMediaService { @Override public String submitEditTask(String orderNo, List orderFiles, List tourismFiles) { try { - // 1. 构建媒体资源列表 - List mediaAssets = buildMediaAssets(orderFiles, tourismFiles); + // 1. 构建时间线配置 + String timeline = buildTimeline(orderFiles, tourismFiles); // 2. 构建输出配置 String outputConfig = buildOutputConfig(orderNo); - // 3. 构建请求 - SubmitBatchMediaProducingJobRequest request = new SubmitBatchMediaProducingJobRequest() - .setProject(imsConfig.getProjectName()) - .setPipelineName(imsConfig.getPipelineName()) - .setTemplateId(imsConfig.getTemplateId()) - .setInputMediaAssets(mediaAssets) - .setOutputConfig(outputConfig) - .setCallbackUrl(imsConfig.getCallbackUrl()); + // 3. 构建项目元数据 + String projectMetadata = buildProjectMetadata(orderNo); + + // 4. 构建userData + String userData = buildUserData(orderNo); + + // 打印请求参数,方便调试 + log.info("提交任务参数: timeline={}, outputConfig={}, projectMetadata={}, userData={}", + timeline, outputConfig, projectMetadata, userData); + + // 5. 构建请求 + SubmitMediaProducingJobRequest request = new SubmitMediaProducingJobRequest() + .setTimeline(timeline) + .setOutputMediaConfig(outputConfig) + .setProjectMetadata(projectMetadata) + .setUserData(userData); + + // 6. 提交任务 + SubmitMediaProducingJobResponse response = imsClient.submitMediaProducingJob(request); - // 4. 提交任务 - SubmitBatchMediaProducingJobResponse response = imsClient.submitBatchMediaProducingJob(request); - if (response != null && response.getStatusCode() == 200) { String jobId = response.getBody().getJobId(); - log.info("提交智能一键成片任务成功: orderNo={}, jobId={}", orderNo, jobId); + log.info("提交智能一键成片任务成功: orderNo={}, jobId={}, projectId={}", + orderNo, jobId, response.getBody().getProjectId()); return jobId; } else { - throw new BusinessException("提交任务失败: " + (response != null ? response.getBody().getMessage() : "未知错误")); + throw new BusinessException("提交任务失败: " + (response != null ? response.getBody().getRequestId() : "未知错误")); } } catch (Exception e) { @@ -60,14 +75,14 @@ public class MediaServiceImpl implements IMediaService { @Override public String getTaskStatus(String jobId) { try { - GetBatchMediaProducingJobRequest request = new GetBatchMediaProducingJobRequest() - .setJobId(jobId) - .setProject(imsConfig.getProjectName()); + GetMediaProducingJobRequest request = new GetMediaProducingJobRequest() + .setJobId(jobId); - GetBatchMediaProducingJobResponse response = imsClient.getBatchMediaProducingJob(request); - - if (response != null && response.getBody() != null) { - return response.getBody().getStatus(); + GetMediaProducingJobResponse response = imsClient.getMediaProducingJob(request); + + if (response != null && response.getBody() != null + && response.getBody().getMediaProducingJob() != null) { + return response.getBody().getMediaProducingJob().getStatus(); } return "UNKNOWN"; @@ -80,14 +95,14 @@ public class MediaServiceImpl implements IMediaService { @Override public String getTaskResult(String jobId) { try { - GetBatchMediaProducingJobRequest request = new GetBatchMediaProducingJobRequest() - .setJobId(jobId) - .setProject(imsConfig.getProjectName()); + GetMediaProducingJobRequest request = new GetMediaProducingJobRequest() + .setJobId(jobId); - GetBatchMediaProducingJobResponse response = imsClient.getBatchMediaProducingJob(request); - - if (response != null && response.getBody() != null) { - return response.getBody().getOutputUrl(); + GetMediaProducingJobResponse response = imsClient.getMediaProducingJob(request); + + if (response != null && response.getBody() != null + && response.getBody().getMediaProducingJob() != null) { + return response.getBody().getMediaProducingJob().getMediaURL(); } return null; @@ -98,54 +113,102 @@ public class MediaServiceImpl implements IMediaService { } /** - * 构建媒体资源列表 + * 构建输出配置 + * 按照阿里云文档格式: + * { + * "MediaURL": "oss://bucket-name/output/example.mp4" + * } */ - private List buildMediaAssets(List orderFiles, List tourismFiles) { - List assets = new ArrayList<>(); + private String buildOutputConfig(String orderNo) { + Map config = new HashMap<>(); + // 注意:这里只需要设置MediaURL + config.put("MediaURL", String.format("oss://%s/output/%s_%s.mp4", + imsConfig.getBucket(), + orderNo, + System.currentTimeMillis() + )); + + String configJson = JSON.toJSONString(config); + log.debug("输出配置: {}", configJson); + return configJson; + } + + /** + * 构建时间线配置 + * 按照阿里云文档格式: + * { + * "VideoTracks": [{ + * "VideoTrackClips": [{ + * "MediaId": "xxxxx" + * }] + * }] + * } + */ + private String buildTimeline(List orderFiles, List tourismFiles) { + Map timeline = new HashMap<>(); + List> videoTracks = new ArrayList<>(); + Map videoTrack = new HashMap<>(); + List> videoTrackClips = new ArrayList<>(); // 处理订单文件 if (orderFiles != null) { for (OrderFile file : orderFiles) { - assets.add(String.format("{\"type\":\"%s\",\"url\":\"oss://%s/%s\"}", - getMediaType(file.getFileType()), - imsConfig.getBucket(), - file.getFilePath() - )); + Map clip = new HashMap<>(); + clip.put("MediaId", getMediaId(file.getFilePath())); + videoTrackClips.add(clip); } } // 处理景区文件 if (tourismFiles != null) { for (TourismFile file : tourismFiles) { - assets.add(String.format("{\"type\":\"image\",\"url\":\"oss://%s/%s\"}", - imsConfig.getBucket(), - file.getImageUrl() - )); + Map clip = new HashMap<>(); + clip.put("MediaId", getMediaId(file.getImageUrl())); + videoTrackClips.add(clip); } } - return assets; + videoTrack.put("VideoTrackClips", videoTrackClips); + videoTracks.add(videoTrack); + timeline.put("VideoTracks", videoTracks); + + String timelineJson = JSON.toJSONString(timeline); + log.debug("时间线配置: {}", timelineJson); + return timelineJson; } /** - * 构建输出配置 + * 构建项目元数据 */ - private String buildOutputConfig(String orderNo) { - return String.format( - "{\"resolution\":\"1080p\",\"bitrate\":\"5000kbps\",\"fileName\":\"%s_%s\"}", - orderNo, - System.currentTimeMillis() - ); + private String buildProjectMetadata(String orderNo) { + Map metadata = new HashMap<>(); + metadata.put("title", "订单视频_" + orderNo); + metadata.put("description", "智能一键成片生成的视频"); + metadata.put("tags", "订单视频,自动生成"); + + String metadataJson = JSON.toJSONString(metadata); + log.debug("项目元数据: {}", metadataJson); + return metadataJson; } /** - * 获取媒体类型 + * 构建用户数据 */ - private String getMediaType(String fileType) { - if (fileType == null) return "other"; - if (fileType.startsWith("video/")) return "video"; - if (fileType.startsWith("audio/")) return "audio"; - if (fileType.startsWith("image/")) return "image"; - return "other"; + private String buildUserData(String orderNo) { + Map userData = new HashMap<>(); + userData.put("orderNo", orderNo); + + String userDataJson = JSON.toJSONString(userData); + log.debug("用户数据: {}", userDataJson); + return userDataJson; } -} \ No newline at end of file + + /** + * 获取媒体ID + */ + private String getMediaId(String filePath) { + // TODO: 这里需要实现获取MediaId的逻辑 + // 可能需要先将文件上传到阿里云,然后获取MediaId + return filePath; + } +} diff --git a/zlt-business/order-center/src/main/resources/application.yml b/zlt-business/order-center/src/main/resources/application.yml index 0a956993..71b88ec5 100644 --- a/zlt-business/order-center/src/main/resources/application.yml +++ b/zlt-business/order-center/src/main/resources/application.yml @@ -81,12 +81,12 @@ videos: aliyun: ims: - endpoint: ice.cn-shanghai.aliyuncs.com - access-key-id: ${ALIYUN_ACCESS_KEY_ID} - access-key-secret: ${ALIYUN_ACCESS_KEY_SECRET} - region: cn-shanghai + endpoint: ice.cn-beijing.aliyuncs.com + access-key-id: ${zlt.oss.secretId} + access-key-secret: ${zlt.oss.secretKey} + region: cn-beijing project-name: ${IMS_PROJECT_NAME} pipeline-name: ${IMS_PIPELINE_NAME} - template-id: ${IMS_TEMPLATE_ID} - callback-url: ${IMS_CALLBACK_URL} - bucket: ${OSS_BUCKET_NAME} + template-id: ${IMS_TEMPLATE_ID:e26a222d7cfb4a1dae85077efaeb05cd} + callback-url: ${IMS_CALLBACK_URL:http://img.goflytec.com/api-order/auto/cut/callback} + bucket: ${zlt.oss.bucketName} diff --git a/zlt-business/order-center/src/main/resources/bootstrap.yml b/zlt-business/order-center/src/main/resources/bootstrap.yml index e780c4e4..1566517e 100644 --- a/zlt-business/order-center/src/main/resources/bootstrap.yml +++ b/zlt-business/order-center/src/main/resources/bootstrap.yml @@ -4,10 +4,10 @@ server: spring: application: name: order-center -# cloud: -# nacos: -# discovery: -# ip: 81.70.164.178 + cloud: + nacos: + discovery: + ip: 81.70.164.178 # cloud: # nacos: # discovery: diff --git a/zlt-config/src/main/resources/bootstrap.properties b/zlt-config/src/main/resources/bootstrap.properties index 2168d2fe..19e3c72f 100644 --- a/zlt-config/src/main/resources/bootstrap.properties +++ b/zlt-config/src/main/resources/bootstrap.properties @@ -1,13 +1,13 @@ ########################## bootstrap级别通用配置 ########################## # 默认开发环境 -spring.profiles.active=dev +spring.profiles.active=prod ##### nacos(注册中心和配置中心)地址 -#spring.cloud.nacos.server-addr=81.70.164.178:8848 -spring.cloud.nacos.server-addr=127.0.0.1:8848 +spring.cloud.nacos.server-addr=81.70.164.178:8848 +#spring.cloud.nacos.server-addr=127.0.0.1:8848 spring.cloud.nacos.username=nacos -spring.cloud.nacos.password=nacos -#spring.cloud.nacos.password=nacosGFLY +#spring.cloud.nacos.password=nacos +spring.cloud.nacos.password=nacosGFLY spring.cloud.nacos.config.file-extension=yml spring.cloud.nacos.config.shared-configs[0].data-id=common.yml spring.cloud.nacos.config.shared-configs[0].refresh=true diff --git a/zlt-web/react-web/src/main/frontend/config/proxy.ts b/zlt-web/react-web/src/main/frontend/config/proxy.ts index 2b8d0a36..61b5280f 100644 --- a/zlt-web/react-web/src/main/frontend/config/proxy.ts +++ b/zlt-web/react-web/src/main/frontend/config/proxy.ts @@ -9,43 +9,43 @@ export default { dev: { '/api-uaa/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-user/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-log/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-search/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-generator/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-file/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-order/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-device/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, }, diff --git a/zlt-web/react-web/src/main/frontend/config/routes.ts b/zlt-web/react-web/src/main/frontend/config/routes.ts index 1922be21..6da40816 100644 --- a/zlt-web/react-web/src/main/frontend/config/routes.ts +++ b/zlt-web/react-web/src/main/frontend/config/routes.ts @@ -116,6 +116,10 @@ path: '/orders/videoTemplate.html', component: './orders/VideoTemplate', }, + { + path: '/orders/editTask.html', + component: './orders/EditTask', + }, ], }, { @@ -166,6 +170,12 @@ path: '/', redirect: '/welcome', }, + { + path: '/orders/edit-task', + name: '剪辑任务管理', + icon: 'VideoCameraOutlined', + component: './orders/EditTask', + }, { component: './404', }, diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/CreateForm.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/CreateForm.tsx new file mode 100644 index 00000000..ab111b50 --- /dev/null +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/CreateForm.tsx @@ -0,0 +1,88 @@ +import React from 'react'; +import { + ModalForm, + ProForm, + ProFormText, + ProFormSelect, + ProFormTextArea, +} from '@ant-design/pro-components'; + +interface CreateFormProps { + visible: boolean; + onVisibleChange: (visible: boolean) => void; + onSubmit: (values: ORDERS.EditTask) => Promise; +} + +const CreateForm: React.FC = ({ + visible, + onVisibleChange, + onSubmit, +}) => { + return ( + + + + + + + + + + + + + + + + + ); +}; + +export default CreateForm; \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/UpdateForm.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/UpdateForm.tsx new file mode 100644 index 00000000..e37cbd0e --- /dev/null +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/components/UpdateForm.tsx @@ -0,0 +1,90 @@ +import React from 'react'; +import { + ModalForm, + ProForm, + ProFormText, + ProFormSelect, + ProFormTextArea, +} from '@ant-design/pro-components'; + +interface UpdateFormProps { + updateModalVisible: boolean; + onVisibleChange: (visible: boolean) => void; + onSubmit: (values: Partial) => Promise; + values?: ORDERS.EditTask; +} + +const UpdateForm: React.FC = ({ + updateModalVisible, + onVisibleChange, + onSubmit, + values, +}) => { + return ( + + + + + + + + + + + + + + + + + ); +}; + +export default UpdateForm; \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/index.tsx new file mode 100644 index 00000000..e020a85d --- /dev/null +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/EditTask/index.tsx @@ -0,0 +1,310 @@ +import React, { useRef, useState, useCallback } from 'react'; +import { PlusOutlined } from '@ant-design/icons'; +import type { ActionType, ProColumns } from '@ant-design/pro-components'; +import { + PageContainer, + ProTable, + QueryFilter, + ProFormSelect, + ProFormText, +} from '@ant-design/pro-components'; +import { Button, Space, Typography, Popconfirm, message, Tag, Tooltip } from 'antd'; +import { getEditTaskList, deleteEditTask } from '@/services/orders/api'; +import CreateForm from './components/CreateForm'; +import UpdateForm from './components/UpdateForm'; + +const { Link } = Typography; + +// 状态选项 +const STATUS_OPTIONS = [ + { label: '待处理', value: 0 }, + { label: '处理中', value: 1 }, + { label: '处理完成', value: 2 }, + { label: '处理失败', value: 3 }, +]; + +// 状态颜色映射 +const statusColorMap = { + 0: { color: 'default', text: '待处理' }, + 1: { color: 'processing', text: '处理中' }, + 2: { color: 'success', text: '处理完成' }, + 3: { color: 'error', text: '处理失败' }, +}; + +// 渲染状态标签 +const renderStatus = (status: number) => { + const statusInfo = statusColorMap[status] || { color: 'gray', text: '未知状态' }; + return {statusInfo.text}; +}; + +const TableList: React.FC = () => { + const actionRef = useRef(); + const [params, setParams] = useState>({}); + const [createModalVisible, handleModalVisible] = useState(false); + const [updateModalVisible, handleUpdateModalVisible] = useState(false); + const [currentRow, setCurrentRow] = useState(); + + // 处理API请求 + const handleApiRequest = async ( + apiCall: () => Promise, + loadingMessage: string, + successMessage: string, + ) => { + const hide = message.loading(loadingMessage); + try { + const result = await apiCall(); + hide(); + if (result.resp_code === 0) { + message.success(successMessage); + return true; + } + message.error(result.resp_msg); + return false; + } catch (error) { + hide(); + message.error(`${successMessage}失败`); + return false; + } + }; + + // 处理删除 + const handleDelete = async (record: ORDERS.EditTask) => { + return handleApiRequest( + () => deleteEditTask(record.id), + '正在删除', + '删除成功' + ); + }; + + // 表格操作处理 + const handleTableAction = useCallback(async ( + action: 'add' | 'edit' | 'delete', + record?: ORDERS.EditTask, + values?: Partial + ) => { + let success = false; + switch (action) { + case 'add': + success = await handleAdd(values as ORDERS.EditTask); + success && handleModalVisible(false); + break; + case 'edit': + if (record) { + success = await handleEdit(record, values || {}); + if (success) { + handleUpdateModalVisible(false); + setCurrentRow(undefined); + } + } + break; + case 'delete': + success = await handleDelete(record!); + break; + } + if (success && actionRef.current) { + actionRef.current.reload(); + } + }, []); + + // 修改 request 处理方式 + const handleRequest = async ( + params: { + pageSize?: number; + current?: number; + keyword?: string; + } & Record, + ) => { + const msg = message.loading('正在加载数据...', 0); + try { + const response = await getEditTaskList({ + page: params.current || 1, + limit: params.pageSize || 10, + orderSn: params.orderSn, + jobId: params.jobId, + status: params.status, + }); + msg(); + + if (response.resp_code === 0) { + return { + data: response.data.records || [], + success: true, + total: response.data.total || 0, + }; + } + message.error(response.resp_msg); + return { + data: [], + success: false, + total: 0, + }; + } catch (error) { + msg(); + message.error('获取数据失败'); + return { + data: [], + success: false, + total: 0, + }; + } + }; + + // 表格列定义 + const columns: ProColumns[] = [ + { + dataIndex: 'index', + valueType: 'indexBorder', + width: 48, + fixed: 'left', + }, + { + title: 'ID', + dataIndex: 'id', + width: 80, + }, + { + title: '用户ID', + dataIndex: 'userId', + width: 100, + }, + { + title: '订单编号', + dataIndex: 'orderSn', + width: 180, + ellipsis: true, + }, + { + title: '任务ID', + dataIndex: 'jobId', + width: 180, + ellipsis: true, + }, + { + title: '处理结果', + dataIndex: 'result', + width: 200, + ellipsis: true, + }, + { + title: '状态', + dataIndex: 'status', + width: 100, + render: (status) => renderStatus(status as number), + }, + { + title: '备注', + dataIndex: 'remark', + width: 200, + ellipsis: true, + }, + { + title: '创建时间', + dataIndex: 'createTime', + valueType: 'dateTime', + width: 160, + ellipsis: true, + }, + { + title: '更新时间', + dataIndex: 'updateTime', + valueType: 'dateTime', + width: 160, + ellipsis: true, + }, + { + title: '操作', + key: 'action', + width: 120, + fixed: 'right', + render: (_, record) => ( + + { + setCurrentRow(record); + handleUpdateModalVisible(true); + }} + > + 修改 + + handleTableAction('delete', record)} + > + 删除 + + + ), + }, + ]; + + return ( + + + + + + + + rowKey="id" + headerTitle="剪辑任务列表" + actionRef={actionRef} + columns={columns} + request={handleRequest} + search={false} + params={params} + scroll={{ x: 1500 }} + pagination={{ + showSizeChanger: true, + showQuickJumper: true, + defaultPageSize: 10, + }} + toolBarRender={() => [ + , + ]} + style={{ + width: '100%', + overflow: 'auto', + }} + /> + handleTableAction('add', undefined, values)} + /> + handleTableAction('edit', currentRow, values)} + values={currentRow} + /> + + ); +}; + +export default TableList; \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx index 0b1cfbe3..73015e46 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx @@ -10,9 +10,8 @@ import { ProFormDigit, ProTable, QueryFilter, - Tooltip, } from '@ant-design/pro-components'; -import { Typography, Popconfirm, Space, message, Image, Button, Tag } from 'antd'; +import { Typography, Popconfirm, Space, message, Image, Button, Tag, Tooltip } from 'antd'; import React, { useRef, useState, useCallback, useEffect } from 'react'; import UpdateForm from './components/UpdateForm'; import { wayline, device } from '@/services/device/api'; diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/components/UpdateForm.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/components/UpdateForm.tsx index 7b81b14c..d4320cc1 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/components/UpdateForm.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/components/UpdateForm.tsx @@ -3,6 +3,7 @@ import { ProForm, ProFormText, ProFormSelect, + ProFormTextArea, } from '@ant-design/pro-components'; import React from 'react'; @@ -45,21 +46,27 @@ const UpdateForm: React.FC = ({ name="tourismName" label="名称" width="md" - rules={[formRules.required]} + rules={[{ required: true, message: '此项为必填项' }]} placeholder="请输入景区名称" /> + + + = ({ label="状态" width="md" options={STATUS_OPTIONS} - rules={[formRules.required]} + rules={[{ required: true, message: '此项为必填项' }]} placeholder="请选择状态" /> + + + + ); }; diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/index.tsx index 014fd78d..de4d3038 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/index.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/Tourism/index.tsx @@ -7,8 +7,9 @@ import { PageContainer, ProForm, ProFormText, - ProTable, ProFormSelect, + ProFormTextArea, + ProTable, } from '@ant-design/pro-components'; import { Typography, message, Popconfirm, Button, Space } from 'antd'; import React, { useRef, useState, useCallback } from 'react'; @@ -127,10 +128,15 @@ const TableList: React.FC = () => { ellipsis: true, }, { - title: '地址', + title: '景点', dataIndex: 'tourismAddress', ellipsis: true, }, + { + title: '景点描述', + dataIndex: 'tourismDesc', + ellipsis: true, + }, { title: '联系电话', dataIndex: 'tourismPhone', @@ -233,6 +239,9 @@ const TableList: React.FC = () => { rules={[formRules.required]} placeholder="请输入景区地址" /> + + + { initialValue="1" /> + + + + {/* 修改表单 */} diff --git a/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts b/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts index 2a6218f4..77491897 100644 --- a/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts +++ b/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts @@ -259,3 +259,32 @@ export async function updateVideoTemplateStatus(id: number, status: number) { }); } +// 获取剪辑任务列表 +export async function getEditTaskList(params: { + page: number; + limit: number; + orderSn?: string; + jobId?: string; + status?: number; +}) { + return request('/api-order/auto/cut/list', { + method: 'GET', + params, + }); +} + +// 新增剪辑任务 +export async function saveOrUpdateEditTask(data: ORDERS.EditTask) { + return request('/api-order/auto/cut/save', { + method: 'POST', + data, + }); +} + +// 删除剪辑任务 +export async function deleteEditTask(id: number) { + return request(`/api-order/auto/cut/delete/${id}`, { + method: 'DELETE', + }); +} + diff --git a/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts b/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts index 3fdb526d..c0ee094c 100644 --- a/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts +++ b/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts @@ -182,6 +182,19 @@ declare namespace ORDERS { company?: string; isDel?: number; } + + interface EditTask { + id: number; + userId: number; + orderSn: string; + jobId: string; + result: string; + status: number; + createTime: string; + updateTime: string; + tenantId: number; + remark: string; + } } declare namespace API {