fix(优化):订单统计按时间升序,新增设备视频流生成,新增设备推流地址缓存逻辑

This commit is contained in:
2025-05-12 17:52:17 +08:00
parent 5ba0d7549e
commit ab5e5414fc
12 changed files with 60 additions and 41 deletions
@@ -2,6 +2,7 @@ package com.central.device.controller;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.alibaba.nacos.shaded.com.google.gson.JsonElement;
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
import com.central.common.model.Result;
import com.central.device.feign.OrderCenterService;
@@ -140,7 +141,7 @@ public class ApiDeviceController {
data.addProperty("file_md5", lineFile.getSign());
// 设置设备视频流地址
try {
data.addProperty("stream_urls", liveStreamService.generateStreamUrls(deviceId).toString());
data.add("stream_urls", gson.fromJson(liveStreamService.generateStreamUrls(deviceId).toJSONString(), JsonElement.class));
} catch (Exception e) {
log.error("生成设备推流/拉流地址异常: deviceId={}, error={}", deviceId, e.getMessage(), e);
data.addProperty("stream_urls", "{}"); // 或者空字符串 ""
@@ -4,10 +4,10 @@ server:
spring:
application:
name: device-center
cloud:
nacos:
discovery:
ip: 119.45.169.13
# cloud:
# nacos:
# discovery:
# ip: 119.45.169.13
# cloud:
# nacos:
# discovery:
@@ -59,7 +59,7 @@ public interface OrderStatisticsMapper extends BaseMapper<OrderStatistics> {
" AND o.code_id = #{qrcodeId}",
"</if>",
"GROUP BY ${groupField}",
"ORDER BY totalOrders DESC",
"ORDER BY o.create_time ASC",
"</script>"
})
List<Map<String, Object>> getOrderStatisticsByGroup(OrderStatisticsQuery query);
@@ -4,10 +4,10 @@ server:
spring:
application:
name: user-center
cloud:
nacos:
discovery:
ip: 124.222.128.40
# cloud:
# nacos:
# discovery:
# ip: 124.222.128.40
# cloud:
# nacos:
# discovery:
@@ -1,11 +1,11 @@
########################## 统一变量配置 ##########################
##### 数据库配置
zlt.datasource.ip=127.0.0.1
zlt.datasource.username=root
zlt.datasource.password=root
#zlt.datasource.ip=sh-cdb-i6yxaaec.sql.tencentcdb.com:58797
#zlt.datasource.ip=127.0.0.1
#zlt.datasource.username=root
#zlt.datasource.password=ZXC_zxc!@#123+
#zlt.datasource.password=root
zlt.datasource.ip=sh-cdb-i6yxaaec.sql.tencentcdb.com:58797
zlt.datasource.username=root
zlt.datasource.password=ZXC_zxc!@#123+
##### redis配置
spring.data.redis.host=192.168.2.20
@@ -1,13 +1,13 @@
########################## bootstrap级别通用配置 ##########################
# 默认开发环境
spring.profiles.active=prod
spring.profiles.active=dev
##### 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
+4 -4
View File
@@ -8,10 +8,10 @@ server:
spring:
application:
name: uaa-server
cloud:
nacos:
discovery:
ip: 124.222.128.40
# cloud:
# nacos:
# discovery:
# ip: 124.222.128.40
encrypt:
key-store:
@@ -12,7 +12,7 @@ const Settings: LayoutSettings & {
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
title: 'Iking-Platform',
title: 'G-Fly',
pwa: false,
logo: './logo.png',
iconfontUrl: '',
@@ -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,
},
},
@@ -103,4 +103,20 @@ server {
return 204;
}
}
# API 代理配置
location /api-device/ {
proxy_pass http://119.45.169.13:9900/api-device/; # 替换为您的后端API地址
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 处理 OPTIONS 请求
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
return 204;
}
}
}
@@ -9,6 +9,7 @@ export async function wayline(params?: { [key: string]: string | number }) {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
console.log(result);
return { data: result.data, total: result.count };
}
@@ -232,6 +232,7 @@ declare namespace API {
}
interface OrderDetail {
mobile: ReactNode;
orderNo: string;
orderStatus: number;
orderAmount: string;