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
516cb67e
Commit
516cb67e
authored
Feb 22, 2023
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:优化管网压力JSON配置
parent
f624be12
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
41 deletions
+57
-41
PressurePumpRelateEnum.java
...join/equipmanage/common/enums/PressurePumpRelateEnum.java
+1
-1
IPressurePumpService.java
...com/yeejoin/equipmanage/service/IPressurePumpService.java
+1
-1
EmergencyServiceImpl.java
...eejoin/equipmanage/service/impl/EmergencyServiceImpl.java
+2
-1
PressurePumpServiceImpl.java
...oin/equipmanage/service/impl/PressurePumpServiceImpl.java
+50
-37
SupervisionVideoServiceImpl.java
...equipmanage/service/impl/SupervisionVideoServiceImpl.java
+1
-1
nameKeyInfo.json
...oot-system-equip/src/main/resources/json/nameKeyInfo.json
+2
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/PressurePumpRelateEnum.java
View file @
516cb67e
...
@@ -18,7 +18,7 @@ public enum PressurePumpRelateEnum {
...
@@ -18,7 +18,7 @@ public enum PressurePumpRelateEnum {
TWO_HOUR
(
"2.0"
,
"2小时"
),
TWO_HOUR
(
"2.0"
,
"2小时"
),
FOUR_HOUR
(
"4.0"
,
"4小时"
),
FOUR_HOUR
(
"4.0"
,
"4小时"
),
START_FIVE
(
"5"
,
"稳压泵启动5分钟"
),
START_FIVE
(
"5"
,
"稳压泵启动5分钟"
),
PIPE_PRESSURE_DIFF
(
"0.5"
,
"管网压力差判定标准,> 0.05Mpa 异常, <= 0.05 正常"
),
PIPE_PRESSURE_DIFF
(
"0.
0
5"
,
"管网压力差判定标准,> 0.05Mpa 异常, <= 0.05 正常"
),
PRESSURE_PUMP_START_BEFORE_MINUTE
(
"-5"
,
"稳压泵启泵前分钟数"
),
PRESSURE_PUMP_START_BEFORE_MINUTE
(
"-5"
,
"稳压泵启泵前分钟数"
),
PIPE_PRESSURE_NORMAL_STATUS
(
"正常"
,
"稳压泵管网压力正常状态"
),
PIPE_PRESSURE_NORMAL_STATUS
(
"正常"
,
"稳压泵管网压力正常状态"
),
PIPE_PRESSURE_ABNORMAL_STATUS
(
"异常"
,
"稳压泵管网压力异常状态"
),
PIPE_PRESSURE_ABNORMAL_STATUS
(
"异常"
,
"稳压泵管网压力异常状态"
),
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IPressurePumpService.java
View file @
516cb67e
...
@@ -131,5 +131,5 @@ public interface IPressurePumpService {
...
@@ -131,5 +131,5 @@ public interface IPressurePumpService {
* @param aClass
* @param aClass
* @return
* @return
*/
*/
Object
mapToObject
(
Map
<
String
,
String
>
map
,
Class
<?>
aClass
)
throws
IllegalAccessException
,
InstantiationException
;
Object
mapToObject
(
Map
<
String
,
String
>
map
,
Class
<?>
aClass
,
String
indexKey
)
throws
IllegalAccessException
,
InstantiationException
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java
View file @
516cb67e
...
@@ -228,6 +228,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
...
@@ -228,6 +228,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
if
(!
CollectionUtils
.
isEmpty
(
infoList
))
{
if
(!
CollectionUtils
.
isEmpty
(
infoList
))
{
Map
map
=
infoList
.
get
(
0
);
Map
map
=
infoList
.
get
(
0
);
String
equipmentCode
=
map
.
get
(
"equipmentCode"
).
toString
();
String
equipmentCode
=
map
.
get
(
"equipmentCode"
).
toString
();
String
pipePressureEquipmentCode
=
map
.
get
(
"pipePressureEquipmentCode"
).
toString
();
String
faultNameKey
=
map
.
get
(
"faultNameKey"
).
toString
();
String
faultNameKey
=
map
.
get
(
"faultNameKey"
).
toString
();
String
top
=
map
.
get
(
"top"
).
toString
();
String
top
=
map
.
get
(
"top"
).
toString
();
// 1. 判断稳压泵整体是否故障
// 1. 判断稳压泵整体是否故障
...
@@ -238,7 +239,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
...
@@ -238,7 +239,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
List
<
IotDataVO
>
dataList
=
dataMap
.
get
(
"dataList"
);
List
<
IotDataVO
>
dataList
=
dataMap
.
get
(
"dataList"
);
List
<
IotDataVO
>
dataListFilterTrue
=
dataMap
.
get
(
"dataListFilterTrue"
);
List
<
IotDataVO
>
dataListFilterTrue
=
dataMap
.
get
(
"dataListFilterTrue"
);
List
<
IotDataVO
>
dataListFilterFalse
=
dataMap
.
get
(
"dataListFilterFalse"
);
List
<
IotDataVO
>
dataListFilterFalse
=
dataMap
.
get
(
"dataListFilterFalse"
);
Map
<
String
,
List
<
IotDataVO
>>
dataPipMap
=
pressurePumpService
.
getDataList
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
e
quipmentCode
,
top
,
pressurePumpPipePressure
,
bizOrgCode
,
null
);
Map
<
String
,
List
<
IotDataVO
>>
dataPipMap
=
pressurePumpService
.
getDataList
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
pipePressureE
quipmentCode
,
top
,
pressurePumpPipePressure
,
bizOrgCode
,
null
);
List
<
IotDataVO
>
dataPipeList
=
dataPipMap
.
get
(
"dataList"
);
List
<
IotDataVO
>
dataPipeList
=
dataPipMap
.
get
(
"dataList"
);
String
nowStrLong
=
DateUtils
.
getDateNowString
();
String
nowStrLong
=
DateUtils
.
getDateNowString
();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/PressurePumpServiceImpl.java
View file @
516cb67e
...
@@ -174,21 +174,16 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
...
@@ -174,21 +174,16 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
// 过滤指定值数据
// 过滤指定值数据
List
<
IotDataVO
>
dataListFilterTrue
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
());
List
<
IotDataVO
>
dataListFilterTrue
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
());
List
<
IotDataVO
>
dataListFilterFalse
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_FALSE
.
getValue
());
List
<
IotDataVO
>
dataListFilterFalse
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_FALSE
.
getValue
());
// 通过 equipmentCode 获取装备
//获取iot的数据
List
<
Map
<
String
,
Object
>>
pumpInfoList
=
equipmentSpecificSerivce
.
getFirePumpInfoEQ
(
equipmentCode
,
bizOrgCode
);
if
(
pressurePumpPipePressure
.
equalsIgnoreCase
(
nameKey
))
{
if
(!
ObjectUtils
.
isEmpty
(
pumpInfoList
))
{
if
(
ObjectUtils
.
isEmpty
(
dataList
)
||
dataList
.
size
()
<
2
)
{
iotCode
=
pumpInfoList
.
get
(
0
).
get
(
"iotCode"
).
toString
();
dataList
=
getIotData
(
top
,
nameKey
,
equipmentCode
,
bizOrgCode
);
if
(
iotCode
.
length
()
>
8
)
{
}
String
prefix
=
iotCode
.
substring
(
0
,
8
);
}
else
{
//获取iot的数据
if
(
ObjectUtils
.
isEmpty
(
dataList
)
||
ObjectUtils
.
isEmpty
(
dataListFilterTrue
)
||
ObjectUtils
.
isEmpty
(
dataListFilterFalse
))
{
if
(
ObjectUtils
.
isEmpty
(
dataList
)
||
ObjectUtils
.
isEmpty
(
dataListFilterTrue
)
||
ObjectUtils
.
isEmpty
(
dataListFilterFalse
)){
dataList
=
getIotData
(
top
,
nameKey
,
equipmentCode
,
bizOrgCode
);
dataList
=
getIotData
(
top
,
prefix
,
nameKey
);
dataListFilterTrue
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
());
// 过滤物联指定值数据
dataListFilterFalse
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_FALSE
.
getValue
());
dataListFilterTrue
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
());
dataListFilterFalse
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_FALSE
.
getValue
());
}
}
else
{
throw
new
BadRequest
(
"装备物联编码错误,请确认!"
);
}
}
}
}
map
.
put
(
"dataList"
,
dataList
);
map
.
put
(
"dataList"
,
dataList
);
...
@@ -197,49 +192,60 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
...
@@ -197,49 +192,60 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
map
;
return
map
;
}
}
private
List
<
IotDataVO
>
getIotData
(
String
top
,
String
prefix
,
String
indexKey
)
{
private
List
<
IotDataVO
>
getIotData
(
String
top
,
String
nameKey
,
String
equipmentCode
,
String
bizOrgCode
)
{
List
<
IotDataVO
>
dataList
=
new
ArrayList
<>();
List
<
IotDataVO
>
dataList
=
new
ArrayList
<>();
List
<
Map
<
String
,
String
>>
iotDataList
=
getIotTopSingleField
(
top
,
prefix
,
null
,
null
,
indexKey
);
// 通过 equipmentCode 获取装备
//将iot的List<Map<String, String>>转化为List<IotDataVO>类型
List
<
Map
<
String
,
Object
>>
pumpInfoList
=
equipmentSpecificSerivce
.
getFirePumpInfoEQ
(
equipmentCode
,
bizOrgCode
);
iotDataList
.
stream
().
forEach
(
e
->
{
if
(!
ObjectUtils
.
isEmpty
(
pumpInfoList
))
{
try
{
String
iotCode
=
pumpInfoList
.
get
(
0
).
get
(
"iotCode"
).
toString
();
IotDataVO
iotDataVO
=
(
IotDataVO
)
mapToObject
(
e
,
IotDataVO
.
class
);
if
(
iotCode
.
length
()
>
8
)
{
dataList
.
add
(
iotDataVO
);
String
prefix
=
iotCode
.
substring
(
0
,
8
);
}
catch
(
Exception
el
)
{
List
<
Map
<
String
,
String
>>
iotDataList
=
getIotTopSingleField
(
top
,
prefix
,
null
,
null
,
nameKey
);
throw
new
BadRequest
(
"IOT数据类型转换失败"
);
//将iot的List<Map<String, String>>转化为List<IotDataVO>类型
iotDataList
.
forEach
(
e
->
{
try
{
IotDataVO
iotDataVO
=
(
IotDataVO
)
mapToObject
(
e
,
IotDataVO
.
class
,
nameKey
);
dataList
.
add
(
iotDataVO
);
}
catch
(
Exception
el
)
{
throw
new
BadRequest
(
"IOT数据类型转换失败"
);
}
});
}
}
});
}
else
{
throw
new
BadRequest
(
"装备物联编码错误,请确认!"
);
}
return
dataList
;
return
dataList
;
}
}
/**
/**
* map 转化为对象
* map 转化为对象
* @param map 需要转化的参数
*
* @param map 需要转化的参数
* @param aClass 要转化成的对象
* @param aClass 要转化成的对象
* @return 转化成功的对象
* @return 转化成功的对象
* @throws IllegalAccessException 非法访问异常
* @throws IllegalAccessException 非法访问异常
* @throws InstantiationException 实例化异常
* @throws InstantiationException 实例化异常
*/
*/
@Override
@Override
public
Object
mapToObject
(
Map
<
String
,
String
>
map
,
Class
<?>
aClass
)
throws
IllegalAccessException
,
InstantiationException
{
public
Object
mapToObject
(
Map
<
String
,
String
>
map
,
Class
<?>
aClass
,
String
indexKey
)
throws
IllegalAccessException
,
InstantiationException
{
if
(
map
.
isEmpty
())
{
if
(
map
.
isEmpty
())
{
return
null
;
return
null
;
}
}
Object
o
=
aClass
.
newInstance
();
Object
o
=
aClass
.
newInstance
();
Field
[]
declaredFields
=
o
.
getClass
().
getDeclaredFields
();
Field
[]
declaredFields
=
o
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
declaredFields
)
{
for
(
Field
field
:
declaredFields
)
{
int
modifiers
=
field
.
getModifiers
();
int
modifiers
=
field
.
getModifiers
();
if
(
Modifier
.
isStatic
(
modifiers
)
||
Modifier
.
isFinal
(
modifiers
))
{
if
(
Modifier
.
isStatic
(
modifiers
)
||
Modifier
.
isFinal
(
modifiers
))
{
continue
;
continue
;
}
}
// (此处如果不设置 无法获取对象的私有属性)
// (此处如果不设置 无法获取对象的私有属性)
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
if
(
"key"
.
equals
(
field
.
getName
()))
{
if
(
"key"
.
equals
(
field
.
getName
()))
{
field
.
set
(
o
,
pressurePumpStart
);
field
.
set
(
o
,
indexKey
);
}
else
if
(
"value"
.
equals
(
field
.
getName
()))
{
}
else
if
(
"value"
.
equals
(
field
.
getName
()))
{
field
.
set
(
o
,
map
.
get
(
pressurePumpStart
));
field
.
set
(
o
,
map
.
get
(
indexKey
));
}
else
{
}
else
{
field
.
set
(
o
,
map
.
get
(
field
.
getName
()));
field
.
set
(
o
,
map
.
get
(
field
.
getName
()));
}
}
}
}
...
@@ -257,6 +263,13 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
...
@@ -257,6 +263,13 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
dataList
.
stream
().
filter
(
x
->
value
.
equalsIgnoreCase
(
x
.
getValue
().
toString
())).
collect
(
Collectors
.
toList
());
return
dataList
.
stream
().
filter
(
x
->
value
.
equalsIgnoreCase
(
x
.
getValue
().
toString
())).
collect
(
Collectors
.
toList
());
}
}
private
List
<
IotDataVO
>
getDataListFilter
(
List
<
IotDataVO
>
dataList
,
Date
beforeDate
)
{
if
(
beforeDate
!=
null
)
{
return
dataList
.
stream
().
filter
(
x
->
DateUtils
.
dateCompare
(
DateUtils
.
longStr2Date
(
x
.
getCreatedTime
()),
beforeDate
)
>=
0
).
collect
(
Collectors
.
toList
());
}
return
dataList
;
}
private
List
<
Map
<
String
,
String
>>
getIotDataFilterList
(
List
<
Map
<
String
,
String
>>
iotDataList
,
String
value
,
Date
beforeDate
)
{
private
List
<
Map
<
String
,
String
>>
getIotDataFilterList
(
List
<
Map
<
String
,
String
>>
iotDataList
,
String
value
,
Date
beforeDate
)
{
if
(
beforeDate
!=
null
)
{
if
(
beforeDate
!=
null
)
{
return
iotDataList
.
stream
().
filter
(
x
->
x
.
containsKey
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
())
&&
DateUtils
.
dateCompare
(
DateUtils
.
longStr2Date
(
x
.
get
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
())),
beforeDate
)
>=
0
&&
value
.
equalsIgnoreCase
(
x
.
get
(
pressurePumpPipePressure
))).
collect
(
Collectors
.
toList
());
return
iotDataList
.
stream
().
filter
(
x
->
x
.
containsKey
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
())
&&
DateUtils
.
dateCompare
(
DateUtils
.
longStr2Date
(
x
.
get
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
())),
beforeDate
)
>=
0
&&
value
.
equalsIgnoreCase
(
x
.
get
(
pressurePumpPipePressure
))).
collect
(
Collectors
.
toList
());
...
@@ -302,7 +315,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
...
@@ -302,7 +315,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
}
}
@Override
@Override
public
double
getAllPressurePumpPipePressureDiff
(
List
<
IotDataVO
>
dataList
,
List
<
IotDataVO
>
dataPipeList
,
String
minutes
)
{
public
double
getAllPressurePumpPipePressureDiff
(
List
<
IotDataVO
>
dataList
,
List
<
IotDataVO
>
dataPipeList
,
String
minutes
)
{
if
(
CollectionUtils
.
isNotEmpty
(
dataList
)
&&
CollectionUtils
.
isNotEmpty
(
dataPipeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
dataList
)
&&
CollectionUtils
.
isNotEmpty
(
dataPipeList
))
{
IotDataVO
iotDataVO
=
dataList
.
get
(
0
);
IotDataVO
iotDataVO
=
dataList
.
get
(
0
);
String
value
=
iotDataVO
.
getValue
().
toString
();
String
value
=
iotDataVO
.
getValue
().
toString
();
...
@@ -313,7 +326,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
...
@@ -313,7 +326,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
try
{
try
{
Date
stop5BeforeDate
=
DateUtils
.
dateAddMinutes
(
DateUtils
.
convertStrToDate
(
createdTime
,
DateUtils
.
DATE_TIME_PATTERN
),
Integer
.
parseInt
(
minutes
));
Date
stop5BeforeDate
=
DateUtils
.
dateAddMinutes
(
DateUtils
.
convertStrToDate
(
createdTime
,
DateUtils
.
DATE_TIME_PATTERN
),
Integer
.
parseInt
(
minutes
));
// 获取指定之前时间,指定值数据
// 获取指定之前时间,指定值数据
List
<
IotDataVO
>
dataFilterList
=
getDataListFilter
(
dataPipeList
,
value
,
stop5BeforeDate
);
List
<
IotDataVO
>
dataFilterList
=
getDataListFilter
(
dataPipeList
,
stop5BeforeDate
);
if
(
CollectionUtils
.
isNotEmpty
(
dataFilterList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
dataFilterList
))
{
double
val1
=
Double
.
parseDouble
(
dataPipeList
.
get
(
0
).
getValue
().
toString
());
double
val1
=
Double
.
parseDouble
(
dataPipeList
.
get
(
0
).
getValue
().
toString
());
double
val2
=
Double
.
parseDouble
(
dataFilterList
.
get
(
dataFilterList
.
size
()
-
1
).
getValue
().
toString
());
double
val2
=
Double
.
parseDouble
(
dataFilterList
.
get
(
dataFilterList
.
size
()
-
1
).
getValue
().
toString
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/SupervisionVideoServiceImpl.java
View file @
516cb67e
...
@@ -164,7 +164,7 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
...
@@ -164,7 +164,7 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
List
<
Map
<
String
,
String
>>
iotDataList
=
pressurePumpService
.
getIotTopSingleField
(
top
,
prefix
,
null
,
null
,
pressurePumpStart
);
List
<
Map
<
String
,
String
>>
iotDataList
=
pressurePumpService
.
getIotTopSingleField
(
top
,
prefix
,
null
,
null
,
pressurePumpStart
);
iotDataList
.
stream
().
forEach
(
e
->
{
iotDataList
.
stream
().
forEach
(
e
->
{
try
{
try
{
IotDataVO
iotDataVO
=
(
IotDataVO
)
pressurePumpService
.
mapToObject
(
e
,
IotDataVO
.
class
);
IotDataVO
iotDataVO
=
(
IotDataVO
)
pressurePumpService
.
mapToObject
(
e
,
IotDataVO
.
class
,
pressurePumpStart
);
DataList
.
add
(
iotDataVO
);
DataList
.
add
(
iotDataVO
);
}
catch
(
Exception
el
)
{
}
catch
(
Exception
el
)
{
throw
new
RuntimeException
();
throw
new
RuntimeException
();
...
...
amos-boot-system-equip/src/main/resources/json/nameKeyInfo.json
View file @
516cb67e
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
"faultNameKey"
:
"FHS_PressurePump_Fault,FHS_PressurePump_RunFault,FHS_PressurePump_OverLoadFault"
,
"faultNameKey"
:
"FHS_PressurePump_Fault,FHS_PressurePump_RunFault,FHS_PressurePump_OverLoadFault"
,
"expire"
:
14400
,
"expire"
:
14400
,
"equipmentCode"
:
"92010800KAL44"
,
"equipmentCode"
:
"92010800KAL44"
,
"pipePressureEquipmentCode"
:
"92011000T5Q44"
,
"top"
:
"100"
"top"
:
"100"
}
}
]
]
\ No newline at end of file
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