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
b1af2f42
Commit
b1af2f42
authored
Feb 23, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
四横八纵稳压泵统计添加定时向缓存中存昨日启动次数任务
parent
f8e7f6a4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
1 deletion
+68
-1
PressurePumpRelateEnum.java
...join/equipmanage/common/enums/PressurePumpRelateEnum.java
+1
-0
EmergencyController.java
...m/yeejoin/equipmanage/controller/EmergencyController.java
+18
-0
IEmergencyService.java
...va/com/yeejoin/equipmanage/service/IEmergencyService.java
+3
-0
IPressurePumpService.java
...com/yeejoin/equipmanage/service/IPressurePumpService.java
+2
-0
EmergencyServiceImpl.java
...eejoin/equipmanage/service/impl/EmergencyServiceImpl.java
+42
-0
PressurePumpServiceImpl.java
...oin/equipmanage/service/impl/PressurePumpServiceImpl.java
+2
-1
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 @
b1af2f42
...
...
@@ -18,6 +18,7 @@ public enum PressurePumpRelateEnum {
TWO_HOUR
(
"2.0"
,
"2小时"
),
FOUR_HOUR
(
"4.0"
,
"4小时"
),
DAY_AVG
(
"-3"
,
"今日累计启停次数,取前3天平均值"
),
CRON_BEFORE_DAY
(
"-1"
,
"昨天定时任务"
),
START_FIVE
(
"5"
,
"稳压泵启动5分钟"
),
PIPE_PRESSURE_DIFF
(
"0.05"
,
"管网压力差判定标准,> 0.05Mpa 异常, <= 0.05 正常"
),
PRESSURE_PUMP_START_BEFORE_MINUTE
(
"-5"
,
"稳压泵启泵前分钟数"
),
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EmergencyController.java
View file @
b1af2f42
...
...
@@ -613,6 +613,24 @@ public class EmergencyController extends AbstractBaseController {
@PersonIdentify
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getPressurePumpDay"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"四横八纵-稳压泵诊断分析"
,
notes
=
"四横八纵-稳压泵诊断分析"
)
public
ResponseModel
getPressurePumpDay
(
@RequestParam
(
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
.
PersonIdentity
personIdentity
=
reginParams
.
getPersonIdentity
();
if
(!
ValidationUtil
.
isEmpty
(
personIdentity
))
{
bizOrgCode
=
personIdentity
.
getBizOrgCode
();
if
(
bizOrgCode
==
null
)
{
return
CommonResponseUtil
.
success
(
Collections
.
EMPTY_LIST
);
}
}
}
return
CommonResponseUtil
.
success
(
iEmergencyService
.
getPressurePumpDay
(
bizOrgCode
));
}
@PersonIdentify
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/alarmList"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"消防告警信息"
,
notes
=
"消防告警信息"
)
public
ResponseModel
alarmList
(
@RequestParam
Integer
pageNumber
,
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEmergencyService.java
View file @
b1af2f42
package
com
.
yeejoin
.
equipmanage
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.equipmanage.common.vo.PressurePumpCountVo
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -59,4 +60,6 @@ public interface IEmergencyService {
List
<
Map
<
String
,
Object
>>
getPressurePumpDiagnosticAnalysis
(
String
bizOrgCode
);
Page
<
Map
<
String
,
Object
>>
alarmList
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
,
List
<
String
>
types
,
List
<
String
>
emergencyLevels
,
String
name
,
Integer
cleanStatus
,
Integer
handleStatus
);
List
<
PressurePumpCountVo
>
getPressurePumpDay
(
String
bizOrgCode
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IPressurePumpService.java
View file @
b1af2f42
...
...
@@ -135,4 +135,6 @@ public interface IPressurePumpService {
Object
mapToObject
(
Map
<
String
,
String
>
map
,
Class
<?>
aClass
,
String
indexKey
)
throws
IllegalAccessException
,
InstantiationException
;
List
<
PressurePumpCountVo
>
getDayAvgDataList
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
infoCode
,
String
countRedisKey
,
String
equipmentCode
,
String
nameKey
,
String
bizOrgCode
,
long
countExpire
);
List
<
PressurePumpCountVo
>
getIotCountData
(
String
startTime
,
String
endTime
,
String
infoCode
,
String
countRedisKey
,
String
prefix
,
String
suffix
,
String
key
,
String
fieldKey
,
long
expire
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java
View file @
b1af2f42
...
...
@@ -2,6 +2,8 @@ package com.yeejoin.equipmanage.service.impl;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog
;
import
com.yeejoin.equipmanage.common.enums.IndexStatusEnum
;
import
com.yeejoin.equipmanage.common.enums.PressurePumpAnalysisEnum
;
...
...
@@ -19,9 +21,12 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.compress.utils.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
...
...
@@ -55,6 +60,9 @@ public class EmergencyServiceImpl implements IEmergencyService {
@Value
(
"${equipment.pressurepump.pipepressure}"
)
private
String
pressurePumpPipePressure
;
@Value
(
"${equipment.pressurepump.start.cron}"
)
private
String
pumpYesterdayStart
;
@Override
public
List
<
Map
<
String
,
Object
>>
getSystemState
(
String
bizOrgCode
)
{
List
<
Map
<
String
,
Object
>>
list
=
emergencyMapper
.
getSystemState
(
bizOrgCode
);
...
...
@@ -394,4 +402,38 @@ public class EmergencyServiceImpl implements IEmergencyService {
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
);
}
//稳压泵定时向缓存中存昨日启动次数任务
@Scheduled
(
cron
=
"${equipment.pressurepump.start.cron}"
)
private
void
stationDoubleReport
()
{
System
.
out
.
println
(
"开始定时存储昨日稳压泵启动次数,定时时间为:"
+
pumpYesterdayStart
);
getPressurePumpDay
(
null
);
}
@Override
public
List
<
PressurePumpCountVo
>
getPressurePumpDay
(
String
bizOrgCode
)
{
// 从 json 配置文件获取配置信息
List
<
Map
>
infoList
=
pressurePumpService
.
getNameKeyInfoList
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
());
List
<
PressurePumpCountVo
>
dataList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
infoList
))
{
try
{
Date
dateNow
=
DateUtils
.
convertStrToDate
(
DateUtils
.
getDateNowString
(),
DateUtils
.
DATE_PATTERN
);
Date
beforeDate
=
DateUtils
.
dateAddDays
(
dateNow
,
Integer
.
parseInt
(
PressurePumpRelateEnum
.
CRON_BEFORE_DAY
.
getValue
()));
// iot获取数据,返回并存储redis
String
startTime
=
DateUtils
.
convertDateToString
(
beforeDate
,
DateUtils
.
DATE_TIME_PATTERN
);
String
endTime
=
DateUtils
.
convertDateToString
(
dateNow
,
DateUtils
.
DATE_TIME_PATTERN
);
Map
map
=
infoList
.
get
(
0
);
String
equipmentCode
=
map
.
get
(
"equipmentCode"
).
toString
();
String
countRedisKey
=
map
.
get
(
"countRedisKey"
).
toString
();
long
countExpire
=
Long
.
parseLong
(
map
.
get
(
"countExpire"
).
toString
());
List
<
Map
<
String
,
Object
>>
pumpInfoList
=
equipmentSpecificSerivce
.
getFirePumpInfoEQ
(
equipmentCode
,
bizOrgCode
);
Object
iotCode
=
pumpInfoList
.
get
(
0
).
get
(
"iotCode"
);
String
prefix
=
ObjectUtils
.
isEmpty
(
iotCode
)
?
""
:
iotCode
.
toString
().
substring
(
0
,
8
);
dataList
=
pressurePumpService
.
getIotCountData
(
startTime
,
endTime
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
countRedisKey
,
prefix
,
null
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
(),
pressurePumpStart
,
countExpire
);
}
catch
(
ParseException
e
)
{
log
.
error
(
"redis存稳压泵昨天启动次数失败:{}"
,
e
.
getMessage
());
}
}
return
dataList
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/PressurePumpServiceImpl.java
View file @
b1af2f42
...
...
@@ -310,7 +310,8 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
Collections
.
emptyList
();
}
private
List
<
PressurePumpCountVo
>
getIotCountData
(
String
startTime
,
String
endTime
,
String
infoCode
,
String
countRedisKey
,
String
prefix
,
String
suffix
,
String
key
,
String
fieldKey
,
long
expire
)
{
@Override
public
List
<
PressurePumpCountVo
>
getIotCountData
(
String
startTime
,
String
endTime
,
String
infoCode
,
String
countRedisKey
,
String
prefix
,
String
suffix
,
String
key
,
String
fieldKey
,
long
expire
)
{
List
<
Map
<
String
,
String
>>
dataMapList
=
getIotCommonListData
(
startTime
,
endTime
,
prefix
,
suffix
,
key
,
fieldKey
);
if
(
CollectionUtils
.
isNotEmpty
(
dataMapList
)
&&
StringUtils
.
isNotBlank
(
key
))
{
Map
<
String
,
List
<
Map
<
String
,
String
>>>
dataMap
=
dataMapList
.
stream
().
filter
(
y
->
y
.
containsKey
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
())
&&
y
.
get
(
fieldKey
)
!=
null
&&
key
.
equalsIgnoreCase
(
y
.
get
(
fieldKey
))).
collect
(
Collectors
.
groupingBy
(
e
->
e
.
get
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
()).
substring
(
0
,
10
)));
...
...
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