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
6f3deb72
Commit
6f3deb72
authored
Sep 06, 2024
by
张森
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CAFS水箱 . CAFS泡沫罐信息API 与应急4.0同步
parent
a08a772f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
5 deletions
+59
-5
UnitEnum.java
...n/java/com/yeejoin/equipmanage/common/enums/UnitEnum.java
+2
-1
UnitTransformUtil.java
...m/yeejoin/equipmanage/common/utils/UnitTransformUtil.java
+35
-0
EmergencyServiceImpl.java
...eejoin/equipmanage/service/impl/EmergencyServiceImpl.java
+22
-4
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/UnitEnum.java
View file @
6f3deb72
...
...
@@ -18,7 +18,8 @@ public enum UnitEnum {
M
(
"m"
,
"米"
,
""
),
DM
(
"dm"
,
"分米"
,
""
),
CM
(
"cm"
,
"厘米"
,
""
),
MM
(
"mm"
,
"毫米"
,
""
);
MM
(
"mm"
,
"毫米"
,
""
),
LFM
(
"m³"
,
"立方米"
,
""
);
private
String
key
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/UnitTransformUtil.java
View file @
6f3deb72
...
...
@@ -152,4 +152,39 @@ public class UnitTransformUtil {
map
.
put
(
"unit"
,
"M"
);
return
map
;
}
public
static
Map
<
String
,
Object
>
transformValuesLFM
(
String
currentValue
,
String
currentUnit
,
String
minValue
,
String
maxValue
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
UnitEnum
.
LFM
.
getKey
().
equalsIgnoreCase
(
currentUnit
)
||
UnitEnum
.
LFM
.
getName
().
equals
(
currentUnit
))
{
BigDecimal
nowVal
=
new
BigDecimal
(
0
);
if
(
StringUtil
.
isNotEmpty
(
currentValue
)
&&
!
"--"
.
equals
(
currentValue
))
{
nowVal
=
new
BigDecimal
(
currentValue
);
map
.
put
(
"nowValue"
,
nowVal
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
}
else
{
map
.
put
(
"nowValue"
,
"--"
);
}
// status 中 0 表示过低;1 表示正常;2 表示过高
if
(
StringUtil
.
isNotEmpty
(
minValue
)
&&
!
"--"
.
equals
(
minValue
)
&&
StringUtil
.
isNotEmpty
(
maxValue
)
&&
!
"--"
.
equals
(
maxValue
)
&&
!
"null"
.
equalsIgnoreCase
(
minValue
)
&&
!
"null"
.
equalsIgnoreCase
(
maxValue
))
{
if
(
nowVal
.
compareTo
(
new
BigDecimal
(
minValue
))
<
0
)
{
map
.
put
(
"status"
,
"0"
);
map
.
put
(
"abs"
,
nowVal
.
divide
(
new
BigDecimal
(
maxValue
),
2
,
BigDecimal
.
ROUND_HALF_UP
).
movePointRight
(
2
));
}
else
if
(
nowVal
.
compareTo
(
new
BigDecimal
(
maxValue
))
>
0
)
{
// 当前值大于最大值
map
.
put
(
"status"
,
"2"
);
map
.
put
(
"abs"
,
100
);
}
else
if
(
nowVal
.
compareTo
(
new
BigDecimal
(
maxValue
))
==
0
)
{
map
.
put
(
"status"
,
"1"
);
map
.
put
(
"abs"
,
100
);
}
else
{
map
.
put
(
"status"
,
"1"
);
map
.
put
(
"abs"
,
nowVal
.
divide
(
new
BigDecimal
(
maxValue
),
2
,
BigDecimal
.
ROUND_HALF_UP
).
movePointRight
(
2
));
}
}
else
{
map
.
put
(
"status"
,
"--"
);
map
.
put
(
"abs"
,
"--"
);
}
}
map
.
put
(
"unit"
,
"m³"
);
return
map
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java
View file @
6f3deb72
...
...
@@ -6,10 +6,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog
;
import
com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO
;
import
com.yeejoin.equipmanage.common.enums.EmergencyEquipTypeEnum
;
import
com.yeejoin.equipmanage.common.enums.IndexStatusEnum
;
import
com.yeejoin.equipmanage.common.enums.PressurePumpAnalysisEnum
;
import
com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum
;
import
com.yeejoin.equipmanage.common.enums.*
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.utils.UnitTransformUtil
;
import
com.yeejoin.equipmanage.common.vo.IotDataVO
;
...
...
@@ -116,6 +113,10 @@ public class EmergencyServiceImpl implements IEmergencyService {
for
(
Map
<
String
,
Object
>
m
:
list
)
{
Map
<
String
,
Object
>
transResult
=
UnitTransformUtil
.
transformValues
(
String
.
valueOf
(
m
.
get
(
"value"
)),
String
.
valueOf
(
m
.
get
(
"unit"
)),
String
.
valueOf
(
m
.
get
(
"minLevel"
)),
String
.
valueOf
(
m
.
get
(
"maxLevel"
)));
if
(
UnitEnum
.
LFM
.
getKey
().
equalsIgnoreCase
(
String
.
valueOf
(
m
.
get
(
"unit"
)))
||
UnitEnum
.
LFM
.
getName
().
equals
(
String
.
valueOf
(
m
.
get
(
"unit"
))))
{
transResult
=
UnitTransformUtil
.
transformValuesLFM
(
String
.
valueOf
(
m
.
get
(
"value"
)),
String
.
valueOf
(
m
.
get
(
"unit"
)),
String
.
valueOf
(
m
.
get
(
"minLevel"
)),
String
.
valueOf
(
m
.
get
(
"maxLevel"
)));
}
m
.
put
(
"value"
,
transResult
.
get
(
"nowValue"
));
if
(
StringUtil
.
isNotEmpty
(
IndexStatusEnum
.
getEnumByKey
(
String
.
valueOf
(
transResult
.
get
(
"status"
)))))
{
m
.
put
(
"statusDesc"
,
IndexStatusEnum
.
getEnumByKey
(
String
.
valueOf
(
transResult
.
get
(
"status"
))).
getDescribe1
());
...
...
@@ -129,6 +130,11 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
else
{
m
.
put
(
"sxyl"
,
transResult
.
get
(
"abs"
));
}
if
(
UnitEnum
.
LFM
.
getKey
().
equalsIgnoreCase
(
String
.
valueOf
(
m
.
get
(
"unit"
)))
||
UnitEnum
.
LFM
.
getName
().
equals
(
String
.
valueOf
(
m
.
get
(
"unit"
))))
{
m
.
put
(
"abs"
,
transResult
.
get
(
"abs"
)
+
"%"
);
}
m
.
put
(
"unit"
,
transResult
.
get
(
"unit"
).
toString
());
}
}
return
Optional
.
ofNullable
(
list
).
orElse
(
Lists
.
newArrayList
());
...
...
@@ -158,6 +164,12 @@ public class EmergencyServiceImpl implements IEmergencyService {
Map
<
String
,
Object
>
transResult
=
UnitTransformUtil
.
transformValues
(
String
.
valueOf
(
m
.
get
(
"nowLevel"
)),
String
.
valueOf
(
m
.
get
(
"unit"
)),
String
.
valueOf
(
m
.
get
(
"minLevel"
)),
String
.
valueOf
(
m
.
get
(
"maxLevel"
)));
// m.put("nowLevel", transResult.get("nowValue"));
if
(
UnitEnum
.
LFM
.
getKey
().
equalsIgnoreCase
(
String
.
valueOf
(
m
.
get
(
"unit"
)))
||
UnitEnum
.
LFM
.
getName
().
equals
(
String
.
valueOf
(
m
.
get
(
"unit"
))))
{
transResult
=
UnitTransformUtil
.
transformValuesLFM
(
String
.
valueOf
(
m
.
get
(
"nowLevel"
)),
String
.
valueOf
(
m
.
get
(
"unit"
)),
String
.
valueOf
(
m
.
get
(
"minLevel"
)),
String
.
valueOf
(
m
.
get
(
"maxLevel"
)));
}
if
(
StringUtil
.
isNotEmpty
(
IndexStatusEnum
.
getEnumByKey
(
String
.
valueOf
(
transResult
.
get
(
"status"
)))))
{
m
.
put
(
"status"
,
IndexStatusEnum
.
getEnumByKey
(
String
.
valueOf
(
transResult
.
get
(
"status"
))).
getDescribe1
());
}
else
{
...
...
@@ -170,6 +182,12 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
else
{
m
.
put
(
"abs"
,
transResult
.
get
(
"abs"
));
}
if
(
UnitEnum
.
LFM
.
getKey
().
equalsIgnoreCase
(
String
.
valueOf
(
m
.
get
(
"unit"
)))
||
UnitEnum
.
LFM
.
getName
().
equals
(
String
.
valueOf
(
m
.
get
(
"unit"
))))
{
m
.
put
(
"abs"
,
transResult
.
get
(
"abs"
)
+
"%"
);
}
m
.
put
(
"unit"
,
transResult
.
get
(
"unit"
).
toString
());
m
.
put
(
"nowLevel"
,
transResult
.
get
(
"nowValue"
).
toString
());
}
}
return
page1
;
...
...
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