Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
plant
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
qinhu
plant
Commits
d70370e0
Commit
d70370e0
authored
4 years ago
by
qinhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报警实时数据
parent
a4daf459
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1102 additions
and
82 deletions
+1102
-82
AlertInfoController.java
.../power/plant/business/controller/AlertInfoController.java
+24
-0
CharacterParamController.java
...r/plant/business/controller/CharacterParamController.java
+4
-16
EventInfoController.java
.../power/plant/business/controller/EventInfoController.java
+41
-0
AlertInfo.java
...wise/sc/energy/power/plant/business/domain/AlertInfo.java
+82
-0
BtreeInfo.java
...wise/sc/energy/power/plant/business/domain/BtreeInfo.java
+69
-0
CharacterParamInfo.java
...nergy/power/plant/business/domain/CharacterParamInfo.java
+3
-1
EventInfo.java
...wise/sc/energy/power/plant/business/domain/EventInfo.java
+113
-0
OscillogramRowMapper.java
...rgy/power/plant/business/domain/OscillogramRowMapper.java
+1
-0
OscillogramTagsMapper.java
...gy/power/plant/business/domain/OscillogramTagsMapper.java
+1
-0
RowKeyMapper.java
...e/sc/energy/power/plant/business/domain/RowKeyMapper.java
+80
-0
AlertInfoVo.java
...sc/energy/power/plant/business/domain/vo/AlertInfoVo.java
+54
-0
BtreeInfoVo.java
...sc/energy/power/plant/business/domain/vo/BtreeInfoVo.java
+47
-0
CharacterParamInfoVo.java
.../power/plant/business/domain/vo/CharacterParamInfoVo.java
+1
-0
EventInfoVo.java
...sc/energy/power/plant/business/domain/vo/EventInfoVo.java
+81
-0
AlertInfoRepository.java
.../power/plant/business/repository/AlertInfoRepository.java
+17
-0
CharacterParamRepository.java
...r/plant/business/repository/CharacterParamRepository.java
+15
-0
EventInfoRepository.java
.../power/plant/business/repository/EventInfoRepository.java
+30
-0
IAlertInfoService.java
...nergy/power/plant/business/service/IAlertInfoService.java
+11
-0
ICharacterParamService.java
.../power/plant/business/service/ICharacterParamService.java
+4
-1
IEventInfoService.java
...nergy/power/plant/business/service/IEventInfoService.java
+30
-0
AlertInfoServiceImpl.java
...wer/plant/business/service/impl/AlertInfoServiceImpl.java
+16
-0
CharacterParamServiceImpl.java
...lant/business/service/impl/CharacterParamServiceImpl.java
+149
-60
EventInfoServiceImpl.java
...wer/plant/business/service/impl/EventInfoServiceImpl.java
+115
-0
ScheduledModel.java
...e/sc/energy/power/plant/business/task/ScheduledModel.java
+114
-4
No files found.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/controller/AlertInfoController.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.AlertInfoVo
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @description: 阈值更新记录
* @author: qh
* @create: 2020-09-03 15:22
**/
@CrossOrigin
@RestController
@RequestMapping
(
"alertinfo/"
)
public
class
AlertInfoController
{
@GetMapping
public
BaseResponse
<
List
<
AlertInfoVo
>>
list
(){
return
null
;
}
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/controller/CharacterParamController.java
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
cn.wise.sc.energy.power.plant.business.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.Oscillogram
;
import
cn.wise.sc.energy.power.plant.business.domain.OscillogramRowMapper
;
import
cn.wise.sc.energy.power.plant.business.domain.OscillogramTagsMapper
;
import
cn.wise.sc.energy.power.plant.business.domain.TendencyQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.service.ICharacterParamService
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
com.spring4all.spring.boot.starter.hbase.api.HbaseTemplate
;
import
org.apache.hadoop.hbase.client.Scan
;
import
org.apache.hadoop.hbase.filter.CompareFilter
;
import
org.apache.hadoop.hbase.filter.Filter
;
import
org.apache.hadoop.hbase.filter.FilterList
;
import
org.apache.hadoop.hbase.filter.RowFilter
;
import
org.apache.hadoop.hbase.filter.SubstringComparator
;
import
org.apache.hadoop.hbase.util.Bytes
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -27,11 +15,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.constraints.NotEmpty
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.
util.ArrayList
;
import
java.
nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -77,7 +65,7 @@ public class CharacterParamController {
}
@PostMapping
(
"/oscillogram"
)
public
BaseResponse
<
Map
<
String
,
String
>>
oscillogram
(
@RequestBody
List
<
String
>
kksCodes
)
{
public
BaseResponse
<
Map
<
String
,
String
>>
oscillogram
(
@RequestBody
List
<
String
>
kksCodes
)
throws
IOException
{
return
BaseResponse
.
okData
(
iCharacterParamService
.
getOscillogram
(
kksCodes
));
}
...
...
@@ -86,7 +74,7 @@ public class CharacterParamController {
public
BaseResponse
<
Boolean
>
uploadFile
(
MultipartFile
file
)
{
try
{
//将文件内容转成json
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
file
.
getInputStream
(),
"utf-8"
);
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
file
.
getInputStream
(),
StandardCharsets
.
UTF_8
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
inputStreamReader
);
String
s
;
StringBuilder
builder
=
new
StringBuilder
();
...
...
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/controller/EventInfoController.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.service.IEventInfoService
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @description: 报警事件
* @author: qh
* @create: 2020-09-03 14:21
**/
@CrossOrigin
@RestController
@RequestMapping
(
"event/info/"
)
public
class
EventInfoController
{
final
IEventInfoService
iEventInfoService
;
public
EventInfoController
(
IEventInfoService
iEventInfoService
)
{
this
.
iEventInfoService
=
iEventInfoService
;
}
@GetMapping
public
BaseResponse
<
List
<
EntityVo
>>
listByState
(
Integer
state
)
{
List
<
EntityVo
>
entityVos
=
iEventInfoService
.
listByState
(
state
);
if
(
entityVos
.
size
()
==
0
){
return
BaseResponse
.
errorMsg
(
"没找着!"
);
}
else
{
return
BaseResponse
.
okData
(
entityVos
);
}
}
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/AlertInfo.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.AlertInfoVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EventInfoVo
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* @description: 预警值更新记录表
* @author: qh
* @create: 2020-09-03 09:52
**/
@Data
@Entity
@Table
(
name
=
"altinfo"
)
public
class
AlertInfo
extends
AbstractEntity
<
Long
>
{
@Override
public
EntityVo
toVo
()
{
AlertInfoVo
entityVo
=
new
AlertInfoVo
();
BeanUtils
.
copyProperties
(
this
,
entityVo
);
return
entityVo
;
}
@Id
private
Long
id
;
/**
* 监测特征所属电站的标识
*/
@Column
(
name
=
"plantid"
)
private
String
plantId
;
/**
* 监测特征所属设备的标识
*/
@Column
(
name
=
"deviceid"
)
private
String
deviceId
;
/**
* 监测特征所属监测单元标识
*/
@Column
(
name
=
"unitcodeid"
)
private
String
unitCodeId
;
/**
* 监测特征唯一标识编码(KKS编码
*/
@Column
(
name
=
"kkscode"
)
private
String
kKSCode
;
/**
* 预警值
*/
@Column
(
name
=
"value"
)
private
Float
value
;
/**
* 预警值
*/
@Column
(
name
=
"newvalue"
)
private
Float
newValue
;
/**
* 记录更新时间
*/
@Column
(
name
=
"valuetime"
)
private
Long
valuetime
;
/**
* 设置来源(角色或后台)
*/
@Column
(
name
=
"usr"
)
private
String
usr
;
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/BtreeInfo.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.BtreeInfoVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Lob
;
import
javax.persistence.Table
;
/**
* @description:
* @author: qh
* @create: 2020-09-03 10:00
**/
@Data
@Entity
@Table
(
name
=
"btreeinfo"
)
public
class
BtreeInfo
extends
AbstractEntity
<
Long
>
{
@Override
public
EntityVo
toVo
()
{
BtreeInfoVo
entityVo
=
new
BtreeInfoVo
();
BeanUtils
.
copyProperties
(
this
,
entityVo
);
return
entityVo
;
}
@Id
private
Long
id
;
/**
* 监测特征所属电站的标识
*/
@Column
(
name
=
"plantid"
)
private
String
plantId
;
/**
* 监测特征所属设备的标识
*/
@Column
(
name
=
"deviceid"
)
private
String
deviceId
;
/**
* 监测特征所属监测单元标识
*/
@Column
(
name
=
"unitcodeid"
)
private
String
unitCodeId
;
/**
* 二叉树诊断名称
*/
@Column
(
name
=
"btreename"
)
private
String
btreeName
;
/**
* 0:正常,1:异常 2:其他
*/
@Column
(
name
=
"result"
)
private
Integer
result
;
/**
* 诊断结论,json格式结论
*/
@Lob
@Column
(
name
=
"diagnosis"
)
private
String
diagnosis
;
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/CharacterParamInfo.java
View file @
d70370e0
...
...
@@ -40,7 +40,8 @@ public class CharacterParamInfo extends AbstractEntity<String> {
BeanUtils
.
copyProperties
(
this
,
characterParamInfoVo
);
return
characterParamInfoVo
;
}
@Column
(
name
=
"parentdir"
)
private
String
parentDir
;
/**
* 监测特征所属电站的标识
*/
...
...
@@ -165,6 +166,7 @@ public class CharacterParamInfo extends AbstractEntity<String> {
* 一级报警下限值
*/
private
Float
protectRuleMinValue
;
/**
* 特征参数保护(一级报警)规则阈值范围是否是排除范围
* 1: 是排除范围 0:是限定范围
...
...
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/EventInfo.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.DeviceInfoVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EventInfoVo
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* @description: 事件记录
* @author: qh
* @create: 2020-09-03 09:36
**/
@Data
@Entity
@Table
(
name
=
"eventinfo"
)
public
class
EventInfo
extends
AbstractEntity
<
Long
>
{
@Override
public
EntityVo
toVo
(){
EventInfoVo
entityVo
=
new
EventInfoVo
();
BeanUtils
.
copyProperties
(
this
,
entityVo
);
return
entityVo
;
}
@Id
private
Long
id
;
/**
* 记录时间
*/
@Column
(
name
=
"valuetime"
)
private
long
valueTime
;
/**
* 监测特征所属电站的标识
*/
@Column
(
name
=
"plantid"
)
private
String
plantId
;
/**
* 监测特征所属设备的标识
*/
@Column
(
name
=
"deviceid"
)
private
String
deviceId
;
/**监测特征所属监测单元标识
*
*/
@Column
(
name
=
"unitcodeid"
)
private
String
unitCodeId
;
/**
* 监测特征唯一标识编码(KKS编码
*/
@Column
(
name
=
"kkscode"
)
private
String
kKSCode
;
/**
* 实际测量值
*/
@Column
(
name
=
"value"
)
private
Float
value
;
/**
* 信号状态:0-正常、1-无效、2-预警报警、
* 3-高报警、4-高高报警、5-上趋势报警、6-下趋势报警
*/
@Column
(
name
=
"alertstat"
)
private
Integer
alertStat
;
/**
* 特征参数保护下限值
*/
@Column
(
name
=
"alertminvalue"
)
private
Float
alertMinvalue
;
/**
* 特征参数保护上限值
*/
@Column
(
name
=
"alertmaxvalue"
)
private
Float
alertMaxvalue
;
/**
* 预警范围:0-范围内 1-范围外
*/
@Column
(
name
=
"alertlimit"
)
private
Integer
alertLimit
;
/**
* 预警值设置来源 (角色或后台)
*/
@Column
(
name
=
"altlimitusr"
)
private
String
altLimitUsr
;
/**
* 监测特征的物理单位,如 um/mm 等
*/
@Column
(
name
=
"cpunit"
)
private
String
cpUnit
;
/**
* 事件状态:0-未处理 1-已处理
*/
@Column
(
name
=
"eventinfo"
)
private
Integer
eventInfo
;
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/OscillogramRowMapper.java
View file @
d70370e0
...
...
@@ -16,6 +16,7 @@ import java.util.NavigableMap;
* @author: qh
* @create: 2020-08-20 15:25
**/
@Deprecated
public
class
OscillogramRowMapper
implements
RowMapper
<
Oscillogram
>
{
private
static
byte
[]
RECORDS
=
"records"
.
getBytes
();
...
...
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/OscillogramTagsMapper.java
View file @
d70370e0
...
...
@@ -15,6 +15,7 @@ import java.util.Set;
* @author: qh
* @create: 2020-08-24 16:37
**/
@Deprecated
public
class
OscillogramTagsMapper
implements
RowMapper
<
Oscillogram
>
{
private
static
byte
[]
COLUMNFAMILY
=
"tags"
.
getBytes
();
...
...
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/RowKeyMapper.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
;
import
cn.hutool.core.codec.Base64Encoder
;
import
com.alibaba.fastjson.JSON
;
import
com.spring4all.spring.boot.starter.hbase.api.RowMapper
;
import
org.apache.hadoop.hbase.client.Result
;
import
org.apache.hadoop.hbase.util.Bytes
;
import
java.util.List
;
/**
* @description: rowKey
* @author: qh
* @create: 2020-09-02 11:38
**/
public
class
RowKeyMapper
implements
RowMapper
<
Oscillogram
>
{
private
static
byte
[]
REORDSFAMILY
=
"records"
.
getBytes
();
private
static
byte
[]
DATA
=
"Data"
.
getBytes
();
private
static
byte
[]
TAGSFAMILY
=
"tags"
.
getBytes
();
private
static
byte
[]
TIMESPAN
=
"TimeSpan"
.
getBytes
();
private
static
byte
[]
DATATYPE
=
"DataType"
.
getBytes
();
private
static
byte
[]
DIRECTION
=
"Direction"
.
getBytes
();
private
static
byte
[]
GENERATIONFREQ
=
"GenerationFreq"
.
getBytes
();
private
static
byte
[]
KKSCODE
=
"KKSCode"
.
getBytes
();
private
static
byte
[]
PARTTYPE
=
"PartType"
.
getBytes
();
private
static
byte
[]
POLENUM
=
"PoleNum"
.
getBytes
();
private
static
byte
[]
RECORDFLAG
=
"RecordFlag"
.
getBytes
();
private
static
byte
[]
SIGNALTYPE
=
"Signaltype"
.
getBytes
();
private
static
byte
[]
STARTTIME
=
"StartTime"
.
getBytes
();
private
static
byte
[]
OFFSET
=
"KeyPhaseOffset"
.
getBytes
();
@Override
public
Oscillogram
mapRow
(
Result
result
,
int
rowNum
)
{
String
timeSpan
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
TIMESPAN
));
String
dataType
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
DATATYPE
));
String
direction
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
DIRECTION
));
String
generationFreq
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
GENERATIONFREQ
));
String
kKSCode
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
KKSCODE
));
String
partType
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
PARTTYPE
));
String
poleNum
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
POLENUM
));
String
recordFlag
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
RECORDFLAG
));
String
signaltype
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
SIGNALTYPE
));
String
startTime
=
Bytes
.
toString
(
result
.
getValue
(
TAGSFAMILY
,
STARTTIME
));
List
<
Float
>
data
=
JSON
.
parseArray
(
Bytes
.
toString
(
result
.
getValue
(
REORDSFAMILY
,
DATA
)),
Float
.
class
);
Oscillogram
oscillogram
=
new
Oscillogram
();
oscillogram
.
setRowKey
(
Base64Encoder
.
encode
(
result
.
getRow
()));
oscillogram
.
setPeriod
(
0
);
oscillogram
.
setKKsCode
(
kKSCode
);
oscillogram
.
setMapData
(
data
);
//获取偏移量
oscillogram
.
setNoVersionKeyPhaseOffset
(
JSON
.
parseArray
(
Bytes
.
toString
(
result
.
getValue
(
REORDSFAMILY
,
OFFSET
)),
Float
.
class
));
try
{
oscillogram
.
setTimeSpan
(
Long
.
parseLong
(
timeSpan
));
}
catch
(
NumberFormatException
ex
)
{
oscillogram
.
setTimeSpan
(
0L
);
}
try
{
oscillogram
.
setRecordFlag
(
Integer
.
parseInt
(
recordFlag
));
}
catch
(
NumberFormatException
ex
)
{
oscillogram
.
setRecordFlag
(
1
);
}
try
{
oscillogram
.
setGenerationFreq
(
Integer
.
parseInt
(
generationFreq
));
}
catch
(
NumberFormatException
ex
)
{
oscillogram
.
setGenerationFreq
(
1
);
}
try
{
oscillogram
.
setPoleNum
(
Integer
.
parseInt
(
poleNum
));
}
catch
(
NumberFormatException
ex
)
{
oscillogram
.
setPoleNum
(
0
);
}
try
{
oscillogram
.
setStart
(
Long
.
parseLong
(
startTime
));
}
catch
(
NumberFormatException
ex
)
{
throw
new
RuntimeException
(
"HBase这个波形图开始时间不为0"
);
}
return
oscillogram
;
}
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/vo/AlertInfoVo.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
.
vo
;
import
lombok.Data
;
/**
* @description:
* @author: qh
* @create: 2020-09-03 09:59
**/
@Data
public
class
AlertInfoVo
extends
EntityVo
{
private
Long
id
;
/**
* 监测特征所属电站的标识
*/
private
String
plantId
;
/**
* 监测特征所属设备的标识
*/
private
String
deviceId
;
/**监测特征所属监测单元标识
*
*/
private
String
unitCodeId
;
/**
* 监测特征唯一标识编码(KKS编码
*/
private
String
kKSCode
;
/**
* 预警值
*/
private
Float
value
;
/**
* 预警值
*/
private
Float
newValue
;
/**
* 记录更新时间
*/
private
Long
valuetime
;
/**
* 设置来源(角色或后台)
*/
private
String
usr
;
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/vo/BtreeInfoVo.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
.
vo
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Lob
;
/**
* @description:
* @author: qh
* @create: 2020-09-03 10:06
**/
@Data
public
class
BtreeInfoVo
extends
EntityVo
{
private
Long
id
;
/**
* 监测特征所属电站的标识
*/
private
String
plantId
;
/**
* 监测特征所属设备的标识
*/
private
String
deviceId
;
/**
* 监测特征所属监测单元标识
*/
private
String
unitCodeId
;
/**
* 二叉树诊断名称
*/
private
String
btreeName
;
/**
* 0:正常,1:异常 2:其他
*/
private
Integer
result
;
/**
* 诊断结论,json格式结论
*/
private
String
diagnosis
;
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/vo/CharacterParamInfoVo.java
View file @
d70370e0
...
...
@@ -23,6 +23,7 @@ import java.util.List;
@NoArgsConstructor
public
class
CharacterParamInfoVo
extends
EntityVo
{
private
String
parentDir
;
/**
* 监测特征所属电站的标识
*/
...
...
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/vo/EventInfoVo.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
.
vo
;
import
lombok.Data
;
/**
* @description: 事件记录
* @author: qh
* @create: 2020-09-03 09:36
**/
@Data
public
class
EventInfoVo
extends
EntityVo
{
private
Long
id
;
/**
* 记录时间
*/
private
long
valueTime
;
/**
* 监测特征所属电站的标识
*/
private
String
plantId
;
/**
* 监测特征所属设备的标识
*/
private
String
deviceId
;
/**监测特征所属监测单元标识
*
*/
private
String
unitCodeId
;
/**
* 监测特征唯一标识编码(KKS编码
*/
private
String
kKSCode
;
/**
* 实际测量值
*/
private
Float
value
;
/**
* 信号状态:0-正常、1-无效、2-预警报警、
* 3-高报警、4-高高报警、5-上趋势报警、6-下趋势报警
*/
private
String
alertStat
;
/**
* 特征参数保护下限值
*/
private
String
alertMinvalue
;
/**
* 特征参数保护上限值
*/
private
String
alertMaxvalue
;
/**
* 预警范围:0-范围内 1-范围外
*/
private
String
alertLimit
;
/**
* 预警值设置来源 (角色或后台)
*/
private
String
altLimitUsr
;
/**
* 监测特征的物理单位,如 um/mm 等
*/
private
String
cpUnit
;
/**
* 事件状态:0-未处理 1-已处理
*/
private
String
eventInfo
;
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/repository/AlertInfoRepository.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
repository
;
import
cn.wise.sc.energy.power.plant.business.domain.AlertInfo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
* @description: 阈值更新记录仓储
* @author: qh
* @create: 2020-09-03 14:41
**/
@Repository
public
interface
AlertInfoRepository
extends
JpaRepository
<
AlertInfo
,
Long
>,
JpaSpecificationExecutor
<
AlertInfo
>
{
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/repository/CharacterParamRepository.java
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
repository
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
java.util.List
;
import
java.util.Map
;
/**
* @description: 测点特征仓储
* @author: qh
...
...
@@ -14,5 +22,12 @@ import org.springframework.stereotype.Repository;
public
interface
CharacterParamRepository
extends
JpaRepository
<
CharacterParamInfo
,
String
>,
JpaSpecificationExecutor
<
CharacterParamInfo
>
{
/**
* 查询报警点数统计
*
* @return map
*/
@Query
(
value
=
"SELECT COUNT(deviceId),deviceId FROM CharacterParamInfo GROUP BY deviceId"
)
List
<
Object
[]>
countAlert
();
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/repository/EventInfoRepository.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
repository
;
import
cn.wise.sc.energy.power.plant.business.domain.EventInfo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* @description: 事件记录仓储
* @author: qh
* @create: 2020-09-03 10:26
**/
@Repository
public
interface
EventInfoRepository
extends
JpaRepository
<
EventInfo
,
Long
>,
JpaSpecificationExecutor
<
EventInfo
>
{
/**
* 查询报警点数统计
*
* @return list
*/
@Query
(
value
=
"SELECT COUNT(e.alertStat) as count, e.alertStat, e.deviceId FROM EventInfo as e"
+
" where e.alertStat > 1 and e.alertStat < 5 GROUP BY e.alertStat,e.deviceId"
)
List
<
Object
[]>
countAlert
();
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/IAlertInfoService.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
;
import
cn.wise.sc.energy.power.plant.business.domain.AlertInfo
;
/**
* @description: 阈值更新记录
* @author: qh
* @create: 2020-09-03 14:56
**/
public
interface
IAlertInfoService
extends
IBaseService
<
Long
,
AlertInfo
>
{
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/ICharacterParamService.java
View file @
d70370e0
...
...
@@ -9,6 +9,7 @@ import cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -20,6 +21,8 @@ import java.util.Map;
**/
public
interface
ICharacterParamService
extends
IBaseService
<
String
,
CharacterParamInfo
>
{
Object
count
();
/**
* 根据部件号 获取当前部件所有测点特征
*
...
...
@@ -114,5 +117,5 @@ public interface ICharacterParamService extends IBaseService<String, CharacterPa
*
* @param kksCodes kkscode
*/
Map
<
String
,
String
>
getOscillogram
(
List
<
String
>
kksCodes
);
Map
<
String
,
String
>
getOscillogram
(
List
<
String
>
kksCodes
)
throws
IOException
;
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/IEventInfoService.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
;
import
cn.wise.sc.energy.power.plant.business.domain.EventInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EventInfoVo
;
import
cn.wise.sc.energy.power.plant.business.service.impl.EventInfoServiceImpl
;
import
java.util.List
;
import
java.util.Map
;
/**
* @description: 事件记录服务层接口
* @author: qh
* @create: 2020-09-03 10:21
**/
public
interface
IEventInfoService
extends
IBaseService
<
Long
,
EventInfo
>
{
/**
* 获取报警记录统计
* @return list
*/
List
<
EventInfoServiceImpl
.
AlertCount
>
countAlert
();
/**
* 根据报警等级获取报警记录
* @param state 等级
* @return list
*/
List
<
EntityVo
>
listByState
(
Integer
state
);
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/impl/AlertInfoServiceImpl.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
.
impl
;
import
cn.wise.sc.energy.power.plant.business.domain.AlertInfo
;
import
cn.wise.sc.energy.power.plant.business.service.IAlertInfoService
;
import
org.springframework.stereotype.Service
;
/**
* @description: 阈值更新
* @author: qh
* @create: 2020-09-03 14:57
**/
@Service
public
class
AlertInfoServiceImpl
extends
BaseServiceImpl
<
Long
,
AlertInfo
>
implements
IAlertInfoService
{
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/impl/CharacterParamServiceImpl.java
View file @
d70370e0
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/impl/EventInfoServiceImpl.java
0 → 100644
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
.
impl
;
import
cn.wise.sc.energy.power.plant.business.domain.DeviceInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.EventInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.repository.DeviceInfoRepository
;
import
cn.wise.sc.energy.power.plant.business.repository.EventInfoRepository
;
import
cn.wise.sc.energy.power.plant.business.service.IEventInfoService
;
import
lombok.Data
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
javax.persistence.criteria.Path
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
/**
* @description: 事件记录服务层实现类
* @author: qh
* @create: 2020-09-03 10:22
**/
@Service
public
class
EventInfoServiceImpl
extends
BaseServiceImpl
<
Long
,
EventInfo
>
implements
IEventInfoService
{
final
DeviceInfoRepository
deviceInfoRepository
;
final
EventInfoRepository
eventInfoRepository
;
public
EventInfoServiceImpl
(
EventInfoRepository
eventInfoRepository
,
DeviceInfoRepository
deviceInfoRepository
)
{
this
.
eventInfoRepository
=
eventInfoRepository
;
this
.
deviceInfoRepository
=
deviceInfoRepository
;
}
@Override
public
List
<
AlertCount
>
countAlert
()
{
List
<
Object
[]>
objects
=
eventInfoRepository
.
countAlert
();
List
<
AlertCount
>
rts
=
new
ArrayList
<>();
for
(
Object
[]
objs
:
objects
)
{
//countAlert()查询2个字段 count()、alertState
if
(
objs
.
length
!=
2
)
{
continue
;
}
Long
count
=
(
long
)
objs
[
0
];
Integer
state
=
(
int
)
objs
[
1
];
String
deviceId
=
(
String
)
objs
[
2
];
Optional
<
DeviceInfo
>
byId
=
deviceInfoRepository
.
findById
(
deviceId
);
if
(
byId
.
isPresent
())
{
continue
;
}
String
deviceName
=
byId
.
get
().
getDeviceName
();
AlertCount
alertCount
;
if
(
state
==
2
)
{
alertCount
=
new
AlertCount
(
"preAlert"
,
deviceName
,
count
);
}
else
if
(
state
==
3
)
{
alertCount
=
new
AlertCount
(
"tallAlert"
,
deviceName
,
count
);
}
else
{
alertCount
=
new
AlertCount
(
"tooTallAlert"
,
deviceName
,
count
);
}
rts
.
add
(
alertCount
);
}
return
rts
;
}
@Override
public
List
<
EntityVo
>
listByState
(
Integer
state
)
{
if
(
state
<
2
||
state
>
4
)
{
return
null
;
}
List
<
EventInfo
>
list
=
eventInfoRepository
.
findAll
((
Specification
<
EventInfo
>)
(
root
,
query
,
criteriaBuilder
)
->
{
Path
<
Integer
>
alertStat
=
root
.
get
(
"alertStat"
);
return
criteriaBuilder
.
equal
(
alertStat
,
state
);
});
List
<
EntityVo
>
rts
=
new
ArrayList
<>(
list
.
size
());
for
(
EventInfo
eventInfo
:
list
)
{
EntityVo
entityVo
=
eventInfo
.
toVo
();
rts
.
add
(
entityVo
);
}
return
rts
;
}
@Data
public
static
class
AlertCount
{
public
AlertCount
(
String
alertLevel
,
String
deviceName
,
Long
count
)
{
this
.
alertLevel
=
alertLevel
;
this
.
deviceName
=
deviceName
;
this
.
count
=
count
;
}
/**
* 报警级别
*/
private
String
alertLevel
;
/**
* 对应设备名字
*/
private
String
deviceName
;
/**
* 对应报警次数
*/
private
Long
count
;
}
}
This diff is collapsed.
Click to expand it.
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/task/ScheduledModel.java
View file @
d70370e0
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
task
;
import
cn.wise.sc.energy.power.plant.business.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.domain.Frequency
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo
;
import
cn.wise.sc.energy.power.plant.business.service.ICharacterParamService
;
import
cn.wise.sc.energy.power.plant.business.service.IEventInfoService
;
import
cn.wise.sc.energy.power.plant.business.service.impl.EventInfoServiceImpl
;
import
com.alibaba.fastjson.JSON
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
...
...
@@ -26,14 +32,17 @@ public class ScheduledModel {
WebSocketServer
webSocketServer
;
final
ICharacterParamService
iCharacterParamService
;
final
IEventInfoService
iEventInfoService
;
public
ScheduledModel
(
WebSocketServer
webSocketServer
,
ICharacterParamService
iCharacterParamService
)
{
ICharacterParamService
iCharacterParamService
,
IEventInfoService
iEventInfoService
)
{
this
.
webSocketServer
=
webSocketServer
;
this
.
iCharacterParamService
=
iCharacterParamService
;
this
.
iEventInfoService
=
iEventInfoService
;
}
@Scheduled
(
cron
=
"0/1 * * * * ? "
)
public
void
indexRealTimeData
()
throws
IOException
{
ConcurrentHashMap
<
String
,
WebSocketServer
>
webSocketMap
=
...
...
@@ -103,6 +112,44 @@ public class ScheduledModel {
rts
.
add
(
dataPower1
);
rts
.
add
(
dataPower2
);
//添加报警点
DataPower
dataPower4
=
new
DataPower
();
List
<
EventInfoServiceImpl
.
AlertCount
>
alertCounts
=
iEventInfoService
.
countAlert
();
DataPower
.
PowerPoints
powerPoints
=
new
DataPower
.
PowerPoints
();
powerPoints
.
setName
(
"预报警"
);
DataPower
.
PowerPoints
powerPoints1
=
new
DataPower
.
PowerPoints
();
powerPoints1
.
setName
(
"高报警"
);
DataPower
.
PowerPoints
powerPoints2
=
new
DataPower
.
PowerPoints
();
powerPoints2
.
setName
(
"高高报警"
);
dataPower4
.
getDataList
().
add
(
powerPoints
);
dataPower4
.
getDataList
().
add
(
powerPoints1
);
dataPower4
.
getDataList
().
add
(
powerPoints2
);
//获取设备长度
Set
<
String
>
deviceNames
=
new
HashSet
<>();
alertCounts
.
forEach
(
arg
->
deviceNames
.
add
(
arg
.
getDeviceName
()));
int
idx
=
0
;
for
(
String
deviceName
:
deviceNames
)
{
dataPower4
.
getXAxis
().
add
(
deviceName
);
int
finalIdx
=
idx
;
alertCounts
.
forEach
(
arg
->
{
//处理名字报警
if
(
"preAlert"
.
equals
(
arg
.
getAlertLevel
()))
{
//预报警
dataPower4
.
getDataList
().
get
(
0
).
getValue
().
add
(
finalIdx
,
arg
.
getCount
()
+
""
);
}
else
if
(
"tallAlert"
.
equals
(
arg
.
getAlertLevel
()))
{
//高报
dataPower4
.
getDataList
().
get
(
1
).
getValue
().
add
(
finalIdx
,
arg
.
getCount
()
+
""
);
}
else
{
//高高报
dataPower4
.
getDataList
().
get
(
2
).
getValue
().
add
(
finalIdx
,
arg
.
getCount
()
+
""
);
}
});
idx
++;
}
rts
.
add
(
dataPower4
);
webSocket
.
sendMessage
(
JSON
.
toJSONString
(
rts
));
}
}
...
...
@@ -189,6 +236,9 @@ public class ScheduledModel {
characterNames
.
add
(
"发电机定子CA线电压"
);
characterNames
.
add
(
"励端轴承排油温度"
);
characterNames
.
add
(
"汽端轴承排油温度"
);
characterNames
.
add
(
"定子上下线棒层间温度"
);
characterNames
.
add
(
"定子上层线棒出水温度"
);
characterNames
.
add
(
"定子下层线棒出水温度"
);
List
<
CharacterParamInfoVo
>
characterParamInfoVos
=
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
...
...
@@ -242,17 +292,78 @@ public class ScheduledModel {
dataPower4
.
getDataList
().
add
(
powerPoints
);
}
}
//处理首页雷达图 超麻烦
DataPower
dataPower5
=
new
DataPower
();
DataPower
.
PowerPoints
powerPoints
=
new
DataPower
.
PowerPoints
();
powerPoints
.
setName
(
"层间温度"
);
powerPoints
.
setValue
(
initList
());
DataPower
.
PowerPoints
powerPoints1
=
new
DataPower
.
PowerPoints
();
powerPoints1
.
setName
(
"上层线棒出水"
);
powerPoints1
.
setValue
(
initList
());
DataPower
.
PowerPoints
powerPoints2
=
new
DataPower
.
PowerPoints
();
powerPoints2
.
setName
(
"下层线棒出水"
);
powerPoints2
.
setValue
(
initList
());
dataPower5
.
getDataList
().
add
(
powerPoints
);
dataPower5
.
getDataList
().
add
(
powerPoints1
);
dataPower5
.
getDataList
().
add
(
powerPoints2
);
for
(
String
key
:
realTimeDataAndCpName
.
keySet
())
{
//只取A结尾的数据
if
(
key
.
contains
(
"定子上下线棒层间温度"
)
&&
!
key
.
contains
(
"B"
))
{
//解析末尾数字
String
indexStr
=
key
.
split
(
"定子上下线棒层间温度"
)[
1
]
.
replace
(
"A"
,
""
);
int
index
;
try
{
index
=
Integer
.
parseInt
(
indexStr
);
}
catch
(
NumberFormatException
ex
)
{
throw
new
RuntimeException
(
"测定名字不符合命名规范!"
);
}
powerPoints
.
getValue
().
set
(
index
-
1
,
realTimeDataAndCpName
.
get
(
key
).
toString
());
}
if
(
key
.
contains
(
"定子上层线棒出水温度"
))
{
//解析末尾数字
String
indexStr
=
key
.
split
(
"上层线棒出水温度"
)[
1
];
int
index
;
try
{
index
=
Integer
.
parseInt
(
indexStr
);
}
catch
(
NumberFormatException
ex
)
{
throw
new
RuntimeException
(
"测定名字不符合命名规范!"
);
}
powerPoints1
.
getValue
().
set
(
index
-
1
,
realTimeDataAndCpName
.
get
(
key
).
toString
());
}
if
(
key
.
contains
(
"定子下层线棒出水温度"
))
{
//解析末尾数字
String
indexStr
=
key
.
split
(
"下层线棒出水温度"
)[
1
];
int
index
;
try
{
index
=
Integer
.
parseInt
(
indexStr
);
}
catch
(
NumberFormatException
ex
)
{
throw
new
RuntimeException
(
"测定名字不符合命名规范!"
);
}
powerPoints2
.
getValue
().
set
(
index
-
1
,
realTimeDataAndCpName
.
get
(
key
).
toString
());
}
}
List
<
DataPower
>
rts
=
new
ArrayList
<>(
4
);
List
<
DataPower
>
rts
=
new
ArrayList
<>(
6
);
rts
.
add
(
dataPower
);
rts
.
add
(
dataPower1
);
rts
.
add
(
dataPower2
);
rts
.
add
(
dataPower3
);
rts
.
add
(
dataPower4
);
rts
.
add
(
dataPower5
);
webSocket
.
sendMessage
(
JSON
.
toJSONString
(
rts
));
}
}
private
List
<
String
>
initList
()
{
List
<
String
>
rts
=
new
ArrayList
<>(
54
);
for
(
int
i
=
0
;
i
<
54
;
i
++)
{
rts
.
add
(
""
);
}
return
rts
;
}
/**
* 首页实时数据:功率趋势图-->单个机组 小时级
*/
...
...
@@ -294,7 +405,6 @@ public class ScheduledModel {
}
}
/**
* 氢系统实时数据
*/
...
...
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