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
4b32b581
Commit
4b32b581
authored
Sep 25, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监盘接口 字段替换 非空验证
parent
8df1dbcb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
34 deletions
+33
-34
ESEquipments.java
...eejoin/amos/boot/module/jxiop/biz/ESDto/ESEquipments.java
+1
-1
DemoController.java
...amos/boot/module/jxiop/biz/controller/DemoController.java
+26
-27
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+3
-3
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+3
-3
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+0
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/ESDto/ESEquipments.java
View file @
4b32b581
...
@@ -40,7 +40,7 @@ public class ESEquipments {
...
@@ -40,7 +40,7 @@ public class ESEquipments {
@Field
(
type
=
FieldType
.
Text
)
@Field
(
type
=
FieldType
.
Text
)
private
String
value
;
private
String
value
;
@Field
(
type
=
FieldType
.
Float
,
index
=
false
)
@Field
(
type
=
FieldType
.
Float
,
index
=
false
)
private
Float
valueF
;
private
Float
valueF
;
@Field
(
type
=
FieldType
.
Text
)
@Field
(
type
=
FieldType
.
Text
)
private
String
valueLabel
;
private
String
valueLabel
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
...
...
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 @
4b32b581
...
@@ -172,7 +172,7 @@ public class DemoController extends BaseController {
...
@@ -172,7 +172,7 @@ public class DemoController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"初始化influxdb-风电、光伏、升压站"
)
@ApiOperation
(
value
=
"初始化influxdb-风电、光伏、升压站"
)
@GetMapping
(
"/test4"
)
@GetMapping
(
"
doc
/test4"
)
public
ResponseModel
<
Integer
>
demoTest3
()
{
public
ResponseModel
<
Integer
>
demoTest3
()
{
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String
[]
strings
=
{
"1668801435891929089"
,
"1669524885619085313"
,
"1668801570352926721"
,
"1669525017559306241"
};
String
[]
strings
=
{
"1668801435891929089"
,
"1669524885619085313"
,
"1668801570352926721"
,
"1669525017559306241"
};
...
@@ -360,7 +360,7 @@ public class DemoController extends BaseController {
...
@@ -360,7 +360,7 @@ public class DemoController extends BaseController {
public
ResponseModel
<
Object
>
demoTest8
()
{
public
ResponseModel
<
Object
>
demoTest8
()
{
QueryBuilder
queryBuilder
=
QueryBuilders
.
matchQuery
(
"equipmentIndexName"
,
"有功功率"
);
QueryBuilder
queryBuilder
=
QueryBuilders
.
matchQuery
(
"equipmentIndexName"
,
"有功功率"
);
SumAggregationBuilder
buyCountSum
=
AggregationBuilders
.
sum
(
"buyCountSum"
).
field
(
"value
Double
"
);
SumAggregationBuilder
buyCountSum
=
AggregationBuilders
.
sum
(
"buyCountSum"
).
field
(
"value
F
"
);
Query
query
=
new
NativeSearchQueryBuilder
()
Query
query
=
new
NativeSearchQueryBuilder
()
.
withQuery
(
queryBuilder
)
.
withQuery
(
queryBuilder
)
.
addAggregation
(
buyCountSum
)
.
addAggregation
(
buyCountSum
)
...
@@ -377,7 +377,7 @@ public class DemoController extends BaseController {
...
@@ -377,7 +377,7 @@ public class DemoController extends BaseController {
public
ResponseModel
<
Object
>
demoTest9
()
{
public
ResponseModel
<
Object
>
demoTest9
()
{
QueryBuilder
queryBuilder
=
QueryBuilders
.
matchQuery
(
"equipmentIndexName"
,
"有功功率"
);
QueryBuilder
queryBuilder
=
QueryBuilders
.
matchQuery
(
"equipmentIndexName"
,
"有功功率"
);
AvgAggregationBuilder
buyCountAvg
=
AggregationBuilders
.
avg
(
"buyCountAvg"
).
field
(
"value
Double
"
);
AvgAggregationBuilder
buyCountAvg
=
AggregationBuilders
.
avg
(
"buyCountAvg"
).
field
(
"value
F
"
);
Query
query
=
new
NativeSearchQueryBuilder
()
Query
query
=
new
NativeSearchQueryBuilder
()
.
withQuery
(
queryBuilder
)
.
withQuery
(
queryBuilder
)
.
addAggregation
(
buyCountAvg
)
.
addAggregation
(
buyCountAvg
)
...
@@ -402,7 +402,7 @@ public class DemoController extends BaseController {
...
@@ -402,7 +402,7 @@ public class DemoController extends BaseController {
// 如果只对一个字段进行分组写一个就好
// 如果只对一个字段进行分组写一个就好
TermsAggregationBuilder
tb1
=
AggregationBuilders
.
terms
(
"group_gatewayId"
).
field
(
"gatewayId.keyword"
);
//gatewayId 是分组字段名,group_gatewayId是查询结果的别名
TermsAggregationBuilder
tb1
=
AggregationBuilders
.
terms
(
"group_gatewayId"
).
field
(
"gatewayId.keyword"
);
//gatewayId 是分组字段名,group_gatewayId是查询结果的别名
// TermsAggregationBuilder tb2 = AggregationBuilders.terms("group_equipmentNumber").field("equipmentNumber.keyword");//equipmentNumber 是分组字段名,group_equipmentNumber是查询结果的别名
// TermsAggregationBuilder tb2 = AggregationBuilders.terms("group_equipmentNumber").field("equipmentNumber.keyword");//equipmentNumber 是分组字段名,group_equipmentNumber是查询结果的别名
SumAggregationBuilder
sb
=
AggregationBuilders
.
sum
(
"sum_valueDouble"
).
field
(
"value
Double"
);
//valueDouble
是求和字段名称,sun_valueDouble是结果别名
SumAggregationBuilder
sb
=
AggregationBuilders
.
sum
(
"sum_valueDouble"
).
field
(
"value
F"
);
//valueF
是求和字段名称,sun_valueDouble是结果别名
// 注意顺序,决定先通过谁分组
// 注意顺序,决定先通过谁分组
tb1
.
subAggregation
(
sb
);
// 通过typeId字段分组统计总数
tb1
.
subAggregation
(
sb
);
// 通过typeId字段分组统计总数
...
@@ -432,8 +432,8 @@ public class DemoController extends BaseController {
...
@@ -432,8 +432,8 @@ public class DemoController extends BaseController {
QueryDto
ff2
=
new
QueryDto
(
"equipmentIndexName.keyword"
,
"有功功率"
);
QueryDto
ff2
=
new
QueryDto
(
"equipmentIndexName.keyword"
,
"有功功率"
);
queryDto
.
add
(
ff1
);
queryDto
.
add
(
ff1
);
queryDto
.
add
(
ff2
);
queryDto
.
add
(
ff2
);
Double
avg
=
commonServiceImpl
.
getavg
(
queryDto
,
"value
Double
"
,
ESEquipments
.
class
);
Double
avg
=
commonServiceImpl
.
getavg
(
queryDto
,
"value
F
"
,
ESEquipments
.
class
);
Double
sum
=
commonServiceImpl
.
getsum
(
queryDto
,
"value
Double
"
,
ESEquipments
.
class
);
Double
sum
=
commonServiceImpl
.
getsum
(
queryDto
,
"value
F
"
,
ESEquipments
.
class
);
Map
<
String
,
Double
>
map
=
new
HashMap
();
Map
<
String
,
Double
>
map
=
new
HashMap
();
map
.
put
(
"1668801435891929089_avg"
,
avg
);
map
.
put
(
"1668801435891929089_avg"
,
avg
);
...
@@ -466,7 +466,7 @@ public class DemoController extends BaseController {
...
@@ -466,7 +466,7 @@ public class DemoController extends BaseController {
// value1.add("1668801435891929089");
// value1.add("1668801435891929089");
// map.put("gatewayId.keyword",value1);
// map.put("gatewayId.keyword",value1);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupavg
(
map
,
"value
Double
"
,
"equipmentIndexName.keyword"
,
ESEquipments
.
class
);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupavg
(
map
,
"value
F
"
,
"equipmentIndexName.keyword"
,
ESEquipments
.
class
);
Map
<
String
,
Object
>
mapdta
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapdta
=
new
HashMap
<>();
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
...
@@ -498,7 +498,7 @@ public class DemoController extends BaseController {
...
@@ -498,7 +498,7 @@ public class DemoController extends BaseController {
value1
.
add
(
"1668801435891929089"
);
value1
.
add
(
"1668801435891929089"
);
map
.
put
(
"gatewayId.keyword"
,
value1
);
map
.
put
(
"gatewayId.keyword"
,
value1
);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupsum
(
map
,
"value
Double
"
,
"equipmentIndexName.keyword"
,
ESEquipments
.
class
);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupsum
(
map
,
"value
F
"
,
"equipmentIndexName.keyword"
,
ESEquipments
.
class
);
Map
<
String
,
Object
>
mapdta
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapdta
=
new
HashMap
<>();
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
...
@@ -556,7 +556,7 @@ public class DemoController extends BaseController {
...
@@ -556,7 +556,7 @@ public class DemoController extends BaseController {
@GetMapping
(
"/test17"
)
@GetMapping
(
"/test17"
)
public
ResponseModel
<
Integer
>
demoTest17
()
{
public
ResponseModel
<
Integer
>
demoTest17
()
{
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String
[]
strings
=
{
"1668801
435891929089"
,
"1669524885619085313"
,
"1668801
570352926721"
,
"1669525017559306241"
};
String
[]
strings
=
{
"1668801570352926721"
,
"1669525017559306241"
};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
// System.out.println(o.toString());
...
@@ -568,6 +568,8 @@ public class DemoController extends BaseController {
...
@@ -568,6 +568,8 @@ public class DemoController extends BaseController {
// QueryWrapper.eq("gateway", "1668801435891929089");
// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏
// 泰和光伏
QueryWrapper
.
eq
(
"gateway"
,
strings
[
i
]);
QueryWrapper
.
eq
(
"gateway"
,
strings
[
i
]);
QueryWrapper
.
eq
(
"front_module"
,
"电量表计"
);
QueryWrapper
.
eq
(
"system_type"
,
"模拟量"
);
long
DATE
=
new
Date
().
getTime
();
long
DATE
=
new
Date
().
getTime
();
System
.
out
.
println
(
DATE
);
System
.
out
.
println
(
DATE
);
List
<
MonitorFanIndicator
>
list
=
monitorFanIndicatorregionMapper
.
selectList
(
QueryWrapper
);
List
<
MonitorFanIndicator
>
list
=
monitorFanIndicatorregionMapper
.
selectList
(
QueryWrapper
);
...
@@ -575,29 +577,26 @@ public class DemoController extends BaseController {
...
@@ -575,29 +577,26 @@ public class DemoController extends BaseController {
List
<
ESEquipments
>
listit
=
new
ArrayList
<>();
List
<
ESEquipments
>
listit
=
new
ArrayList
<>();
for
(
MonitorFanIndicator
monitorFanIndicator
:
list
)
{
for
(
MonitorFanIndicator
monitorFanIndicator
:
list
)
{
Map
<
String
,
String
>
tag
=
new
HashMap
<>();
Map
<
String
,
String
>
tag
=
new
HashMap
<>();
Map
<
String
,
Object
>
maps2
=
new
HashMap
<>();
Map
<
String
,
Object
>
maps2
=
new
HashMap
<>();
tag
.
put
(
"equipmentsIdx"
,
monitorFanIndicator
.
getAddressGateway
());
tag
.
put
(
"equipmentsIdx"
,
monitorFanIndicator
.
getAddressGateway
());
maps2
.
put
(
"address"
,
monitorFanIndicator
.
getIndexAddress
());
//
maps2.put("address", monitorFanIndicator.getIndexAddress());
maps2
.
put
(
"dataType"
,
monitorFanIndicator
.
getDataType
());
//
maps2.put("dataType", monitorFanIndicator.getDataType());
maps2
.
put
(
"equipmentSpecificName"
,
monitorFanIndicator
.
getFanCode
());
//
maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
maps2
.
put
(
"gatewayId"
,
monitorFanIndicator
.
getGateway
());
//
maps2.put("gatewayId", monitorFanIndicator.getGateway());
maps2
.
put
(
"isAlarm"
,
monitorFanIndicator
.
getIsAlarm
());
//
maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2
.
put
(
"createdTime"
,
"2023-07-05 18:30:26"
);
//
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2
.
put
(
"unit"
,
monitorFanIndicator
.
getUnit
());
//
maps2.put("unit", monitorFanIndicator.getUnit());
maps2
.
put
(
"value"
,
""
);
//
maps2.put("value", "");
maps2
.
put
(
"traceId"
,
""
);
//
maps2.put("traceId", "");
maps2
.
put
(
"equipmentIndexName"
,
monitorFanIndicator
.
getIndicator
());
//
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2
.
put
(
"equipmentNumber"
,
monitorFanIndicator
.
getEquipmentNumber
());
//
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2
.
put
(
"frontModule"
,
monitorFanIndicator
.
getFrontModule
()
);
maps2
.
put
(
"frontModule"
,
"模拟量"
);
maps2
.
put
(
"systemType"
,
monitorFanIndicator
.
getSystemType
());
//
maps2.put("systemType", monitorFanIndicator.getSystemType());
maps2
.
put
(
"pictureName"
,
monitorFanIndicator
.
getPictureName
());
//
maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称
//升压站的字段显示名称
maps2
.
put
(
"displayName"
,
monitorFanIndicator
.
getEquipmentNumber
());
//
maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
influxDbConnection
.
insert
(
"indicators_"
+
monitorFanIndicator
.
getGateway
(),
tag
,
maps2
,
1688558007051L
,
TimeUnit
.
MILLISECONDS
);
influxDbConnection
.
insert
(
"indicators_"
+
monitorFanIndicator
.
getGateway
(),
tag
,
maps2
,
1688558007051L
,
TimeUnit
.
MILLISECONDS
);
}
}
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitorFanIdxController.java
View file @
4b32b581
...
@@ -643,7 +643,7 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -643,7 +643,7 @@ public class MonitorFanIdxController extends BaseController {
data3
.
put
(
"title"
,
columnMap
.
get
(
"月发电量"
).
toString
());
data3
.
put
(
"title"
,
columnMap
.
get
(
"月发电量"
).
toString
());
objects
.
add
(
data3
);
objects
.
add
(
data3
);
Map
<
String
,
Object
>
data4
=
new
HashMap
<>();
Map
<
String
,
Object
>
data4
=
new
HashMap
<>();
data4
.
put
(
"title"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"WTX-801_25_WTX-801_总辐射"
));
data4
.
put
(
"title"
,
String
.
format
(
"%.2f"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"WTX-801_25_WTX-801_总辐射"
)
));
objects
.
add
(
data4
);
objects
.
add
(
data4
);
Map
<
String
,
Object
>
data5
=
new
HashMap
<>();
Map
<
String
,
Object
>
data5
=
new
HashMap
<>();
data5
.
put
(
"title"
,
columnMap
.
get
(
"年发电量"
).
toString
());
data5
.
put
(
"title"
,
columnMap
.
get
(
"年发电量"
).
toString
());
...
@@ -652,10 +652,10 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -652,10 +652,10 @@ public class MonitorFanIdxController extends BaseController {
data6
.
put
(
"title"
,
columnMap
.
get
(
"有功功率"
).
toString
())
;
data6
.
put
(
"title"
,
columnMap
.
get
(
"有功功率"
).
toString
())
;
objects
.
add
(
data6
);
objects
.
add
(
data6
);
Map
<
String
,
Object
>
data7
=
new
HashMap
<>();
Map
<
String
,
Object
>
data7
=
new
HashMap
<>();
data7
.
put
(
"title"
,
columnMap
.
get
(
"日照时数"
).
toString
(
));
data7
.
put
(
"title"
,
String
.
format
(
"%.2f"
,((
Double
.
parseDouble
(
columnMap
.
get
(
"日发电量"
).
toString
())/
10
)/
(
Double
.
parseDouble
(
columnMap
.
get
(
"装机容量"
).
toString
())))
));
objects
.
add
(
data7
);
objects
.
add
(
data7
);
Map
<
String
,
Object
>
data8
=
new
HashMap
<>();
Map
<
String
,
Object
>
data8
=
new
HashMap
<>();
data8
.
put
(
"title"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"WTX-801_25_WTX-801_总辐射累计"
));
data8
.
put
(
"title"
,
String
.
format
(
"%.2f"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"WTX-801_25_WTX-801_总辐射累计"
)
));
objects
.
add
(
data8
);
objects
.
add
(
data8
);
Map
<
String
,
Object
>
data9
=
new
HashMap
<>();
Map
<
String
,
Object
>
data9
=
new
HashMap
<>();
data9
.
put
(
"title"
,
"0.00%"
);
//综合效率
data9
.
put
(
"title"
,
"0.00%"
);
//综合效率
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
4b32b581
...
@@ -247,7 +247,7 @@ public class CommonServiceImpl {
...
@@ -247,7 +247,7 @@ public class CommonServiceImpl {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
totalvalue
;
return
totalvalue
;
}
}
return
Double
.
valueOf
(
String
.
format
(
"%.2f"
,
totalvalue
));
return
Double
.
valueOf
(
String
.
format
(
"%.2f"
,
totalvalue
*
CommonConstans
.
pvGenPoweActor
));
}
}
public
Double
getTotalByIndicatiorAndParams
(
String
gatewayId
,
String
indicator
,
String
querySql
)
{
public
Double
getTotalByIndicatiorAndParams
(
String
gatewayId
,
String
indicator
,
String
querySql
)
{
...
@@ -573,13 +573,13 @@ public class CommonServiceImpl {
...
@@ -573,13 +573,13 @@ public class CommonServiceImpl {
}
}
public
Double
getAvagerByEquipmentIndxName
(
List
<
ESEquipments
>
equipments
,
String
indexName
)
{
public
Double
getAvagerByEquipmentIndxName
(
List
<
ESEquipments
>
equipments
,
String
indexName
)
{
Double
result
=
0.00
;
Double
result
=
0.00
;
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
mapToDouble
(
ESEquipments:
:
getValueF
).
average
().
getAsDouble
();
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
filter
(
esEquipments
->
esEquipments
.
getValueF
()!=
null
).
mapToDouble
(
ESEquipments:
:
getValueF
).
average
().
getAsDouble
();
return
result
;
return
result
;
}
}
public
Double
getSumByEquipmentIndxName
(
List
<
ESEquipments
>
equipments
,
String
indexName
)
{
public
Double
getSumByEquipmentIndxName
(
List
<
ESEquipments
>
equipments
,
String
indexName
)
{
Double
result
=
0.00
;
Double
result
=
0.00
;
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
mapToDouble
(
ESEquipments:
:
getValueF
).
sum
();
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
filter
(
esEquipments
->
esEquipments
.
getValueF
()!=
null
).
mapToDouble
(
ESEquipments:
:
getValueF
).
sum
();
return
result
;
return
result
;
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
View file @
4b32b581
This diff is collapsed.
Click to expand it.
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