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
53167628
Commit
53167628
authored
Apr 08, 2024
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.大屏监控全国社会贡献度、区域社会贡献度接口数据源修改。
parent
bf3c1399
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
35 deletions
+105
-35
MonitorService.java
...in/amos/boot/module/jxiop/biz/service/MonitorService.java
+41
-4
MonitorServiceImpl.java
...oot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
+64
-31
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/MonitorService.java
View file @
53167628
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData
;
...
...
@@ -11,25 +12,61 @@ import java.util.Map;
public
interface
MonitorService
{
/**
* @Description 根据区域编码动态运维数据
* @param areaCode 区域编码
* @return 全国运维数据
* @Description 根据区域编码动态运维数据
*/
IPage
<
Map
<
String
,
Object
>>
operationData
(
String
areaCode
);
/**
* @Description 全国新能源接入情况
* @return Map<String, Object>
* @Description 全国新能源接入情况
*/
Map
<
String
,
Object
>
accessSituation
();
/**
* @Description 区域新能源接入情况
* @return Map<String, Object>
* @Description 区域新能源接入情况
*/
Map
<
String
,
Object
>
qyAccessSituation
();
/**
* @return List<RegionNationWideDto>
* @Description 获取全国数据
*/
Map
<
String
,
Object
>
gettimedateyfdqs
();
/**
* @return List<RegionNationWideDto>
* @Description 获取区域数据
*/
Map
<
String
,
Object
>
gettimedateyfd
(
String
areaName
);
Map
<
String
,
Object
>
gettimedateqyyfd
(
String
areaName
);
/**
* @return List<RegionNationWideDto>
* @Description 获取区域数据
*/
Map
<
String
,
Object
>
gettimedateqyyfd
(
String
areaName
);
/**
* @Description 获取全国的发电量趋势
* @return SeriesData
*/
SeriesData
getSeriesDataqg
();
/**
* @Description 根据areaCode获取全国发电量趋势
* @param areaCode
* @return SeriesData
*/
SeriesData
getSeriesDataqy
(
String
areaCode
);
/**
* @Descripiton 根据入参动态获取社会贡献
* @param areaCode
* @return
*/
Page
<
HashMap
<
String
,
String
>>
socialContribution
(
String
areaCode
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
View file @
53167628
...
...
@@ -5,39 +5,33 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.api.Enum.StationType
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.BuDunGenDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.BudunDayGenTrendDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.BudunMonthTrendDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.BundunCompleteDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.Region
;
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.MapRegionMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.Constants
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.HttpRequestUtil
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.MonitorService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil
;
import
lombok.RequiredArgsConstructor
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.elasticsearch.search.aggregations.Aggregation
;
import
org.elasticsearch.search.aggregations.Aggregations
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.metrics.ParsedSum
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
java.io.PipedReader
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -179,6 +173,7 @@ public class MonitorServiceImpl implements MonitorService {
return
mapjn
;
}
@Override
public
Map
<
String
,
Object
>
gettimedateyfdqs
()
{
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_generated_quota_trend
;
...
...
@@ -238,15 +233,15 @@ public class MonitorServiceImpl implements MonitorService {
public
SeriesData
getSeriesDataqg
()
{
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_day_generation_trend
;
List
<
BudunDayGenTrendDto
>
budunDayGenTrendDtoList
=
httpRequestUtil
.
getResPonse
(
requestUrl
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
,
BudunDayGenTrendDto
.
class
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
String
>
listdate
=
new
ArrayList
<>();
List
<
Double
>
listjn
=
new
ArrayList
<>();
List
<
Double
>
listqn
=
new
ArrayList
<>();
String
currentYear
=
LocalDate
.
now
().
getYear
()
+
"-"
;
List
<
Double
>
listjn
=
new
ArrayList
<>();
List
<
Double
>
listqn
=
new
ArrayList
<>();
String
currentYear
=
LocalDate
.
now
().
getYear
()
+
"-"
;
budunDayGenTrendDtoList
.
forEach
(
bundunDayGenTrendDto
->
{
listjn
.
add
(
bundunDayGenTrendDto
.
getCurrent_generating_capacity
());
listqn
.
add
(
bundunDayGenTrendDto
.
getLast_generating_capacity
());
listdate
.
add
(
bundunDayGenTrendDto
.
getReporting_date
().
replace
(
currentYear
,
""
));
listjn
.
add
(
bundunDayGenTrendDto
.
getCurrent_generating_capacity
());
listqn
.
add
(
bundunDayGenTrendDto
.
getLast_generating_capacity
());
listdate
.
add
(
bundunDayGenTrendDto
.
getReporting_date
().
replace
(
currentYear
,
""
));
});
Map
<
String
,
Object
>
mapjn
=
new
HashMap
<>();
mapjn
.
put
(
"data"
,
listjn
);
...
...
@@ -270,23 +265,24 @@ public class MonitorServiceImpl implements MonitorService {
return
seriesData
;
}
public
SeriesData
getSeriesDataqy
(
String
areaCode
){
MapRegion
mapRegion
=
mapRegionMapper
.
selectOne
(
new
QueryWrapper
<
MapRegion
>().
eq
(
"areaCode"
,
areaCode
));
String
areaName
=
""
;
if
(!
ObjectUtils
.
isEmpty
(
mapRegion
)&&!
ObjectUtils
.
isEmpty
(
mapRegion
.
getName
())&&!
mapRegion
.
getName
().
contains
(
Constants
.
areaChinese
)){
areaName
=
mapRegion
.
getName
().
replace
(
Constants
.
areaChinese
,
""
);
@Override
public
SeriesData
getSeriesDataqy
(
String
areaCode
)
{
MapRegion
mapRegion
=
mapRegionMapper
.
selectOne
(
new
QueryWrapper
<
MapRegion
>().
eq
(
"areaCode"
,
areaCode
));
String
areaName
=
""
;
if
(!
ObjectUtils
.
isEmpty
(
mapRegion
)
&&
!
ObjectUtils
.
isEmpty
(
mapRegion
.
getName
())
&&
!
mapRegion
.
getName
().
contains
(
Constants
.
areaChinese
))
{
areaName
=
mapRegion
.
getName
()
+
Constants
.
areaChinese
;
}
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_day_generation_trend
+
"&areaName="
+
areaName
;
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_day_generation_trend
+
"&areaName="
+
areaName
;
List
<
BudunDayGenTrendDto
>
budunDayGenTrendDtoList
=
httpRequestUtil
.
getResPonse
(
requestUrl
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
,
BudunDayGenTrendDto
.
class
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
String
>
listdate
=
new
ArrayList
<>();
List
<
Double
>
listjn
=
new
ArrayList
<>();
List
<
Double
>
listqn
=
new
ArrayList
<>();
String
currentYear
=
LocalDate
.
now
().
getYear
()
+
"-"
;
List
<
Double
>
listjn
=
new
ArrayList
<>();
List
<
Double
>
listqn
=
new
ArrayList
<>();
String
currentYear
=
LocalDate
.
now
().
getYear
()
+
"-"
;
budunDayGenTrendDtoList
.
forEach
(
bundunDayGenTrendDto
->
{
listjn
.
add
(
bundunDayGenTrendDto
.
getCurrent_generating_capacity
());
listqn
.
add
(
bundunDayGenTrendDto
.
getLast_generating_capacity
());
listdate
.
add
(
bundunDayGenTrendDto
.
getReporting_date
().
replace
(
currentYear
,
""
));
listdate
.
add
(
bundunDayGenTrendDto
.
getReporting_date
().
replace
(
currentYear
,
""
));
});
Map
<
String
,
Object
>
mapjn
=
new
HashMap
<>();
mapjn
.
put
(
"data"
,
listjn
);
...
...
@@ -300,12 +296,49 @@ public class MonitorServiceImpl implements MonitorService {
seriesData
.
setSeriesData
(
list
);
seriesData
.
setAxisData
(
listdate
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
"qy/fdqs/"
+
areaCode
,
JSON
.
toJSONString
(
seriesData
).
getBytes
(),
1
,
true
);
emqKeeper
.
getMqttClient
().
publish
(
"qy/fdqs/"
+
areaCode
,
JSON
.
toJSONString
(
seriesData
).
getBytes
(),
1
,
true
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
return
seriesData
;
}
@Override
public
Page
<
HashMap
<
String
,
String
>>
socialContribution
(
String
areaCode
)
{
Double
totalAnnual
=
0.0
;
MapRegion
mapRegion
=
mapRegionMapper
.
selectOne
(
new
QueryWrapper
<
MapRegion
>().
eq
(
"areaCode"
,
areaCode
));
String
areaName
=
""
;
if
(!
ObjectUtils
.
isEmpty
(
mapRegion
)
&&
!
ObjectUtils
.
isEmpty
(
mapRegion
.
getName
())
&&
!
mapRegion
.
getName
().
contains
(
Constants
.
areaChinese
))
{
areaName
=
mapRegion
.
getName
()+
Constants
.
areaChinese
;
}
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_area_item_url
;
if
(
areaCode
!=
null
){
requestUrl
=
requestUrl
+
"&areaName="
+
areaName
;
}
List
<
BuDunGenDto
>
buDunGenDtos
=
httpRequestUtil
.
getResPonse
(
requestUrl
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
,
BuDunGenDto
.
class
);
if
(
buDunGenDtos
.
size
()>
0
){
totalAnnual
=
buDunGenDtos
.
get
(
0
).
getYear
();
}
Page
<
HashMap
<
String
,
String
>>
page3
=
new
Page
<>(
1
,
10
);
HashMap
<
String
,
String
>
stringHashMap13
=
new
HashMap
<>();
List
<
HashMap
<
String
,
String
>>
list3
=
new
ArrayList
<>();
stringHashMap13
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
(
totalAnnual
*
CommonConstans
.
carbonDioxide
)));
stringHashMap13
.
put
(
"unit"
,
"二氧化碳减排量(t)"
);
list3
.
add
(
stringHashMap13
);
HashMap
<
String
,
String
>
stringHashMap14
=
new
HashMap
<>();
stringHashMap14
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
(
totalAnnual
*
CommonConstans
.
standardCoal
)));
stringHashMap14
.
put
(
"unit"
,
"节约标准煤(t)"
);
list3
.
add
(
stringHashMap14
);
HashMap
<
String
,
String
>
stringHashMap15
=
new
HashMap
<>();
stringHashMap15
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
(
totalAnnual
*
CommonConstans
.
toner
)));
stringHashMap15
.
put
(
"unit"
,
"碳粉尘减排量(t)"
);
list3
.
add
(
stringHashMap15
);
HashMap
<
String
,
String
>
stringHashMap16
=
new
HashMap
<>();
stringHashMap16
.
put
(
"title"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
(
totalAnnual
*
CommonConstans
.
sulfurDioxide
)));
stringHashMap16
.
put
(
"unit"
,
"二氧化硫减排量(t)"
);
list3
.
add
(
stringHashMap16
);
page3
.
setRecords
(
list3
);
return
page3
;
}
}
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