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
410a604e
Commit
410a604e
authored
Aug 10, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加大屏接口
parent
7ba4a966
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
254 additions
and
27 deletions
+254
-27
StationType.java
.../yeejoin/amos/boot/module/jxiop/api/Enum/StationType.java
+30
-0
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+0
-0
TemporaryDataMapper.java
...os/boot/module/jxiop/biz/mapper2/TemporaryDataMapper.java
+2
-1
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+77
-0
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+41
-12
ESWindSpeed.java
...yeejoin/amos/boot/module/jxiop/biz/ESDto/ESWindSpeed.java
+28
-0
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+9
-10
TemporaryDataMapper.java
...os/boot/module/jxiop/biz/mapper2/TemporaryDataMapper.java
+2
-1
ESWindSpeedRepository.java
...ot/module/jxiop/biz/repository/ESWindSpeedRepository.java
+16
-0
WindSpeedScheduled.java
...s/boot/module/jxiop/biz/scheduled/WindSpeedScheduled.java
+34
-0
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+0
-2
application.properties
...iop-monitor-biz/src/main/resources/application.properties
+2
-1
TemporaryDataMapper.xml
...src/main/resources/mapper/cluster/TemporaryDataMapper.xml
+13
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/Enum/StationType.java
0 → 100644
View file @
410a604e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
StationType
{
FJC
(
"风电场"
,
"FJC"
),
JZGFC
(
"集中光伏场"
,
"JZGFC"
),
FBSGFC
(
"分布式光伏场"
,
"FBSGFC"
);
private
String
name
;
private
String
code
;
public
static
String
getCode
(
String
name
)
{
for
(
StationType
stationType
:
StationType
.
values
())
{
if
(
stationType
.
getName
().
equals
(
name
))
{
return
stationType
.
getCode
();
}
}
return
null
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitorFanIdxController.java
View file @
410a604e
This diff is collapsed.
Click to expand it.
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/TemporaryDataMapper.java
View file @
410a604e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESWindSpeed
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.List
;
...
@@ -18,4 +18,5 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
...
@@ -18,4 +18,5 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
@RequestParam
(
value
=
"equipmentIndexName"
)
String
equipmentIndexName
);
@RequestParam
(
value
=
"equipmentIndexName"
)
String
equipmentIndexName
);
List
<
ESWindSpeed
>
getAllData
();
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
410a604e
...
@@ -3,18 +3,37 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
...
@@ -3,18 +3,37 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto
;
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.dto.SocialContributionDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
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.mapper2.SjglZsjZsbtzMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils
;
import
com.yeejoin.amos.component.influxdb.InfluxdbUtil
;
import
com.yeejoin.amos.component.influxdb.InfluxdbUtil
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.Aggregation
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.Aggregations
;
import
org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
import
org.springframework.data.elasticsearch.core.SearchHits
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder
;
import
org.springframework.data.elasticsearch.core.query.Query
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -28,6 +47,15 @@ public class CommonServiceImpl {
...
@@ -28,6 +47,15 @@ public class CommonServiceImpl {
@Autowired
@Autowired
SjglZsjZsbtzMapper
sjglZsjZsbtzMapper
;
SjglZsjZsbtzMapper
sjglZsjZsbtzMapper
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
StationCacheDataInit
stationCacheDataInit
;
@Autowired
private
ElasticsearchRestTemplate
elasticsearchTemplate
;
/**
/**
* @deprecated 获取指标值总和
* @deprecated 获取指标值总和
* @param gatewayId 网关id 用于拼接sql语句
* @param gatewayId 网关id 用于拼接sql语句
...
@@ -119,4 +147,53 @@ public class CommonServiceImpl {
...
@@ -119,4 +147,53 @@ public class CommonServiceImpl {
socialContributionDtoPage
.
setCurrent
(
1
);
socialContributionDtoPage
.
setCurrent
(
1
);
return
socialContributionDtoPage
;
return
socialContributionDtoPage
;
}
}
public
List
<
StationCacheInfoDto
>
getListStationCacheInfoDto
(){
List
<
StationCacheInfoDto
>
stationCacheInfoDtoList
=
redisTemplate
.
opsForList
().
range
(
"station_info_cache"
,
0
,-
1
);
if
(
ObjectUtils
.
isEmpty
(
stationCacheInfoDtoList
)){
try
{
stationCacheDataInit
.
run
();
stationCacheInfoDtoList
=
redisTemplate
.
opsForList
().
range
(
"station_info_cache"
,
0
,-
1
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
stationCacheInfoDtoList
;
}
/*
*分组求和
**/
public
List
<?
extends
Terms
.
Bucket
>
getgroupsum
(
Map
<
String
,
List
<
String
>>
value
,
String
keyavg
,
String
groupKey
,
Class
clas
){
List
<?
extends
Terms
.
Bucket
>
listdata
=
null
;
BoolQueryBuilder
queryBuilder
=
QueryBuilders
.
boolQuery
();
for
(
String
key:
value
.
keySet
()){
List
<
String
>
va
=
value
.
get
(
key
);
queryBuilder
.
must
(
QueryBuilders
.
termsQuery
(
key
,
va
));
}
TermsAggregationBuilder
tb1
=
AggregationBuilders
.
terms
(
"groupKey"
).
field
(
groupKey
);
SumAggregationBuilder
buyCountSum
=
AggregationBuilders
.
sum
(
"buyCountSum"
).
field
(
keyavg
);
tb1
.
subAggregation
(
buyCountSum
);
// 通过typeId字段分组统计总数
Query
query
=
new
NativeSearchQueryBuilder
()
.
withQuery
(
queryBuilder
)
.
addAggregation
(
tb1
)
.
withPageable
(
PageRequest
.
of
(
0
,
1
))
.
build
();
query
.
setTrackTotalHits
(
true
);
SearchHits
search
=
elasticsearchTemplate
.
search
(
query
,
ESEquipments
.
class
);
if
(
search
.
hasAggregations
())
{
Aggregations
aggregations
=
search
.
getAggregations
();
if
(
Objects
.
nonNull
(
aggregations
))
{
List
<
Aggregation
>
list
=
aggregations
.
asList
();
listdata
=
list
!=
null
&&!
list
.
isEmpty
()?((
ParsedStringTerms
)
list
.
get
(
0
)).
getBuckets
():
null
;
}
}
return
listdata
;
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
View file @
410a604e
...
@@ -103,6 +103,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -103,6 +103,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired
@Autowired
EmqKeeper
emqKeeper
;
EmqKeeper
emqKeeper
;
@Autowired
CommonServiceImpl
commonServiceImpl
;
@Value
(
"${pictureUrl}"
)
@Value
(
"${pictureUrl}"
)
String
pictureUrl
;
String
pictureUrl
;
...
@@ -1745,22 +1748,32 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -1745,22 +1748,32 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
public
void
sendMqttByRanking
(
List
<
Map
<
String
,
Object
>>
list
,
String
code
,
String
topic
){
public
void
sendMqttByRanking
(
List
<
Map
<
String
,
Object
>>
list
,
String
code
,
String
topic
){
list
.
stream
().
sorted
((
o1
,
o2
)->{
//先发送区域消息
double
o1Num
=
Double
.
parseDouble
(
o1
.
get
(
"value"
).
toString
());
List
<
StationCacheInfoDto
>
listStationCacheInfoDto
=
commonServiceImpl
.
getListStationCacheInfoDto
();
double
o2Num
=
Double
.
parseDouble
(
o2
.
get
(
"value"
).
toString
());
Map
<
String
,
List
<
StationCacheInfoDto
>>
belongAreaList
=
listStationCacheInfoDto
.
stream
().
collect
(
Collectors
.
groupingBy
(
StationCacheInfoDto:
:
getBelongArea
));
if
((
o1Num
-
o2Num
)<
0
){
for
(
String
s
:
belongAreaList
.
keySet
())
{
return
-
1
;
List
<
String
>
ids
=
belongAreaList
.
get
(
s
).
stream
().
map
(
StationCacheInfoDto:
:
getFanGatewayId
).
collect
(
Collectors
.
toList
());
}
else
if
((
o1Num
-
o2Num
)>
0
){
String
idStrings
=
String
.
join
(
","
,
ids
);
return
1
;
List
<
Map
<
String
,
Object
>>
dataList
=
list
.
stream
().
filter
(
e
->
idStrings
.
contains
(
e
.
get
(
"gateWayId"
).
toString
())).
collect
(
Collectors
.
toList
());
}
else
{
List
<
Map
<
String
,
Object
>>
resultList
=
mapListToSort
(
dataList
).
stream
().
limit
(
5
).
collect
(
Collectors
.
toList
());
return
0
;
IPage
<
Map
<
String
,
Object
>>
result
=
new
Page
<>();
result
.
setRecords
(
resultList
);
result
.
setCurrent
(
1
);
result
.
setTotal
(
resultList
.
size
());
try
{
emqKeeper
.
getMqttClient
().
publish
(
s
+
"/"
+
topic
+
"/"
+
code
,
JSON
.
toJSONString
(
result
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
}
);
}
//发送全国数据消息
List
<
Map
<
String
,
Object
>>
maps
=
mapListToSort
(
list
);
List
<
Map
<
String
,
Object
>>
resultList
=
maps
.
stream
().
limit
(
5
).
collect
(
Collectors
.
toList
());
IPage
<
Map
<
String
,
Object
>>
result
=
new
Page
<>();
IPage
<
Map
<
String
,
Object
>>
result
=
new
Page
<>();
result
.
setRecords
(
l
ist
);
result
.
setRecords
(
resultL
ist
);
result
.
setCurrent
(
1
);
result
.
setCurrent
(
1
);
result
.
setTotal
(
l
ist
.
size
());
result
.
setTotal
(
resultL
ist
.
size
());
try
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
topic
+
"/"
+
code
,
JSON
.
toJSONString
(
result
).
getBytes
(),
0
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
topic
+
"/"
+
code
,
JSON
.
toJSONString
(
result
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
...
@@ -1769,6 +1782,22 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -1769,6 +1782,22 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
List
<
Map
<
String
,
Object
>>
mapListToSort
(
List
<
Map
<
String
,
Object
>>
list
){
list
.
stream
().
sorted
((
o1
,
o2
)->{
double
o1Num
=
Double
.
parseDouble
(
o1
.
get
(
"value"
).
toString
());
double
o2Num
=
Double
.
parseDouble
(
o2
.
get
(
"value"
).
toString
());
if
((
o1Num
-
o2Num
)<
0
){
return
-
1
;
}
else
if
((
o1Num
-
o2Num
)>
0
){
return
1
;
}
else
{
return
0
;
}
});
return
list
;
}
public
Map
<
String
,
Object
>
generatingCapacity
(
String
gatewayId
,
String
query
){
public
Map
<
String
,
Object
>
generatingCapacity
(
String
gatewayId
,
String
query
){
String
querySql
=
" SELECT * FROM indicators_"
+
gatewayId
+
" WHERE equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量'"
;
String
querySql
=
" SELECT * FROM indicators_"
+
gatewayId
+
" WHERE equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量'"
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/ESDto/ESWindSpeed.java
0 → 100644
View file @
410a604e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
ESDto
;
import
io.github.classgraph.json.Id
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.springframework.data.elasticsearch.annotations.Document
;
import
org.springframework.data.elasticsearch.annotations.Field
;
import
org.springframework.data.elasticsearch.annotations.FieldType
;
@Data
@Accessors
(
chain
=
true
)
@Document
(
indexName
=
"wind_speed"
)
public
class
ESWindSpeed
{
@Id
private
Long
sequenceNumber
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
private
String
createdTime
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
private
String
equipmentIndexName
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
private
String
equipmentNumber
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
private
String
gatewayId
;
@Field
(
type
=
FieldType
.
Double
,
index
=
false
)
private
Double
value
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
private
String
batchNo
;
}
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 @
410a604e
...
@@ -255,12 +255,15 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -255,12 +255,15 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"概览-全站功率曲线"
)
@ApiOperation
(
value
=
"概览-全站功率曲线"
)
@GetMapping
(
"/overviewWindSpeed"
)
@GetMapping
(
"/overviewWindSpeed"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getOverviewWindSpeed
(
@RequestParam
(
value
=
"stationId"
,
required
=
true
)
String
stationId
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
public
ResponseModel
<
Map
<
String
,
Object
>>
getOverviewWindSpeed
(
@RequestParam
(
value
=
"stationId"
,
required
=
false
)
String
stationId
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
String
gatewayId
=
""
;
String
gatewayId
=
stationBasic
.
getBoosterGatewayId
();
if
(
null
!=
stationId
){
if
(
null
==
type
){
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
gatewayId
=
stationBasic
.
getFanGatewayId
();
gatewayId
=
stationBasic
.
getBoosterGatewayId
();
}
if
(
null
==
type
){
gatewayId
=
stationBasic
.
getFanGatewayId
();
}
}
Map
<
String
,
Object
>
detailsWindSpeed
=
monitorFanIndicator
.
getDetailsWindSpeedAll
(
gatewayId
);
Map
<
String
,
Object
>
detailsWindSpeed
=
monitorFanIndicator
.
getDetailsWindSpeedAll
(
gatewayId
);
return
ResponseHelper
.
buildResponse
(
detailsWindSpeed
);
return
ResponseHelper
.
buildResponse
(
detailsWindSpeed
);
...
@@ -854,8 +857,4 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -854,8 +857,4 @@ public class MonitorFanIdxController extends BaseController {
return
CommonResponseUtil
.
success
();
return
CommonResponseUtil
.
success
();
}
}
}
}
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 @
410a604e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESWindSpeed
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
@@ -17,5 +18,5 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
...
@@ -17,5 +18,5 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
Map
<
String
,
String
>
getStatisticsInfo
(
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
,
Map
<
String
,
String
>
getStatisticsInfo
(
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
,
@RequestParam
(
value
=
"equipmentIndexName"
)
String
equipmentIndexName
);
@RequestParam
(
value
=
"equipmentIndexName"
)
String
equipmentIndexName
);
List
<
ESWindSpeed
>
getAllData
();
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/repository/ESWindSpeedRepository.java
0 → 100644
View file @
410a604e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
repository
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESWindSpeed
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
org.springframework.stereotype.Repository
;
/**
* @description:
* @author: tw
* @createDate: 2023/8/8
*/
@Repository
public
interface
ESWindSpeedRepository
extends
PagingAndSortingRepository
<
ESWindSpeed
,
Long
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/scheduled/WindSpeedScheduled.java
0 → 100644
View file @
410a604e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
scheduled
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESWindSpeed
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TemporaryDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.repository.ESWindSpeedRepository
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
java.util.ArrayList
;
import
java.util.List
;
@EnableScheduling
public
class
WindSpeedScheduled
{
@Autowired
TemporaryDataMapper
temporaryDataMapper
;
@Autowired
ESWindSpeedRepository
esWindSpeedRepository
;
@Scheduled
(
cron
=
"${windSpeed.cron}"
)
private
void
initData
(){
esWindSpeedRepository
.
saveAll
(
temporaryDataMapper
.
getAllData
());
}
}
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 @
410a604e
...
@@ -777,7 +777,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -777,7 +777,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
TemporaryData
temporaryData
=
new
TemporaryData
();
TemporaryData
temporaryData
=
new
TemporaryData
();
temporaryData
.
setBatchNo
(
timeInMillis
);
temporaryData
.
setBatchNo
(
timeInMillis
);
temporaryData
.
setCreatedTime
(
time
.
split
(
" "
)[
1
]);
temporaryData
.
setCreatedTime
(
time
.
split
(
" "
)[
1
]);
temporaryData
.
setEquipmentIndexName
(
indicatorsDto
.
getDisplayName
());
temporaryData
.
setGatewayId
(
indicatorsDto
.
getGatewayId
());
temporaryData
.
setGatewayId
(
indicatorsDto
.
getGatewayId
());
temporaryData
.
setValue
(
Float
.
valueOf
(
indicatorsDto
.
getValue
()));
temporaryData
.
setValue
(
Float
.
valueOf
(
indicatorsDto
.
getValue
()));
temporaryData
.
setEquipmentNumber
(
indicatorsDto
.
getEquipmentNumber
());
temporaryData
.
setEquipmentNumber
(
indicatorsDto
.
getEquipmentNumber
());
...
@@ -791,7 +790,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -791,7 +790,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
TemporaryData
temporaryData
=
new
TemporaryData
();
TemporaryData
temporaryData
=
new
TemporaryData
();
temporaryData
.
setBatchNo
(
timeInMillis
);
temporaryData
.
setBatchNo
(
timeInMillis
);
temporaryData
.
setCreatedTime
(
time
.
split
(
" "
)[
1
]);
temporaryData
.
setCreatedTime
(
time
.
split
(
" "
)[
1
]);
temporaryData
.
setEquipmentIndexName
(
indicatorsDto
.
getDisplayName
());
temporaryData
.
setGatewayId
(
indicatorsDto
.
getGatewayId
());
temporaryData
.
setGatewayId
(
indicatorsDto
.
getGatewayId
());
temporaryData
.
setValue
(
Float
.
valueOf
(
indicatorsDto
.
getValue
()));
temporaryData
.
setValue
(
Float
.
valueOf
(
indicatorsDto
.
getValue
()));
temporaryData
.
setEquipmentNumber
(
indicatorsDto
.
getEquipmentNumber
());
temporaryData
.
setEquipmentNumber
(
indicatorsDto
.
getEquipmentNumber
());
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/resources/application.properties
View file @
410a604e
...
@@ -77,7 +77,8 @@ gl.avg.column=有功功率,日利用小时,瞬时风速
...
@@ -77,7 +77,8 @@ gl.avg.column=有功功率,日利用小时,瞬时风速
#ES 曲线图定时 0 57 23 * * ?
windSpeed.cron
=
0 25 9 * * ?
spring.elasticsearch.rest.uris
=
http://39.98.224.23:9200
spring.elasticsearch.rest.uris
=
http://39.98.224.23:9200
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/resources/mapper/cluster/TemporaryDataMapper.xml
View file @
410a604e
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
<if
test=
"gatewayId != null and gatewayId != ''"
>
<if
test=
"gatewayId != null and gatewayId != ''"
>
gatewayId = #{gatewayId}
gatewayId = #{gatewayId}
</if>
</if>
<if
test=
"gatewayId == null or gatewayId == ''"
>
equipmentNumber is not null
</if>
</where>
</where>
GROUP BY batch_no ,equipmentIndexName;
GROUP BY batch_no ,equipmentIndexName;
</select>
</select>
...
@@ -29,6 +32,16 @@
...
@@ -29,6 +32,16 @@
FROM
FROM
`temporary_data`
`temporary_data`
WHERE
WHERE
gatewayId = #{gatewayId} and equipmentIndexName =#{equipmentIndexName}
gatewayId = #{gatewayId} and equipmentIndexName =#{equipmentIndexName}
</select>
</select>
<select
id=
"getAllData"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESWindSpeed"
>
SELECT
*
FROM
`temporary_data`
</select>
</mapper>
</mapper>
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