Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
qingdaoMuseumPlatform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
qingdaoMuseumPlatform
Commits
ffe69e79
Commit
ffe69e79
authored
Jul 24, 2026
by
PC-20251223ZVQQ\Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运行分析修改
parent
2eb4581a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
device.ts
src/biz/device.ts
+4
-3
mqttClient.ts
src/biz/mqttClient.ts
+2
-1
report.ts
src/biz/report.ts
+9
-9
running.ts
src/biz/running.ts
+0
-0
No files found.
src/biz/device.ts
View file @
ffe69e79
...
@@ -94,10 +94,11 @@ export async function handleDevicePush(deviceId: string, data: any, deviceTime?:
...
@@ -94,10 +94,11 @@ export async function handleDevicePush(deviceId: string, data: any, deviceTime?:
[
"name"
]
[
"name"
]
);
);
// 调用空调控制(非文创区域才允许自动控温)
// 调用空调控制(非文创区域才允许自动控温)
if
(
regionRow
?.
data
&&
!
regionRow
.
data
.
name
?.
includes
(
"文创"
))
{
//
if (regionRow?.data && !regionRow.data.name?.includes("文创")) {
// 根据设备上报的数据,联动控制空调设备
// 根据设备上报的数据,联动控制空调设备
await
controlAcByEnvironment
(
deviceId
,
data
);
let
regionName
=
regionRow
?.
data
&&
!
regionRow
.
data
.
name
?
regionRow
.
data
.
name
:
""
;
}
await
controlAcByEnvironment
(
deviceId
,
data
,
regionName
);
// }
return
{
success
:
true
};
return
{
success
:
true
};
}
}
...
...
src/biz/mqttClient.ts
View file @
ffe69e79
...
@@ -107,7 +107,8 @@ export async function processDeviceData(message) {
...
@@ -107,7 +107,8 @@ export async function processDeviceData(message) {
// && !regionRow.data.name?.includes("社会责任厅")
// && !regionRow.data.name?.includes("社会责任厅")
// && !regionRow.data.name?.includes("新包装")
// && !regionRow.data.name?.includes("新包装")
// ) {
// ) {
await
controlAcByEnvironment
(
devEUI
,
data
);
let
regionName
=
regionRow
?.
data
&&
!
regionRow
.
data
.
name
?
regionRow
.
data
.
name
:
""
;
await
controlAcByEnvironment
(
devEUI
,
data
,
regionName
);
// }
// }
}
}
...
...
src/biz/report.ts
View file @
ffe69e79
...
@@ -11,7 +11,7 @@ import { selectDataListByParam } from "../data/findData";
...
@@ -11,7 +11,7 @@ import { selectDataListByParam } from "../data/findData";
const
HALL_NAMES
=
[
"A馆"
,
"B馆"
,
"C馆"
];
const
HALL_NAMES
=
[
"A馆"
,
"B馆"
,
"C馆"
];
const
HALL_KEYS
=
[
"total_a"
,
"total_b"
,
"total_c"
];
const
HALL_KEYS
=
[
"total_a"
,
"total_b"
,
"total_c"
];
const
TABLE_TITLE_LIST
=
[
"时间"
,
"运行时长"
,
"温度℃"
,
"客流量"
,
"
能耗kWh
"
];
const
TABLE_TITLE_LIST
=
[
"时间"
,
"运行时长"
,
"温度℃"
,
"客流量"
,
"
总耗电量
"
];
// ======================= 工具函数 =======================
// ======================= 工具函数 =======================
...
@@ -67,10 +67,10 @@ function fmtNum(val: number | null): string {
...
@@ -67,10 +67,10 @@ function fmtNum(val: number | null): string {
return
String
(
Math
.
round
(
val
*
10
)
/
10
);
return
String
(
Math
.
round
(
val
*
10
)
/
10
);
}
}
/** 格式化能耗,为 0 时返回 "——" */
/** 格式化能耗,
保留两位小数,
为 0 时返回 "——" */
function
fmtEnergy
(
val
:
number
):
string
{
function
fmtEnergy
(
val
:
number
):
string
{
if
(
val
<=
0
)
return
"——"
;
if
(
val
<=
0
)
return
"——"
;
return
Math
.
round
(
val
).
toLocaleString
(
)
+
"kwh"
;
return
String
(
Math
.
round
(
val
*
100
)
/
100
)
+
"kwh"
;
}
}
/** 按周七天生成日期数组 */
/** 按周七天生成日期数组 */
...
@@ -318,19 +318,19 @@ export async function getWeeklyReportData(weekOffset: number = 0): Promise<any>
...
@@ -318,19 +318,19 @@ export async function getWeeklyReportData(weekOffset: number = 0): Promise<any>
dayRunHours
>
0
?
fmtNum
(
dayRunHours
)
+
"h"
:
"——"
,
dayRunHours
>
0
?
fmtNum
(
dayRunHours
)
+
"h"
:
"——"
,
dayTempCount
>
0
?
fmtNum
(
dayTempSum
/
dayTempCount
)
:
"——"
,
dayTempCount
>
0
?
fmtNum
(
dayTempSum
/
dayTempCount
)
:
"——"
,
dayVisitor
>
0
?
String
(
dayVisitor
)
:
"——"
,
dayVisitor
>
0
?
String
(
dayVisitor
)
:
"——"
,
dayEnergy
>
0
?
String
(
Math
.
round
(
dayEnergy
/
24
*
100
)
/
100
)
:
"——"
,
dayEnergy
>
0
?
String
(
Math
.
round
(
dayEnergy
*
100
)
/
100
)
:
"——"
,
]);
]);
}
}
// ===== 第四步:汇总各馆 =====
// ===== 第四步:汇总各馆 =====
const
hallAvgTemp
=
hallTempCount
>
0
?
hallTempSum
/
hallTempCount
:
null
;
const
hallAvgTemp
=
hallTempCount
>
0
?
hallTempSum
/
hallTempCount
:
null
;
const
hallTempStr
=
hallAvgTemp
!=
null
?
fmtNum
(
hallAvgTemp
)
+
"°C"
:
"——"
;
const
hallTempStr
=
hallAvgTemp
!=
null
?
fmtNum
(
hallAvgTemp
)
+
"°C"
:
"——"
;
const
hallEnergyStr
=
fmtEnergy
(
hallTotalEnergy
/
7
);
const
hallEnergyStr
=
fmtEnergy
(
hallTotalEnergy
);
const
kllStr
=
hallTotalVisitor
>
0
?
String
(
Math
.
round
(
hallTotalVisitor
/
7
))
:
"——"
;
const
kllStr
=
hallTotalVisitor
>
0
?
String
(
Math
.
round
(
hallTotalVisitor
))
:
"——"
;
dataTotal
[
hallKey
]
=
{
nh
:
hallEnergyStr
,
kll
:
kllStr
,
jw
:
hallTempStr
};
dataTotal
[
hallKey
]
=
{
nh
:
hallEnergyStr
,
kll
:
kllStr
,
jw
:
hallTempStr
};
runDatas
[
hallName
]
=
{
runDatas
[
hallName
]
=
{
rjnh
:
hallTotalEnergy
>
0
?
fmtNum
(
hallTotalEnergy
/
7
)
+
" kWh"
:
"——"
,
rjnh
:
hallTotalEnergy
>
0
?
String
(
Math
.
round
(
hallTotalEnergy
*
100
)
/
100
)
+
" kWh"
:
"——"
,
tableData
:
[{
titleList
:
TABLE_TITLE_LIST
,
tableList
}],
tableData
:
[{
titleList
:
TABLE_TITLE_LIST
,
tableList
}],
totalData
:
[
totalData
:
[
"周累计"
,
"周累计"
,
...
@@ -355,8 +355,8 @@ export async function getWeeklyReportData(weekOffset: number = 0): Promise<any>
...
@@ -355,8 +355,8 @@ export async function getWeeklyReportData(weekOffset: number = 0): Promise<any>
// ===== 第五步:整体汇总 + 评价 =====
// ===== 第五步:整体汇总 + 评价 =====
dataTotal
.
ztyx
=
{
dataTotal
.
ztyx
=
{
nh
:
fmtEnergy
(
overallEnergy
/
7
),
nh
:
fmtEnergy
(
overallEnergy
),
kll
:
overallVisitor
>
0
?
String
(
Math
.
round
(
overallVisitor
/
7
))
:
"——"
,
kll
:
overallVisitor
>
0
?
String
(
Math
.
round
(
overallVisitor
))
:
"——"
,
jw
:
overallTempCount
>
0
jw
:
overallTempCount
>
0
?
fmtNum
(
overallTempSum
/
overallTempCount
)
+
"°C"
?
fmtNum
(
overallTempSum
/
overallTempCount
)
+
"°C"
:
"——"
,
:
"——"
,
...
...
src/biz/running.ts
View file @
ffe69e79
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment