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
bee7d0d2
Commit
bee7d0d2
authored
Jul 03, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取最新的数据
parent
9c1f0f39
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
4 deletions
+108
-4
DataSynchronizationImpl.java
...odule/jxiop/biz/service/impl/DataSynchronizationImpl.java
+82
-0
StationDataTaskImpl.java
...ot/module/jxiop/biz/service/impl/StationDataTaskImpl.java
+26
-4
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/DataSynchronizationImpl.java
0 → 100644
View file @
bee7d0d2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.cache.Redis
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
DataSynchronizationImpl
{
//缓存的热工院数据
private
static
final
String
RedisKey
=
"RGYZJB_CACHE"
;
/**
* 场站信息service
*/
@Autowired
StationBasicServiceImpl
stationBasicServiceImpl
;
/**
* 中间表service
*/
@Autowired
SjglZsjZsbtzServiceImpl
sjglZsjZsbtzServiceImpl
;
public
void
dataSync
(){
// 1: 场站 list
List
<
StationBasic
>
stationBasicList
=
getStationBasicList
();
stationBasicList
.
forEach
(
stationBasic
->
{
getSjglZsjZsbtz
(
stationBasic
);
});
// 2:异步 每个场站
// 3: 风机list 同步
// 4:查询单个分机 异步
// 5:时序库 lidt
// size(),
// List<List<Map<String ,Object>>> lidtd= Lists.partition(lidt,1000);
//
// 异步:
// mysql
}
/**@deprecated 获取所有的场站列表
*
* @return 场站列表list
*/
public
List
<
StationBasic
>
getStationBasicList
(){
List
<
StationBasic
>
stationBasicList
=
new
ArrayList
<>();
stationBasicList
=
stationBasicServiceImpl
.
list
();
return
stationBasicList
;
}
/**
* @deprecated 获取场站下的所有设备信
* @param stationBasic 场站信息
* @return 设备基础信息
*/
public
List
<
SjglZsjZsbtz
>
getSjglZsjZsbtz
(
StationBasic
stationBasic
){
List
<
SjglZsjZsbtz
>
sjglZsjZsbtzList
=
new
ArrayList
<>();
sjglZsjZsbtzList
=
sjglZsjZsbtzServiceImpl
.
getSjglZsjZsbtzListByWerks
(
stationBasic
.
getStationNumber
());
return
sjglZsjZsbtzList
;
}
/**
* @deprecated 获取场站下的所有设备信
* @return 设备基础信息
*/
public
List
<
SjglZsjZsbtz
>
cacheSjglZsjZsbtz
(){
List
cacheParams
=
new
ArrayList
();
cacheParams
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
RedisKey
,
0
,
-
1
);
List
<
SjglZsjZsbtz
>
sjglZsjZsbtzList
=
sjglZsjZsbtzServiceImpl
.
getSjglZsjZsbtzList
();
if
(
cacheParams
.
size
()
!=
sjglZsjZsbtzList
.
size
()){
Redis
.
getRedisTemplate
().
delete
(
RedisKey
);
Redis
.
getRedisTemplate
().
opsForList
().
leftPushAll
(
RedisKey
,
sjglZsjZsbtzList
);
}
return
sjglZsjZsbtzList
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/StationDataTaskImpl.java
View file @
bee7d0d2
...
...
@@ -8,6 +8,8 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IStationDataTask
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
org.influxdb.dto.QueryResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
...
...
@@ -24,6 +26,8 @@ public class StationDataTaskImpl implements IStationDataTask {
@Autowired
TpriDmpDatabookServiceImpl
tpriDmpDatabookServiceImpl
;
@Autowired
InfluxDbConnection
influxDbConnection
;
@Autowired
MonitorFanIndicatorImpl
monitorFanIndicatorImpl
;
...
...
@@ -41,7 +45,6 @@ public class StationDataTaskImpl implements IStationDataTask {
}
@Override
@Async
(
"jxiopAsyncExecutor"
)
public
List
<
DeviceDto
>
getListDevice
(
StationTaksDto
stationTaksDto
)
{
List
<
DeviceDto
>
deviceDtoList
=
new
ArrayList
<>();
TpriDmpDatabook
tpriDmpDatabook
=
tpriDmpDatabookServiceImpl
.
getTpriDmpDatabookByDataName
(
"风机"
);
...
...
@@ -49,7 +52,10 @@ public class StationDataTaskImpl implements IStationDataTask {
sjglZsjZsbtzList
.
forEach
(
sjglZsjZsbtz
->
{
DeviceDto
deviceDto
=
new
DeviceDto
();
deviceDto
.
setGateway
(
stationTaksDto
.
getGateway
());
deviceDto
.
setNumberName
(
""
);
String
kksbm
=
sjglZsjZsbtz
.
getKksbm
();
String
[]
kksbms
=
kksbm
.
split
(
" "
);
String
numberName
=
kksbms
[
kksbms
.
length
-
1
].
replace
(
"MD"
,
""
);
deviceDto
.
setNumberName
(
numberName
);
});
return
deviceDtoList
;
}
...
...
@@ -69,9 +75,25 @@ public class StationDataTaskImpl implements IStationDataTask {
monitorFanIndicatorImpl
.
UpdateMonitorFanIndicator
(
indexDtos
);
}
}
public
List
<
IndexDto
>
getIndexDto
(
DeviceDto
deviceDto
)
{
QueryResult
query
=
influxDbConnection
.
query
(
"SELECT * FROM iot_data where \"equipmentSpecificName\" =~/.*"
+
deviceDto
.
getNumberName
()+
".*/ and \"gatewayId\" =~/"
+
deviceDto
.
getGateway
()+
"/ group by \"equipmentsIdx\" limit 1"
);
List
<
QueryResult
.
Result
>
queryResults
=
query
.
getResults
();
for
(
int
i
=
0
;
i
<
queryResults
.
size
()
;
i
++)
{
QueryResult
.
Result
result
=
queryResults
.
get
(
i
);
List
list
=
result
.
getSeries
();
for
(
int
j
=
0
;
j
<
list
.
size
()
;
j
++)
{
QueryResult
.
Series
series
=
(
QueryResult
.
Series
)
list
.
get
(
j
);
System
.
out
.
println
(
series
.
getName
());
System
.
out
.
println
(
series
.
getColumns
());
System
.
out
.
println
(
series
.
getValues
());
System
.
out
.
println
(
series
.
getTags
());
}
}
return
null
;
}
@Override
public
void
setMonitorFanIndicator
(
List
<
IndexDto
>
list
)
{
}
}
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