Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
1f31fc78
Commit
1f31fc78
authored
Oct 21, 2024
by
张森
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
站端设备平台v5>运行趋势>运行监视,消防水池绑定了2个探测器,水池液位错误显示其中1个探测器的液位而不是平均值
parent
6dc0d3c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
EquipmentSpecificSerivceImpl.java
...quipmanage/service/impl/EquipmentSpecificSerivceImpl.java
+36
-4
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java
View file @
1f31fc78
...
@@ -2564,6 +2564,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -2564,6 +2564,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
String
[]
split
=
equipInfo
.
getIotCode
().
split
(
","
);
String
[]
split
=
equipInfo
.
getIotCode
().
split
(
","
);
for
(
String
iotCode
:
split
)
{
for
(
String
iotCode
:
split
)
{
HashMap
<
String
,
List
<
BigDecimal
>>
stringIntegerHashMapIn
=
new
HashMap
<>();
String
equipIndexKey
=
iotCodeIndexKeyMap
.
get
(
iotCode
);
String
equipIndexKey
=
iotCodeIndexKeyMap
.
get
(
iotCode
);
String
[]
equipIndexKeyNew
=
equipIndexKey
.
split
(
","
);
String
[]
equipIndexKeyNew
=
equipIndexKey
.
split
(
","
);
if
(!
ObjectUtils
.
isEmpty
(
iotDataInfoMap
)
&&
iotDataInfoMap
.
containsKey
(
iotCode
))
{
if
(!
ObjectUtils
.
isEmpty
(
iotDataInfoMap
)
&&
iotDataInfoMap
.
containsKey
(
iotCode
))
{
...
@@ -2574,20 +2575,51 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -2574,20 +2575,51 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
for
(
String
key
:
equipIndexKeyNew
)
{
for
(
String
key
:
equipIndexKeyNew
)
{
if
(
mapList
.
containsKey
(
key
)
&&
!
ObjectUtils
.
isEmpty
(
mapList
.
get
(
key
)))
{
if
(
mapList
.
containsKey
(
key
)
&&
!
ObjectUtils
.
isEmpty
(
mapList
.
get
(
key
)))
{
if
(
stringIntegerHashMap
.
containsKey
(
dateX
))
{
if
(
stringIntegerHashMap
In
.
containsKey
(
dateX
))
{
stringIntegerHashMap
.
get
(
dateX
).
add
(
new
BigDecimal
(
mapList
.
get
(
key
)));
stringIntegerHashMap
In
.
get
(
dateX
).
add
(
new
BigDecimal
(
mapList
.
get
(
key
)));
}
else
{
}
else
{
List
<
BigDecimal
>
bigDecimals
=
new
ArrayList
<>();
List
<
BigDecimal
>
bigDecimals
=
new
ArrayList
<>();
bigDecimals
.
add
(
new
BigDecimal
(
mapList
.
get
(
key
)));
bigDecimals
.
add
(
new
BigDecimal
(
mapList
.
get
(
key
)));
stringIntegerHashMap
.
put
(
dateX
,
bigDecimals
);
stringIntegerHashMap
In
.
put
(
dateX
,
bigDecimals
);
}
}
}
}
}
}
}
}
}
}
}
for
(
Map
.
Entry
<
String
,
List
<
BigDecimal
>>
stringListEntry
:
stringIntegerHashMapIn
.
entrySet
())
{
BigDecimal
lastNum
=
BigDecimal
.
ZERO
;
List
<
BigDecimal
>
orDefault
=
stringListEntry
.
getValue
();
// 计算非空值的总和
BigDecimal
sum
=
orDefault
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
// 计算非空值的数量
long
count
=
orDefault
.
stream
().
filter
(
Objects:
:
nonNull
).
count
();
// 检查除数是否为0
BigDecimal
divide
;
if
(
count
==
0
)
{
// 如果非空值数量为0,可以选择返回0或其他默认值
divide
=
lastNum
;
}
else
{
// 否则,进行除法运算
divide
=
sum
.
divide
(
new
BigDecimal
(
count
),
2
,
RoundingMode
.
HALF_UP
);
}
if
(
stringIntegerHashMap
.
containsKey
(
stringListEntry
.
getKey
()))
{
stringIntegerHashMap
.
get
(
stringListEntry
.
getKey
()).
add
(
divide
);
}
else
{
List
<
BigDecimal
>
bigDecimals
=
new
ArrayList
<>();
bigDecimals
.
add
(
divide
);
stringIntegerHashMap
.
put
(
stringListEntry
.
getKey
(),
bigDecimals
);
}
}
}
List
<
Object
>
values
=
new
ArrayList
<>();
List
<
Object
>
values
=
new
ArrayList
<>();
BigDecimal
lastNum
=
BigDecimal
.
ZERO
;
BigDecimal
lastNum
=
BigDecimal
.
ZERO
;
for
(
int
i
=
0
;
i
<
allTimeList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
allTimeList
.
size
();
i
++)
{
...
...
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