Merge branch 'fix-branch' of https://gitee.com/L-Shilin/go-fly-platform-services into develop
# Conflicts: # zlt-business/order-center/src/main/java/com/central/order/service/IOrderFileService.java # zlt-business/order-center/src/main/java/com/central/order/service/impl/OrderFileServiceImpl.java
This commit is contained in:
+1
-1
@@ -160,7 +160,7 @@ public class ApiDeviceController {
|
||||
if (requestResult.getStatus() == 200 || requestResult.getStatus() == 500) {
|
||||
log.info("设置设备属性返回消息: message={}", requestResult.getMessage());
|
||||
if (requestResult.getMessage().equals("Device is offline")){
|
||||
return Result.failed("设备已离线请稍后重试");
|
||||
return Result.failed("Device is offline","设备已离线请稍后重试");
|
||||
}
|
||||
Result updateResult = orderCenterService.updateOrderStatusDoing(orderNo);
|
||||
if (updateResult.getResp_code() != null && updateResult.getResp_code() == 0) {
|
||||
|
||||
+1
-1
@@ -197,7 +197,7 @@ public class OrderController {
|
||||
|
||||
List<Order> userOrderList = orderService.getOrderCountByStatusAndUser(user.getId(),OrderStatus.PAID.getId(),OrderStatus.UNPAID.getId());
|
||||
if (!userOrderList.isEmpty()){
|
||||
return Result.succeed("已存在订单,请前往订单页确认,请勿重复下单");
|
||||
return Result.failed("已存在订单,请前往订单页确认,请勿重复下单");
|
||||
}
|
||||
|
||||
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
|
||||
|
||||
+83
-14
@@ -167,27 +167,45 @@ public class OrderFileController {
|
||||
log.warn("参数为空,orderFile: {}", orderFile);
|
||||
return Result.failed(orderFile,"参数为空");
|
||||
}
|
||||
|
||||
// 校验订单是否存在
|
||||
Order order = orderService.getOrderByNumber(orderFile.getOrderNo());
|
||||
if (order == null) {
|
||||
log.warn("订单不存在,订单号: {}", orderFile.getOrderNo());
|
||||
return Result.failed(orderFile,"订单不存在");
|
||||
}
|
||||
orderFile.setOrderNo(order.getOrderNo());
|
||||
orderFile.setUserId(order.getUserId());
|
||||
if (orderFile.getFilePath() != null) {
|
||||
FileInfo fileInfo = fileCenterService.creatFileInfo(orderFile.getFilePath());
|
||||
if (fileInfo == null) {
|
||||
log.warn("文件信息创建失败,filePath: {}", orderFile.getFilePath());
|
||||
return Result.failed(orderFile,"文件信息创建失败");
|
||||
}
|
||||
orderFile.setFileId(fileInfo.getId());
|
||||
orderFile.setFilePath(fileInfo.getPath());
|
||||
orderFile.setFileType(fileInfo.getContentType());
|
||||
orderFile.setTourismId(order.getTourismId());
|
||||
} else {
|
||||
|
||||
// 校验文件路径是否为空
|
||||
if (orderFile.getFilePath() == null || orderFile.getFilePath().trim().isEmpty()) {
|
||||
log.warn("素材路径为空,订单号: {}", orderFile.getOrderNo());
|
||||
return Result.failed(orderFile,"素材路径为空");
|
||||
}
|
||||
|
||||
// 先校验记录是否已经存在
|
||||
OrderFile existingOrderFile = orderFileService.getOrderFileByFilePath(orderFile.getFilePath());
|
||||
if (existingOrderFile != null) {
|
||||
log.info("记录已存在,不再重复创建,订单号: {}, 文件路径: {}", orderFile.getOrderNo(), orderFile.getFilePath());
|
||||
return Result.succeed(existingOrderFile, "记录已存在,无需重复创建");
|
||||
}
|
||||
|
||||
// 设置订单相关信息
|
||||
orderFile.setOrderNo(order.getOrderNo());
|
||||
orderFile.setUserId(order.getUserId());
|
||||
|
||||
// 创建文件信息
|
||||
FileInfo fileInfo = fileCenterService.creatFileInfo(orderFile.getFilePath());
|
||||
if (fileInfo == null) {
|
||||
log.warn("文件信息创建失败,filePath: {}", orderFile.getFilePath());
|
||||
return Result.failed(orderFile,"文件信息创建失败");
|
||||
}
|
||||
|
||||
// 设置文件相关信息
|
||||
orderFile.setFileId(fileInfo.getId());
|
||||
orderFile.setFilePath(fileInfo.getPath());
|
||||
orderFile.setFileType(fileInfo.getContentType());
|
||||
orderFile.setTourismId(order.getTourismId());
|
||||
|
||||
// 保存记录
|
||||
boolean saved = orderFileService.save(orderFile);
|
||||
if (saved) {
|
||||
// 机库上报订单素材,更新订单状态为素材上传中,如果订单为设备执行中则更新,否则说明状态已更新
|
||||
@@ -201,7 +219,7 @@ public class OrderFileController {
|
||||
checkAndUpdateOrderStatus(order);
|
||||
|
||||
log.info("素材记录创建成功,订单号: {}, 文件ID: {}", orderFile.getOrderNo(), orderFile.getFileId());
|
||||
return Result.succeed(orderFile, "更新成功");
|
||||
return Result.succeed(orderFile, "创建成功");
|
||||
} else {
|
||||
log.error("素材记录保存失败,订单号: {}", orderFile.getOrderNo());
|
||||
return Result.failed(orderFile,"素材记录保存失败");
|
||||
@@ -299,4 +317,55 @@ public class OrderFileController {
|
||||
|
||||
}
|
||||
|
||||
@Operation(summary = "根据文件路径查询订单文件记录是否存在")
|
||||
@GetMapping("/path/{filePath}")
|
||||
public Result<OrderFile> getOrderFileByFilePath(@PathVariable("filePath") String filePath) {
|
||||
try {
|
||||
if (filePath == null || filePath.trim().isEmpty()) {
|
||||
return Result.failed("文件路径不能为空");
|
||||
}
|
||||
|
||||
OrderFile orderFile = orderFileService.getOrderFileByFilePath(filePath);
|
||||
if (orderFile == null) {
|
||||
return Result.failed("未找到对应的订单文件记录");
|
||||
}
|
||||
|
||||
// 设置文件查看URL
|
||||
orderFile.setViewUrl(fileCenterService.getViewUrlByPath(orderFile.getFilePath()));
|
||||
|
||||
// 设置压缩文件查看URL
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
fileMap.put("style", fileStyle);
|
||||
fileMap.put("path", orderFile.getFilePath());
|
||||
orderFile.setZipViewUrl(fileCenterService.getViewUrlByPathStyle(fileMap));
|
||||
|
||||
return Result.succeed(orderFile, "记录已存在");
|
||||
} catch (Exception e) {
|
||||
log.error("根据文件路径查询订单文件记录失败: filePath={}", filePath, e);
|
||||
return Result.failed("查询失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "检查文件路径对应的订单文件记录是否存在")
|
||||
@GetMapping("/exists/{filePath}")
|
||||
public Result<Boolean> checkOrderFileExists(@PathVariable("filePath") String filePath) {
|
||||
try {
|
||||
if (filePath == null || filePath.trim().isEmpty()) {
|
||||
return Result.failed("文件路径不能为空");
|
||||
}
|
||||
|
||||
OrderFile orderFile = orderFileService.getOrderFileByFilePath(filePath);
|
||||
boolean exists = orderFile != null;
|
||||
|
||||
if (exists) {
|
||||
return Result.succeed(true, "记录已存在");
|
||||
} else {
|
||||
return Result.succeed(false, "记录不存在");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("检查文件路径对应的订单文件记录是否存在失败: filePath={}", filePath, e);
|
||||
return Result.failed("检查失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -99,5 +99,12 @@ public interface IOrderFileService extends ISuperService<OrderFile> {
|
||||
* @return 文件数量
|
||||
*/
|
||||
Long countOrderFilesByType(String orderNo, String fileType);
|
||||
|
||||
/**
|
||||
* 根据文件路径查询订单文件资源
|
||||
* @param filePath 文件路径
|
||||
* @return 订单文件资源
|
||||
*/
|
||||
OrderFile getOrderFileByFilePath(String filePath);
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -118,4 +118,19 @@ public class OrderFileServiceImpl extends SuperServiceImpl<OrderFileMapper, Orde
|
||||
.eq("file_type", fileType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderFile getOrderFileByFilePath(String filePath) {
|
||||
try {
|
||||
log.debug("根据文件路径查询订单文件: filePath={}", filePath);
|
||||
return baseMapper.selectOne(
|
||||
new QueryWrapper<OrderFile>()
|
||||
.eq("file_path", filePath)
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error("根据文件路径查询订单文件失败: filePath={}", filePath, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -153,7 +153,8 @@ zlt:
|
||||
/api-device/token/query,
|
||||
/api-order/user/temp,
|
||||
/api-file/file/expires,
|
||||
/api-order/refund/auto
|
||||
/api-order/refund/auto,
|
||||
/api-order/files/exists/**
|
||||
auth:
|
||||
urlPermission:
|
||||
#是否开启url级别权限
|
||||
|
||||
Reference in New Issue
Block a user