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
e92d197f
Commit
e92d197f
authored
May 12, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改设备指标单位获取数据源
parent
db9af26e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+10
-8
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
e92d197f
...
...
@@ -609,7 +609,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
BigDecimal
minValue
=
getBigDecimal
(
map
.
get
(
"minValues"
));
BigDecimal
maxValue
=
getBigDecimal
(
map
.
get
(
"maxValues"
));
BigDecimal
nowValue
=
getBigDecimal
(
iotDataVO
.
getValue
());
BigDecimal
checkValue
=
checkUnit
(
iotDataVO
.
getKey
().
toLowerCase
()
,
nowValue
);
BigDecimal
checkValue
=
checkUnit
(
equipmentSpecificIndex
.
getEquipmentSpecificId
(),
iotDataVO
.
getKey
().
toLowerCase
()
,
nowValue
);
if
(!
ObjectUtils
.
isEmpty
(
checkValue
)){
nowValue
=
checkValue
;
}
...
...
@@ -682,7 +682,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
nowValue
=
add
.
divide
(
new
BigDecimal
(
i
),
2
,
RoundingMode
.
HALF_UP
);
}
BigDecimal
checkValue
=
checkUnit
(
iotDataVO
.
getKey
().
toLowerCase
()
,
nowValue
);
BigDecimal
checkValue
=
checkUnit
(
equipmentSpecificIndex
.
getEquipmentSpecificId
(),
iotDataVO
.
getKey
().
toLowerCase
()
,
nowValue
);
if
(!
ObjectUtils
.
isEmpty
(
checkValue
)){
nowValue
=
checkValue
;
}
...
...
@@ -724,14 +724,16 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return
alarmFlag
;
}
private
BigDecimal
checkUnit
(
String
indexKey
,
BigDecimal
nowValue
){
LambdaQueryWrapper
<
EquipmentIndex
>
eq
=
new
QueryWrapper
<
EquipmentIndex
>().
lambda
().
eq
(
EquipmentIndex:
:
getPerfQuotaDefinitionId
,
indexKey
);
EquipmentIndex
one
=
equipmentIndexService
.
getOne
(
eq
);
if
(!
ObjectUtils
.
isEmpty
(
one
)
||
!
ObjectUtils
.
isEmpty
(
one
.
getUnit
())){
if
(
UnitEnum
.
MM
.
getKey
().
equalsIgnoreCase
(
one
.
getUnit
())
||
UnitEnum
.
MM
.
getName
().
equals
(
one
.
getUnit
())){
private
BigDecimal
checkUnit
(
Long
equipmentSpecificId
,
String
indexKey
,
BigDecimal
nowValue
){
LambdaQueryWrapper
<
EquipmentSpecificIndex
>
lambda
=
new
QueryWrapper
<
EquipmentSpecificIndex
>().
lambda
();
lambda
.
eq
(
EquipmentSpecificIndex
::
getEquipmentSpecificId
,
equipmentSpecificId
);
lambda
.
eq
(
EquipmentSpecificIndex
::
getEquipmentIndexKey
,
indexKey
);
EquipmentSpecificIndex
equipmentSpecificIndex
=
equipmentSpecificIndexMapper
.
selectOne
(
lambda
);
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndex
)
||
!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndex
.
getUnit
())){
if
(
UnitEnum
.
MM
.
getKey
().
equalsIgnoreCase
(
equipmentSpecificIndex
.
getUnit
())
||
UnitEnum
.
MM
.
getName
().
equals
(
equipmentSpecificIndex
.
getUnit
())){
BigDecimal
divide
=
new
BigDecimal
(
1000
);
nowValue
=
nowValue
.
divide
(
divide
,
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
else
if
(
UnitEnum
.
CM
.
getKey
().
equalsIgnoreCase
(
one
.
getUnit
())
||
UnitEnum
.
CM
.
getName
().
equals
(
one
.
getUnit
())){
}
else
if
(
UnitEnum
.
CM
.
getKey
().
equalsIgnoreCase
(
equipmentSpecificIndex
.
getUnit
())
||
UnitEnum
.
CM
.
getName
().
equals
(
equipmentSpecificIndex
.
getUnit
())){
BigDecimal
divide
=
new
BigDecimal
(
100
);
nowValue
=
nowValue
.
divide
(
divide
,
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
...
...
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