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
4ce938c7
Commit
4ce938c7
authored
Apr 01, 2024
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.运行监盘全国地图、省份地图接口接入物联监盘。
parent
fa6882c4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
187 additions
and
18 deletions
+187
-18
StationBasic.java
...ejoin/amos/boot/module/jxiop/api/entity/StationBasic.java
+2
-2
CommonConstans.java
.../amos/boot/module/jxiop/biz/constants/CommonConstans.java
+2
-0
DemoController.java
...amos/boot/module/jxiop/biz/controller/DemoController.java
+2
-1
StationCacheInfoDto.java
...n/amos/boot/module/jxiop/biz/dto/StationCacheInfoDto.java
+5
-0
CoreCommonService.java
...amos/boot/module/jxiop/biz/service/CoreCommonService.java
+9
-0
MonitorService.java
...in/amos/boot/module/jxiop/biz/service/MonitorService.java
+5
-0
CoreCommonServiceImpl.java
.../module/jxiop/biz/service/impl/CoreCommonServiceImpl.java
+13
-6
MonitorServiceImpl.java
...oot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
+149
-9
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/entity/StationBasic.java
View file @
4ce938c7
...
@@ -163,12 +163,12 @@ public class StationBasic extends BaseEntity {
...
@@ -163,12 +163,12 @@ public class StationBasic extends BaseEntity {
* 前置网关配置的场站名称
* 前置网关配置的场站名称
*/
*/
@TableField
(
"station_core_name"
)
@TableField
(
"station_core_name"
)
private
String
stationCoreName
;
private
String
stationCoreName
;
/**
/**
* 前置配置的升压站名称
* 前置配置的升压站名称
*/
*/
@TableField
(
"booster_core_name"
)
@TableField
(
"booster_core_name"
)
private
String
boosterCoreName
;
private
String
boosterCoreName
;
/**
/**
* 装机容量
* 装机容量
*/
*/
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/constants/CommonConstans.java
View file @
4ce938c7
...
@@ -177,6 +177,8 @@ public class CommonConstans {
...
@@ -177,6 +177,8 @@ public class CommonConstans {
public
static
final
String
YEAR_GEN_ATTAINMENT_RATE
=
"年计划完成率"
;
public
static
final
String
YEAR_GEN_ATTAINMENT_RATE
=
"年计划完成率"
;
//年利用小时数
//年利用小时数
public
static
final
String
YEAR_GEN_HOURS
=
"年利用小时数"
;
public
static
final
String
YEAR_GEN_HOURS
=
"年利用小时数"
;
public
static
final
String
WIND_SPEED_THIRTY_SECONDS
=
"30秒平均风速"
;
public
static
final
String
TOTAL_RADIATION
=
"辐照度"
;
//------------------监盘服务改造新增常量结束------------------------------
//------------------监盘服务改造新增常量结束------------------------------
...
...
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 @
4ce938c7
...
@@ -516,7 +516,8 @@ public class DemoController extends BaseController {
...
@@ -516,7 +516,8 @@ public class DemoController extends BaseController {
@GetMapping
(
"/testFeignCall"
)
@GetMapping
(
"/testFeignCall"
)
public
List
<
CoreValuesDto
>
testFeignCall
()
{
public
List
<
CoreValuesDto
>
testFeignCall
()
{
List
<
CoreValuesDto
>
coreValuesDtos
=
coreCommonService
.
getValuesByStationNamesAndPointsNames
(
null
,
null
);
List
<
CoreValuesDto
>
coreValuesDtos
=
coreCommonService
.
getValuesByStationNamesAndPointsNames
(
null
,
null
);
monitorService
.
getTotalData
();
// monitorService.getTotalData();
monitorService
.
getNationWideInfo
(
"江西省"
,
"gis"
);
// Double sum = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// Double sum = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// Double avg = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// Double avg = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
return
coreValuesDtos
;
return
coreValuesDtos
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/StationCacheInfoDto.java
View file @
4ce938c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
dto
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -31,4 +32,8 @@ public class StationCacheInfoDto implements Serializable {
...
@@ -31,4 +32,8 @@ public class StationCacheInfoDto implements Serializable {
private
String
areaCode
;
private
String
areaCode
;
//
//
private
String
address
;
private
String
address
;
private
String
stationCoreName
;
private
String
boosterCoreName
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/CoreCommonService.java
View file @
4ce938c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
org.springframework.util.ObjectUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
public
interface
CoreCommonService
{
public
interface
CoreCommonService
{
/**
/**
...
@@ -26,4 +34,5 @@ public interface CoreCommonService {
...
@@ -26,4 +34,5 @@ public interface CoreCommonService {
* @return
* @return
*/
*/
Double
getAverageOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
);
Double
getAverageOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/MonitorService.java
View file @
4ce938c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
java.util.List
;
public
interface
MonitorService
{
public
interface
MonitorService
{
public
void
getTotalData
();
public
void
getTotalData
();
public
List
<
RegionNationWideDto
>
getNationWideInfo
(
String
provinceName
,
String
type
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CoreCommonServiceImpl.java
View file @
4ce938c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.feign.CoreFeignClient
;
import
com.yeejoin.amos.boot.module.jxiop.biz.feign.CoreFeignClient
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,14 +25,15 @@ import java.util.stream.Collectors;
...
@@ -19,14 +25,15 @@ import java.util.stream.Collectors;
public
class
CoreCommonServiceImpl
implements
CoreCommonService
{
public
class
CoreCommonServiceImpl
implements
CoreCommonService
{
private
final
CoreFeignClient
coreFeignClient
;
private
final
CoreFeignClient
coreFeignClient
;
@Override
@Override
public
List
<
CoreValuesDto
>
getValuesByStationNamesAndPointsNames
(
String
stationNames
,
String
pointsNames
)
{
public
List
<
CoreValuesDto
>
getValuesByStationNamesAndPointsNames
(
String
stationNames
,
String
pointsNames
)
{
FeignClientResult
<
List
<
Object
>>
feignClientResult
=
coreFeignClient
.
getValues
(
stationNames
,
pointsNames
);
FeignClientResult
<
List
<
Object
>>
feignClientResult
=
coreFeignClient
.
getValues
(
stationNames
,
pointsNames
);
List
<
Object
>
list
=
feignClientResult
.
getResult
();
List
<
Object
>
list
=
feignClientResult
.
getResult
();
List
<
CoreValuesDto
>
result
=
new
ArrayList
<>();
List
<
CoreValuesDto
>
result
=
new
ArrayList
<>();
list
.
forEach
(
o
->
{
list
.
forEach
(
o
->
{
CoreValuesDto
coreValuesDto
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
o
),
CoreValuesDto
.
class
);
CoreValuesDto
coreValuesDto
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
o
),
CoreValuesDto
.
class
);
coreValuesDto
.
setDataMap
(
coreValuesDto
.
getData
().
stream
().
flatMap
(
m
->
m
.
entrySet
().
stream
()).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,(
a
,
b
)->
b
)));
coreValuesDto
.
setDataMap
(
coreValuesDto
.
getData
().
stream
().
flatMap
(
m
->
m
.
entrySet
().
stream
()).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,
(
a
,
b
)
->
b
)));
result
.
add
(
coreValuesDto
);
result
.
add
(
coreValuesDto
);
});
});
return
result
;
return
result
;
...
@@ -35,7 +42,7 @@ public class CoreCommonServiceImpl implements CoreCommonService {
...
@@ -35,7 +42,7 @@ public class CoreCommonServiceImpl implements CoreCommonService {
@Override
@Override
public
Double
getSumOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
)
{
public
Double
getSumOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
)
{
AtomicReference
<
Double
>
result
=
new
AtomicReference
<>(
0.0
);
AtomicReference
<
Double
>
result
=
new
AtomicReference
<>(
0.0
);
coreValuesDtoList
=
coreValuesDtoList
.
stream
().
filter
(
coreValuesDto
->
coreValuesDto
.
getDataMap
().
size
()>
0
&&
coreValuesDto
.
getDataMap
().
containsKey
(
pointName
)).
collect
(
Collectors
.
toList
());
coreValuesDtoList
=
coreValuesDtoList
.
stream
().
filter
(
coreValuesDto
->
coreValuesDto
.
getDataMap
().
size
()
>
0
&&
coreValuesDto
.
getDataMap
().
containsKey
(
pointName
)).
collect
(
Collectors
.
toList
());
coreValuesDtoList
.
forEach
(
coreValuesDto
->
{
coreValuesDtoList
.
forEach
(
coreValuesDto
->
{
result
.
set
(
result
.
get
()
+
Double
.
parseDouble
(
coreValuesDto
.
getDataMap
().
get
(
pointName
).
toString
()));
result
.
set
(
result
.
get
()
+
Double
.
parseDouble
(
coreValuesDto
.
getDataMap
().
get
(
pointName
).
toString
()));
});
});
...
@@ -45,11 +52,11 @@ public class CoreCommonServiceImpl implements CoreCommonService {
...
@@ -45,11 +52,11 @@ public class CoreCommonServiceImpl implements CoreCommonService {
@Override
@Override
public
Double
getAverageOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
)
{
public
Double
getAverageOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
)
{
AtomicReference
<
Double
>
result
=
new
AtomicReference
<>(
0.0
);
AtomicReference
<
Double
>
result
=
new
AtomicReference
<>(
0.0
);
coreValuesDtoList
=
coreValuesDtoList
.
stream
().
filter
(
coreValuesDto
->
coreValuesDto
.
getDataMap
().
size
()>
0
&&
coreValuesDto
.
getDataMap
().
containsKey
(
pointName
)).
collect
(
Collectors
.
toList
());
coreValuesDtoList
=
coreValuesDtoList
.
stream
().
filter
(
coreValuesDto
->
coreValuesDto
.
getDataMap
().
size
()
>
0
&&
coreValuesDto
.
getDataMap
().
containsKey
(
pointName
)).
collect
(
Collectors
.
toList
());
coreValuesDtoList
.
forEach
(
coreValuesDto
->
{
coreValuesDtoList
.
forEach
(
coreValuesDto
->
{
result
.
set
(
result
.
get
()
+
Double
.
parseDouble
(
coreValuesDto
.
getDataMap
().
get
(
pointName
).
toString
()));
result
.
set
(
result
.
get
()
+
Double
.
parseDouble
(
coreValuesDto
.
getDataMap
().
get
(
pointName
).
toString
()));
});
});
return
result
.
get
()
/
coreValuesDtoList
.
size
();
return
result
.
get
()
/
coreValuesDtoList
.
size
();
}
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
View file @
4ce938c7
...
@@ -4,31 +4,36 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,31 +4,36 @@ import com.alibaba.fastjson.JSON;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.*
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationPlan
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
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.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService
;
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.MonitorService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.net.URLDecoder
;
import
java.util.Calendar
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
@Slf4j
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
MonitorServiceImpl
implements
MonitorService
{
public
class
MonitorServiceImpl
implements
MonitorService
{
private
final
EmqKeeper
emqKeeper
;
private
final
EmqKeeper
emqKeeper
;
private
final
CoreCommonService
coreCommonService
;
private
final
CoreCommonService
coreCommonService
;
private
final
StationBasicMapper
stationBasicMapper
;
private
final
StationBasicMapper
stationBasicMapper
;
private
final
StationPlanMapper
stationPlanMapper
;
private
final
RegionMapper
regionMapper
;
private
final
StationCoordinateMapper
stationCoordinateMapper
;
private
final
MapRegionMapper
mapRegionMapper
;
@Override
@Override
...
@@ -157,4 +162,139 @@ public class MonitorServiceImpl implements MonitorService {
...
@@ -157,4 +162,139 @@ public class MonitorServiceImpl implements MonitorService {
}
}
}
}
@Override
public
List
<
RegionNationWideDto
>
getNationWideInfo
(
String
provinceName
,
String
type
)
{
List
<
RegionNationWideDto
>
regionNationWideDtoList
=
new
ArrayList
<>();
List
<
StationCacheInfoDto
>
stationCacheInfoDtoList
=
this
.
getListStationCacheInfoDto
();
List
<
Region
>
regionList
=
this
.
regionMapper
.
selectList
(
new
QueryWrapper
<
Region
>().
eq
(
"level"
,
1
));
List
<
StationCacheInfoDto
>
list
=
new
ArrayList
<>();
if
((!
ObjectUtils
.
isEmpty
(
type
)
&&
type
.
equals
(
"gis"
))
&&
(
ObjectUtils
.
isEmpty
(
provinceName
)
||
provinceName
.
equals
(
""
)))
{
for
(
int
i
=
0
;
i
<
regionList
.
size
();
i
++)
{
RegionNationWideDto
regionNationWideDto
=
new
RegionNationWideDto
();
Region
region
=
regionList
.
get
(
i
);
list
=
stationCacheInfoDtoList
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getBelongProvince
().
equals
(
region
.
getRegionName
())).
collect
(
Collectors
.
toList
());
List
<
StationCacheInfoDto
>
fdlist
=
list
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
());
List
<
StationCacheInfoDto
>
gflist
=
list
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationType
().
contains
(
"GFDZ"
)).
collect
(
Collectors
.
toList
());
List
<
StationCacheInfoDto
>
cnlist
=
list
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getStationType
().
equals
(
"CNDZ"
)).
collect
(
Collectors
.
toList
());
if
(
list
.
size
()
>
0
)
{
regionNationWideDto
.
setJsJoin
(
true
);
}
else
{
regionNationWideDto
.
setJsJoin
(
false
);
}
regionNationWideDto
.
setFengdian
(
String
.
valueOf
(
fdlist
.
size
()));
regionNationWideDto
.
setGuangfu
(
String
.
valueOf
(
gflist
.
size
()));
regionNationWideDto
.
setChuneng
(
String
.
valueOf
(
cnlist
.
size
()));
regionNationWideDto
.
setGuangfuMW
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
gflist
.
stream
().
mapToDouble
(
stationCacheInfoDto
->
Double
.
parseDouble
(
stationCacheInfoDto
.
getInstalledCapacity
())).
sum
()));
regionNationWideDto
.
setFengdianMV
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
fdlist
.
stream
().
mapToDouble
(
stationCacheInfoDto
->
Double
.
parseDouble
(
stationCacheInfoDto
.
getInstalledCapacity
())).
sum
()));
regionNationWideDto
.
setChunengMV
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
cnlist
.
stream
().
mapToDouble
(
stationCacheInfoDto
->
Double
.
parseDouble
(
stationCacheInfoDto
.
getInstalledCapacity
())).
sum
()));
regionNationWideDto
.
setName
(
region
.
getRegionName
());
regionNationWideDtoList
.
add
(
regionNationWideDto
);
}
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
provinceName
)
&&
provinceName
.
contains
(
"%"
))
{
try
{
provinceName
=
URLDecoder
.
decode
(
provinceName
,
"UTF-8"
);
}
catch
(
Exception
e
)
{
}
}
List
<
CoreValuesDto
>
coreValuesDtos
=
coreCommonService
.
getValuesByStationNamesAndPointsNames
(
null
,
null
);
String
finalProvinceName
=
provinceName
;
if
(!
ObjectUtils
.
isEmpty
(
type
)
&&
type
.
equals
(
"station"
))
{
list
=
stationCacheInfoDtoList
;
}
else
{
list
=
stationCacheInfoDtoList
.
stream
().
filter
(
stationCacheInfoDto
->
stationCacheInfoDto
.
getBelongProvince
().
equals
(
finalProvinceName
)).
collect
(
Collectors
.
toList
());
}
List
<
StationCoordinate
>
stationCoordinateList
=
stationCoordinateMapper
.
selectList
(
new
QueryWrapper
<
StationCoordinate
>().
isNotNull
(
"station_id"
).
eq
(
"is_main_coordinate"
,
0
));
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
HashMap
<
String
,
Double
>
hashMap
=
new
HashMap
<>();
StationCacheInfoDto
stationCacheInfoDto
=
list
.
get
(
i
);
RegionNationWideDto
regionNationWideDto
=
new
RegionNationWideDto
();
regionNationWideDto
.
setStaitionId
(
String
.
valueOf
(
stationCacheInfoDto
.
getStationId
()));
regionNationWideDto
.
setStaitionName
(
stationCacheInfoDto
.
getStationName
());
regionNationWideDto
.
setStaitionType
(
stationCacheInfoDto
.
getStationType
());
String
speendOrirradiate
=
"0.00"
;
regionNationWideDto
.
setStationCapacity
(
stationCacheInfoDto
.
getInstalledCapacity
());
if
(
stationCacheInfoDto
.
getStationType
().
equals
(
"FDZ"
)&&
stationCacheInfoDto
.
getStationCoreName
()!=
null
&&
stationCacheInfoDto
.
getBoosterCoreName
()!=
null
)
{
List
<
CoreValuesDto
>
coreValuesDtoList
=
coreValuesDtos
.
stream
().
filter
(
coreValuesDto
->
coreValuesDto
.
getName
().
equals
(
stationCacheInfoDto
.
getStationCoreName
())||
coreValuesDto
.
getName
().
equals
(
stationCacheInfoDto
.
getBoosterCoreName
())).
collect
(
Collectors
.
toList
());
if
(
coreValuesDtoList
!=
null
&&
coreValuesDtoList
.
size
()>
0
)
{
speendOrirradiate
=
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtoList
,
CommonConstans
.
WIND_SPEED_THIRTY_SECONDS
));
}
}
else
if
(
stationCacheInfoDto
.
getStationType
().
contains
(
"GFDZ"
))
{
List
<
CoreValuesDto
>
coreValuesDtoList
=
coreValuesDtos
.
stream
().
filter
(
coreValuesDto
->
coreValuesDto
.
getName
().
equals
(
stationCacheInfoDto
.
getStationCoreName
())||
coreValuesDto
.
getName
().
equals
(
stationCacheInfoDto
.
getBoosterCoreName
())).
collect
(
Collectors
.
toList
());
if
(
coreValuesDtoList
!=
null
&&
coreValuesDtoList
.
size
()>
0
)
{
speendOrirradiate
=
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtoList
,
CommonConstans
.
WIND_SPEED_THIRTY_SECONDS
));
}
}
regionNationWideDto
.
setSpeendOrirradiate
(
speendOrirradiate
);
StationCoordinate
stationCoordinate
=
stationCoordinateList
.
stream
().
filter
(
stationCoordinate1
->
String
.
valueOf
(
stationCoordinate1
.
getStationId
()).
equals
(
stationCacheInfoDto
.
getStationId
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
hashMap
.
put
(
"lng"
,
Double
.
valueOf
(
stationCoordinate
.
getLongitude
()));
hashMap
.
put
(
"lat"
,
Double
.
valueOf
(
stationCoordinate
.
getLaitude
()));
regionNationWideDto
.
setPosition
(
hashMap
);
regionNationWideDtoList
.
add
(
regionNationWideDto
);
}
}
List
<
StationCacheInfoDto
>
finalList
=
list
;
String
finalProvinceName1
=
provinceName
;
Thread
thread
=
new
Thread
(()
->
{
getCompletionOfPowerIndicatorsByCurrentData
(
finalList
,
finalProvinceName1
);
});
thread
.
start
();
return
regionNationWideDtoList
;
}
public
void
getCompletionOfPowerIndicatorsByCurrentData
(
List
<
StationCacheInfoDto
>
stationBasicList
,
String
provinceName
)
{
String
provinceNameTopic
=
""
;
if
(
provinceName
.
contains
(
"黑龙江"
)
||
provinceName
.
contains
(
"内蒙古"
))
{
provinceNameTopic
=
provinceName
.
substring
(
0
,
3
);
}
else
{
provinceNameTopic
=
provinceName
.
substring
(
0
,
2
);
}
HashMap
<
String
,
String
>
stringHashMap
=
new
HashMap
<>();
stringHashMap
.
put
(
"title"
,
provinceNameTopic
+
"区域"
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
provinceName
+
"_proviceName_topic"
,
JSON
.
toJSON
(
stringHashMap
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
log
.
info
(
"----------------------------------推送省份名称消息成功败--------------------------------"
);
}
catch
(
Exception
e
)
{
log
.
info
(
"----------------------------------推送省份名称消息失败--------------------------------"
);
}
}
/**
* 获取场站的缓存信息,后续启动时需要将此数据从
*
* @return
*/
public
List
<
StationCacheInfoDto
>
getListStationCacheInfoDto
()
{
List
<
StationCacheInfoDto
>
stationCacheInfoDtos
=
new
ArrayList
<>();
List
<
Region
>
regionList
=
regionMapper
.
selectList
(
new
QueryWrapper
<
Region
>().
eq
(
"LEVEL"
,
1
));
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"
));
for
(
int
i
=
0
;
i
<
stationBasicList
.
size
();
i
++)
{
StationBasic
stationBasic
=
stationBasicList
.
get
(
i
);
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
));
Double
installedCapacity
=
0.0d
;
if
(!
ObjectUtils
.
isEmpty
(
stationBasic
.
getInstalledCapacity
()))
{
installedCapacity
=
stationBasic
.
getInstalledCapacity
();
}
stationCacheInfoDto
.
setInstalledCapacity
(
String
.
format
(
"%.2f"
,
installedCapacity
));
stationCacheInfoDto
.
setFanGatewayId
(
stationBasic
.
getFanGatewayId
());
stationCacheInfoDto
.
setAreaCode
(
mapRegionList
.
stream
().
filter
(
mapRegion
->
mapRegion
.
getProvince
().
contains
(
stationCacheInfoDto
.
getBelongProvince
().
substring
(
0
,
2
))
||
mapRegion
.
getProvince
().
contains
(
stationCacheInfoDto
.
getBelongProvince
().
substring
(
0
,
3
))).
map
(
mapRegion
->
mapRegion
.
getAreaCode
()).
collect
(
Collectors
.
toList
()).
get
(
0
));
stationCacheInfoDto
.
setBoosterGatewayId
(
stationBasic
.
getBoosterGatewayId
());
stationCacheInfoDto
.
setBoosterCoreName
(
stationBasic
.
getBoosterCoreName
());
stationCacheInfoDto
.
setStationCoreName
(
stationBasic
.
getStationCoreName
());
stationCacheInfoDtos
.
add
(
stationCacheInfoDto
);
}
return
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