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
9a59a898
Commit
9a59a898
authored
Feb 27, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
稳压泵启停列表、最近一次启停间隔、近三日平均启动次数计算逻辑修改
parent
d9a2570b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
25 deletions
+44
-25
PressurePumpRelateEnum.java
...join/equipmanage/common/enums/PressurePumpRelateEnum.java
+1
-0
SupervisionConfigureController.java
...quipmanage/controller/SupervisionConfigureController.java
+0
-0
ISupervisionVideoService.java
...yeejoin/equipmanage/service/ISupervisionVideoService.java
+2
-0
EmergencyServiceImpl.java
...eejoin/equipmanage/service/impl/EmergencyServiceImpl.java
+3
-1
PressurePumpServiceImpl.java
...oin/equipmanage/service/impl/PressurePumpServiceImpl.java
+4
-22
SupervisionVideoServiceImpl.java
...equipmanage/service/impl/SupervisionVideoServiceImpl.java
+34
-2
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 @
9a59a898
...
@@ -13,6 +13,7 @@ public enum PressurePumpRelateEnum {
...
@@ -13,6 +13,7 @@ public enum PressurePumpRelateEnum {
ONE_HOUR_MINUTE
(
"60"
,
"60分钟"
),
ONE_HOUR_MINUTE
(
"60"
,
"60分钟"
),
IOT_INDEX_VALUE_TRUE
(
"true"
,
"物联指标值:true"
),
IOT_INDEX_VALUE_TRUE
(
"true"
,
"物联指标值:true"
),
IOT_INDEX_VALUE_FALSE
(
"false"
,
"物联指标值:false"
),
IOT_INDEX_VALUE_FALSE
(
"false"
,
"物联指标值:false"
),
ONE_TIME
(
"1"
,
"物联指标最近1条数据"
),
HALF_HOUR
(
"0.5"
,
"半小时"
),
HALF_HOUR
(
"0.5"
,
"半小时"
),
ONE_HOUR
(
"1.0"
,
"1小时"
),
ONE_HOUR
(
"1.0"
,
"1小时"
),
TWO_HOUR
(
"2.0"
,
"2小时"
),
TWO_HOUR
(
"2.0"
,
"2小时"
),
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/SupervisionConfigureController.java
View file @
9a59a898
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/ISupervisionVideoService.java
View file @
9a59a898
...
@@ -21,4 +21,6 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> {
...
@@ -21,4 +21,6 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> {
List
<
String
>
queryVideoAllId
(
String
bizOrgCode
);
List
<
String
>
queryVideoAllId
(
String
bizOrgCode
);
Page
<
Map
<
String
,
Object
>>
queryPumpInfo
(
Page
page
,
String
bizOrgCode
);
Page
<
Map
<
String
,
Object
>>
queryPumpInfo
(
Page
page
,
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
selectPressureDetails
(
String
bizOrgCode
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java
View file @
9a59a898
...
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
...
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
...
@@ -280,7 +281,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
...
@@ -280,7 +281,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
}
}
}
}
}
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_DAY_AVG
.
setValue
(
Math
.
round
(
dayAvgFrequency
.
get
()
/
Math
.
abs
(
Integer
.
parseInt
(
PressurePumpRelateEnum
.
DAY_AVG
.
getValue
()))));
DecimalFormat
df
=
new
DecimalFormat
(
"0.0"
);
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_DAY_AVG
.
setValue
(
df
.
format
(
Double
.
valueOf
(
dayAvgFrequency
.
get
())
/
Double
.
valueOf
(
Math
.
abs
(
Integer
.
parseInt
(
PressurePumpRelateEnum
.
DAY_AVG
.
getValue
())))));
// 6. 管网压力状态
// 6. 管网压力状态
double
pressureDiff
=
pressurePumpService
.
getAllPressurePumpPipePressureDiff
(
dataList
,
dataPipeList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP_START_BEFORE_MINUTE
.
getValue
());
double
pressureDiff
=
pressurePumpService
.
getAllPressurePumpPipePressureDiff
(
dataList
,
dataPipeList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP_START_BEFORE_MINUTE
.
getValue
());
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_PIPE
.
setValue
(
pressureDiff
>
Double
.
parseDouble
(
PressurePumpRelateEnum
.
PIPE_PRESSURE_DIFF
.
getValue
())
?
PressurePumpRelateEnum
.
PIPE_PRESSURE_ABNORMAL_STATUS
.
getValue
()
:
PressurePumpRelateEnum
.
PIPE_PRESSURE_NORMAL_STATUS
.
getValue
());
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_PIPE
.
setValue
(
pressureDiff
>
Double
.
parseDouble
(
PressurePumpRelateEnum
.
PIPE_PRESSURE_DIFF
.
getValue
())
?
PressurePumpRelateEnum
.
PIPE_PRESSURE_ABNORMAL_STATUS
.
getValue
()
:
PressurePumpRelateEnum
.
PIPE_PRESSURE_NORMAL_STATUS
.
getValue
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/PressurePumpServiceImpl.java
View file @
9a59a898
...
@@ -148,28 +148,10 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
...
@@ -148,28 +148,10 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
public
long
getAllPressurePumpStartStopInterval
(
List
<
IotDataVO
>
dataList
,
List
<
IotDataVO
>
dataListFilterTrue
,
List
<
IotDataVO
>
dataListFilterFalse
,
String
nowStrLong
)
{
public
long
getAllPressurePumpStartStopInterval
(
List
<
IotDataVO
>
dataList
,
List
<
IotDataVO
>
dataListFilterTrue
,
List
<
IotDataVO
>
dataListFilterFalse
,
String
nowStrLong
)
{
String
intervalTime1
=
nowStrLong
;
String
intervalTime1
=
nowStrLong
;
String
intervalTime2
=
nowStrLong
;
String
intervalTime2
=
nowStrLong
;
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
if
(!
ObjectUtils
.
isEmpty
(
dataListFilterTrue
)
&&
dataListFilterTrue
.
size
()
>
2
)
{
IotDataVO
iotDataVO
=
dataList
.
get
(
0
);
//获取启动列表中
String
value
=
iotDataVO
.
getValue
().
toString
();
intervalTime1
=
dataListFilterTrue
.
get
(
0
).
getCreatedTime
();
String
createdTime
=
iotDataVO
.
getCreatedTime
();
intervalTime2
=
dataListFilterTrue
.
get
(
1
).
getCreatedTime
();
if
(
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
().
equalsIgnoreCase
(
value
))
{
intervalTime1
=
createdTime
;
if
(
CollectionUtils
.
isNotEmpty
(
dataListFilterFalse
))
{
// 获取最新的停止时间
intervalTime2
=
dataListFilterFalse
.
get
(
0
).
getCreatedTime
();
}
}
else
{
if
(
CollectionUtils
.
isNotEmpty
(
dataListFilterFalse
)
&&
CollectionUtils
.
isNotEmpty
(
dataListFilterTrue
))
{
// 获取最新的启动时间
intervalTime1
=
dataListFilterTrue
.
get
(
0
).
getCreatedTime
();
// 获取大于启动信号,且最近停止信号的时间
String
finalIntervalTime
=
intervalTime1
;
List
<
IotDataVO
>
timeList
=
dataListFilterFalse
.
stream
().
filter
(
x
->
DateUtils
.
getDurationSeconds
(
finalIntervalTime
,
x
.
getCreatedTime
(),
DateUtils
.
DATE_TIME_PATTERN
)
>=
0
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
timeList
))
{
intervalTime2
=
timeList
.
get
(
timeList
.
size
()
-
1
).
getCreatedTime
();
}
}
}
}
}
// 结果向上取整
// 结果向上取整
double
ceil
=
Math
.
ceil
(
Math
.
abs
(
DateUtils
.
getDurationSeconds
(
intervalTime1
,
intervalTime2
,
DateUtils
.
DATE_TIME_PATTERN
))
*
1.0
/
Double
.
parseDouble
(
PressurePumpRelateEnum
.
ONE_HOUR_MINUTE
.
getValue
()));
double
ceil
=
Math
.
ceil
(
Math
.
abs
(
DateUtils
.
getDurationSeconds
(
intervalTime1
,
intervalTime2
,
DateUtils
.
DATE_TIME_PATTERN
))
*
1.0
/
Double
.
parseDouble
(
PressurePumpRelateEnum
.
ONE_HOUR_MINUTE
.
getValue
()));
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/SupervisionVideoServiceImpl.java
View file @
9a59a898
...
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
...
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -128,7 +128,8 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
...
@@ -128,7 +128,8 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
log
.
error
(
"近3天平均启动次数获取失败-->dayAvgFrequency:{}"
,
e
.
getMessage
());
log
.
error
(
"近3天平均启动次数获取失败-->dayAvgFrequency:{}"
,
e
.
getMessage
());
}
}
int
dayAvgStartNum
=
Math
.
round
(
dayAvgFrequency
.
get
()
/
Math
.
abs
(
Integer
.
parseInt
(
PressurePumpRelateEnum
.
DAY_AVG
.
getValue
())));
DecimalFormat
df
=
new
DecimalFormat
(
"0.0"
);
String
dayAvgStartNum
=
df
.
format
(
Double
.
valueOf
(
dayAvgFrequency
.
get
())
/
Double
.
valueOf
(
Math
.
abs
(
Integer
.
parseInt
(
PressurePumpRelateEnum
.
DAY_AVG
.
getValue
()))));
pressurePumpInfo
=
fireFightingSystemMapper
.
getPressurePumpInfo
(
page
,
bizOrgCode
,
null
);
pressurePumpInfo
=
fireFightingSystemMapper
.
getPressurePumpInfo
(
page
,
bizOrgCode
,
null
);
String
prefix
=
null
;
String
prefix
=
null
;
for
(
Map
<
String
,
Object
>
item
:
pressurePumpInfo
.
getRecords
())
{
for
(
Map
<
String
,
Object
>
item
:
pressurePumpInfo
.
getRecords
())
{
...
@@ -228,4 +229,35 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
...
@@ -228,4 +229,35 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
return
pressurePumpInfo
;
return
pressurePumpInfo
;
}
}
@Override
public
List
<
Map
<
String
,
Object
>>
selectPressureDetails
(
String
bizOrgCode
)
{
List
<
Map
<
String
,
Object
>>
pressurePumpInfo
=
fireFightingSystemMapper
.
selectAllPressurePumpInfo
(
bizOrgCode
);
pressurePumpInfo
.
stream
().
map
(
item
->
{
String
prefix
=
null
;
String
suffix
=
null
;
String
iotCode
=
item
.
get
(
"iot_code"
).
toString
();
if
(
iotCode
.
length
()
>
8
)
{
prefix
=
iotCode
.
substring
(
0
,
8
);
suffix
=
iotCode
.
substring
(
8
);
}
else
{
throw
new
BadRequest
(
"装备物联编码错误,请确认!"
);
}
//通过iot最近一次的启动和停止时间
List
<
Map
<
String
,
String
>>
trueData
=
pressurePumpService
.
getIotTopSingleField
(
PressurePumpRelateEnum
.
ONE_TIME
.
getValue
(),
prefix
,
suffix
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
(),
pressurePumpStart
);
List
<
Map
<
String
,
String
>>
falseData
=
pressurePumpService
.
getIotTopSingleField
(
PressurePumpRelateEnum
.
ONE_TIME
.
getValue
(),
prefix
,
suffix
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_FALSE
.
getValue
(),
pressurePumpStart
);
if
(!
ObjectUtils
.
isEmpty
(
trueData
)){
item
.
put
(
"startTime"
,
trueData
.
get
(
0
).
get
(
"createdTime"
));
}
else
{
item
.
put
(
"startTime"
,
""
);
}
if
(!
ObjectUtils
.
isEmpty
(
falseData
)){
item
.
put
(
"stopTime"
,
falseData
.
get
(
0
).
get
(
"createdTime"
));
}
else
{
item
.
put
(
"stopTime"
,
""
);
}
return
item
;
}).
collect
(
Collectors
.
toList
());
return
pressurePumpInfo
;
}
}
}
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