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
af59bb89
Commit
af59bb89
authored
Nov 29, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、给部盾提供接口发电量详情接口
parent
ac80a9d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
36 deletions
+51
-36
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+2
-2
MonitoringServiceImpl.java
.../module/jxiop/biz/service/impl/MonitoringServiceImpl.java
+49
-34
No files found.
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 @
af59bb89
...
...
@@ -1526,8 +1526,8 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"全国发电详情部盾"
)
@GetMapping
(
"/getGenPowerInfo"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getGenPowerInfo
()
{
return
ResponseHelper
.
buildResponse
(
monitoringService
.
getGenPowerInfo
());
public
ResponseModel
<
Map
<
String
,
Object
>>
getGenPowerInfo
(
@RequestParam
(
required
=
false
)
String
areaCode
)
{
return
ResponseHelper
.
buildResponse
(
monitoringService
.
getGenPowerInfo
(
areaCode
));
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitoringServiceImpl.java
View file @
af59bb89
...
...
@@ -1264,16 +1264,24 @@ public class MonitoringServiceImpl {
return
returnResult
;
}
public
Map
<
String
,
Object
>
getGenPowerInfo
()
{
public
Map
<
String
,
Object
>
getGenPowerInfo
(
String
areaCode
)
{
List
<
StationCacheInfoDto
>
stationCacheInfoDtos
=
commonServiceImpl
.
getListStationCacheInfoDto
();
List
<
StationCacheInfoDto
>
fanStationList
=
stationCacheInfoDtos
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
());
List
<
StationCacheInfoDto
>
pvStationList
=
stationCacheInfoDtos
.
stream
().
filter
(
stationCacheInfoDto
->
!
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
StationCacheInfoDto
>>
groupByProvince
=
stationCacheInfoDtos
.
stream
().
collect
(
Collectors
.
groupingBy
(
StationCacheInfoDto:
:
getBelongProvince
));
if
(
StringUtils
.
isNotBlank
(
areaCode
))
{
MapRegion
mapRegion
=
mapRegionMapper
.
selectOne
(
new
QueryWrapper
<
MapRegion
>().
eq
(
"area_code"
,
areaCode
));
List
<
StationCacheInfoDto
>
filterData
=
stationCacheInfoDtos
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getAreaCode
().
equals
(
areaCode
)).
collect
(
Collectors
.
toList
());
stationCacheInfoDtos
=
filterData
.
size
()
>
0
?
filterData
:
stationCacheInfoDtos
;
if
(!
ObjectUtils
.
isEmpty
(
mapRegion
)){
stationCacheInfoDtos
=
filterData
;
}
}
List
<
StationCacheInfoDto
>
fanStationList
=
stationCacheInfoDtos
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
());
List
<
StationCacheInfoDto
>
pvStationList
=
stationCacheInfoDtos
.
stream
().
filter
(
stationCacheInfoDto
->
!
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
StationCacheInfoDto
>>
groupByProvince
=
stationCacheInfoDtos
.
stream
().
collect
(
Collectors
.
groupingBy
(
StationCacheInfoDto:
:
getBelongProvince
));
HashMap
<
String
,
Object
>
returnResult
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
pv_interval
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
fan_interval
=
new
HashMap
<>();
HashMap
<
String
,
Double
>
dayGenCache
=
new
HashMap
();
HashMap
<
String
,
Double
>
monthGenCache
=
new
HashMap
();
HashMap
<
String
,
Double
>
dayGenCache
=
new
HashMap
();
HashMap
<
String
,
Double
>
monthGenCache
=
new
HashMap
();
returnResult
.
put
(
"pv_station_count"
,
pvStationList
.
size
());
returnResult
.
put
(
"fan_station_count"
,
fanStationList
.
size
());
AtomicReference
<
Double
>
powerOfDayFD
=
new
AtomicReference
<>(
new
Double
(
0.00
));
...
...
@@ -1289,8 +1297,8 @@ public class MonitoringServiceImpl {
List
<
ESEquipments
>
result
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
powerOfDayFD
.
updateAndGet
(
v
->
v
+
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
"日发电量"
)));
powerOfMonthFD
.
updateAndGet
(
v
->
v
+
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
"月发电量"
)));
dayGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
"日发电量"
)));
monthGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
"月发电量"
)));
dayGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
"日发电量"
)));
monthGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
"月发电量"
)));
planOfFD
.
updateAndGet
(
v
->
v
+
getPlanGenByStationIdAndMonth
(
stationBasic
.
getStationId
()));
});
pvStationList
.
forEach
(
stationBasic
->
{
...
...
@@ -1300,46 +1308,53 @@ public class MonitoringServiceImpl {
List
<
ESEquipments
>
result
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
powerOfDayGF
.
updateAndGet
(
v
->
v
+
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
CommonConstans
.
taiHeGenIndicatorDay
));
powerOfMonthGF
.
updateAndGet
(
v
->
v
+
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
CommonConstans
.
taiHeGenIndicatorMonth
));
dayGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
CommonConstans
.
taiHeGenIndicatorDay
)));
monthGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
CommonConstans
.
taiHeGenIndicatorMonth
)));
dayGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
CommonConstans
.
taiHeGenIndicatorDay
)));
monthGenCache
.
put
(
stationBasic
.
getStationId
(),
keepFourdecimalPlaces
(
commonServiceImpl
.
getSumByEquipmentIndxName
(
result
,
CommonConstans
.
taiHeGenIndicatorMonth
)));
planOfGF
.
updateAndGet
(
v
->
v
+
getPlanGenByStationIdAndMonth
(
stationBasic
.
getStationId
()));
});
returnResult
.
put
(
"today_pv_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfDayGF
.
get
()));
returnResult
.
put
(
"today_fan_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfDayFD
.
get
()));
returnResult
.
put
(
"month_pv_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfMonthGF
.
get
()));
returnResult
.
put
(
"month_fan_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfMonthFD
.
get
()));
returnResult
.
put
(
"month_pv_quota_schedule"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,(
powerOfMonthGF
.
get
()/
planOfGF
.
get
())*
100
));
returnResult
.
put
(
"month_fan_quota_schedule"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,(
powerOfMonthFD
.
get
()/
planOfFD
.
get
())*
100
));
returnResult
.
put
(
"today_pv_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfDayGF
.
get
()));
returnResult
.
put
(
"today_fan_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfDayFD
.
get
()));
returnResult
.
put
(
"month_pv_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfMonthGF
.
get
()));
returnResult
.
put
(
"month_fan_power"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
powerOfMonthFD
.
get
()));
returnResult
.
put
(
"month_pv_quota_schedule"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
(
powerOfMonthGF
.
get
()
/
planOfGF
.
get
())
*
100
));
if
(
returnResult
.
get
(
"month_pv_quota_schedule"
).
toString
().
equals
(
"NaN"
)){
returnResult
.
put
(
"month_pv_quota_schedule"
,
0.00f
);
}
returnResult
.
put
(
"month_fan_quota_schedule"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
(
powerOfMonthFD
.
get
()
/
planOfFD
.
get
())
*
100
));
if
(
returnResult
.
get
(
"month_fan_quota_schedule"
).
toString
().
equals
(
"NaN"
)){
returnResult
.
put
(
"month_fan_quota_schedule"
,
0.00f
);
}
groupByProvince
.
keySet
().
forEach
(
s
->
{
HashMap
<
String
,
Object
>
fan
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
pv
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
fan
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
pv
=
new
HashMap
<>();
List
<
StationCacheInfoDto
>
list
=
groupByProvince
.
get
(
s
);
List
<
String
>
fanStationIds
=
list
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
()).
stream
().
map
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationId
()).
collect
(
Collectors
.
toList
());
List
<
String
>
pvStationIds
=
list
.
stream
().
filter
(
stationCacheInfoDto
->
!
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
()).
stream
().
map
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationId
()).
collect
(
Collectors
.
toList
());
fan
.
put
(
"station_count"
,
fanStationIds
.
size
());
pv
.
put
(
"station_count"
,
pvStationIds
.
size
());
fan
.
put
(
"today_power"
,
getTotalPowerFromCache
(
fanStationIds
,
dayGenCache
));
pv
.
put
(
"today_power"
,
getTotalPowerFromCache
(
pvStationIds
,
dayGenCache
));
fan
.
put
(
"month_power"
,
getTotalPowerFromCache
(
fanStationIds
,
monthGenCache
));
pv
.
put
(
"month_power"
,
getTotalPowerFromCache
(
pvStationIds
,
monthGenCache
));
pv_interval
.
put
(
s
,
pv
);
fan_interval
.
put
(
s
,
fan
);
fan
.
put
(
"station_count"
,
fanStationIds
.
size
());
pv
.
put
(
"station_count"
,
pvStationIds
.
size
());
fan
.
put
(
"today_power"
,
getTotalPowerFromCache
(
fanStationIds
,
dayGenCache
));
pv
.
put
(
"today_power"
,
getTotalPowerFromCache
(
pvStationIds
,
dayGenCache
));
fan
.
put
(
"month_power"
,
getTotalPowerFromCache
(
fanStationIds
,
monthGenCache
));
pv
.
put
(
"month_power"
,
getTotalPowerFromCache
(
pvStationIds
,
monthGenCache
));
pv_interval
.
put
(
s
,
pv
);
fan_interval
.
put
(
s
,
fan
);
});
returnResult
.
put
(
"pv_interval"
,
pv_interval
);
returnResult
.
put
(
"fan_interval"
,
fan_interval
);
returnResult
.
put
(
"pv_interval"
,
pv_interval
);
returnResult
.
put
(
"fan_interval"
,
fan_interval
);
return
returnResult
;
}
public
Double
getPlanGenByStationIdAndMonth
(
String
stationId
)
{
String
[]
dates
=
DateUtil
.
today
().
split
(
"-"
);
return
stationPlanMapper
.
getPlanGenByStationIdAndMonth
(
stationId
,
dates
[
0
],
String
.
valueOf
(
Integer
.
valueOf
(
dates
[
1
])));
}
public
Double
getTotalPowerFromCache
(
List
<
String
>
keys
,
HashMap
<
String
,
Double
>
cache
)
{
AtomicReference
<
Double
>
result
=
new
AtomicReference
<>(
0.0
);
keys
.
forEach
(
s
->
{
result
.
set
(
result
.
get
()
+
cache
.
get
(
s
));
});
return
keepFourdecimalPlaces
(
result
.
get
());
public
Double
getTotalPowerFromCache
(
List
<
String
>
keys
,
HashMap
<
String
,
Double
>
cache
)
{
AtomicReference
<
Double
>
result
=
new
AtomicReference
<>(
0.0
);
keys
.
forEach
(
s
->
{
result
.
set
(
result
.
get
()
+
cache
.
get
(
s
));
});
return
keepFourdecimalPlaces
(
result
.
get
());
}
}
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