()
+ .eq("wayline_id",waylineId));
+ }
}
diff --git a/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java b/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java
index f833e966..c26862cc 100644
--- a/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java
+++ b/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java
@@ -5,6 +5,7 @@ import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.file.service.IFileService;
import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -26,6 +27,7 @@ import java.util.Map;
*
* @author 作者 owen E-mail: 624191343@qq.com
*/
+@Slf4j
@RestController
public class FileController {
@Autowired
@@ -103,7 +105,10 @@ public class FileController {
@GetMapping("/file/{id}")
public String getFileViewUrl(@PathVariable String id) {
- return fileService.getViewUrl(id);
+ log.info("请求文件可访问链接,参数文件Id:{}",id);
+ String viewUrl = fileService.getViewUrl(id);
+ log.info("请求文件可访问链接,链接值:{}",viewUrl);
+ return viewUrl;
}
@GetMapping("/files/{id}")
diff --git a/zlt-business/file-center/src/main/java/com/central/file/service/impl/OssService.java b/zlt-business/file-center/src/main/java/com/central/file/service/impl/OssService.java
index c70e8dbe..f6f99117 100644
--- a/zlt-business/file-center/src/main/java/com/central/file/service/impl/OssService.java
+++ b/zlt-business/file-center/src/main/java/com/central/file/service/impl/OssService.java
@@ -8,8 +8,10 @@ import com.central.common.model.FileInfo;
import com.central.oss.model.ObjectInfo;
import com.central.oss.properties.FileServerProperties;
import com.central.oss.template.OssTemplate;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@@ -22,6 +24,7 @@ import java.io.OutputStream;
* @date 2025/1/13
*
*/
+@Slf4j
@Service
@ConditionalOnProperty(prefix = FileServerProperties.PREFIX, name = "type", havingValue = FileServerProperties.TYPE_OSS)
public class OssService extends AbstractIFileService {
@@ -87,7 +90,25 @@ public class OssService extends AbstractIFileService {
@Override
public FileInfo getFileInfo(String id) {
- return baseMapper.findById(id);
+ if (StringUtils.isEmpty(id)) {
+ log.warn("文件ID为空");
+ return null;
+ }
+ try {
+ log.info("开始查询文件信息: fileId={}", id);
+ FileInfo fileInfo = baseMapper.selectById(id.trim()); // 添加trim()去除可能的空格
+
+ if (fileInfo == null) {
+ log.warn("未找到文件信息: fileId={}", id);
+ return null;
+ }
+
+ log.info("查询文件信息成功: fileId={}, path={}", fileInfo.getId(), fileInfo.getPath());
+ return fileInfo;
+ } catch (Exception e) {
+ log.error("查询文件信息异常: fileId={}, error={}", id, e.getMessage(), e);
+ throw new RuntimeException("查询文件信息失败", e);
+ }
}
@Override
diff --git a/zlt-business/file-center/src/main/resources/application.yml b/zlt-business/file-center/src/main/resources/application.yml
index 282241a5..30d1ce89 100644
--- a/zlt-business/file-center/src/main/resources/application.yml
+++ b/zlt-business/file-center/src/main/resources/application.yml
@@ -47,7 +47,7 @@ zlt:
bucketName: ${zlt.oss.bucketName}
#多租户配置
tenant:
- enable: true
+ enable: false
#fastDFS配置
#fdfs:
diff --git a/zlt-business/order-center/src/main/java/com/central/order/controller/OrderController.java b/zlt-business/order-center/src/main/java/com/central/order/controller/OrderController.java
index a9621f92..8331df04 100644
--- a/zlt-business/order-center/src/main/java/com/central/order/controller/OrderController.java
+++ b/zlt-business/order-center/src/main/java/com/central/order/controller/OrderController.java
@@ -12,6 +12,7 @@ import com.central.log.annotation.AuditLog;
import com.central.order.config.TencentPayProperties;
import com.central.order.enums.CommonStatus;
import com.central.order.enums.OrderStatus;
+import com.central.order.feign.DeviceCenterService;
import com.central.order.feign.FileCenterService;
import com.central.order.feign.UserCenterService;
import com.central.order.model.*;
@@ -93,6 +94,11 @@ public class OrderController {
// 获取当前日期,格式化为 yyyyMMdd
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstant.DATEMINUTE_FORMAT);
+ @Autowired
+ private DeviceCenterService deviceCenterService;
+
+
+
/**
* 列表
*/
@@ -335,7 +341,19 @@ public class OrderController {
if (orderService.getUnCompleteOrderCount(deviceSn)==0){
List orders = orderService.getOrdersInQueueByDevice(deviceSn);
if (!orders.isEmpty()){
- return Result.succeed(orders.get(0),"获取成功");
+ Order order = orders.get(0);
+ QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
+ Assert.notNull(qrCode,"二维码数据不能为空");
+
+ // 从二维码中获取航线ID
+ String waylineId = qrCode.getWaylineId();
+ // 根据航线ID获取对应的文件路径
+ String waylineFilePath = fileCenterService.getFileViewUrl(waylineId);
+ Assert.notNull(waylineFilePath,"订单航线数据不能为空");
+
+ order.setFileMd5(deviceCenterService.getLineFileSign(waylineId));
+ order.setWaylineLinkUrl(waylineFilePath);
+ return Result.succeed(order,"获取成功");
}
}
return Result.failed("未存在排队队列");
diff --git a/zlt-business/order-center/src/main/java/com/central/order/controller/QrCodeController.java b/zlt-business/order-center/src/main/java/com/central/order/controller/QrCodeController.java
index c02f813e..877f4e7f 100644
--- a/zlt-business/order-center/src/main/java/com/central/order/controller/QrCodeController.java
+++ b/zlt-business/order-center/src/main/java/com/central/order/controller/QrCodeController.java
@@ -20,6 +20,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -133,13 +134,16 @@ public class QrCodeController {
}
@GetMapping("/wayline/{orderNo}")
- public String getWaylineByOrderNo(@PathVariable("orderNo") String orderNo){
+ public Map getWaylineByOrderNo(@PathVariable("orderNo") String orderNo){
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单No不能为空");
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
Assert.notNull(qrCode,"二维码数据不能为空");
String waylineFilePath = fileCenterService.getFileViewUrl(qrCode.getWaylineId());
- return waylineFilePath;
+ Map map = new HashMap<>();
+ map.put("waylineFilePath",waylineFilePath);
+ map.put("waylineId",qrCode.getWaylineId());
+ return map;
}
}
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 6ac46867..17a29f04 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
@@ -1,46 +1,29 @@
package com.central.order.feign;
import com.central.common.constant.ServiceNameConstants;
-import com.central.common.model.FileInfo;
-import com.central.common.model.Result;
-import com.central.order.feign.fallback.FileCenterServiceFallbackFactory;
+import com.central.order.feign.fallback.DeviceCenterServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Map;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
/**
- * user-center模块远程调用
+ * device-center模块远程调用
*
* @author lsl
* @version 1.0
* @description user-center模块远程调用
* @create 2025/1/13
**/
-@FeignClient(name = ServiceNameConstants.FILE_SERVICE, fallbackFactory = FileCenterServiceFallbackFactory.class, dismiss404 = true)
-public interface FileCenterService {
+@FeignClient(name = ServiceNameConstants.DEVICE_SERVICE, fallbackFactory = DeviceCenterServiceFallbackFactory.class, dismiss404 = true)
+public interface DeviceCenterService {
/**
- * 通过ID查询预览地址
+ * 通过ID查询文件sign
*
* @param id 文件ID
* @return
*/
- @GetMapping("/file/{id}")
- String getFileViewUrl(@PathVariable("id") String id);
+ @GetMapping("/wayline/sign/{id}")
+ String getLineFileSign(@PathVariable("id") String id);
- @GetMapping("/type/{id}")
- String getFileContentType(@PathVariable("id") String id);
-
- @GetMapping("/qrcode/{codeId}")
- Result