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
5d4da207
Commit
5d4da207
authored
Sep 01, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新配置到配置文件并且对于请求配置进行微调
parent
3adc91c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
StationCacheDataInit.java
.../boot/module/jxiop/biz/initdata/StationCacheDataInit.java
+24
-23
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/initdata/StationCacheDataInit.java
View file @
5d4da207
...
...
@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
lombok.RequiredArgsConstructor
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.CommandLineRunner
;
...
...
@@ -25,45 +26,45 @@ import java.util.List;
import
java.util.stream.Collectors
;
@Component
@RequiredArgsConstructor
public
class
StationCacheDataInit
implements
CommandLineRunner
{
private
final
StationBasicMapper
stationBasicMapper
;
private
final
RegionMapper
regionMapper
;
private
final
MapRegionMapper
mapRegionMapper
;
private
final
SjglZsjZsbtzMapper
sjglZsjZsbtzMapper
;
private
final
CommonServiceImpl
commonServiceImpl
;
private
final
RedisTemplate
redisTemplate
;
Logger
logger
=
LoggerFactory
.
getLogger
(
StationCacheDataInit
.
class
);
@Resource
private
StationBasicMapper
stationBasicMapper
;
@Resource
private
RegionMapper
regionMapper
;
@Resource
private
MapRegionMapper
mapRegionMapper
;
@Resource
private
SjglZsjZsbtzMapper
sjglZsjZsbtzMapper
;
@Resource
private
CommonServiceImpl
commonServiceImpl
;
@Resource
private
RedisTemplate
redisTemplate
;
public
void
run
(
String
...
args
)
throws
Exception
{
List
<
StationCacheInfoDto
>
stationCacheInfoDtos
=
new
ArrayList
<>();
redisTemplate
.
delete
(
"station_info_cache"
);
List
<
Region
>
regionList
=
regionMapper
.
selectList
(
new
QueryWrapper
<
Region
>().
eq
(
"LEVEL"
,
1
));
List
<
MapRegion
>
mapRegionList
=
mapRegionMapper
.
selectList
(
new
QueryWrapper
<
MapRegion
>().
isNotNull
(
"name"
));
List
<
MapRegion
>
mapRegionList
=
mapRegionMapper
.
selectList
(
new
QueryWrapper
<
MapRegion
>().
isNotNull
(
"name"
));
List
<
StationBasic
>
stationBasicList
=
stationBasicMapper
.
selectList
(
new
QueryWrapper
<
StationBasic
>().
isNotNull
(
"belong_area"
).
isNotNull
(
"fan_gateway_id"
));
stationBasicList
.
forEach
(
stationBasic
->
{
StationCacheInfoDto
stationCacheInfoDto
=
new
StationCacheInfoDto
();
stationCacheInfoDto
.
setStationId
(
stationBasic
.
getSequenceNbr
().
toString
());
stationCacheInfoDto
.
setStationName
(
stationBasic
.
getStationName
());
stationCacheInfoDto
.
setStationType
(
stationBasic
.
getStationType
());
stationCacheInfoDto
.
setBelongProvince
(
regionList
.
stream
().
filter
(
region
->
region
.
getRegionCode
().
toString
().
equals
(
stationBasic
.
getBelongArea
().
replace
(
"["
,
""
).
split
(
","
)[
0
])).
map
(
region
->
region
.
getRegionName
()).
collect
(
Collectors
.
toList
()).
get
(
0
));
stationCacheInfoDto
.
setBelongArea
(
mapRegionList
.
stream
().
filter
(
mapRegion
->
mapRegion
.
getProvince
().
contains
(
stationCacheInfoDto
.
getBelongProvince
().
substring
(
0
,
2
))||
mapRegion
.
getProvince
().
contains
(
stationCacheInfoDto
.
getBelongProvince
().
substring
(
0
,
3
))).
map
(
mapRegion
->
mapRegion
.
getName
()).
collect
(
Collectors
.
toList
()).
get
(
0
));
stationCacheInfoDto
.
setInstalledCapacity
(
String
.
format
(
"%.2f"
,
sjglZsjZsbtzMapper
.
getStationCapactityByStationWerks
(
stationBasic
.
getStationNumber
())));
List
<
QueryDto
>
queryDtoList
=
new
ArrayList
<>();
queryDtoList
.
add
(
new
QueryDto
(
"gatewayId"
,
stationBasic
.
getFanGatewayId
()));
queryDtoList
.
add
(
new
QueryDto
(
"equipmentIndexName.keyword"
,
"有功功率"
));
if
(!
stationBasic
.
getStationType
().
equals
(
"FDZ"
)){
queryDtoList
.
add
(
new
QueryDto
(
"frontModule"
,
"逆变器"
));
stationCacheInfoDto
.
setBelongProvince
(
regionList
.
stream
().
filter
(
region
->
region
.
getRegionCode
().
toString
().
equals
(
stationBasic
.
getBelongArea
().
replace
(
"["
,
""
).
split
(
","
)[
0
])).
map
(
region
->
region
.
getRegionName
()).
collect
(
Collectors
.
toList
()).
get
(
0
));
stationCacheInfoDto
.
setBelongArea
(
mapRegionList
.
stream
().
filter
(
mapRegion
->
mapRegion
.
getProvince
().
contains
(
stationCacheInfoDto
.
getBelongProvince
().
substring
(
0
,
2
))
||
mapRegion
.
getProvince
().
contains
(
stationCacheInfoDto
.
getBelongProvince
().
substring
(
0
,
3
))).
map
(
mapRegion
->
mapRegion
.
getName
()).
collect
(
Collectors
.
toList
()).
get
(
0
));
stationCacheInfoDto
.
setInstalledCapacity
(
String
.
format
(
"%.2f"
,
sjglZsjZsbtzMapper
.
getStationCapactityByStationWerks
(
stationBasic
.
getStationNumber
())));
try
{
List
<
QueryDto
>
queryDtoList
=
new
ArrayList
<>();
queryDtoList
.
add
(
new
QueryDto
(
"gatewayId"
,
stationBasic
.
getFanGatewayId
()));
queryDtoList
.
add
(
new
QueryDto
(
"equipmentIndexName.keyword"
,
"有功功率"
));
if
(!
stationBasic
.
getStationType
().
equals
(
"FDZ"
))
{
queryDtoList
.
add
(
new
QueryDto
(
"frontModule"
,
"逆变器"
));
}
stationCacheInfoDto
.
setEquipmentNumbers
(
commonServiceImpl
.
getCount
(
queryDtoList
,
"equipmentNumber.Keyword"
,
ESEquipments
.
class
).
toString
());
}
catch
(
Exception
exception
)
{
logger
.
info
(
"--------------------查询ES错误---------------------------"
);
}
stationCacheInfoDto
.
setEquipmentNumbers
(
commonServiceImpl
.
getCount
(
queryDtoList
,
"equipmentNumber.Keyword"
,
ESEquipments
.
class
).
toString
());
stationCacheInfoDto
.
setFanGatewayId
(
stationBasic
.
getFanGatewayId
());
stationCacheInfoDto
.
setBoosterGatewayId
(
stationBasic
.
getBoosterGatewayId
());
stationCacheInfoDtos
.
add
(
stationCacheInfoDto
);
});
redisTemplate
.
opsForList
().
leftPushAll
(
"station_info_cache"
,
stationCacheInfoDtos
);
redisTemplate
.
opsForList
().
leftPushAll
(
"station_info_cache"
,
stationCacheInfoDtos
);
}
}
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