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
49b4b7c7
Commit
49b4b7c7
authored
Oct 16, 2023
by
litengwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
927302a7
9cad6191
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
35 deletions
+165
-35
KsolarDataAcquisitionServiceImpl.java
...i/face/service/impl/KsolarDataAcquisitionServiceImpl.java
+7
-3
WarningNameEnum.java
...join/amos/boot/module/jxiop/biz/Enum/WarningNameEnum.java
+48
-0
BigScreenAnalyseController.java
...dule/jxiop/biz/controller/BigScreenAnalyseController.java
+20
-0
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+11
-0
HealthStatusIndicatorServiceImpl.java
...op/biz/service/impl/HealthStatusIndicatorServiceImpl.java
+79
-32
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/KsolarDataAcquisitionServiceImpl.java
View file @
49b4b7c7
...
@@ -120,6 +120,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
...
@@ -120,6 +120,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
for
(
String
stationId
:
stationIds
)
{
for
(
String
stationId
:
stationIds
)
{
LambdaQueryWrapper
<
KsolarStationList
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
KsolarStationList
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
KsolarStationList:
:
getStationId
,
stationId
);
wrapper
.
eq
(
KsolarStationList:
:
getStationId
,
stationId
);
wrapper
.
orderByDesc
(
KsolarStationList:
:
getCreatedTime
);
List
<
KsolarStationList
>
ksolarStationLists
=
kSolarStationMapper
.
selectList
(
wrapper
);
List
<
KsolarStationList
>
ksolarStationLists
=
kSolarStationMapper
.
selectList
(
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
ksolarStationLists
))
{
if
(!
CollectionUtils
.
isEmpty
(
ksolarStationLists
))
{
KsolarStationList
ksolarStation
=
ksolarStationLists
.
get
(
0
);
KsolarStationList
ksolarStation
=
ksolarStationLists
.
get
(
0
);
...
@@ -170,11 +171,11 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
...
@@ -170,11 +171,11 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpStation
.
setState
(
KSolarConstant
.
stationStaus
.
get
(
String
.
valueOf
(
ksolarStation
.
getStatus
())));
jpStation
.
setState
(
KSolarConstant
.
stationStaus
.
get
(
String
.
valueOf
(
ksolarStation
.
getStatus
())));
jpStation
.
setRealTimePower
(
ksolarStation
.
getPowerInter
());
jpStation
.
setRealTimePower
(
ksolarStation
.
getPowerInter
());
jpStation
.
setDayGenerate
(
ksolarStation
.
getDayGeneration
());
jpStation
.
setDayGenerate
(
ksolarStation
.
getDayGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpStation
.
setAccumulatedPower
(
ksolarStation
.
getTotalGeneration
());
jpStation
.
setAccumulatedPower
(
ksolarStation
.
getTotalGeneration
());
jpStation
.
setArea
(
ksolarStation
.
getAddress
());
jpStation
.
setArea
(
ksolarStation
.
getAddress
());
// 日收益
// 日收益
jpStation
.
setDayIncome
(
stationEarn
.
getDayEarn
()
*
KSolarConstant
.
kwhToMwh
);
jpStation
.
setDayIncome
(
stationEarn
.
getDayEarn
());
// 月发电量
// 月发电量
jpStation
.
setMonthGenerate
(
stationEarn
.
getMonthGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpStation
.
setMonthGenerate
(
stationEarn
.
getMonthGeneration
()
*
KSolarConstant
.
kwhToMwh
);
// 年发电量
// 年发电量
...
@@ -331,6 +332,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
...
@@ -331,6 +332,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
for
(
String
stationId
:
stationIds
)
{
for
(
String
stationId
:
stationIds
)
{
LambdaQueryWrapper
<
KsolarStationList
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
KsolarStationList
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
KsolarStationList:
:
getStationId
,
stationId
);
wrapper
.
eq
(
KsolarStationList:
:
getStationId
,
stationId
);
wrapper
.
orderByDesc
(
KsolarStationList:
:
getCreatedTime
);
List
<
KsolarStationList
>
ksolarStationLists
=
kSolarStationMapper
.
selectList
(
wrapper
);
List
<
KsolarStationList
>
ksolarStationLists
=
kSolarStationMapper
.
selectList
(
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
ksolarStationLists
))
{
if
(!
CollectionUtils
.
isEmpty
(
ksolarStationLists
))
{
KsolarStationList
ksolarStationList
=
ksolarStationLists
.
get
(
0
);
KsolarStationList
ksolarStationList
=
ksolarStationLists
.
get
(
0
);
...
@@ -416,6 +418,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
...
@@ -416,6 +418,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
collectIds
.
forEach
(
collectId
->
{
collectIds
.
forEach
(
collectId
->
{
LambdaQueryWrapper
<
KsolarStationCollectList
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
KsolarStationCollectList
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
KsolarStationCollectList:
:
getCollectId
,
collectId
);
wrapper
.
eq
(
KsolarStationCollectList:
:
getCollectId
,
collectId
);
wrapper
.
orderByDesc
(
KsolarStationCollectList:
:
getCreatedTime
);
List
<
KsolarStationCollectList
>
ksolarStationCollectLists
=
ksolarStationCollectListMapper
.
selectList
(
wrapper
);
List
<
KsolarStationCollectList
>
ksolarStationCollectLists
=
ksolarStationCollectListMapper
.
selectList
(
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
ksolarStationCollectLists
))
{
if
(!
CollectionUtils
.
isEmpty
(
ksolarStationCollectLists
))
{
KsolarStationCollectList
ksolarStationCollectList
=
ksolarStationCollectLists
.
get
(
0
);
KsolarStationCollectList
ksolarStationCollectList
=
ksolarStationCollectLists
.
get
(
0
);
...
@@ -461,7 +464,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
...
@@ -461,7 +464,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setCurrentPower
(
ksolarStationCollectData
.
getPowerApparent
());
jpInverter
.
setCurrentPower
(
ksolarStationCollectData
.
getPowerApparent
());
jpInverter
.
setDayPowerGeneration
(
ksolarStationCollectData
.
getDayGeneration
());
jpInverter
.
setDayPowerGeneration
(
ksolarStationCollectData
.
getDayGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpInverter
.
setMonthPowerGeneration
(
ksolarStationCollectData
.
getMonthGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpInverter
.
setMonthPowerGeneration
(
ksolarStationCollectData
.
getMonthGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpInverter
.
setYearPowerGeneration
(
ksolarStationCollectData
.
getYearGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpInverter
.
setYearPowerGeneration
(
ksolarStationCollectData
.
getYearGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpInverter
.
setTotalPowerGeneration
(
ksolarStationCollectData
.
getTotalGeneration
()
*
KSolarConstant
.
kwhToMwh
);
jpInverter
.
setTotalPowerGeneration
(
ksolarStationCollectData
.
getTotalGeneration
()
*
KSolarConstant
.
kwhToMwh
);
...
@@ -470,6 +473,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
...
@@ -470,6 +473,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpInverter
.
setThirdStationId
(
ksolarStationCollectList
.
getThirdStationId
());
jpInverter
.
setThirdStationId
(
ksolarStationCollectList
.
getThirdStationId
());
jpInverter
.
setThirdCode
(
PVProducerInfoEnum
.
KSOLAR
.
getCode
());
jpInverter
.
setThirdCode
(
PVProducerInfoEnum
.
KSOLAR
.
getCode
());
jpInverter
.
setStationName
(
ksolarStationCollectList
.
getStationName
());
jpInverter
.
setStationName
(
ksolarStationCollectList
.
getStationName
());
jpInverter
.
setAddr
(
ksolarStationCollectList
.
getAddress
());
if
(!
ObjectUtils
.
isEmpty
(
jpInverter
.
getSequenceNbr
()))
{
if
(!
ObjectUtils
.
isEmpty
(
jpInverter
.
getSequenceNbr
()))
{
jpInverterMapper
.
updateById
(
jpInverter
);
jpInverterMapper
.
updateById
(
jpInverter
);
}
else
{
}
else
{
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/Enum/WarningNameEnum.java
0 → 100644
View file @
49b4b7c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
Enum
;
import
com.yeejoin.amos.boot.module.jxiop.api.Enum.AlarmDesc
;
public
enum
WarningNameEnum
{
ANQUAN
(
0
,
"安全"
),
ZHUYI
(
1
,
"注意"
),
JINGGAO
(
2
,
"警告"
),
WEIXIAN
(
3
,
"危险"
);
private
int
code
;
private
String
name
;
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
WarningNameEnum
(
int
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
int
getCode
(
String
name
)
{
for
(
WarningNameEnum
warningNameEnum
:
WarningNameEnum
.
values
())
{
if
(
warningNameEnum
.
getName
().
equals
(
name
))
{
return
warningNameEnum
.
getCode
();
}
}
return
0
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/BigScreenAnalyseController.java
View file @
49b4b7c7
...
@@ -954,4 +954,24 @@ public class BigScreenAnalyseController extends BaseController {
...
@@ -954,4 +954,24 @@ public class BigScreenAnalyseController extends BaseController {
}
}
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取区域信息,根据层级查询单位信息 key 和 value都是区域名称"
)
@GetMapping
(
"/getAreaListByLevel"
)
public
ResponseModel
<
List
<
Map
<
String
,
String
>>>
getAreaListByLevel
(
@RequestParam
(
"level"
)
String
level
)
throws
Exception
{
FeignClientResult
<
List
<
CompanyModel
>>
listFeignClientResult
=
Privilege
.
companyClient
.
queryAgencyList
(
level
);
ArrayList
<
Map
<
String
,
String
>>
maps
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
listFeignClientResult
))
{
if
(
listFeignClientResult
.
getStatus
()
==
200
)
{
listFeignClientResult
.
getResult
().
forEach
(
item
->
{
HashMap
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"text"
,
item
.
getCompanyName
());
resultMap
.
put
(
"value"
,
item
.
getCompanyName
());
maps
.
add
(
resultMap
);
});
}
else
{
throw
new
RuntimeException
(
listFeignClientResult
.
getMessage
());
}
}
return
ResponseHelper
.
buildResponse
(
maps
);
}
}
}
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 @
49b4b7c7
...
@@ -132,6 +132,9 @@ public class CommonServiceImpl {
...
@@ -132,6 +132,9 @@ public class CommonServiceImpl {
@Autowired
@Autowired
IdxBizPvPointVarCentralValueMapper
idxBizPvPointVarCentralValueMapper
;
IdxBizPvPointVarCentralValueMapper
idxBizPvPointVarCentralValueMapper
;
@Autowired
HealthStatusIndicatorServiceImpl
healthStatusIndicatorService
;
/**
/**
* @return
* @return
* @deprecated 获取工况变量列表风机
* @deprecated 获取工况变量列表风机
...
@@ -1462,6 +1465,7 @@ public class CommonServiceImpl {
...
@@ -1462,6 +1465,7 @@ public class CommonServiceImpl {
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningMinuteByFan
()
{
public
void
healthWarningMinuteByFan
()
{
Date
time
=
new
Date
();
Date
time
=
new
Date
();
Calendar
calendar
=
Calendar
.
getInstance
();
List
<
IdxBizFanPointProcessVariableClassificationDto
>
data
=
idxBizFanPointProcessVariableClassificationMapper
.
getInfluxDBData
();
List
<
IdxBizFanPointProcessVariableClassificationDto
>
data
=
idxBizFanPointProcessVariableClassificationMapper
.
getInfluxDBData
();
Map
<
String
,
List
<
IdxBizFanPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanPointProcessVariableClassificationDto:
:
getGatewayId
));
Map
<
String
,
List
<
IdxBizFanPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanPointProcessVariableClassificationDto:
:
getGatewayId
));
BoolQueryBuilder
boolMustAll
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
boolMustAll
=
QueryBuilders
.
boolQuery
();
...
@@ -1603,6 +1607,10 @@ public class CommonServiceImpl {
...
@@ -1603,6 +1607,10 @@ public class CommonServiceImpl {
try
{
try
{
logger
.
info
(
"--------------------response: "
+
response
);
logger
.
info
(
"--------------------response: "
+
response
);
logger
.
info
(
"------------------------------------------调用健康指数计算算法结束----------------------------------------"
);
logger
.
info
(
"------------------------------------------调用健康指数计算算法结束----------------------------------------"
);
logger
.
info
(
"------------------------------------------开始计算预警----------------------------------------"
);
healthStatusIndicatorService
.
healthWarningMinute
(
calendar
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -1613,6 +1621,7 @@ public class CommonServiceImpl {
...
@@ -1613,6 +1621,7 @@ public class CommonServiceImpl {
@Scheduled
(
cron
=
"0 0/10 * * * ?"
)
@Scheduled
(
cron
=
"0 0/10 * * * ?"
)
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningMinuteByPv
()
{
public
void
healthWarningMinuteByPv
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
Date
time
=
new
Date
();
Date
time
=
new
Date
();
List
<
IdxBizPvPointProcessVariableClassificationDto
>
data
=
idxBizPvPointProcessVariableClassificationMapper
.
getInfluxDBData
();
List
<
IdxBizPvPointProcessVariableClassificationDto
>
data
=
idxBizPvPointProcessVariableClassificationMapper
.
getInfluxDBData
();
Map
<
String
,
List
<
IdxBizPvPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizPvPointProcessVariableClassificationDto:
:
getGatewayId
));
Map
<
String
,
List
<
IdxBizPvPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizPvPointProcessVariableClassificationDto:
:
getGatewayId
));
...
@@ -1744,6 +1753,8 @@ public class CommonServiceImpl {
...
@@ -1744,6 +1753,8 @@ public class CommonServiceImpl {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
healthStatusIndicatorService
.
healthWarningMinuteGF
(
calendar
);
}
}
...
...
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 @
49b4b7c7
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.Enum.WarningNameEnum
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -67,10 +68,10 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -67,10 +68,10 @@ public class HealthStatusIndicatorServiceImpl {
*
*
*/
*/
@Scheduled
(
cron
=
"0 0 */1 * * ?"
)
//
@Scheduled(cron = "0 0 */1 * * ?")
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningMinuteGF
()
{
public
void
healthWarningMinuteGF
(
Calendar
calendar
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
//
Calendar calendar = Calendar.getInstance();
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)-
1
);
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)-
1
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
...
@@ -136,7 +137,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -136,7 +137,7 @@ public class HealthStatusIndicatorServiceImpl {
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
content
=
healthValueMinCount
+
"分钟"
;
content
=
healthValueMinCount
*
10
+
"分钟"
;
if
(
riskNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
)){
if
(
riskNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
)){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
,
"risk"
);
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
,
"risk"
);
level
=
"危险"
;
level
=
"危险"
;
...
@@ -151,8 +152,16 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -151,8 +152,16 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
}
}
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
IdxBizPvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
IdxBizPvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
IdxBizPvWarningRecord:
:
getStatus
,
0
);
query
.
orderByDesc
(
IdxBizPvWarningRecord:
:
getRecDate
);
List
<
IdxBizPvWarningRecord
>
idxBizPvWarningRecords
=
idxBizPvWarningRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
idxBizPvWarningRecord
.
setRecord
(
idxBizPvHealthIndices
.
get
(
0
).
getRecord
());
idxBizPvWarningRecord
.
setRecord
(
idxBizPvHealthIndices
.
get
(
0
).
getRecord
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArae
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArae
());
...
@@ -183,7 +192,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -183,7 +192,7 @@ public class HealthStatusIndicatorServiceImpl {
*
*
*/
*/
@Scheduled
(
cron
=
"0 0
*/5
* * ?"
)
@Scheduled
(
cron
=
"0 0
0/1
* * ?"
)
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningHourGF
()
{
public
void
healthWarningHourGF
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
...
@@ -230,15 +239,15 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -230,15 +239,15 @@ public class HealthStatusIndicatorServiceImpl {
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
}
}
...
@@ -272,8 +281,16 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -272,8 +281,16 @@ public class HealthStatusIndicatorServiceImpl {
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
}
}
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
IdxBizPvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
IdxBizPvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
IdxBizPvWarningRecord:
:
getStatus
,
0
);
query
.
orderByDesc
(
IdxBizPvWarningRecord:
:
getRecDate
);
List
<
IdxBizPvWarningRecord
>
idxBizPvWarningRecords
=
idxBizPvWarningRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
idxBizPvWarningRecord
.
setRecord
(
idxBizPvHealthIndices
.
get
(
0
).
getRecord
());
idxBizPvWarningRecord
.
setRecord
(
idxBizPvHealthIndices
.
get
(
0
).
getRecord
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArae
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArae
());
...
@@ -304,7 +321,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -304,7 +321,7 @@ public class HealthStatusIndicatorServiceImpl {
*
*
*/
*/
@Scheduled
(
cron
=
"0 0 0
*/3
* ? "
)
@Scheduled
(
cron
=
"0 0 0
0/1
* ? "
)
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningDayGF
()
{
public
void
healthWarningDayGF
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
...
@@ -352,15 +369,15 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -352,15 +369,15 @@ public class HealthStatusIndicatorServiceImpl {
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
}
}
...
@@ -391,8 +408,16 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -391,8 +408,16 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
}
}
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
IdxBizPvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
IdxBizPvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
IdxBizPvWarningRecord:
:
getStatus
,
0
);
query
.
orderByDesc
(
IdxBizPvWarningRecord:
:
getRecDate
);
List
<
IdxBizPvWarningRecord
>
idxBizPvWarningRecords
=
idxBizPvWarningRecordMapper
.
selectList
(
query
);
if
(!
level
.
equals
(
""
)){
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
idxBizPvWarningRecord
.
setRecord
(
idxBizPvHealthIndices
.
get
(
0
).
getRecord
());
idxBizPvWarningRecord
.
setRecord
(
idxBizPvHealthIndices
.
get
(
0
).
getRecord
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArae
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArae
());
...
@@ -419,10 +444,10 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -419,10 +444,10 @@ public class HealthStatusIndicatorServiceImpl {
}
}
@Scheduled
(
cron
=
"0 0 */1 * * ?"
)
//
@Scheduled(cron = "0 0 */1 * * ?")
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningMinute
()
{
public
void
healthWarningMinute
(
Calendar
calendar
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
//
Calendar calendar = Calendar.getInstance();
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)-
1
);
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)-
1
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
...
@@ -493,7 +518,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -493,7 +518,7 @@ public class HealthStatusIndicatorServiceImpl {
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
content
=
healthValueMinCount
+
"分钟"
;
content
=
healthValueMinCount
*
10
+
"分钟"
;
if
(
riskNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
)){
if
(
riskNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
)){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
,
"risk"
);
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
,
"risk"
);
level
=
"危险"
;
level
=
"危险"
;
...
@@ -508,8 +533,16 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -508,8 +533,16 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
}
}
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
IdxBizFanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
IdxBizFanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
IdxBizFanWarningRecord:
:
getStatus
,
0
);
query
.
orderByDesc
(
IdxBizFanWarningRecord:
:
getRecDate
);
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecords
=
idxBizFanWarningRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
idxBizFanWarningRecord
.
setRecord
(
idxBizFanHealthIndices
.
get
(
0
).
getRecord
());
idxBizFanWarningRecord
.
setRecord
(
idxBizFanHealthIndices
.
get
(
0
).
getRecord
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArae
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArae
());
...
@@ -540,7 +573,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -540,7 +573,7 @@ public class HealthStatusIndicatorServiceImpl {
*
*
*/
*/
@Scheduled
(
cron
=
"0 0
*/5
* * ?"
)
@Scheduled
(
cron
=
"0 0
0/1
* * ?"
)
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningHour
()
{
public
void
healthWarningHour
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
...
@@ -583,15 +616,15 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -583,15 +616,15 @@ public class HealthStatusIndicatorServiceImpl {
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
}
}
...
@@ -626,8 +659,15 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -626,8 +659,15 @@ public class HealthStatusIndicatorServiceImpl {
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
}
}
LambdaQueryWrapper
<
IdxBizFanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
IdxBizFanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
IdxBizFanWarningRecord:
:
getStatus
,
0
);
query
.
orderByDesc
(
IdxBizFanWarningRecord:
:
getRecDate
);
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecords
=
idxBizFanWarningRecordMapper
.
selectList
(
query
);
if
(!
level
.
equals
(
""
)){
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
idxBizFanWarningRecord
.
setRecord
(
idxBizFanHealthIndices
.
get
(
0
).
getRecord
());
idxBizFanWarningRecord
.
setRecord
(
idxBizFanHealthIndices
.
get
(
0
).
getRecord
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArae
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArae
());
...
@@ -658,7 +698,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -658,7 +698,7 @@ public class HealthStatusIndicatorServiceImpl {
*
*
*/
*/
@Scheduled
(
cron
=
"0 0 0
*/3
* ? "
)
@Scheduled
(
cron
=
"0 0 0
0/1
* ? "
)
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningDay
()
{
public
void
healthWarningDay
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
...
@@ -693,22 +733,21 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -693,22 +733,21 @@ public class HealthStatusIndicatorServiceImpl {
Double
healthValueNotice
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
long
healthValueDayCount
=
0
;
long
healthValueHourCount
=
0
;
long
healthValueMinCount
=
0
;
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
break
;
}
}
...
@@ -743,7 +782,15 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -743,7 +782,15 @@ public class HealthStatusIndicatorServiceImpl {
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
}
}
if
(!
level
.
equals
(
""
)){
LambdaQueryWrapper
<
IdxBizFanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
IdxBizFanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
IdxBizFanWarningRecord:
:
getStatus
,
0
);
query
.
orderByDesc
(
IdxBizFanWarningRecord:
:
getRecDate
);
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecords
=
idxBizFanWarningRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
idxBizFanWarningRecord
.
setRecord
(
idxBizFanHealthIndices
.
get
(
0
).
getRecord
());
idxBizFanWarningRecord
.
setRecord
(
idxBizFanHealthIndices
.
get
(
0
).
getRecord
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArae
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArae
());
...
...
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