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
fa6882c4
Commit
fa6882c4
authored
Apr 01, 2024
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.运行监盘获取全国数据service方法编写及实现。
parent
e373867b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
4 deletions
+171
-4
DemoController.java
...amos/boot/module/jxiop/biz/controller/DemoController.java
+6
-4
MonitorService.java
...in/amos/boot/module/jxiop/biz/service/MonitorService.java
+5
-0
MonitorServiceImpl.java
...oot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
+160
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/DemoController.java
View file @
fa6882c4
...
...
@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import
com.yeejoin.amos.boot.module.jxiop.biz.feign.CoreFeignClient
;
import
com.yeejoin.amos.boot.module.jxiop.biz.repository.ESEquipmentsRepository
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.MonitorService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.*
;
//import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
...
...
@@ -110,7 +111,8 @@ public class DemoController extends BaseController {
@Autowired
private
EquipmentsJxiopDocMysqlMapper
equipmentsJxiopDocMysqlMapper
;
@Autowired
private
MonitorService
monitorService
;
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"手动更新场站缓存信息接口"
)
...
...
@@ -445,7 +447,6 @@ public class DemoController extends BaseController {
query
.
setTrackTotalHits
(
true
);
SearchHits
<
ESEquipments
>
search
=
elasticsearchTemplate
.
search
(
query
,
ESEquipments
.
class
);
return
ResponseHelper
.
buildResponse
(
search
);
}
...
...
@@ -515,8 +516,9 @@ public class DemoController extends BaseController {
@GetMapping
(
"/testFeignCall"
)
public
List
<
CoreValuesDto
>
testFeignCall
()
{
List
<
CoreValuesDto
>
coreValuesDtos
=
coreCommonService
.
getValuesByStationNamesAndPointsNames
(
null
,
null
);
Double
sum
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
DAY_POWER_GENERATION
);
Double
avg
=
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtos
,
CommonConstans
.
DAY_POWER_GENERATION
);
monitorService
.
getTotalData
();
// Double sum = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// Double avg = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
return
coreValuesDtos
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/MonitorService.java
0 → 100644
View file @
fa6882c4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
;
public
interface
MonitorService
{
public
void
getTotalData
();
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
0 → 100644
View file @
fa6882c4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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.StationPlan
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.MonitorService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@RequiredArgsConstructor
public
class
MonitorServiceImpl
implements
MonitorService
{
private
final
EmqKeeper
emqKeeper
;
private
final
CoreCommonService
coreCommonService
;
private
final
StationBasicMapper
stationBasicMapper
;
private
final
StationPlanMapper
stationPlanMapper
;
@Override
public
void
getTotalData
()
{
//获取所有的场站数据
List
<
CoreValuesDto
>
coreValuesDtos
=
coreCommonService
.
getValuesByStationNamesAndPointsNames
(
null
,
null
);
List
<
StationBasic
>
stationBasicListAll
=
stationBasicMapper
.
selectList
(
new
QueryWrapper
<
StationBasic
>().
isNotNull
(
"fan_gateway_id"
));
List
<
StationBasic
>
fdzList
=
stationBasicListAll
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
());
List
<
StationBasic
>
gfList
=
stationBasicListAll
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getStationType
().
contains
(
"GFDZ"
)).
collect
(
Collectors
.
toList
());
List
<
StationBasic
>
cnList
=
stationBasicListAll
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getStationType
().
equals
(
"CNDZ"
)).
collect
(
Collectors
.
toList
());
Page
<
HashMap
<
String
,
String
>>
page
=
new
Page
<>(
1
,
10
);
Page
<
HashMap
<
String
,
String
>>
page1
=
new
Page
<>(
1
,
10
);
Page
<
HashMap
<
String
,
String
>>
page2
=
new
Page
<>(
1
,
10
);
//----------------装机容量开始-----------------------
List
<
HashMap
<
String
,
String
>>
list
=
new
ArrayList
<>();
//装机容量
HashMap
<
String
,
String
>
stringHashMap
=
new
HashMap
<>();
BigDecimal
totalInstall
=
new
BigDecimal
(
stationBasicListAll
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getInstalledCapacity
()
!=
null
).
mapToDouble
(
StationBasic:
:
getInstalledCapacity
).
sum
());
stringHashMap
.
put
(
"title"
,
totalInstall
.
toString
());
stringHashMap
.
put
(
"data"
,
""
);
list
.
add
(
stringHashMap
);
//风电站
HashMap
<
String
,
String
>
stringHashMap1
=
new
HashMap
<>();
BigDecimal
fdzInstall
=
new
BigDecimal
(
fdzList
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getInstalledCapacity
()
!=
null
).
mapToDouble
(
StationBasic:
:
getInstalledCapacity
).
sum
());
stringHashMap1
.
put
(
"title"
,
fdzInstall
.
toString
());
stringHashMap1
.
put
(
"data"
,
String
.
valueOf
(
fdzList
.
size
()));
list
.
add
(
stringHashMap1
);
//光伏电站
HashMap
<
String
,
String
>
stringHashMap2
=
new
HashMap
<>();
BigDecimal
gfInstall
=
new
BigDecimal
(
gfList
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getInstalledCapacity
()
!=
null
).
mapToDouble
(
StationBasic:
:
getInstalledCapacity
).
sum
());
stringHashMap2
.
put
(
"title"
,
gfInstall
.
toString
());
stringHashMap2
.
put
(
"data"
,
String
.
valueOf
(
gfList
.
size
()));
list
.
add
(
stringHashMap2
);
//储能站
HashMap
<
String
,
String
>
stringHashMap3
=
new
HashMap
<>();
BigDecimal
cnInstall
=
new
BigDecimal
(
cnList
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getInstalledCapacity
()
!=
null
).
mapToDouble
(
StationBasic:
:
getInstalledCapacity
).
sum
());
stringHashMap3
.
put
(
"title"
,
cnInstall
.
toString
());
stringHashMap3
.
put
(
"data"
,
String
.
valueOf
(
cnList
.
size
()));
list
.
add
(
stringHashMap3
);
page
.
setRecords
(
list
);
BigDecimal
gFInstall
=
new
BigDecimal
(
stationBasicListAll
.
stream
().
filter
(
stationBasic
->
stationBasic
.
getInstalledCapacity
()
!=
null
).
mapToDouble
(
StationBasic:
:
getInstalledCapacity
).
sum
());
//----------------------装机容量结束----------------------------------------
// ----------------装机容量开始-----------------------
List
<
HashMap
<
String
,
String
>>
list1
=
new
ArrayList
<>();
List
<
HashMap
<
String
,
String
>>
list2
=
new
ArrayList
<>();
Double
powerOfDay
=
0.0000
;
Double
powerOfMonth
=
0.0000
;
Double
powerOfAnnual
=
0.0000
;
Double
completeRateOfAnnual
=
0.00
;
Double
useHoursOfAnnual
=
0.00
;
Double
powerOfDayFD
=
0.0000
;
Double
powerOfMonthFD
=
0.0000
;
Double
powerOfAnnualFD
=
0.0000
;
Double
useHoursOfAnnualFD
=
0.0000
;
Double
completeRateOfAnnualFD
=
0.00
;
Double
powerOfDayGF
=
0.0000
;
Double
powerOfMonthGF
=
0.0000
;
Double
powerOfAnnualGF
=
0.0000
;
Double
completeRateOfAnnualGF
=
0.00
;
Double
useHoursOfAnnualGF
=
0.00
;
if
(
coreValuesDtos
.
size
()
>
0
)
{
powerOfDay
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
DAY_POWER_GENERATION
);
powerOfMonth
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
MONTH_POWER_GENERATION
);
powerOfAnnual
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_POWER_GENERATION
);
completeRateOfAnnual
=
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_GEN_ATTAINMENT_RATE
);
//年利用小时数
useHoursOfAnnual
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_GEN_HOURS
);
List
<
String
>
fdNames
=
fdzList
.
stream
().
map
(
StationBasic:
:
getStationCoreName
).
collect
(
Collectors
.
toList
());
List
<
String
>
gfNames
=
gfList
.
stream
().
map
(
StationBasic:
:
getStationCoreName
).
collect
(
Collectors
.
toList
());
List
<
CoreValuesDto
>
fdcoreValuesDtos
=
coreValuesDtos
.
stream
().
filter
(
dto
->
fdNames
.
contains
(
dto
.
getName
())).
collect
(
Collectors
.
toList
());
List
<
CoreValuesDto
>
gfcoreValuesDtos
=
coreValuesDtos
.
stream
().
filter
(
dto
->
gfNames
.
contains
(
dto
.
getName
())).
collect
(
Collectors
.
toList
());
if
(
fdcoreValuesDtos
.
size
()
>
0
)
{
powerOfDayFD
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
DAY_POWER_GENERATION
);
powerOfMonthFD
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
MONTH_POWER_GENERATION
);
powerOfAnnualFD
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_POWER_GENERATION
);
completeRateOfAnnualFD
=
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_GEN_ATTAINMENT_RATE
);
//年利用小时数
useHoursOfAnnualFD
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_GEN_HOURS
);
}
if
(
gfcoreValuesDtos
.
size
()
>
0
)
{
powerOfDayGF
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
DAY_POWER_GENERATION
);
powerOfMonthGF
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
MONTH_POWER_GENERATION
);
powerOfAnnualGF
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_POWER_GENERATION
);
completeRateOfAnnualGF
=
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_GEN_ATTAINMENT_RATE
);
//年利用小时数
useHoursOfAnnualGF
=
coreCommonService
.
getSumOfByPointName
(
coreValuesDtos
,
CommonConstans
.
YEAR_GEN_HOURS
);
}
}
HashMap
<
String
,
String
>
stringHashMap4
=
new
HashMap
<>();
stringHashMap4
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfDayFD
)
+
"/"
+
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfDayGF
));
list1
.
add
(
stringHashMap4
);
HashMap
<
String
,
String
>
stringHashMap5
=
new
HashMap
<>();
stringHashMap5
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfMonthFD
)
+
"/"
+
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfMonthGF
));
list1
.
add
(
stringHashMap5
);
HashMap
<
String
,
String
>
stringHashMap6
=
new
HashMap
<>();
stringHashMap6
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfAnnualFD
)
+
"/"
+
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfAnnualGF
));
list1
.
add
(
stringHashMap6
);
HashMap
<
String
,
String
>
stringHashMap7
=
new
HashMap
<>();
stringHashMap7
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
useHoursOfAnnualFD
)
+
"/"
+
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
useHoursOfAnnualGF
));
list1
.
add
(
stringHashMap7
);
HashMap
<
String
,
String
>
stringHashMap8
=
new
HashMap
<>();
stringHashMap8
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
completeRateOfAnnualFD
)
+
"/"
+
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
completeRateOfAnnualGF
));
list1
.
add
(
stringHashMap8
);
page1
.
setRecords
(
list1
);
HashMap
<
String
,
String
>
stringHashMap9
=
new
HashMap
<>();
stringHashMap9
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfDay
));
list2
.
add
(
stringHashMap9
);
HashMap
<
String
,
String
>
stringHashMap10
=
new
HashMap
<>();
stringHashMap10
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfMonth
));
list2
.
add
(
stringHashMap10
);
HashMap
<
String
,
String
>
stringHashMap11
=
new
HashMap
<>();
stringHashMap11
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
powerOfAnnual
));
list2
.
add
(
stringHashMap11
);
HashMap
<
String
,
String
>
stringHashMap12
=
new
HashMap
<>();
stringHashMap12
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
(
completeRateOfAnnual
*
100
)));
list2
.
add
(
stringHashMap12
);
page2
.
setRecords
(
list2
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
"total_zjrl_topic"
,
JSON
.
toJSON
(
page
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
emqKeeper
.
getMqttClient
().
publish
(
"total_ssscsj_topic"
,
JSON
.
toJSON
(
page1
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
emqKeeper
.
getMqttClient
().
publish
(
"total_zssscsj_topic"
,
JSON
.
toJSON
(
page2
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
}
catch
(
Exception
ex
)
{
}
}
}
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