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
cba395e6
Commit
cba395e6
authored
Aug 17, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
c2ea1be8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
139 additions
and
4 deletions
+139
-4
IdxBizFanPointVarCentralValueDto.java
...odule/jxiop/biz/dto/IdxBizFanPointVarCentralValueDto.java
+3
-0
IdxBizFanPointVarCentralValue.java
...odule/jxiop/biz/entity/IdxBizFanPointVarCentralValue.java
+4
-3
IdxBizFanWarningRecord.java
.../boot/module/jxiop/biz/entity/IdxBizFanWarningRecord.java
+5
-0
IdxBizFanPointProcessVariableClassificationMapper.java
...r2/IdxBizFanPointProcessVariableClassificationMapper.java
+2
-1
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+116
-0
HealthStatusIndicatorServiceImpl.java
...op/biz/service/impl/HealthStatusIndicatorServiceImpl.java
+0
-0
application.properties
...iop-analyse-biz/src/main/resources/application.properties
+9
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/IdxBizFanPointVarCentralValueDto.java
View file @
cba395e6
...
@@ -114,4 +114,7 @@ public class IdxBizFanPointVarCentralValueDto {
...
@@ -114,4 +114,7 @@ public class IdxBizFanPointVarCentralValueDto {
@TableField
(
"PROCESS_POINT2_ID"
)
@TableField
(
"PROCESS_POINT2_ID"
)
private
Double
processPoint2Id
;
private
Double
processPoint2Id
;
@ApiModelProperty
(
value
=
"预警内容"
)
@TableField
(
"CONTENT"
)
private
String
CONTENT
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/entity/IdxBizFanPointVarCentralValue.java
View file @
cba395e6
...
@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
...
@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
/**
/**
*
*
...
@@ -39,7 +40,7 @@ public class IdxBizFanPointVarCentralValue{
...
@@ -39,7 +40,7 @@ public class IdxBizFanPointVarCentralValue{
*
*
*/
*/
@TableField
(
"REC_DATE"
)
@TableField
(
"REC_DATE"
)
private
LocalDateTim
e
recDate
;
private
Dat
e
recDate
;
/**
/**
*
*
...
@@ -81,7 +82,7 @@ public class IdxBizFanPointVarCentralValue{
...
@@ -81,7 +82,7 @@ public class IdxBizFanPointVarCentralValue{
*
*
*/
*/
@TableField
(
"ANALYSIS_POINT_ID"
)
@TableField
(
"ANALYSIS_POINT_ID"
)
private
Integer
analysisPointId
;
private
String
analysisPointId
;
/**
/**
* 片区
* 片区
...
@@ -171,6 +172,6 @@ public class IdxBizFanPointVarCentralValue{
...
@@ -171,6 +172,6 @@ public class IdxBizFanPointVarCentralValue{
* 工况变量2ID
* 工况变量2ID
*/
*/
@TableField
(
"PROCESS_POINT2_ID"
)
@TableField
(
"PROCESS_POINT2_ID"
)
private
Double
processPoint2Id
;
private
String
processPoint2Id
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/entity/IdxBizFanWarningRecord.java
View file @
cba395e6
...
@@ -125,4 +125,9 @@ public class IdxBizFanWarningRecord{
...
@@ -125,4 +125,9 @@ public class IdxBizFanWarningRecord{
@TableField
(
"EQUIPMENT_NAME"
)
@TableField
(
"EQUIPMENT_NAME"
)
private
String
equipmentName
;
private
String
equipmentName
;
/**
* 预警内容
* */
@TableField
(
"CONTENT"
)
private
String
CONTENT
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/IdxBizFanPointProcessVariableClassificationMapper.java
View file @
cba395e6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableClassificationDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointProcessVariableClassification
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointProcessVariableClassification
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,7 +13,7 @@ import java.util.List;
...
@@ -12,7 +13,7 @@ import java.util.List;
* @date 2023-08-15
* @date 2023-08-15
*/
*/
public
interface
IdxBizFanPointProcessVariableClassificationMapper
extends
BaseMapper
<
IdxBizFanPointProcessVariableClassification
>
{
public
interface
IdxBizFanPointProcessVariableClassificationMapper
extends
BaseMapper
<
IdxBizFanPointProcessVariableClassification
>
{
List
<
IdxBizFanPointProcessVariableClassification
>
getInfluxDBData
();
List
<
IdxBizFanPointProcessVariableClassification
Dto
>
getInfluxDBData
();
List
<
String
>
gateWayIdListFan
();
List
<
String
>
gateWayIdListFan
();
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
cba395e6
...
@@ -2,15 +2,27 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
...
@@ -2,15 +2,27 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
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.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableClassificationDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.*
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.*
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*
;
import
com.yeejoin.amos.component.influxdb.InfluxdbUtil
;
import
com.yeejoin.amos.component.influxdb.InfluxdbUtil
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
import
org.springframework.data.elasticsearch.core.SearchHit
;
import
org.springframework.data.elasticsearch.core.SearchHits
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -48,6 +60,11 @@ public class CommonServiceImpl {
...
@@ -48,6 +60,11 @@ public class CommonServiceImpl {
@Value
(
"${gkzxzjs.key:input 2}"
)
@Value
(
"${gkzxzjs.key:input 2}"
)
String
gkzxzjskey2
;
String
gkzxzjskey2
;
//----------------健康指数值计算相关请求属性配置------------------------
@Value
(
"${gkzxzjs.url:8804dc58-508b-4e73-8346-5aa8d808746f}"
)
String
jkzsjsurl
;
// {"tableName": "idx_biz_fan_point_process_variable_classification"} 风机工况变量划分
// {"tableName": "idx_biz_fan_point_process_variable_classification"} 风机工况变量划分
// {"tableName": "idx_biz_pv_point_process_variable_classification"} 光伏工况变量画分
// {"tableName": "idx_biz_pv_point_process_variable_classification"} 光伏工况变量画分
// {"tableName": "idx_biz_fan_point_var_correlation"} 风机相关性
// {"tableName": "idx_biz_fan_point_var_correlation"} 风机相关性
...
@@ -63,6 +80,13 @@ public class CommonServiceImpl {
...
@@ -63,6 +80,13 @@ public class CommonServiceImpl {
@Autowired
@Autowired
private
InfluxdbUtil
influxdbUtil
;
private
InfluxdbUtil
influxdbUtil
;
@Autowired
private
ElasticsearchRestTemplate
elasticsearchTemplate
;
@Autowired
IdxBizFanPointVarCentralValueMapper
idxBizFanPointVarCentralValueMapper
;
/**
/**
* @return
* @return
...
@@ -638,4 +662,96 @@ public class CommonServiceImpl {
...
@@ -638,4 +662,96 @@ public class CommonServiceImpl {
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
FORMAT_UTC
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
FORMAT_UTC
);
return
dateFormat
.
format
(
timeStr
);
return
dateFormat
.
format
(
timeStr
);
}
}
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
private
void
healthWarningMinute
()
{
List
<
IdxBizFanPointProcessVariableClassificationDto
>
data
=
idxBizFanPointProcessVariableClassificationMapper
.
getInfluxDBData
();
Map
<
String
,
List
<
IdxBizFanPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanPointProcessVariableClassificationDto:
:
getGatewayId
));
BoolQueryBuilder
boolMustAll
=
QueryBuilders
.
boolQuery
();
List
<
QueryBuilder
>
should
=
boolMustAll
.
should
();
for
(
String
s
:
maps
.
keySet
())
{
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
();
List
<
String
>
address
=
maps
.
get
(
s
).
stream
().
map
(
IdxBizFanPointProcessVariableClassificationDto:
:
getIndexAddress
).
collect
(
Collectors
.
toList
());
boolQueryBuilder
.
must
(
QueryBuilders
.
termsQuery
(
"address.keyword"
,
address
)).
must
(
QueryBuilders
.
matchQuery
(
"gatewayId.keyword"
,
s
));
should
.
add
(
boolQueryBuilder
);
}
// 创建查询构造器
NativeSearchQueryBuilder
queryBuilder
=
new
NativeSearchQueryBuilder
()
//过滤条件
.
withQuery
(
boolMustAll
);
List
<
ESEquipments
>
equipments
=
new
LinkedList
<>();
long
totle
=
0
;
try
{
SearchHits
<
ESEquipments
>
searchHits
=
elasticsearchTemplate
.
search
(
queryBuilder
.
build
(),
ESEquipments
.
class
);
for
(
SearchHit
searchHit
:
searchHits
.
getSearchHits
())
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
searchHit
.
getContent
());
ESEquipments
eSAlertCalled
=
JSONObject
.
toJavaObject
(
jsonObject
,
ESEquipments
.
class
);
equipments
.
add
(
eSAlertCalled
);
}
totle
=
searchHits
.
getTotalHits
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
for
(
IdxBizFanPointProcessVariableClassificationDto
datum
:
data
)
{
for
(
ESEquipments
equipment
:
equipments
)
{
if
(
equipment
.
getAddress
().
equals
(
datum
.
getIndexAddress
())
&&
equipment
.
getGatewayId
().
equals
(
datum
.
getGatewayId
())){
datum
.
setCurrentValue
(
equipment
.
getValueDouble
());
}
}
}
LambdaQueryWrapper
<
IdxBizFanPointVarCentralValue
>
wrapper
=
new
LambdaQueryWrapper
<>();
List
<
IdxBizFanPointVarCentralValue
>
idxBizUhefs
=
idxBizFanPointVarCentralValueMapper
.
selectList
(
wrapper
);
List
<
Map
<
String
,
Object
>>
datas
=
new
ArrayList
<>();
for
(
IdxBizFanPointVarCentralValue
idxBizUhef
:
idxBizUhefs
)
{
double
value1
=
0.00
;
double
value2
=
0.00
;
double
value3
=
0.00
;
double
value4
=
0.00
;
for
(
IdxBizFanPointProcessVariableClassificationDto
datum
:
data
)
{
if
(
idxBizUhef
.
getProcessPoint1Id
().
equals
(
datum
.
getSequenceNbr
())){
value1
=
datum
.
getCurrentValue
();
}
if
(
idxBizUhef
.
getProcessPoint2Id
().
equals
(
datum
.
getSequenceNbr
()))
{
value2
=
datum
.
getCurrentValue
();
}
if
(
idxBizUhef
.
getProcessPoint3Id
().
equals
(
datum
.
getSequenceNbr
()))
{
value3
=
datum
.
getCurrentValue
();
}
if
(
idxBizUhef
.
getAnalysisPointId
().
equals
(
datum
.
getSequenceNbr
()))
{
value4
=
datum
.
getCurrentValue
();
}
}
if
(
idxBizUhef
.
getProcess1Min
()
<
value1
&&
value1
<
idxBizUhef
.
getProcess1Max
()
&&
idxBizUhef
.
getProcess2Min
()
<
value2
&&
value2
<
idxBizUhef
.
getPorcess2Max
()
&&
idxBizUhef
.
getProcess3Min
()
<
value3
&&
value3
<
idxBizUhef
.
getProcess3Max
()){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"analysVariable"
,
value4
);
map
.
put
(
"stdDev"
,
idxBizUhef
.
getAnalysisStdDev
());
map
.
put
(
"centerValue"
,
idxBizUhef
.
getAnalysisCenterValue
());
map
.
put
(
"analysVariableId"
,
idxBizUhef
.
getAnalysisPointId
());
datas
.
add
(
map
);
}
}
if
(!
datas
.
isEmpty
())
{
logger
.
info
(
"------------------------------------------开始调用健康指数计算算法开始----------------------------------------"
);
HashMap
<
String
,
Object
>
realParams
=
new
HashMap
<>();
realParams
.
put
(
gkzxzjskey1
,
datas
);
String
response
=
HttpUtil
.
createPost
(
baseUrl
+
jkzsjsurl
).
body
(
JSON
.
toJSONString
(
realParams
)).
execute
().
body
();
try
{
logger
.
info
(
"--------------------repsonse: "
+
response
);
TimeUnit
.
SECONDS
.
sleep
(
sleepTime
);
logger
.
info
(
"------------------------------------------调用健康指数计算算法结束----------------------------------------"
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/HealthStatusIndicatorServiceImpl.java
View file @
cba395e6
This diff is collapsed.
Click to expand it.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/application.properties
View file @
cba395e6
...
@@ -80,3 +80,11 @@ spring.elasticsearch.rest.connection-timeout=30000
...
@@ -80,3 +80,11 @@ spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username
=
elastic
spring.elasticsearch.rest.username
=
elastic
spring.elasticsearch.rest.password
=
123456
spring.elasticsearch.rest.password
=
123456
spring.elasticsearch.rest.read-timeout
=
30000
spring.elasticsearch.rest.read-timeout
=
30000
healthValue_Warn
=
39
healthValue_Risk
=
59
healthValue_Notice
=
79
healthValue_DayCount
=
3
healthValue_HourCount
=
6
healthValue_MinCount
=
5
\ No newline at end of file
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