fix[文件服务]:修复传参名称不匹配导致文件加载不出来问题

This commit is contained in:
2025-02-25 11:37:50 +08:00
parent 969c5246d5
commit 2bca1983ec
8 changed files with 25 additions and 30 deletions
@@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
@@ -71,10 +72,7 @@ public class ApiDeviceController {
JsonObject jsonObject;
String property = MapUtil.getStrValue(param, "control");
String value = MapUtil.getStrValue(param, "order_no");
// System.out.println("order_no"+value);
if (value == null || "".equals(value)) {
return Result.succeed("暂未开放控制权限");
}
Assert.notNull(value,"任务编号不能为空");
Result res = orderCenterService.getOrderExecStatus(value);
if (res.getResp_code() != null && res.getResp_code() == 1){
@@ -84,10 +82,9 @@ public class ApiDeviceController {
if (ControlEnum.contains(ControlEnum.valueOf(property.toUpperCase()))) {
jsonObject = gson.fromJson(controlMessageConstant.CONTROL_MESSAGE_MAP.get(property), JsonObject.class);
if (value != null || value != "") {
JsonObject data = jsonObject.getAsJsonObject("data");
data.addProperty("order_no", value);
}
JsonObject data = jsonObject.getAsJsonObject("data");
data.addProperty("order_no", value);
}else {
return Result.succeed("暂未开放控制权限");
}
@@ -108,7 +108,7 @@ public class FileController {
}
@GetMapping("/files/path/style")
public String getViewUrlByPathStyle(@RequestParam Map<String, Object> params) {
public String getViewUrlByPathStyle(@RequestParam Map<String, String> params) {
return fileService.getZipViewUrlByPath(MapUtils.getString(params,"path"),MapUtils.getString(params, "style"));
}
@@ -4,11 +4,11 @@ server:
spring:
application:
name: file-center
# cloud:
# nacos:
# discovery:
# ip: 119.45.169.13
cloud:
nacos:
discovery:
ip: 119.45.169.13
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
max-file-size: 20MB
max-request-size: 20MB
@@ -18,7 +18,6 @@ import com.central.order.service.IOrderFileService;
import com.central.order.service.IOrderService;
import com.central.order.service.IQrCodeService;
import com.central.order.service.ITourismService;
import com.central.order.util.ContentTypeUtil;
import com.wechat.pay.java.core.exception.ServiceException;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.*;
@@ -153,9 +152,8 @@ public class OrderController {
Map<String,String> imgMap = new HashMap<>();
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
imgMap.put("url", url.replace(cdnOssUrl,cdnUrl));
imgMap.put("contentType", ContentTypeUtil.getContentTypeFromUrl(url));
fileMap.put("name",orderFile.getFilePath());
imgMap.put("contentType", orderFile.getFileType());
fileMap.put("path",orderFile.getFilePath());
imgMap.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
resultList.add(imgMap);
}
@@ -247,9 +245,9 @@ public class OrderController {
LoginAppUser user = LoginUserContextHolder.getUser();
QrCode qrCode = qrCodeService.getByCodeId(codeId);
Assert.notNull(qrCode,"二维码CODEID不能为空");
Order order = orderService.getOrderyStatusAndUser(OrderStatus.PAID.getId(), user.getId());
Order order = orderService.getOrderByStatusAndUser(OrderStatus.PAID.getId(), user.getId());
Map<String, Object> map = new HashMap<>();
map.put("price",Integer.parseInt(qrCode.getPrice()) /100);
map.put("price",appendPriceStr(qrCode.getPrice()));
//如果用户存在已支付订单,则查询当前排在第几
if (order != null){
Integer count = orderService.getOrderRankingByOrderId(order.getId());
@@ -68,7 +68,7 @@ public interface IOrderService extends ISuperService<Order> {
Long getOrderCountByStatus(Integer status);
Order getOrderyStatusAndUser(Integer status, Long userId);
Order getOrderByStatusAndUser(Integer status, Long userId);
/**
* 获取user订单记录
@@ -171,7 +171,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
}
@Override
public Order getOrderyStatusAndUser(Integer status, Long userId) {
public Order getOrderByStatusAndUser(Integer status, Long userId) {
return baseMapper.selectOne(new QueryWrapper<Order>()
.eq("order_status", status)
.eq("user_id", userId));
@@ -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:
@@ -1,10 +1,10 @@
########################## bootstrap级别通用配置 ##########################
# 默认开发环境
spring.profiles.active=dev
spring.profiles.active=prod
##### nacos(注册中心和配置中心)地址
#spring.cloud.nacos.server-addr=47.94.136.130:8848
spring.cloud.nacos.server-addr=127.0.0.1:8848
spring.cloud.nacos.server-addr=47.94.136.130:8848
#spring.cloud.nacos.server-addr=127.0.0.1:8848
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos
spring.cloud.nacos.config.file-extension=yml