Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
288fc5a9
Commit
288fc5a9
authored
Sep 18, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
18e2fd0f
c56be71a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
220 additions
and
51 deletions
+220
-51
CommonConstans.java
.../amos/boot/module/jxiop/biz/constants/CommonConstans.java
+3
-0
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+16
-12
ESEquipmentsDTO.java
...ejoin/amos/boot/module/jxiop/biz/dto/ESEquipmentsDTO.java
+29
-0
TemporaryDataMapper.java
...os/boot/module/jxiop/biz/mapper2/TemporaryDataMapper.java
+4
-1
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+44
-4
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+101
-33
MonitoringServiceIMQTTmpl.java
...ule/jxiop/biz/service/impl/MonitoringServiceIMQTTmpl.java
+2
-1
TemporaryDataMapper.xml
...src/main/resources/mapper/cluster/TemporaryDataMapper.xml
+21
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/constants/CommonConstans.java
View file @
288fc5a9
...
...
@@ -90,6 +90,9 @@ public class CommonConstans {
public
static
final
String
QueryStringEquipmentNumberKeyword
=
"equipmentNumber.keyword"
;
public
static
final
String
QueryStringValue
=
"value"
;
public
static
final
String
QueryStringValueKeyword
=
"value.keyword"
;
public
static
final
String
QueryStringValueLabel
=
"valueLabel"
;
public
static
final
String
QueryStringValueLabelKeyword
=
"valueLabel.keyword"
;
public
static
final
String
QueryStringDataType
=
"dataType"
;
public
static
final
String
QueryStringDisplayName
=
"displayName"
;
public
static
final
String
QueryStringDisplayNameKeyword
=
"displayName.keyword"
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitorFanIdxController.java
View file @
288fc5a9
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.extra.pinyin.PinyinUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -16,6 +17,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.DeaviationRateDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.ESEquipmentsDTO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.EquipAlarmEventServiceImpl
;
...
...
@@ -99,12 +101,13 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"风机布置图 - 风机状态列表"
)
@GetMapping
(
"/getFanStatusList"
)
public
ResponseModel
<
IPage
<
ESEquipments
>>
getFanStatusList
(
@RequestParam
(
value
=
"stationId"
,
required
=
false
)
String
stationId
,
public
ResponseModel
<
IPage
<
ESEquipments
DTO
>>
getFanStatusList
(
@RequestParam
(
value
=
"stationId"
,
required
=
false
)
String
stationId
,
@RequestParam
(
value
=
"current"
,
required
=
false
)
int
current
,
@RequestParam
(
value
=
"size"
,
required
=
false
)
int
size
)
{
List
<
ESEquipments
>
fanStatusList
=
monitorFanIndicator
.
getFanStatusList
(
stationId
);
Page
<
ESEquipments
>
page
=
new
Page
<>(
current
,
size
);
List
<
ESEquipments
>
collect
=
fanStatusList
.
stream
()
List
<
ESEquipmentsDTO
>
fanStatusList
=
monitorFanIndicator
.
getFanStatusList
(
stationId
);
Page
<
ESEquipmentsDTO
>
page
=
new
Page
<>(
current
,
size
);
List
<
ESEquipmentsDTO
>
collect
=
fanStatusList
.
stream
()
.
sorted
(
Comparator
.
comparing
(
t
->
Integer
.
parseInt
(
t
.
getEquipmentNumber
())))
.
skip
((
long
)
(
current
-
1
)
*
size
)
.
limit
(
size
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -117,17 +120,17 @@ public class MonitorFanIdxController extends BaseController {
@ApiOperation
(
value
=
"风机布置图 - 风机状态图片"
)
@GetMapping
(
"/getFanStatusListImage"
)
public
ResponseModel
<
IPage
<
HashMap
<
String
,
String
>>>
getFanStatusListImages
(
@RequestParam
(
value
=
"stationId"
,
required
=
false
)
String
stationId
){
List
<
ESEquipments
>
fanStatusList
=
monitorFanIndicator
.
getFanStatusList
(
stationId
);
List
<
ESEquipments
>
collect
=
fanStatusList
.
stream
()
List
<
ESEquipments
DTO
>
fanStatusList
=
monitorFanIndicator
.
getFanStatusList
(
stationId
);
List
<
ESEquipments
DTO
>
collect
=
fanStatusList
.
stream
()
.
limit
(
999
)
.
collect
(
Collectors
.
toList
());
IPage
<
HashMap
<
String
,
String
>>
page
=
new
Page
<>();
HashMap
<
String
,
String
>
hashMap
=
new
HashMap
<>();
List
<
ESEquipments
>
indexDtoList
=
collect
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments
:
:
getEquipmentNumber
)).
collect
(
Collectors
.
toList
());
List
<
ESEquipments
DTO
>
indexDtoList
=
collect
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipmentsDTO
:
:
getEquipmentNumber
)).
collect
(
Collectors
.
toList
());
//获取拼音首字母
String
prefix
=
commonService
.
getFanDevicePrefix
(
stationId
);
for
(
int
i
=
1
;
i
<=
indexDtoList
.
size
();
i
++)
{
ESEquipments
ESEquipments
=
indexDtoList
.
get
(
i
-
1
);
ESEquipments
DTO
ESEquipments
=
indexDtoList
.
get
(
i
-
1
);
hashMap
.
put
(
"url"
+
i
,
fanStatusImagePathPrefix
+
"/"
+
"风机-"
+
ESEquipments
.
getAddress
()+
".gif"
);
hashMap
.
put
(
"name"
+
i
,
prefix
+
ESEquipments
.
getEquipmentNumber
());
//用于参数传递
...
...
@@ -491,9 +494,10 @@ public class MonitorFanIdxController extends BaseController {
@ApiOperation
(
value
=
"故障记录API"
)
@GetMapping
(
"/alarmEventtList"
)
public
ResponseModel
<
ResultsData
>
getAlarmEventList
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"stationId"
)
String
stationId
,
@RequestParam
(
value
=
"type"
)
String
type
)
{
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"stationId"
)
String
stationId
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
type
=
StrUtil
.
isEmpty
(
type
)
?
"0"
:
type
;
ResultsData
resultsData
=
new
ResultsData
();
if
(
type
.
equals
(
"0"
)){
resultsData
=
monitorFanIndicatorImpl
.
getAlarmEventList
(
current
,
size
,
stationId
);
...
...
@@ -695,7 +699,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"详情基础信息"
)
@GetMapping
(
"/getStatisticsInfo"
)
public
ResponseModel
<
Map
<
String
,
String
>>
getStatisticsInfo
(
@RequestParam
(
value
=
"equipmentIndexName"
,
required
=
false
)
String
equipmentIndexName
,
public
ResponseModel
<
Map
<
String
,
Object
>>
getStatisticsInfo
(
@RequestParam
(
value
=
"equipmentIndexName"
,
required
=
false
)
String
equipmentIndexName
,
@RequestParam
(
value
=
"stationId"
,
required
=
false
)
String
stationId
,
@RequestParam
(
value
=
"stationType"
,
required
=
false
)
String
stationType
)
{
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/ESEquipmentsDTO.java
0 → 100644
View file @
288fc5a9
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
dto
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
ESEquipmentsDTO
{
private
String
id
;
private
String
address
;
private
String
dataType
;
private
String
equipmentSpecificName
;
private
String
gatewayId
;
private
String
isAlarm
;
private
Date
createdTime
;
private
String
unit
;
private
String
value
;
private
Float
valueDouble
;
private
String
valueLabel
;
private
String
traceId
;
private
String
equipmentIndexName
;
private
String
equipmentNumber
;
private
String
frontModule
;
private
String
systemType
;
private
String
pictureName
;
private
String
displayName
;
private
String
state
;
private
String
color
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/TemporaryDataMapper.java
View file @
288fc5a9
...
...
@@ -12,7 +12,10 @@ import java.util.Map;
public
interface
TemporaryDataMapper
extends
BaseMapper
<
TemporaryData
>
{
List
<
Map
<
String
,
String
>>
timingTemporarysSorageData
(
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
);
List
<
Map
<
String
,
Object
>>
timingTemporarysSorageData
(
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
);
List
<
Map
<
String
,
Object
>>
timingTemporarysSorageDataByIndexName
(
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
,
@RequestParam
(
value
=
"equipmentIndexName"
)
String
equipmentIndexName
);
Map
<
String
,
String
>
getStatisticsInfo
(
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
,
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
288fc5a9
...
...
@@ -18,10 +18,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.initdata.StationCacheDataInit;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.repository.ESEquipmentsRepository
;
import
com.yeejoin.amos.component.influxdb.InfluxdbUtil
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.MatchPhraseQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.index.query.WildcardQueryBuilder
;
import
org.elasticsearch.index.query.*
;
import
org.elasticsearch.script.Script
;
import
org.elasticsearch.script.ScriptType
;
import
org.elasticsearch.search.aggregations.Aggregation
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.Aggregations
;
...
...
@@ -598,4 +597,45 @@ public class CommonServiceImpl {
}
return
null
;
}
public
<
T
>
List
<
T
>
getListDataByCondtionsByValueNotEqValueLabel
(
Map
<
String
,
List
<
String
>>
mustQuerCondtion
,
Map
<
String
,
String
>
shouldQuerCondtion
,
Map
<
String
,
String
>
notMustQuerCondtion
,
Class
<
T
>
tClass
)
{
BoolQueryBuilder
queryBuilder
=
QueryBuilders
.
boolQuery
();
if
(!
ObjectUtils
.
isEmpty
(
mustQuerCondtion
))
{
for
(
String
key
:
mustQuerCondtion
.
keySet
())
{
List
<
String
>
va
=
mustQuerCondtion
.
get
(
key
);
queryBuilder
.
must
(
QueryBuilders
.
termsQuery
(
key
,
va
));
}
}
if
(!
ObjectUtils
.
isEmpty
(
shouldQuerCondtion
))
{
for
(
String
key
:
shouldQuerCondtion
.
keySet
())
{
queryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
shouldQuerCondtion
.
get
(
key
)));
}
}
if
(!
ObjectUtils
.
isEmpty
(
notMustQuerCondtion
))
{
for
(
String
key
:
notMustQuerCondtion
.
keySet
())
{
queryBuilder
.
mustNot
(
QueryBuilders
.
termsQuery
(
key
,
notMustQuerCondtion
.
get
(
key
)));
}
}
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"param1"
,
""
);
Script
script
=
new
Script
(
ScriptType
.
INLINE
,
Script
.
DEFAULT_SCRIPT_LANG
,
"doc['value.keyword'].value != doc['valueLabel.keyword'].value + params.param1"
,
params
);
ScriptQueryBuilder
scriptQueryBuilder
=
QueryBuilders
.
scriptQuery
(
script
);
queryBuilder
.
filter
(
scriptQueryBuilder
);
Query
query
=
new
NativeSearchQueryBuilder
()
.
withQuery
(
queryBuilder
)
.
build
();
query
.
setTrackTotalHits
(
true
);
SearchHits
search
=
elasticsearchTemplate
.
search
(
query
,
tClass
);
if
(
search
.
hasSearchHits
())
{
List
<
SearchHit
<
T
>>
searchHitList
=
search
.
getSearchHits
();
List
<
T
>
list
=
searchHitList
.
stream
().
map
(
hit
->
hit
.
getContent
()).
collect
(
Collectors
.
toList
());
return
list
;
}
return
null
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
View file @
288fc5a9
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.Query
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.BeanUtils
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
...
...
@@ -131,7 +133,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
waringData
=
waringData
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentNumber
().
equals
(
equipmentNumber
)).
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isNotEmpty
(
waringData
))
{
waringData
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
size
),(
current
*
size
));
Integer
newSize
=
waringData
.
size
()
>=
size
?
size
:
waringData
.
size
();
waringData
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
newSize
),(
current
*
newSize
));
}
//对于查询到的告警信息进行按照时间顺序进行排序
DataGridMock
DataGridMock
=
new
DataGridMock
(
current
,
!
waringData
.
isEmpty
()
?
waringData
.
size
()
:
0
,
false
,
current
,
waringData
);
...
...
@@ -155,14 +158,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String
gateway
=
stationBasic
.
getFanGatewayId
();
Map
<
String
,
List
<
String
>>
queryCodntion
=
new
HashMap
<>();
queryCodntion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gateway
));
queryCodntion
.
put
(
CommonConstans
.
QueryStringIsAlarm
,
Arrays
.
asList
(
"1"
));
List
<
ESEquipments
>
alldata
=
commonServiceImpl
.
getListDataByCondtions
(
queryCodntion
,
null
,
ESEquipments
.
class
);
List
<
ESEquipments
>
waringData
=
alldata
.
stream
().
filter
(
esEquipments
->
!
esEquipments
.
getValue
().
equals
(
"0.0"
)&&!
esEquipments
.
getValue
().
equals
(
esEquipments
.
getValueLabel
())).
collect
(
Collectors
.
toList
());
String
table
=
gateway
;
queryCodntion
.
put
(
CommonConstans
.
QueryStringIsAlarmKeyword
,
Arrays
.
asList
(
"1"
));
HashMap
<
String
,
String
>
notMustMap
=
new
HashMap
<>();
notMustMap
.
put
(
CommonConstans
.
QueryStringValueKeyword
,
"0.0"
);
notMustMap
.
put
(
CommonConstans
.
QueryStringValueLabelKeyword
,
"0.0"
);
List
<
ESEquipments
>
waringData
=
commonServiceImpl
.
getListDataByCondtionsByValueNotEqValueLabel
(
queryCodntion
,
null
,
notMustMap
,
ESEquipments
.
class
);
if
(
StringUtils
.
isNotEmpty
(
equipmentNumber
))
{
waringData
=
waringData
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentNumber
().
equals
(
equipmentNumber
)&&
esEquipments
.
getEquipmentSpecificName
().
contains
(
"风机"
)).
collect
(
Collectors
.
toList
());
}
List
<
ESEquipments
>
lisSort
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
size
),(
current
*
size
));
Integer
newSize
=
waringData
.
size
()
>=
size
?
size
:
waringData
.
size
();
List
<
ESEquipments
>
lisSort
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
newSize
),(
current
*
newSize
));
//对于查询到的告警信息进行按照时间顺序进行排序
//构建平台数据
DataGridMock
DataGridMock
=
new
DataGridMock
(
current
,
!
waringData
.
isEmpty
()
?
waringData
.
size
():
0
,
false
,
current
,
lisSort
);
...
...
@@ -278,7 +283,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return
stationBasicMapper
.
selectById
(
stationId
);
}
public
List
<
ESEquipments
>
getFanStatusList
(
String
stationId
)
{
public
List
<
ESEquipments
DTO
>
getFanStatusList
(
String
stationId
)
{
StationBasic
stationBasic
=
getOneByStationNumber
(
stationId
);
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"发电状态"
,
"报警状态"
,
"停机状态"
,
"故障状态"
,
"待机状态"
,
"维护状态"
,
"正常发电状态"
,
"实时故障22"
));
...
...
@@ -288,27 +293,46 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion1
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"报警状态"
));
queryCondtion1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getFanGatewayId
()));
List
<
ESEquipments
>
equipNumList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion1
,
null
,
ESEquipments
.
class
);
Map
<
String
,
String
>
collect
=
result
.
stream
().
collect
(
Collectors
.
toMap
(
ESEquipments:
:
getEquipmentNumber
,
ESEquipments:
:
getEquipmentIndexName
,
(
item1
,
item2
)
->
item1
));
Map
<
String
,
String
>
collect
=
CollectionUtils
.
isEmpty
(
result
)
?
new
HashMap
<
String
,
String
>()
:
result
.
stream
().
collect
(
Collectors
.
toMap
(
ESEquipments:
:
getEquipmentNumber
,
ESEquipments:
:
getEquipmentIndexName
,
(
item1
,
item2
)
->
item1
));
HashMap
<
String
,
String
>
colorMap
=
new
HashMap
<>();
colorMap
.
put
(
"正常运行"
,
"#00aa00"
);
colorMap
.
put
(
"报警运行"
,
"#ffc400"
);
colorMap
.
put
(
"停机状态"
,
"#0055ff"
);
colorMap
.
put
(
"故障状态"
,
"#ff0000"
);
colorMap
.
put
(
"限功率"
,
"#a3f5aa"
);
colorMap
.
put
(
"待机状态"
,
"#00aaff"
);
colorMap
.
put
(
"维护状态"
,
"#ff00ff"
);
colorMap
.
put
(
"通讯中断"
,
"#7d8e95"
);
List
<
ESEquipmentsDTO
>
resultList
=
new
ArrayList
<>();
equipNumList
.
forEach
(
item
->
{
String
status
=
ObjectUtils
.
isEmpty
(
CommonConstans
.
fanStatus
.
get
(
collect
.
get
(
item
.
getEquipmentNumber
())))
?
"通讯中断"
:
CommonConstans
.
fanStatus
.
get
(
collect
.
get
(
item
.
getEquipmentNumber
()));
item
.
setAddress
(
status
);
ESEquipmentsDTO
esEquipmentsDTO
=
new
ESEquipmentsDTO
();
BeanUtil
.
copyProperties
(
item
,
esEquipmentsDTO
);
String
color
=
colorMap
.
get
(
status
);
esEquipmentsDTO
.
setState
(
status
);
esEquipmentsDTO
.
setColor
(
color
);
resultList
.
add
(
esEquipmentsDTO
);
});
return
equipNumList
;
return
resultList
;
}
public
List
<
IndexDto
>
getFanStatusStatistics
(
String
stationId
)
{
List
<
ESEquipments
>
equipNumList
=
getFanStatusList
(
stationId
);
Map
<
String
,
Long
>
countMap
=
equipNumList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ESEquipments:
:
getAddress
,
Collectors
.
counting
()));
List
<
ESEquipments
DTO
>
equipNumList
=
getFanStatusList
(
stationId
);
Map
<
String
,
Long
>
countMap
=
equipNumList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ESEquipments
DTO
:
:
getAddress
,
Collectors
.
counting
()));
List
<
IndexDto
>
resultList
=
new
ArrayList
<>();
List
<
String
>
list
=
Arrays
.
asList
(
"正常运行"
,
"报警运行"
,
"停机状态"
,
"故障状态"
,
"限功率"
,
"待机状态"
,
"维护状态"
,
"通讯中断"
);
HashMap
<
String
,
String
>
colorMap
=
new
HashMap
<>();
colorMap
.
put
(
"正常运行"
,
"#00aa00"
);
colorMap
.
put
(
"报警运行"
,
"#ffc400"
);
colorMap
.
put
(
"停机状态"
,
"#0055ff"
);
colorMap
.
put
(
"故障状态"
,
"#
00aaff
"
);
colorMap
.
put
(
"故障状态"
,
"#
ff0000
"
);
colorMap
.
put
(
"限功率"
,
"#a3f5aa"
);
colorMap
.
put
(
"待机状态"
,
"#
ff0000
"
);
colorMap
.
put
(
"待机状态"
,
"#
00aaff
"
);
colorMap
.
put
(
"维护状态"
,
"#ff00ff"
);
colorMap
.
put
(
"通讯中断"
,
"#7d8e95"
);
list
.
forEach
(
item
->
{
...
...
@@ -334,7 +358,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
indexDto
.
setLongitude
(
String
.
valueOf
(
jsonObject
.
get
(
"longitude"
)));
indexDto
.
setLatitude
(
String
.
valueOf
(
jsonObject
.
get
(
"latitude"
)));
StationBasic
stationBasic
=
getOneByStationNumber
(
stationId
);
List
<
ESEquipments
>
fanStatusList
=
getFanStatusList
(
stationId
);
List
<
ESEquipments
DTO
>
fanStatusList
=
getFanStatusList
(
stationId
);
String
fanStatus
=
fanStatusList
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentNumber
().
equals
(
equipNum
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getAddress
();
indexDto
.
setEquipmentIndexName
(
fanStatus
);
List
<
Map
<
String
,
String
>>
fanConfigPower
=
monitorFanIndicatorregionMapper
.
getFanConfigPower
(
stationBasic
.
getFanGatewayId
(),
equipNum
);
...
...
@@ -421,18 +445,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public
Map
<
String
,
Object
>
getDetailsWindSpeedAll
(
String
gatewayId
)
{
List
<
Map
<
String
,
String
>>
list
=
temporaryDataMapper
.
timingTemporarysSorageData
(
gatewayId
);
List
<
Map
<
String
,
Object
>>
list
=
temporaryDataMapper
.
timingTemporarysSorageData
(
gatewayId
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
String
>
values
=
new
ArrayList
<>();
List
<
String
>
valueList
=
new
ArrayList
<>();
Set
<
String
>
time
=
new
TreeSet
<>();
for
(
Map
<
String
,
String
>
stringStringMap
:
list
)
{
if
(
stringStringMap
.
get
(
"equipmentIndexName"
).
equals
(
"有功功率"
))
{
values
.
add
(
stringStringMap
.
get
(
"value"
));
for
(
Map
<
String
,
Object
>
stringStringMap
:
list
)
{
if
(
stringStringMap
.
get
(
"equipmentIndexName"
).
toString
().
equals
(
"有功功率"
))
{
values
.
add
(
stringStringMap
.
get
(
"value"
)
.
toString
()
);
}
else
{
valueList
.
add
(
stringStringMap
.
get
(
"value"
));
time
.
add
(
stringStringMap
.
get
(
"createdTime"
));
valueList
.
add
(
stringStringMap
.
get
(
"value"
)
.
toString
()
);
time
.
add
(
stringStringMap
.
get
(
"createdTime"
)
.
toString
()
);
}
}
...
...
@@ -663,9 +687,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public
void
schedSolarPower
(
String
gatewayId
,
long
timeInMillis
)
{
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringDisplayName
,
Arrays
.
asList
(
"总辐射累计"
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringDisplayName
Keyword
,
Arrays
.
asList
(
"总辐射累计"
));
List
<
ESEquipments
>
indicatorsDtoList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
queryCondtion
.
put
(
CommonConstans
.
QueryStringDisplayName
,
Arrays
.
asList
(
"有功功率"
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringDisplayName
Keyword
,
Arrays
.
asList
(
"有功功率"
));
List
<
ESEquipments
>
indicatorsDtoLists
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
List
<
TemporaryData
>
temporaryDatas
=
new
ArrayList
<>();
List
<
TemporaryData
>
temporaryDatass
=
new
ArrayList
<>();
...
...
@@ -774,10 +798,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public
List
<
Map
<
String
,
Object
>>
getAnalogQuantity
(
String
gatewayId
,
String
frontModule
,
String
systemType
)
{
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
Map
<
String
,
String
>
shouldCondtion
=
new
HashMap
<>();
shouldCondtion
.
put
(
CommonConstans
.
QueryStringFrontMoudle
,
frontModule
);
shouldCondtion
.
put
(
CommonConstans
.
QueryStringSystemType
,
systemType
);
List
<
ESEquipments
>
esEquipmentsList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
shouldCondtion
,
ESEquipments
.
class
);
Map
<
String
,
String
>
likeMap
=
new
HashMap
<>();
likeMap
.
put
(
CommonConstans
.
QueryStringFrontMoudleNotKeyWord
,
frontModule
);
likeMap
.
put
(
CommonConstans
.
QueryStringSystemType
,
systemType
);
List
<
ESEquipments
>
esEquipmentsList
=
commonServiceImpl
.
getListDataByCondtions
AndLike
(
queryCondtion
,
null
,
ESEquipments
.
class
,
likeMap
);
List
<
ESEquipments
>
listData
=
esEquipmentsList
.
stream
().
filter
(
esEquipments
->
!
esEquipments
.
getDisplayName
().
equals
(
""
)).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
Object
>>
statusMaps
=
new
ArrayList
<>();
for
(
ESEquipments
listDatum
:
listData
)
{
...
...
@@ -802,9 +826,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
likeCodtion
.
put
(
CommonConstans
.
QueryStringDisplayName
+
".keyword"
,
"合位"
);
List
<
ESEquipments
>
listData
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
,
likeCodtion
);
Collator
instance
=
Collator
.
getInstance
(
Locale
.
CHINA
);
Collections
.
sort
(
listData
,
(
e1
,
e2
)
->
{
return
instance
.
compare
(
e1
.
getFrontModule
(),
e2
.
getFrontModule
());
});
List
<
Map
<
String
,
Object
>>
statusMaps
=
new
ArrayList
<>();
Map
<
String
,
List
<
ESEquipments
>>
collect
=
listData
.
stream
().
collect
(
Collectors
.
groupingBy
(
ESEquipments:
:
getFrontModule
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
String
s
:
collect
.
keySet
())
{
Map
<
String
,
Object
>
statusMap
=
new
HashMap
<>();
if
(
frontModule
.
equals
(
"前光"
))
{
...
...
@@ -862,7 +890,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
TpriDmpDatabook
tpriDmpDatabook
=
tpriDmpDatabookServiceImpl
.
getTpriDmpDatabookByDataName
(
"风机"
);
List
<
Map
<
String
,
Object
>>
dataMaps
=
sjglZsjZsbtzServiceImpl
.
sjglZsjZsbtzMapper
.
getStationInfoMapByStationWerks
(
werks
,
tpriDmpDatabook
.
getDataid
().
toString
());
//获取风机列表
List
<
ESEquipments
>
fanStatusList
=
getFanStatusList
(
stationId
);
List
<
ESEquipments
DTO
>
fanStatusList
=
getFanStatusList
(
stationId
);
fanStatusList
.
forEach
(
equipments
->
{
fanstatutsHashMap
.
put
(
equipments
.
getEquipmentNumber
(),
equipments
.
getAddress
());
});
...
...
@@ -1466,7 +1494,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return
resultMap
;
}
public
Map
<
String
,
String
>
getStatisticsInfo
(
String
equipmentIndexName
,
String
stationId
)
{
public
Map
<
String
,
Object
>
getStatisticsInfo
(
String
equipmentIndexName
,
String
stationId
)
{
StationCacheInfoDto
stationCacheInfoDto
=
commonServiceImpl
.
getStationCacheInfoDtoByStationId
(
stationId
);
String
gatewayId
=
stationCacheInfoDto
.
getFanGatewayId
();
if
(!
"FDZ"
.
equals
(
stationCacheInfoDto
.
getStationType
()))
{
...
...
@@ -1477,9 +1505,49 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationCacheInfoDto
.
getBoosterGatewayId
()));
List
<
ESEquipments
>
listData
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
String
load
=
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
Double
.
parseDouble
(
String
.
valueOf
(
listData
.
get
(
0
).
getValueDouble
()))
/
Double
.
parseDouble
(
stationCacheInfoDto
.
getInstalledCapacity
()));
Map
<
String
,
String
>
result
=
temporaryDataMapper
.
getStatisticsInfo
(
gatewayId
,
equipmentIndexName
);
result
.
put
(
"load"
,
load
);
return
result
;
List
<
Map
<
String
,
Object
>>
list
=
temporaryDataMapper
.
timingTemporarysSorageDataByIndexName
(
gatewayId
,
equipmentIndexName
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
String
>
values
=
new
ArrayList
<>();
Set
<
String
>
time
=
new
TreeSet
<>();
String
v
=
list
.
get
(
0
).
get
(
"value"
).
toString
();
double
min
=
Double
.
parseDouble
(
v
);
double
max
=
Double
.
parseDouble
(
v
);
double
mean
=
0.0
;
String
minTime
=
list
.
get
(
0
).
get
(
"createdTime"
).
toString
();
String
maxTime
=
list
.
get
(
0
).
get
(
"createdTime"
).
toString
();
for
(
Map
<
String
,
Object
>
stringStringMap
:
list
)
{
double
value
=
Double
.
parseDouble
(
stringStringMap
.
get
(
"value"
).
toString
());
values
.
add
(
String
.
format
(
"%.2f"
,
value
));
if
(
value
<
min
){
min
=
value
;
minTime
=
stringStringMap
.
get
(
"createdTime"
).
toString
();
}
else
if
(
value
>
max
){
max
=
value
;
maxTime
=
stringStringMap
.
get
(
"createdTime"
).
toString
();
}
time
.
add
(
stringStringMap
.
get
(
"createdTime"
).
toString
());
}
for
(
String
value
:
values
)
{
mean
+=
Double
.
parseDouble
(
value
);
}
mean
=
Double
.
parseDouble
(
String
.
format
(
"%.2f"
,
mean
/
values
.
size
()));
List
<
Map
<
String
,
Object
>>
seriesData
=
new
ArrayList
<>();
map
.
put
(
"mean"
,
mean
);
map
.
put
(
"max"
,
max
);
map
.
put
(
"min"
,
min
);
map
.
put
(
"maxTime"
,
maxTime
);
map
.
put
(
"minTime"
,
minTime
);
map
.
put
(
"load"
,
load
);
return
map
;
}
...
...
@@ -1488,7 +1556,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringFrontMoudle
,
Arrays
.
asList
(
frontModule
));
List
<
ESEquipments
>
esEquipmentsList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
List
<
ESEquipments
>
listData
=
esEquipmentsList
.
stream
().
filter
(
esEquipments
->
!
esEquipments
.
getEquipmentNumber
().
equals
(
""
)).
collect
(
Collectors
.
toList
());
List
<
ESEquipments
>
listData
=
esEquipmentsList
.
stream
().
filter
(
esEquipments
->
!
esEquipments
.
getEquipmentNumber
().
equals
(
""
)).
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getEquipmentNumber
)).
collect
(
Collectors
.
toList
());
if
(
null
!=
equipmentNumber
)
{
listData
=
esEquipmentsList
.
stream
().
filter
(
esEquipments
->
!
esEquipments
.
getEquipmentNumber
().
contains
(
equipmentNumber
)).
collect
(
Collectors
.
toList
());
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitoringServiceIMQTTmpl.java
View file @
288fc5a9
...
...
@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.ESEquipmentsDTO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils
;
...
...
@@ -336,7 +337,7 @@ public class MonitoringServiceIMQTTmpl {
Integer
size
=
99
;
List
<
StationBasic
>
stationBasicList
=
stationBasicMapper
.
selectList
(
new
QueryWrapper
<
StationBasic
>().
isNotNull
(
"sequence_nbr"
).
eq
(
"station_type"
,
"FDZ"
));
stationBasicList
.
forEach
(
stationBasic
->
{
List
<
ESEquipments
>
fanStatusList
=
monitorFanIndicator
.
getFanStatusList
(
String
.
valueOf
(
stationBasic
.
getSequenceNbr
()));
List
<
ESEquipments
DTO
>
fanStatusList
=
monitorFanIndicator
.
getFanStatusList
(
String
.
valueOf
(
stationBasic
.
getSequenceNbr
()));
fanStatusList
.
forEach
(
indexDto
->
{
String
stationBasicId
=
String
.
valueOf
(
stationBasic
.
getSequenceNbr
());
String
equipmentNumber
=
indexDto
.
getEquipmentNumber
();
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/resources/mapper/cluster/TemporaryDataMapper.xml
View file @
288fc5a9
...
...
@@ -19,6 +19,27 @@
</if>
</where>
GROUP BY batch_no ,equipmentIndexName;
</select>
<select
id=
"timingTemporarysSorageDataByIndexName"
resultType=
"map"
>
SELECT avg(value) as value ,
created_time as createdTime ,
equipmentIndexName
FROM
`temporary_data`
<where>
<if
test=
"gatewayId != null and gatewayId != ''"
>
gatewayId = #{gatewayId}
</if>
<if
test=
"gatewayId == null and gatewayId == ''"
>
equipmentNumber is not null and equipmentIndexName is not null
</if>
<if
test=
"equipmentIndexName != null and equipmentIndexName != ''"
>
and equipmentIndexName =#{equipmentIndexName}
</if>
</where>
GROUP BY batch_no ,equipmentIndexName;
</select>
...
...
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