Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
39aaa9b3
Commit
39aaa9b3
authored
Jul 25, 2024
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
智慧分析 - 健康等级 片区/全国计算调整
parent
d86c5abe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
30 deletions
+58
-30
TestController.java
...amos/boot/module/jxiop/biz/controller/TestController.java
+4
-1
IFanHealthIndexService.java
...boot/module/jxiop/biz/service/IFanHealthIndexService.java
+26
-0
FanHealthIndexServiceImpl.java
...ule/jxiop/biz/service/impl/FanHealthIndexServiceImpl.java
+4
-4
PvHealthIndexServiceImpl.java
...dule/jxiop/biz/service/impl/PvHealthIndexServiceImpl.java
+4
-4
TdengineTimeServiceImpl.java
...odule/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
+20
-21
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TestController.java
View file @
39aaa9b3
...
...
@@ -211,7 +211,10 @@ public class TestController extends BaseController {
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
tdengineTimeService
.
insertMomentDataPvTest
(
"2024-07-25 08:00:00"
);
// tdengineTimeService.insertMomentDataPvTest("2024-07-24 08:00:00");
//区域 全域最后统一生成
tdengineTimeService
.
insertMomentDataAllTest
(
"2024-07-24 08:00:00"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/IFanHealthIndexService.java
View file @
39aaa9b3
...
...
@@ -90,8 +90,34 @@ public interface IFanHealthIndexService {
*/
List
<
FanHealthIndex
>
getInfoListByGroupByQgFan
(
String
startTime
,
String
tableName
,
String
analysisObjectType
);
/**
* 光伏 & 风电加权平均计算 :区域
*
*
* @param startTime startTime
* @param fanTableName fanTableName
* @param pvTableName pvTableName
* @param analysisObjectType analysisObjectType
* @return {@link List< HealthIndexDTO>}
* @author yangyang
* @throws
* @date 2024/7/25 14:01
*/
List
<
HealthIndexDTO
>
getInfoListByGroupByQy
(
String
startTime
,
String
fanTableName
,
String
pvTableName
,
String
analysisObjectType
);
/**
* 光伏 & 风电加权平均计算 :全域【所有 / 全国】
*
*
* @param startTime startTime
* @param fanTableName fanTableName
* @param pvTableName pvTableName
* @param analysisObjectType analysisObjectType
* @return {@link List< HealthIndexDTO>}
* @author yangyang
* @throws
* @date 2024/7/25 14:01
*/
List
<
HealthIndexDTO
>
getInfoListByGroupByQg
(
String
startTime
,
String
fanTableName
,
String
pvTableName
,
String
analysisObjectType
);
FanHealthIndex
toFanHealthIndex
(
HealthIndexDTO
healthIndex
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/FanHealthIndexServiceImpl.java
View file @
39aaa9b3
...
...
@@ -380,7 +380,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
weightMap
.
putAll
(
fanWeightMap
);
weightMap
.
putAll
(
pvWeightMap
);
// 开始计算加权平均
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()
+
o
.
getArea
()
+
o
.
getOrgCode
()
));
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()
+
o
.
getArea
()));
List
<
HealthIndexDTO
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
HealthIndexDTO
healthIndex
=
new
HealthIndexDTO
();
...
...
@@ -426,7 +426,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
weightMap
.
putAll
(
pvWeightMap
);
// 开始计算加权平均
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()
+
o
.
getOrgCode
()
));
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()));
List
<
HealthIndexDTO
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
HealthIndexDTO
healthIndex
=
new
HealthIndexDTO
();
...
...
@@ -475,8 +475,8 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
public
Double
getWeight
(
Supplier
<
String
>
key
,
Map
<
String
,
Float
>
weightMap
)
{
Float
weight
=
weightMap
.
get
(
key
.
get
());
if
(
weight
==
null
)
{
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
没有配置测点
权重"
);
throw
new
RuntimeException
(
"【"
+
key
.
get
()
+
"】
没有配置测点
权重"
);
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
未配置
权重"
);
throw
new
RuntimeException
(
"【"
+
key
.
get
()
+
"】
未配置
权重"
);
}
return
weight
.
doubleValue
();
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/PvHealthIndexServiceImpl.java
View file @
39aaa9b3
...
...
@@ -162,7 +162,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
String
analysisObjectType
)
{
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
QueryWrapper
<
IdxBizPvWeight
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"
4
"
);
queryWrapper
.
eq
(
"type"
,
"
3
"
);
queryWrapper
.
isNotNull
(
"value"
);
List
<
IdxBizPvWeight
>
idxBizFanWeights
=
idxBizPvWeightMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
(),
IdxBizPvWeight:
:
getValue
));
...
...
@@ -218,7 +218,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
String
analysisObjectType
)
{
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
QueryWrapper
<
IdxBizPvWeight
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"
3
"
);
queryWrapper
.
eq
(
"type"
,
"
4
"
);
queryWrapper
.
isNotNull
(
"value"
);
List
<
IdxBizPvWeight
>
idxBizFanWeights
=
idxBizPvWeightMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
(),
IdxBizPvWeight:
:
getValue
));
...
...
@@ -371,8 +371,8 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
public
Double
getWeight
(
Supplier
<
String
>
key
,
Map
<
String
,
Float
>
weightMap
)
{
Float
weight
=
weightMap
.
get
(
key
.
get
());
if
(
weight
==
null
)
{
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
没有配置测点
权重"
);
throw
new
RuntimeException
(
"
没有配置测点
权重"
);
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
未配置
权重"
);
throw
new
RuntimeException
(
"
未配置
权重"
);
}
return
weight
.
doubleValue
();
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
View file @
39aaa9b3
...
...
@@ -443,14 +443,6 @@ public class TdengineTimeServiceImpl {
List
<
FanHealthIndex
>
fanHealthIndicesCz
=
fanHealthIndexMapper
.
getInfoListByGroupByCzFan
(
startTime
,
"fan_health_index_moment"
,
"设备"
);
List
<
FanHealthIndex
>
fanHealthIndicesCzNew
=
fanHealthIndexService
.
getInfoListByGroupByCzFan
(
startTime
,
"fan_health_index_moment"
,
"设备"
);
print
(
"场站"
,
fanHealthIndicesCz
,
fanHealthIndicesCzNew
);
// 区域
List
<
FanHealthIndex
>
fanHealthIndicesQy
=
fanHealthIndexMapper
.
getInfoListByGroupByQyFan
(
startTime
,
"fan_health_index_moment"
,
"场站"
);
List
<
FanHealthIndex
>
fanHealthIndicesQyNew
=
fanHealthIndexService
.
getInfoListByGroupByQyFan
(
startTime
,
"fan_health_index_moment"
,
"场站"
);
print
(
"区域"
,
fanHealthIndicesQy
,
fanHealthIndicesQyNew
);
// 全域【所有 / 全国】
List
<
FanHealthIndex
>
fanHealthIndicesQg
=
fanHealthIndexMapper
.
getInfoListByGroupByQgFan
(
startTime
,
"fan_health_index_moment"
,
"片区"
);
List
<
FanHealthIndex
>
fanHealthIndicesQgNew
=
fanHealthIndexService
.
getInfoListByGroupByQgFan
(
startTime
,
"fan_health_index_moment"
,
"片区"
);
print
(
"全域"
,
fanHealthIndicesQg
,
fanHealthIndicesQgNew
);
}
public
void
insertMomentDataPvTest
(
String
startTime
)
throws
ParseException
{
...
...
@@ -466,15 +458,6 @@ public class TdengineTimeServiceImpl {
List
<
PvHealthIndex
>
fanHealthIndicesCz
=
pvHealthIndexMapper
.
getInfoListByGroupByCzPv
(
startTime
,
"pv_health_index_moment"
,
"子阵"
);
List
<
PvHealthIndex
>
fanHealthIndicesCzNew
=
pvHealthIndexService
.
getInfoListByGroupByCzPv
(
startTime
,
"pv_health_index_moment"
,
"子阵"
);
printPv
(
"场站"
,
fanHealthIndicesCz
,
fanHealthIndicesCzNew
);
// 片区
List
<
PvHealthIndex
>
fanHealthIndicesQy
=
pvHealthIndexMapper
.
getInfoListByGroupByQyPv
(
startTime
,
"pv_health_index_moment"
,
"场站"
);
List
<
PvHealthIndex
>
fanHealthIndicesQyNew
=
pvHealthIndexService
.
getInfoListByGroupByQyPv
(
startTime
,
"pv_health_index_moment"
,
"场站"
);
printPv
(
"片区"
,
fanHealthIndicesQy
,
fanHealthIndicesQyNew
);
// 全域【所有 / 全国】
List
<
PvHealthIndex
>
fanHealthIndicesQg
=
pvHealthIndexMapper
.
getInfoListByGroupByQgPv
(
startTime
,
"pv_health_index_moment"
,
"片区"
);
List
<
PvHealthIndex
>
fanHealthIndicesQgNew
=
pvHealthIndexService
.
getInfoListByGroupByQgPv
(
startTime
,
"pv_health_index_moment"
,
"片区"
);
printPv
(
"全域"
,
fanHealthIndicesQg
,
fanHealthIndicesQgNew
);
}
public
void
print
(
String
desc
,
List
<
FanHealthIndex
>
olds
,
List
<
FanHealthIndex
>
news
)
{
...
...
@@ -485,10 +468,14 @@ public class TdengineTimeServiceImpl {
}
public
void
printPv
(
String
desc
,
List
<
PvHealthIndex
>
olds
,
List
<
PvHealthIndex
>
news
)
{
olds
.
sort
(
Comparator
.
comparing
(
PvHealthIndex:
:
getArea
).
thenComparing
(
PvHealthIndex:
:
getStation
).
thenComparing
(
PvHealthIndex:
:
getEquipmentName
).
thenComparing
(
PvHealthIndex:
:
getSubarray
).
thenComparing
(
PvHealthIndex:
:
getPointName
));
news
.
sort
(
Comparator
.
comparing
(
PvHealthIndex:
:
getArea
).
thenComparing
(
PvHealthIndex:
:
getStation
).
thenComparing
(
PvHealthIndex:
:
getEquipmentName
).
thenComparing
(
PvHealthIndex:
:
getSubarray
).
thenComparing
(
PvHealthIndex:
:
getPointName
));
log
.
info
(
"对比{} old => {}"
,
desc
,
olds
);
log
.
info
(
"对比{} news => {}"
,
desc
,
news
);
try
{
olds
.
sort
(
Comparator
.
comparing
(
PvHealthIndex:
:
getArea
).
thenComparing
(
PvHealthIndex:
:
getStation
).
thenComparing
(
PvHealthIndex:
:
getEquipmentName
).
thenComparing
(
PvHealthIndex:
:
getSubarray
).
thenComparing
(
PvHealthIndex:
:
getPointName
));
news
.
sort
(
Comparator
.
comparing
(
PvHealthIndex:
:
getArea
).
thenComparing
(
PvHealthIndex:
:
getStation
).
thenComparing
(
PvHealthIndex:
:
getEquipmentName
).
thenComparing
(
PvHealthIndex:
:
getSubarray
).
thenComparing
(
PvHealthIndex:
:
getPointName
));
log
.
info
(
"对比{} old => {}"
,
desc
,
olds
);
log
.
info
(
"对比{} news => {}"
,
desc
,
news
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
insertMomentDataAll
(
String
recDate
)
throws
ParseException
{
...
...
@@ -518,4 +505,16 @@ public class TdengineTimeServiceImpl {
List
<
PvHealthIndex
>
pvHealthIndicesQg
=
healthIndexQgDTOS
.
stream
().
map
(
o
->
fanHealthIndexService
.
toPvHealthIndex
(
o
)).
collect
(
Collectors
.
toList
());
saveBatchPv
(
pvHealthIndicesQg
,
"pv_health_index_moment"
,
recDate
,
WarningPeriodEnum
.
MINUTES
.
getName
(),
pvLevelListQg
);
}
public
void
insertMomentDataAllTest
(
String
startTime
)
throws
ParseException
{
List
<
HealthIndexDTO
>
healthIndexQyDTOS
=
fanHealthIndexService
.
getInfoListByGroupByQy
(
startTime
,
"fan_health_index_moment"
,
"pv_health_index_moment"
,
"场站"
);
List
<
FanHealthIndex
>
fanHealthIndicesQy
=
healthIndexQyDTOS
.
stream
().
map
(
o
->
fanHealthIndexService
.
toFanHealthIndex
(
o
)).
collect
(
Collectors
.
toList
());
List
<
PvHealthIndex
>
pvHealthIndicesQy
=
healthIndexQyDTOS
.
stream
().
map
(
o
->
fanHealthIndexService
.
toPvHealthIndex
(
o
)).
collect
(
Collectors
.
toList
());
log
.
info
(
"场站 => {}"
,
healthIndexQyDTOS
);
List
<
HealthIndexDTO
>
healthIndexQgDTOS
=
fanHealthIndexService
.
getInfoListByGroupByQg
(
startTime
,
"fan_health_index_moment"
,
"pv_health_index_moment"
,
"片区"
);
List
<
FanHealthIndex
>
fanHealthIndicesQg
=
healthIndexQgDTOS
.
stream
().
map
(
o
->
fanHealthIndexService
.
toFanHealthIndex
(
o
)).
collect
(
Collectors
.
toList
());
List
<
PvHealthIndex
>
pvHealthIndicesQg
=
healthIndexQgDTOS
.
stream
().
map
(
o
->
fanHealthIndexService
.
toPvHealthIndex
(
o
)).
collect
(
Collectors
.
toList
());
log
.
info
(
"片区 => {}"
,
healthIndexQgDTOS
);
}
}
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