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
529ffc78
Commit
529ffc78
authored
Feb 15, 2023
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:同步新旧接口,间隔不统一问题
parent
e1a99945
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
19 deletions
+62
-19
SupervisionConfigureController.java
...quipmanage/controller/SupervisionConfigureController.java
+18
-14
IEmergencyService.java
...va/com/yeejoin/equipmanage/service/IEmergencyService.java
+2
-0
EmergencyServiceImpl.java
...eejoin/equipmanage/service/impl/EmergencyServiceImpl.java
+42
-5
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/SupervisionConfigureController.java
View file @
529ffc78
...
...
@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.utils.*;
import
com.yeejoin.equipmanage.config.PersonIdentify
;
import
com.yeejoin.equipmanage.fegin.IotFeign
;
import
com.yeejoin.equipmanage.mapper.FireFightingSystemMapper
;
import
com.yeejoin.equipmanage.service.IEmergencyService
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService
;
import
com.yeejoin.equipmanage.service.IFireFightingSystemService
;
import
com.yeejoin.equipmanage.service.ISupervisionVideoService
;
...
...
@@ -23,7 +24,6 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.DateTimeUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
...
...
@@ -55,6 +55,9 @@ public class SupervisionConfigureController extends AbstractBaseController {
@Autowired
private
ISupervisionVideoService
supervisionVideoService
;
@Autowired
private
IEmergencyService
emergencyService
;
@Value
(
"${equipment.pressurepump.start}"
)
private
String
pressurePumpStart
;
...
...
@@ -276,14 +279,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
Page
<
Map
<
String
,
Object
>>
pressurePumpInfo
=
fireFightingSystemMapper
.
getPressurePumpInfo
(
page
,
bizOrgCode
,
null
);
List
<
Long
>
startTimeList
=
new
ArrayList
();
List
<
Long
>
stopTimeList
=
new
ArrayList
();
pressurePumpInfo
.
getRecords
().
stream
().
map
(
item
->
{
String
prefix
=
null
;
for
(
Map
<
String
,
Object
>
item
:
pressurePumpInfo
.
getRecords
())
{
item
.
put
(
"monthStartNum"
,
0
);
item
.
put
(
"halfHourStartNum"
,
0
);
item
.
put
(
"twoHourStartNum"
,
0
);
item
.
put
(
"fourHourStartNum"
,
0
);
item
.
put
(
"update_time"
,
"--"
);
item
.
put
(
"equipment_index_name"
,
"--"
);
String
prefix
=
null
;
String
suffix
=
null
;
String
iotCode
=
item
.
get
(
"iot_code"
).
toString
();
if
(
iotCode
.
length
()
>
8
)
{
...
...
@@ -426,17 +429,18 @@ public class SupervisionConfigureController extends AbstractBaseController {
}
else
{
item
.
put
(
"sort"
,
1
);
}
return
item
;
}).
collect
(
Collectors
.
toList
());
List
<
Long
>
startCollect
=
startTimeList
.
stream
().
sorted
(
Comparator
.
reverseOrder
()).
limit
(
1
).
collect
(
Collectors
.
toList
());
List
<
Long
>
stopCollect
=
stopTimeList
.
stream
().
sorted
(
Comparator
.
reverseOrder
()).
limit
(
1
).
collect
(
Collectors
.
toList
());
long
res
=
0L
;
if
(
startCollect
.
size
()
>
0
&&
stopCollect
.
size
()
>
0
)
{
res
=
Math
.
abs
(
startCollect
.
get
(
0
)
-
stopCollect
.
get
(
0
));
}
long
diffMinute
=
0L
;
diffMinute
=
res
/
1000
/
60
;
long
finalDiffMinute
=
diffMinute
;
}
// List<Long> startCollect = startTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList());
// List<Long> stopCollect = stopTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList());
// long res = 0L;
// if (startCollect.size() > 0 && stopCollect.size() > 0) {
// res = Math.abs(startCollect.get(0) - stopCollect.get(0));
// }
// long diffMinute = 0L;
// diffMinute = res / 1000 / 60;
// long finalDiffMinute = diffMinute;
double
finalDiffMinute
=
emergencyService
.
getPressurePumpIntervalTime
(
prefix
,
getAppKey
(),
getProduct
(),
getToken
());
pressurePumpInfo
.
getRecords
().
stream
(
).
map
(
item
->
{
item
.
put
(
"startAndStopInterval"
,
finalDiffMinute
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEmergencyService.java
View file @
529ffc78
...
...
@@ -58,5 +58,7 @@ public interface IEmergencyService {
List
<
Map
<
String
,
Object
>>
getPressurePumpDiagnosticAnalysis
(
String
equipmentCode
,
String
nameKeys
,
String
fieldKey
,
String
bizOrgCode
,
String
appKey
,
String
product
,
String
token
);
double
getPressurePumpIntervalTime
(
String
prefix
,
String
appKey
,
String
product
,
String
token
);
Page
<
Map
<
String
,
Object
>>
alarmList
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
,
List
<
String
>
types
,
List
<
String
>
emergencyLevels
,
String
name
,
Integer
cleanStatus
,
Integer
handleStatus
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java
View file @
529ffc78
...
...
@@ -393,16 +393,14 @@ public class EmergencyServiceImpl implements IEmergencyService {
String
value
=
intervalDataList
.
get
(
0
).
get
(
pressurePumpStart
);
List
<
Map
<
String
,
String
>>
falseDataList
=
intervalDataList
.
stream
().
filter
(
x
->
x
.
containsKey
(
"createdTime"
)
&&
"false"
.
equalsIgnoreCase
(
x
.
get
(
pressurePumpStart
))).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
String
>>
trueDataList
=
intervalDataList
.
stream
().
filter
(
x
->
x
.
containsKey
(
"createdTime"
)
&&
"true"
.
equalsIgnoreCase
(
x
.
get
(
pressurePumpStart
))).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
falseDataList
)
&&
!
CollectionUtils
.
isEmpty
(
trueDataList
))
{
intervalTime1
=
falseDataList
.
get
(
0
).
get
(
"createdTime"
);
if
(!
CollectionUtils
.
isEmpty
(
trueDataList
))
{
intervalTime2
=
trueDataList
.
get
(
0
).
get
(
"createdTime"
);
}
if
(
"true"
.
equalsIgnoreCase
(
value
))
{
if
(!
CollectionUtils
.
isEmpty
(
trueDataList
))
{
durationTime
=
intervalTime2
;
}
if
(!
CollectionUtils
.
isEmpty
(
falseDataList
))
{
try
{
durationTime
=
intervalTime2
;
intervalTime1
=
falseDataList
.
get
(
0
).
get
(
"createdTime"
);
String
stop5BeforeTime
=
DateUtils
.
convertDateToString
(
DateUtils
.
dateAddMinutes
(
DateUtils
.
convertStrToDate
(
intervalTime1
,
"yyyy-MM-dd HH:mm:ss"
),
-
5
),
"yyyy-MM-dd HH:mm:ss"
);
ResponseModel
pipeResponseModel
=
iotFeign
.
selectListNew
(
appKey
,
product
,
token
,
prefix
,
null
,
stop5BeforeTime
,
intervalTime2
,
null
,
"FHS_PipePressureDetector_PipePressure"
);
if
(
200
==
pipeResponseModel
.
getStatus
())
{
...
...
@@ -423,6 +421,10 @@ public class EmergencyServiceImpl implements IEmergencyService {
if
(!
CollectionUtils
.
isEmpty
(
falseDataList
)
&&
!
CollectionUtils
.
isEmpty
(
trueDataList
))
{
durationTime
=
trueDataList
.
get
(
0
).
get
(
"createdTime"
);
nowStrLong
=
falseDataList
.
get
(
0
).
get
(
"createdTime"
);
// 获取最接近最新启动信号,且时间大于启动信号的停止信号时间值
String
finalIntervalTime
=
intervalTime2
;
List
<
Map
<
String
,
String
>>
timeList
=
falseDataList
.
stream
().
filter
(
x
->
DateUtils
.
getDurationSecconds
(
finalIntervalTime
,
x
.
get
(
"createdTime"
),
"yyyy-MM-dd HH:mm:ss"
)
>=
0
).
collect
(
Collectors
.
toList
());
intervalTime1
=
timeList
.
get
(
timeList
.
size
()
-
1
).
get
(
"createdTime"
);
}
}
}
...
...
@@ -457,6 +459,41 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
@Override
public
double
getPressurePumpIntervalTime
(
String
prefix
,
String
appKey
,
String
product
,
String
token
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
ResponseModel
intervalResponseModel
=
iotFeign
.
topSingleField
(
appKey
,
product
,
token
,
"100"
,
prefix
,
null
,
null
,
pressurePumpStart
);
String
nowStrLong
=
DateUtils
.
getNowStrLong
();
String
intervalTime1
=
nowStrLong
;
String
intervalTime2
=
nowStrLong
;
if
(
200
==
intervalResponseModel
.
getStatus
())
{
String
json
=
JSON
.
toJSONString
(
intervalResponseModel
.
getResult
());
List
<
Map
<
String
,
String
>>
intervalDataList
=
(
List
<
Map
<
String
,
String
>>)
JSONArray
.
parse
(
json
);
if
(!
CollectionUtils
.
isEmpty
(
intervalDataList
))
{
String
value
=
intervalDataList
.
get
(
0
).
get
(
pressurePumpStart
);
List
<
Map
<
String
,
String
>>
falseDataList
=
intervalDataList
.
stream
().
filter
(
x
->
x
.
containsKey
(
"createdTime"
)
&&
"false"
.
equalsIgnoreCase
(
x
.
get
(
pressurePumpStart
))).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
String
>>
trueDataList
=
intervalDataList
.
stream
().
filter
(
x
->
x
.
containsKey
(
"createdTime"
)
&&
"true"
.
equalsIgnoreCase
(
x
.
get
(
pressurePumpStart
))).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
trueDataList
))
{
intervalTime2
=
trueDataList
.
get
(
0
).
get
(
"createdTime"
);
}
if
(
"true"
.
equalsIgnoreCase
(
value
))
{
if
(!
CollectionUtils
.
isEmpty
(
falseDataList
))
{
intervalTime1
=
falseDataList
.
get
(
0
).
get
(
"createdTime"
);
}
}
else
{
if
(!
CollectionUtils
.
isEmpty
(
falseDataList
)
&&
!
CollectionUtils
.
isEmpty
(
trueDataList
))
{
nowStrLong
=
falseDataList
.
get
(
0
).
get
(
"createdTime"
);
// 获取最接近最新启动信号,且时间大于启动信号的停止信号时间值
String
finalIntervalTime
=
intervalTime2
;
List
<
Map
<
String
,
String
>>
timeList
=
falseDataList
.
stream
().
filter
(
x
->
DateUtils
.
getDurationSecconds
(
finalIntervalTime
,
x
.
get
(
"createdTime"
),
"yyyy-MM-dd HH:mm:ss"
)
>=
0
).
collect
(
Collectors
.
toList
());
intervalTime1
=
timeList
.
get
(
timeList
.
size
()
-
1
).
get
(
"createdTime"
);
}
}
}
}
return
Math
.
ceil
((
double
)
Math
.
abs
(
DateUtils
.
getDurationSecconds
(
intervalTime1
,
intervalTime2
,
"yyyy-MM-dd HH:mm:ss"
))
/
60
);
}
@Override
public
Page
<
Map
<
String
,
Object
>>
alarmList
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
,
List
<
String
>
types
,
List
<
String
>
emergencyLevels
,
String
name
,
Integer
cleanStatus
,
Integer
handleStatus
)
{
return
emergencyMapper
.
alarmList
(
page
,
bizOrgCode
,
types
,
emergencyLevels
,
name
,
cleanStatus
,
handleStatus
);
}
...
...
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