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
5db47cd7
Commit
5db47cd7
authored
Nov 29, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、给部盾提供接口发电量详情接口
parent
43025d6f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
3 deletions
+89
-3
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+10
-0
MonitoringServiceImpl.java
.../module/jxiop/biz/service/impl/MonitoringServiceImpl.java
+79
-3
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 @
5db47cd7
...
...
@@ -1521,4 +1521,14 @@ public class MonitorFanIdxController extends BaseController {
public
ResponseModel
<
Map
<
String
,
String
>>
getGenPowerInfoForBuDun
(
@RequestParam
(
required
=
false
)
String
areaCode
,
@RequestParam
(
required
=
false
)
String
stationId
)
{
return
ResponseHelper
.
buildResponse
(
monitoringService
.
getGenPowerInfoForBuDun
(
areaCode
,
stationId
));
}
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"全国发电详情部盾"
)
@GetMapping
(
"/getGenPowerInfo"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getGenPowerInfo
()
{
return
ResponseHelper
.
buildResponse
(
monitoringService
.
getGenPowerInfo
());
}
}
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 @
5db47cd7
...
...
@@ -13,9 +13,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.*
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
lombok.Data
;
import
org.apache.commons.lang.StringUtils
;
import
org.checkerframework.checker.units.qual.min
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -27,7 +25,6 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
java.math.BigDecimal
;
import
java.net.URLDecoder
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
...
...
@@ -1266,4 +1263,83 @@ public class MonitoringServiceImpl {
}
return
returnResult
;
}
public
Map
<
String
,
Object
>
getGenPowerInfo
()
{
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
));
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
();
returnResult
.
put
(
"pv_station_count"
,
pvStationList
.
size
());
returnResult
.
put
(
"fan_station_count"
,
fanStationList
.
size
());
AtomicReference
<
Double
>
powerOfDayFD
=
new
AtomicReference
<>(
new
Double
(
0.00
));
AtomicReference
<
Double
>
powerOfMonthFD
=
new
AtomicReference
<>(
new
Double
(
0.00
));
AtomicReference
<
Double
>
powerOfDayGF
=
new
AtomicReference
<>(
new
Double
(
0.00
));
AtomicReference
<
Double
>
powerOfMonthGF
=
new
AtomicReference
<>(
new
Double
(
0.00
));
AtomicReference
<
Double
>
planOfFD
=
new
AtomicReference
<>(
new
Double
(
0.00
));
AtomicReference
<
Double
>
planOfGF
=
new
AtomicReference
<>(
new
Double
(
0.00
));
fanStationList
.
forEach
(
stationBasic
->
{
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"日发电量"
,
"月发电量"
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getFanGatewayId
()));
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
,
"月发电量"
)));
planOfFD
.
updateAndGet
(
v
->
v
+
getPlanGenByStationIdAndMonth
(
stationBasic
.
getStationId
()));
});
pvStationList
.
forEach
(
stationBasic
->
{
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
CommonConstans
.
taiHeGenIndicator
);
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getBoosterGatewayId
()));
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
)));
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
));
groupByProvince
.
keySet
().
forEach
(
s
->
{
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
);
});
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
());
}
}
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