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
5077fd40
Commit
5077fd40
authored
Aug 26, 2020
by
qinhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
离线导入
parent
d0d858fd
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
645 additions
and
82 deletions
+645
-82
.gitignore
.gitignore
+58
-0
PowerPlantApplication.java
...sc/energy/power/plant/business/PowerPlantApplication.java
+6
-5
PowerPlantRunner.java
...wise/sc/energy/power/plant/business/PowerPlantRunner.java
+3
-1
DataPower.java
...n/wise/sc/energy/power/plant/business/bean/DataPower.java
+3
-2
CharacterParamController.java
...r/plant/business/controller/CharacterParamController.java
+70
-10
PlantInfoController.java
.../power/plant/business/controller/PlantInfoController.java
+28
-6
RuntimeOptionController.java
...er/plant/business/controller/RuntimeOptionController.java
+0
-12
UserInfoController.java
...y/power/plant/business/controller/UserInfoController.java
+8
-2
Frequency.java
...wise/sc/energy/power/plant/business/domain/Frequency.java
+52
-0
FrequencyQuery.java
...sc/energy/power/plant/business/domain/FrequencyQuery.java
+84
-0
Oscillogram.java
...se/sc/energy/power/plant/business/domain/Oscillogram.java
+16
-0
OscillogramRowMapper.java
...rgy/power/plant/business/domain/OscillogramRowMapper.java
+2
-0
OscillogramTagsMapper.java
...gy/power/plant/business/domain/OscillogramTagsMapper.java
+54
-0
UserInfo.java
.../wise/sc/energy/power/plant/business/domain/UserInfo.java
+5
-0
UserInfoQuery.java
.../sc/energy/power/plant/business/domain/UserInfoQuery.java
+0
-1
TendencyStatus.java
...nergy/power/plant/business/domain/eum/TendencyStatus.java
+3
-3
WaveAnalysis.java
...wise/sc/energy/power/plant/business/jni/WaveAnalysis.java
+12
-0
OpentsdbOkHttpClient.java
...y/power/plant/business/opentsdb/OpentsdbOkHttpClient.java
+1
-1
JWTAuthenticationFilter.java
...ower/plant/business/security/JWTAuthenticationFilter.java
+23
-6
JwtUserDetailsService.java
.../power/plant/business/security/JwtUserDetailsService.java
+16
-1
ICharacterParamService.java
.../power/plant/business/service/ICharacterParamService.java
+14
-4
IPlantInfoService.java
...nergy/power/plant/business/service/IPlantInfoService.java
+9
-0
IUserInfoService.java
...energy/power/plant/business/service/IUserInfoService.java
+3
-1
CharacterParamServiceImpl.java
...lant/business/service/impl/CharacterParamServiceImpl.java
+40
-5
PlantInfoServiceImpl.java
...wer/plant/business/service/impl/PlantInfoServiceImpl.java
+91
-1
UserInfoServiceImpl.java
...ower/plant/business/service/impl/UserInfoServiceImpl.java
+19
-11
ScheduledModel.java
...e/sc/energy/power/plant/business/task/ScheduledModel.java
+7
-7
Utils.java
...a/cn/wise/sc/energy/power/plant/business/utils/Utils.java
+16
-0
application.yml
power-bussiness/src/main/resources/application.yml
+2
-3
No files found.
.gitignore
0 → 100644
View file @
5077fd40
### gradle ###
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.settings/
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
rebel.xml
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
### maven ###
target/
*.war
*.ear
*.zip
*.tar
*.tar.gz
### logs ####
/logs/
*.log
### temp ignore ###
*.cache
*.diff
*.patch
*.tmp
*.java~
*.properties~
*.xml~
### system ignore ###
.DS_Store
Thumbs.db
Servers
.metadata
upload
gen_code
\ No newline at end of file
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/PowerPlantApplication.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
;
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
;
import
cn.wise.sc.energy.power.plant.business.jni.WaveAnalysis
;
import
cn.wise.sc.energy.power.plant.business.security.SecurityConfig
;
import
cn.wise.sc.energy.power.plant.business.security.SecurityConfig
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.ImportAutoConfiguration
;
import
org.springframework.boot.autoconfigure.ImportAutoConfiguration
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
//@EnableSwagger2
@EnableScheduling
@EnableScheduling
@SpringBootApplication
@SpringBootApplication
@ImportAutoConfiguration
(
SecurityConfig
.
class
)
@ImportAutoConfiguration
(
SecurityConfig
.
class
)
public
class
PowerPlantApplication
{
public
class
PowerPlantApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
PowerPlantApplication
.
class
,
args
);
SpringApplication
.
run
(
PowerPlantApplication
.
class
,
args
);
}
WaveAnalysis
.
waveAnalysisModel
(
"{}"
);
}
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/PowerPlantRunner.java
View file @
5077fd40
...
@@ -8,6 +8,8 @@ import cn.wise.sc.energy.power.plant.business.domain.vo.UnitInfoVo;
...
@@ -8,6 +8,8 @@ import cn.wise.sc.energy.power.plant.business.domain.vo.UnitInfoVo;
import
cn.wise.sc.energy.power.plant.business.service.IDeviceInfoService
;
import
cn.wise.sc.energy.power.plant.business.service.IDeviceInfoService
;
import
cn.wise.sc.energy.power.plant.business.service.IPlantInfoService
;
import
cn.wise.sc.energy.power.plant.business.service.IPlantInfoService
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationArguments
;
...
@@ -44,7 +46,6 @@ public class PowerPlantRunner implements ApplicationRunner {
...
@@ -44,7 +46,6 @@ public class PowerPlantRunner implements ApplicationRunner {
}
}
/**
/**
*
* 初始化 电厂配置文件信息
* 初始化 电厂配置文件信息
*/
*/
private
void
initRedis
()
{
private
void
initRedis
()
{
...
@@ -243,4 +244,5 @@ public class PowerPlantRunner implements ApplicationRunner {
...
@@ -243,4 +244,5 @@ public class PowerPlantRunner implements ApplicationRunner {
}
}
return
rts
;
return
rts
;
}
}
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/bean/DataPower.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
bean
;
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
bean
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
import
lombok.Data
;
import
org.nustaq.serialization.coders.JSONAsString
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,12 +16,13 @@ public class DataPower {
...
@@ -16,12 +16,13 @@ public class DataPower {
/**
/**
* X轴数据
* X轴数据
*/
*/
@JSON
AsString
@JSON
Field
(
name
=
"xaxis"
)
List
<
Object
>
xAxis
=
new
ArrayList
<>();
List
<
Object
>
xAxis
=
new
ArrayList
<>();
/**
/**
* 折线图的点数据
* 折线图的点数据
*/
*/
@JSONField
(
name
=
"dataList"
)
List
<
PowerPoints
>
dataList
=
new
ArrayList
<>();
List
<
PowerPoints
>
dataList
=
new
ArrayList
<>();
/**
/**
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/controller/CharacterParamController.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
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.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.FrequencyQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.Oscillogram
;
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.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.TendencyQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
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.business.service.ICharacterParamService
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.spring4all.spring.boot.starter.hbase.api.HbaseTemplate
;
import
com.spring4all.spring.boot.starter.hbase.api.HbaseTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -19,8 +21,15 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -19,8 +21,15 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
java.io.BufferedReader
;
import
java.io.FileDescriptor
;
import
java.io.FileInputStream
;
import
java.io.FileReader
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -56,10 +65,6 @@ public class CharacterParamController {
...
@@ -56,10 +65,6 @@ public class CharacterParamController {
}
}
@GetMapping
(
"/3d"
)
@GetMapping
(
"/3d"
)
// @ApiImplicitParams({
// @ApiImplicitParam(name = "deviceId", value = "机组id"),
// @ApiImplicitParam(name = "fileName", value = "文件名 '温度,压力,湿度'")
// })
public
BaseResponse
<
Map
<
String
,
Map
<
String
,
HashMap
<
Long
,
Number
>>>>
get3DCharacter
(
String
deviceId
,
public
BaseResponse
<
Map
<
String
,
Map
<
String
,
HashMap
<
Long
,
Number
>>>>
get3DCharacter
(
String
deviceId
,
String
fileName
)
{
String
fileName
)
{
return
iCharacterParamService
.
get3DCharacter
(
deviceId
,
fileName
);
return
iCharacterParamService
.
get3DCharacter
(
deviceId
,
fileName
);
...
@@ -71,25 +76,80 @@ public class CharacterParamController {
...
@@ -71,25 +76,80 @@ public class CharacterParamController {
tendencyQuery
.
getTimeModelQuery
(),
tendencyQuery
.
getStatus
());
tendencyQuery
.
getTimeModelQuery
(),
tendencyQuery
.
getStatus
());
}
}
@PostMapping
(
"/
test
"
)
@PostMapping
(
"/
oscillogram
"
)
public
BaseResponse
<
List
<
Oscillogram
>>
test
(
@RequestBody
List
<
String
>
kksCodes
)
{
public
BaseResponse
<
List
<
Oscillogram
>>
oscillogram
(
@RequestBody
List
<
String
>
kksCodes
)
{
List
<
Oscillogram
>
oscillograms
=
hbaseTemplate
.
find
(
"thermalpower-plant-wave-data"
,
List
<
Oscillogram
>
oscillograms
=
hbaseTemplate
.
find
(
"thermalpower-plant-wave-data"
,
"records"
,
new
OscillogramRowMapper
());
"records"
,
new
OscillogramRowMapper
());
List
<
Oscillogram
>
oscillogramsTags
=
hbaseTemplate
.
find
(
"thermalpower-plant-wave-data"
,
System
.
out
.
println
(
JSON
.
toJSONString
(
oscillograms
));
"tags"
,
new
OscillogramTagsMapper
());
//关联tags
oscillograms
.
forEach
(
arg
->
{
oscillogramsTags
.
forEach
(
opt
->
{
if
(
opt
.
getRowKey
().
equals
(
arg
.
getRowKey
()))
{
arg
.
setTimeSpan
(
opt
.
getTimeSpan
());
arg
.
setRecordFlag
(
opt
.
getRecordFlag
());
}
});
});
List
<
CharacterParamInfo
>
characterParamInfos
=
iCharacterParamService
.
getByKksCodes
(
kksCodes
);
List
<
CharacterParamInfo
>
characterParamInfos
=
iCharacterParamService
.
getByKksCodes
(
kksCodes
);
List
<
Oscillogram
>
rts
=
new
ArrayList
<>(
oscillograms
.
size
());
List
<
Oscillogram
>
rts
=
new
ArrayList
<>(
oscillograms
.
size
());
for
(
Oscillogram
oscillogram
:
oscillograms
)
{
for
(
Oscillogram
oscillogram
:
oscillograms
)
{
characterParamInfos
.
forEach
(
arg
->
{
characterParamInfos
.
forEach
(
arg
->
{
if
(
oscillogram
.
getKKsCode
().
equals
(
arg
.
getKksCode
()))
{
if
(
oscillogram
.
getKKsCode
().
equals
(
arg
.
getKksCode
()))
{
oscillogram
.
setKKsCode
(
arg
.
getCpName
());
rts
.
add
(
oscillogram
);
rts
.
add
(
oscillogram
);
}
}
});
});
}
}
FrequencyQuery
frequencyQuery
=
new
FrequencyQuery
();
FrequencyQuery
.
Record
record
=
new
FrequencyQuery
.
Record
();
FrequencyQuery
.
DataOut
dataOut
=
new
FrequencyQuery
.
DataOut
();
frequencyQuery
.
setRecord
(
record
);
frequencyQuery
.
getRecord
().
setData
(
dataOut
);
frequencyQuery
.
getRecord
().
getData
().
setData
(
new
ArrayList
<>());
for
(
Oscillogram
oscillogram
:
rts
)
{
FrequencyQuery
.
DataIn
dataIn
=
new
FrequencyQuery
.
DataIn
();
dataIn
.
setKKSCode
(
oscillogram
.
getKKsCode
());
dataIn
.
setData
(
oscillogram
.
getMapData
());
dataIn
.
setKeyPhaseOffset
(
oscillogram
.
getNoVersionKeyPhaseOffset
());
dataIn
.
setPeriod
(
oscillogram
.
getPeriod
());
dataOut
.
setDirection
(
0
);
dataOut
.
setGenerationFreq
(
oscillogram
.
getGenerationFreq
());
dataOut
.
setRecordFlag
(
oscillogram
.
getRecordFlag
());
dataOut
.
setPoleNum
(
oscillogram
.
getPoleNum
());
frequencyQuery
.
getRecord
().
getData
().
getData
().
add
(
dataIn
);
}
String
frequencyQueryStr
=
JSON
.
toJSONString
(
frequencyQuery
);
System
.
out
.
println
(
"=================频谱图参数"
);
System
.
out
.
println
(
frequencyQueryStr
);
iCharacterParamService
.
getFrequency
(
JSON
.
toJSONString
(
rts
));
return
BaseResponse
.
okData
(
rts
);
return
BaseResponse
.
okData
(
rts
);
}
}
@PostMapping
(
"/upload"
)
public
BaseResponse
<
Boolean
>
uploadFile
(
MultipartFile
file
)
{
try
{
//将文件内容转成json
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
file
.
getInputStream
(),
"utf-8"
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
inputStreamReader
);
String
s
=
null
;
StringBuilder
builder
=
new
StringBuilder
();
while
((
s
=
bufferedReader
.
readLine
())
!=
null
)
{
builder
.
append
(
s
).
append
(
"\n"
);
}
bufferedReader
.
close
();
String
rts
=
builder
.
toString
();
String
replace
=
rts
.
replace
(
"\t"
,
" "
);
System
.
out
.
println
(
replace
);
return
BaseResponse
.
okData
(
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
BaseResponse
.
okDataMsg
(
false
,
"上传失败!"
);
}
}
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/controller/PlantInfoController.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
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.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.domain.DetecInteractionQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.DetecInteractionQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
...
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.UUID
;
...
@@ -25,7 +27,6 @@ import java.util.UUID;
...
@@ -25,7 +27,6 @@ import java.util.UUID;
**/
**/
@CrossOrigin
@CrossOrigin
@RestController
@RestController
//@Api(tags = "电厂信息")
@RequestMapping
(
"plantInfo/"
)
@RequestMapping
(
"plantInfo/"
)
public
class
PlantInfoController
{
public
class
PlantInfoController
{
...
@@ -73,9 +74,30 @@ public class PlantInfoController {
...
@@ -73,9 +74,30 @@ public class PlantInfoController {
}
}
}
}
// @GetMapping("/initPower")
@GetMapping
(
"plant/initPower"
)
// public BaseResponse<List<DataPower>> getInitPower(String plantId, String deviceId) {
public
BaseResponse
<
DataPower
>
getInitPower
(
String
plantId
,
String
deviceId
)
{
//
DataPower
initPower
=
iPlantInfoService
.
getInitPower
(
plantId
,
deviceId
);
//
if
(
initPower
==
null
)
{
// }
return
BaseResponse
.
errorMsg
(
"当前时间点没有数据!"
);
}
//如果是机组
if
(
StrUtil
.
isNotBlank
(
deviceId
))
{
DataPower
.
PowerPoints
powerPoints
=
initPower
.
getDataList
().
get
(
0
);
initPower
.
getDataList
().
clear
();
initPower
.
getDataList
().
add
(
powerPoints
);
}
else
{
List
<
DataPower
.
PowerPoints
>
newDataList
=
new
ArrayList
<>(
2
);
List
<
DataPower
.
PowerPoints
>
dataList
=
initPower
.
getDataList
();
for
(
DataPower
.
PowerPoints
powerPoints
:
dataList
)
{
if
(
powerPoints
.
getName
().
contains
(
"1F"
)){
newDataList
.
add
(
0
,
powerPoints
);
}
else
{
newDataList
.
add
(
1
,
powerPoints
);
}
}
initPower
.
setDataList
(
newDataList
);
}
return
BaseResponse
.
okData
(
initPower
);
}
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/controller/RuntimeOptionController.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
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.common.core.bean.BaseResponse
;
import
com.spring4all.spring.boot.starter.hbase.api.HbaseTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
/**
* @description: 运行时选项配置controller
* @description: 运行时选项配置controller
...
@@ -19,12 +12,7 @@ import java.util.List;
...
@@ -19,12 +12,7 @@ import java.util.List;
**/
**/
@CrossOrigin
@CrossOrigin
@RestController
@RestController
//@Api(tags = "系统运行时选项配置")
@RequestMapping
(
"runtimeOption/"
)
@RequestMapping
(
"runtimeOption/"
)
public
class
RuntimeOptionController
{
public
class
RuntimeOptionController
{
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/controller/UserInfoController.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
cn.wise.sc.energy.power.plant.business.domain.PageQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.PageQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.UserInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.UserInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.UserInfoQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.UserInfoQuery
;
...
@@ -35,8 +36,13 @@ public class UserInfoController {
...
@@ -35,8 +36,13 @@ public class UserInfoController {
}
}
@GetMapping
(
"/page"
)
@GetMapping
(
"/page"
)
public
BaseResponse
<
Page
<
UserInfo
>>
page
(
PageQuery
page
,
String
username
)
{
public
BaseResponse
<
Page
<
UserInfo
>>
page
(
PageQuery
page
,
String
username
,
String
plantId
)
{
return
iUserInfoService
.
page
(
page
.
getPageNo
(),
page
.
getPageSize
(),
username
);
if
(
StrUtil
.
isBlank
(
plantId
)){
return
BaseResponse
.
errorMsg
(
"电厂id不能为空!"
);
}
return
iUserInfoService
.
page
(
page
.
getPageNo
(),
page
.
getPageSize
(),
username
,
plantId
);
}
}
@PostMapping
(
"/new"
)
@PostMapping
(
"/new"
)
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/Frequency.java
0 → 100644
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
;
import
lombok.Data
;
/**
* @description: 频谱图数据结构
* @author: qh
* @create: 2020-08-24 18:04
**/
@Data
public
class
Frequency
{
@lombok
.
Data
public
static
class
Data
{
/**
* kksCode
*/
private
String
KKSCode
;
/**
* 幅值(Y轴坐标)
*/
private
String
Data
;
/**
* 频率(X轴坐标)
*/
private
String
Index
;
/**
* 主频频率
*/
private
String
MainFreq
;
/**
* 主频幅值
*/
private
String
MainFreqAmp
;
/**
* 次频频率
*/
private
String
SecFreq
;
/**
* 次频幅值
*/
private
String
SecFreqAmp
;
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/FrequencyQuery.java
0 → 100644
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
;
import
lombok.Data
;
import
java.util.List
;
/**
* @description:
* @author: qh
* @create: 2020-08-24 19:30
**/
@Data
public
class
FrequencyQuery
{
/**
* 开始时间
*/
private
Long
StartTime
;
/**
* 时间间隔
*/
private
Long
TimeSpan
;
private
Record
record
;
@lombok
.
Data
public
static
class
Record
{
private
DataOut
Data
;
}
@lombok
.
Data
public
static
class
DataOut
{
/**
* 键相类型为波形数据数组下标
*/
private
Integer
KeyPhaseTyped
=
1
;
/**
* 磁极数目
*/
private
Integer
PoleNum
;
/**
* 发电机频率单位(Hz)
*/
private
String
GenerationFreq
;
/**
* 旋转方向(0:顺时针,1:逆时针)
*/
private
Integer
Direction
;
/**
* 记录类型(0:连续采样,1定时采样:)
*/
private
Integer
RecordFlag
;
private
List
<
DataIn
>
Data
;
}
@Data
public
static
class
DataIn
{
/**
* 测点对应KKS编码
*/
private
String
KKSCode
;
/**
* 样包采样周期数
*/
private
Integer
Period
;
/**
* 各键相点相对起始时间偏移
*/
private
String
KeyPhaseOffset
;
/**
* 数据区域
*/
private
String
Data
;
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/Oscillogram.java
View file @
5077fd40
...
@@ -41,4 +41,20 @@ public class Oscillogram {
...
@@ -41,4 +41,20 @@ public class Oscillogram {
* 特征偏移
* 特征偏移
*/
*/
private
String
noVersionKeyPhaseOffset
;
private
String
noVersionKeyPhaseOffset
;
/**
* 时间间隔
*/
private
Long
timeSpan
;
private
Integer
recordFlag
;
private
String
startTime
;
private
String
rowKey
;
private
Integer
Period
;
private
String
GenerationFreq
;
private
String
KeyPhaseTyped
;
private
Integer
PoleNum
;
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/OscillogramRowMapper.java
View file @
5077fd40
...
@@ -19,10 +19,12 @@ public class OscillogramRowMapper implements RowMapper<Oscillogram> {
...
@@ -19,10 +19,12 @@ public class OscillogramRowMapper implements RowMapper<Oscillogram> {
private
static
byte
[]
DATA
=
"Data"
.
getBytes
();
private
static
byte
[]
DATA
=
"Data"
.
getBytes
();
private
static
byte
[]
OFFSET
=
"KeyPhaseOffset"
.
getBytes
();
private
static
byte
[]
OFFSET
=
"KeyPhaseOffset"
.
getBytes
();
@Override
@Override
public
Oscillogram
mapRow
(
Result
result
,
int
rowNum
)
throws
Exception
{
public
Oscillogram
mapRow
(
Result
result
,
int
rowNum
)
throws
Exception
{
Oscillogram
oscillogram
=
new
Oscillogram
();
Oscillogram
oscillogram
=
new
Oscillogram
();
oscillogram
.
setRowKey
(
Base64Encoder
.
encode
(
result
.
getRow
()));
//解密当前kkscode
//解密当前kkscode
oscillogram
.
setKKsCode
(
getKKsCode
(
result
.
getRow
()));
oscillogram
.
setKKsCode
(
getKKsCode
(
result
.
getRow
()));
//获取特征信息
//获取特征信息
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/OscillogramTagsMapper.java
0 → 100644
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
domain
;
import
cn.hutool.core.codec.Base64Decoder
;
import
cn.hutool.core.codec.Base64Encoder
;
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.NavigableMap
;
import
java.util.Set
;
/**
* @description:
* @author: qh
* @create: 2020-08-24 16:37
**/
public
class
OscillogramTagsMapper
implements
RowMapper
<
Oscillogram
>
{
private
static
byte
[]
COLUMNFAMILY
=
"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
();
@Override
public
Oscillogram
mapRow
(
Result
result
,
int
rowNum
)
throws
Exception
{
String
timeSpan
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
TIMESPAN
));
String
dataType
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
DATATYPE
));
String
direction
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
DIRECTION
));
String
generationFreq
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
GENERATIONFREQ
));
String
kKSCode
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
GENERATIONFREQ
));
String
partType
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
PARTTYPE
));
String
poleNum
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
POLENUM
));
String
recordFlag
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
RECORDFLAG
));
String
signaltype
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
SIGNALTYPE
));
String
startTime
=
Bytes
.
toString
(
result
.
getValue
(
COLUMNFAMILY
,
STARTTIME
));
Oscillogram
oscillogram
=
new
Oscillogram
();
oscillogram
.
setTimeSpan
(
Long
.
parseLong
(
timeSpan
));
oscillogram
.
setRecordFlag
(
Integer
.
parseInt
(
recordFlag
));
oscillogram
.
setRowKey
(
Base64Encoder
.
encode
(
result
.
getRow
()));
oscillogram
.
setPeriod
(
0
);
oscillogram
.
setGenerationFreq
(
generationFreq
);
oscillogram
.
setPoleNum
(
Integer
.
parseInt
(
poleNum
));
return
oscillogram
;
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/UserInfo.java
View file @
5077fd40
...
@@ -35,6 +35,8 @@ public class UserInfo extends AbstractEntity<String> implements UserDetails {
...
@@ -35,6 +35,8 @@ public class UserInfo extends AbstractEntity<String> implements UserDetails {
private
String
id
;
private
String
id
;
private
String
username
;
private
String
username
;
private
String
password
;
private
String
password
;
private
Integer
role
;
private
String
plantid
;
@Transient
@Transient
private
Collection
<?
extends
GrantedAuthority
>
authorities
;
private
Collection
<?
extends
GrantedAuthority
>
authorities
;
...
@@ -55,6 +57,7 @@ public class UserInfo extends AbstractEntity<String> implements UserDetails {
...
@@ -55,6 +57,7 @@ public class UserInfo extends AbstractEntity<String> implements UserDetails {
this
.
authorities
=
mapToGrantedAuthorities
(
authorities
);
this
.
authorities
=
mapToGrantedAuthorities
(
authorities
);
this
.
enabled
=
enabled
;
this
.
enabled
=
enabled
;
}
}
public
UserInfo
(
public
UserInfo
(
String
id
,
String
id
,
String
username
,
String
username
,
...
@@ -67,11 +70,13 @@ public class UserInfo extends AbstractEntity<String> implements UserDetails {
...
@@ -67,11 +70,13 @@ public class UserInfo extends AbstractEntity<String> implements UserDetails {
this
.
authorities
=
mapToGrantedAuthorities
(
authoritie
);
this
.
authorities
=
mapToGrantedAuthorities
(
authoritie
);
this
.
enabled
=
enabled
;
this
.
enabled
=
enabled
;
}
}
private
List
<
GrantedAuthority
>
mapToGrantedAuthorities
(
List
<
String
>
authorities
)
{
private
List
<
GrantedAuthority
>
mapToGrantedAuthorities
(
List
<
String
>
authorities
)
{
return
authorities
.
stream
()
return
authorities
.
stream
()
.
map
(
authority
->
new
SimpleGrantedAuthority
(
authority
))
.
map
(
authority
->
new
SimpleGrantedAuthority
(
authority
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
private
List
<
GrantedAuthority
>
mapToGrantedAuthorities
(
String
authoritie
)
{
private
List
<
GrantedAuthority
>
mapToGrantedAuthorities
(
String
authoritie
)
{
return
Arrays
.
asList
(
new
SimpleGrantedAuthority
(
authoritie
));
return
Arrays
.
asList
(
new
SimpleGrantedAuthority
(
authoritie
));
}
}
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/UserInfoQuery.java
View file @
5077fd40
...
@@ -24,5 +24,4 @@ public class UserInfoQuery implements Serializable {
...
@@ -24,5 +24,4 @@ public class UserInfoQuery implements Serializable {
@NotEmpty
(
message
=
"password不能为空!"
)
@NotEmpty
(
message
=
"password不能为空!"
)
private
String
password
;
private
String
password
;
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/domain/eum/TendencyStatus.java
View file @
5077fd40
...
@@ -7,9 +7,9 @@ package cn.wise.sc.energy.power.plant.business.domain.eum;
...
@@ -7,9 +7,9 @@ package cn.wise.sc.energy.power.plant.business.domain.eum;
**/
**/
public
enum
TendencyStatus
{
public
enum
TendencyStatus
{
YEAR
(
3
,
"
7d
-avg-zero"
),
YEAR
(
3
,
"
1y
-avg-zero"
),
WEEK
(
1
,
"1
M
-avg-zero"
),
WEEK
(
1
,
"1
w
-avg-zero"
),
MONTH
(
2
,
"1
y
-avg-zero"
);
MONTH
(
2
,
"1
n
-avg-zero"
);
private
Integer
code
;
private
Integer
code
;
private
String
downSample
;
private
String
downSample
;
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/jni/WaveAnalysis.java
0 → 100644
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
jni
;
/**
* @description:
* @author: qh
* @create: 2020-08-24 19:40
**/
public
class
WaveAnalysis
{
public
static
native
String
waveAnalysisModel
(
String
jstr
);
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/opentsdb/OpentsdbOkHttpClient.java
View file @
5077fd40
...
@@ -194,7 +194,7 @@ public class OpentsdbOkHttpClient {
...
@@ -194,7 +194,7 @@ public class OpentsdbOkHttpClient {
* @throws IOException
* @throws IOException
* @throws URISyntaxException
* @throws URISyntaxException
*/
*/
public
QueryLastResponse
queryLast
(
QueryLastRequest
request
)
public
static
QueryLastResponse
queryLast
(
QueryLastRequest
request
)
throws
IOException
,
URISyntaxException
{
throws
IOException
,
URISyntaxException
{
String
response
=
OkHttpClientUtil
.
getInstance
().
postJson
(
BASE_URL
+
Endpoint
.
QUERY_LAST
.
getPath
(),
JsonUtil
.
writeValueAsString
(
request
));
String
response
=
OkHttpClientUtil
.
getInstance
().
postJson
(
BASE_URL
+
Endpoint
.
QUERY_LAST
.
getPath
(),
JsonUtil
.
writeValueAsString
(
request
));
List
<
LastDataPoint
>
results
=
JsonUtil
.
readValue
(
response
,
List
.
class
,
LastDataPoint
.
class
);
List
<
LastDataPoint
>
results
=
JsonUtil
.
readValue
(
response
,
List
.
class
,
LastDataPoint
.
class
);
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/security/JWTAuthenticationFilter.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
security
;
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
security
;
import
cn.wise.sc.energy.power.plant.business.domain.UserInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.UserInfo
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.jsonwebtoken.Jwts
;
import
io.jsonwebtoken.Jwts
;
import
io.jsonwebtoken.SignatureAlgorithm
;
import
io.jsonwebtoken.SignatureAlgorithm
;
...
@@ -39,6 +41,7 @@ public class JWTAuthenticationFilter extends
...
@@ -39,6 +41,7 @@ public class JWTAuthenticationFilter extends
public
Authentication
attemptAuthentication
(
final
HttpServletRequest
request
,
public
Authentication
attemptAuthentication
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
)
throws
AuthenticationException
{
final
HttpServletResponse
response
)
throws
AuthenticationException
{
try
{
try
{
final
LoginRequest
loginRequest
=
this
.
objectMapper
final
LoginRequest
loginRequest
=
this
.
objectMapper
.
readValue
(
request
.
getInputStream
(),
LoginRequest
.
class
);
.
readValue
(
request
.
getInputStream
(),
LoginRequest
.
class
);
return
this
.
authenticationManager
.
authenticate
(
return
this
.
authenticationManager
.
authenticate
(
...
@@ -55,12 +58,26 @@ public class JWTAuthenticationFilter extends
...
@@ -55,12 +58,26 @@ public class JWTAuthenticationFilter extends
final
HttpServletResponse
response
,
final
FilterChain
chain
,
final
HttpServletResponse
response
,
final
FilterChain
chain
,
final
Authentication
authResult
)
{
final
Authentication
authResult
)
{
final
String
token
=
Jwts
.
builder
()
final
String
token
=
Jwts
.
builder
()
.
setSubject
(((
UserInfo
)
authResult
.
getPrincipal
()).
getUsername
())
.
setSubject
(((
UserInfo
)
authResult
.
getPrincipal
()).
getUsername
())
.
setIssuedAt
(
new
Date
())
.
setIssuedAt
(
new
Date
())
.
setExpiration
(
Date
.
from
(
OffsetDateTime
.
now
().
plusDays
(
5
).
toInstant
()))
.
setExpiration
(
Date
.
from
(
OffsetDateTime
.
now
().
plusDays
(
5
).
toInstant
()))
.
signWith
(
JWTKeyHolder
.
KEY
,
SignatureAlgorithm
.
HS512
)
.
signWith
(
JWTKeyHolder
.
KEY
,
SignatureAlgorithm
.
HS512
)
.
compact
();
.
compact
();
response
.
addHeader
(
AUTHORIZATION_HEADER
,
TOKEN_PREFIX
+
token
);
response
.
addHeader
(
AUTHORIZATION_HEADER
,
TOKEN_PREFIX
+
token
);
response
.
addCookie
(
new
Cookie
(
SecurityConstants
.
AUTH_COOKIE
,
token
));
try
{
String
role
=
((
UserInfo
)
authResult
.
getPrincipal
()).
getRole
()
+
""
;
String
rts
=
JSON
.
toJSONString
(
BaseResponse
.
okData
(
role
));
response
.
setHeader
(
"Content-type"
,
"text/html;charset=UTF-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
getWriter
().
write
(
rts
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
// response.addCookie(new Cookie(SecurityConstants.AUTH_COOKIE, token));
}
public
static
void
main
(
String
[]
args
)
{
String
t
=
"asdadasd\tadasdasd"
;
System
.
out
.
println
(
t
);
}
}
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/security/JwtUserDetailsService.java
View file @
5077fd40
...
@@ -8,6 +8,7 @@ import org.springframework.security.core.userdetails.UserDetails;
...
@@ -8,6 +8,7 @@ import org.springframework.security.core.userdetails.UserDetails;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -28,15 +29,29 @@ public class JwtUserDetailsService implements UserDetailsService {
...
@@ -28,15 +29,29 @@ public class JwtUserDetailsService implements UserDetailsService {
@Override
@Override
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
String
[]
split
=
username
.
split
(
"\\|"
);
if
(
split
.
length
!=
2
)
{
throw
new
UsernameNotFoundException
(
"username is not available!"
);
}
String
account
=
split
[
0
];
//获取数据库用户信息
//获取数据库用户信息
List
<
UserInfo
>
list
=
iUserInfoService
.
getSysUserByUsername
(
username
);
List
<
UserInfo
>
list
=
iUserInfoService
.
getSysUserByUsername
(
account
);
//todo 权限获取
//todo 权限获取
if
(
list
.
size
()
==
0
)
{
if
(
list
.
size
()
==
0
)
{
log
.
warn
(
"未找到当前用户:{} \n ====== cn.wise.sc.pay.common.security2.userDetail.JwtUserDetailsService.loadUserByUsername()"
,
username
);
log
.
warn
(
"未找到当前用户:{} \n ====== cn.wise.sc.pay.common.security2.userDetail.JwtUserDetailsService.loadUserByUsername()"
,
username
);
throw
new
UsernameNotFoundException
(
"未找到当前用户!"
);
throw
new
UsernameNotFoundException
(
"未找到当前用户!"
);
}
}
//判断用户登录
UserDetails
userDetails
=
list
.
get
(
0
);
UserDetails
userDetails
=
list
.
get
(
0
);
//判断用户所属
UserInfo
userInfo
=
(
UserInfo
)
userDetails
;
if
(!
userInfo
.
getPlantid
().
equals
(
split
[
1
]))
{
throw
new
UsernameNotFoundException
(
"user is not belong to this plant!"
);
}
((
UserInfo
)
userDetails
).
setUsername
(
username
);
return
userDetails
;
return
userDetails
;
}
}
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/ICharacterParamService.java
View file @
5077fd40
...
@@ -3,10 +3,10 @@ package cn.wise.sc.energy.power.plant.business.service;
...
@@ -3,10 +3,10 @@ package cn.wise.sc.energy.power.plant.business.service;
import
cn.wise.sc.energy.power.plant.business.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery
;
import
cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
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.domain.vo.CharacterParamInfoVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -76,24 +76,34 @@ public interface ICharacterParamService extends IBaseService<String, CharacterPa
...
@@ -76,24 +76,34 @@ public interface ICharacterParamService extends IBaseService<String, CharacterPa
*
*
* @param characterNames 名字 like
* @param characterNames 名字 like
* @param plantCode 电厂id
* @param plantCode 电厂id
* @param deviceId 机组id
* @param deviceId
机组id
* @return list
* @return list
*/
*/
List
<
CharacterParamInfoVo
>
getCharacterByName
(
List
<
String
>
characterNames
,
String
plantCode
,
String
deviceId
);
List
<
CharacterParamInfoVo
>
getCharacterByName
(
List
<
String
>
characterNames
,
String
plantCode
,
String
deviceId
);
/**
/**
* 获取趋势图
* 获取趋势图
* @param keys KksCode
*
* @param keys KksCode
* @param timeModelQuery 时间端
* @param timeModelQuery 时间端
* @param status 统计方式
* @param status
统计方式
* @return list
* @return list
*/
*/
BaseResponse
<
DataPower
>
getTendency
(
List
<
String
>
keys
,
TimeModelQuery
timeModelQuery
,
Integer
status
);
BaseResponse
<
DataPower
>
getTendency
(
List
<
String
>
keys
,
TimeModelQuery
timeModelQuery
,
Integer
status
);
/**
/**
* 感觉kkscode获取测点
* 感觉kkscode获取测点
*
* @param kksCodes kks
* @param kksCodes kks
* @return list
* @return list
*/
*/
List
<
CharacterParamInfo
>
getByKksCodes
(
List
<
String
>
kksCodes
);
List
<
CharacterParamInfo
>
getByKksCodes
(
List
<
String
>
kksCodes
);
/**
* 获取频谱图数据信息
*
* @param toJSONString 波形图JSON
* @return list
*/
List
<
Frequency
>
getFrequency
(
String
toJSONString
);
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/IPlantInfoService.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
;
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
;
import
cn.wise.sc.energy.power.plant.business.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.domain.PlantInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.PlantInfo
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
java.util.List
;
/**
/**
* @description: 电厂信息服务层
* @description: 电厂信息服务层
* @author: qh
* @author: qh
...
@@ -16,4 +19,10 @@ public interface IPlantInfoService extends IBaseService<String, PlantInfo> {
...
@@ -16,4 +19,10 @@ public interface IPlantInfoService extends IBaseService<String, PlantInfo> {
* @return total
* @return total
*/
*/
BaseResponse
<
Double
>
getTotalPower
(
String
plantId
);
BaseResponse
<
Double
>
getTotalPower
(
String
plantId
);
/**
* 获取电厂功率初始数据
* @return
*/
DataPower
getInitPower
(
String
plantId
,
String
deviceId
);
}
}
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/IUserInfoService.java
View file @
5077fd40
...
@@ -26,9 +26,10 @@ public interface IUserInfoService {
...
@@ -26,9 +26,10 @@ public interface IUserInfoService {
* @param pageNo 起始页
* @param pageNo 起始页
* @param pageSize 每页大小
* @param pageSize 每页大小
* @param username 用户名
* @param username 用户名
* @param plantId 电厂id
* @return EntityVo
* @return EntityVo
*/
*/
BaseResponse
<
Page
<
UserInfo
>>
page
(
Integer
pageNo
,
Integer
pageSize
,
String
username
);
BaseResponse
<
Page
<
UserInfo
>>
page
(
Integer
pageNo
,
Integer
pageSize
,
String
username
,
String
plantId
);
/**
/**
* 添加新的对象
* 添加新的对象
...
@@ -40,6 +41,7 @@ public interface IUserInfoService {
...
@@ -40,6 +41,7 @@ public interface IUserInfoService {
/**
/**
* 编辑
* 编辑
*
* @param userInfo 用户信息
* @param userInfo 用户信息
* @return
* @return
*/
*/
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/impl/CharacterParamServiceImpl.java
View file @
5077fd40
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import
cn.wise.sc.energy.power.plant.business.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.bean.DataPower
;
import
cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery
;
import
cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.Frequency
;
import
cn.wise.sc.energy.power.plant.business.domain.UnitInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.UnitInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.eum.TendencyStatus
;
import
cn.wise.sc.energy.power.plant.business.domain.eum.TendencyStatus
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo
;
...
@@ -18,8 +19,11 @@ import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
...
@@ -18,8 +19,11 @@ import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import
cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum
;
import
cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.opentsdb.client.api.query.request.QueryLastRequest
;
import
net.opentsdb.client.api.query.response.QueryLastResponse
;
import
net.opentsdb.client.api.query.response.QueryResponse
;
import
net.opentsdb.client.api.query.response.QueryResponse
;
import
net.opentsdb.client.bean.Aggregator
;
import
net.opentsdb.client.bean.Aggregator
;
import
net.opentsdb.client.bean.LastDataPointQuery
;
import
net.opentsdb.client.bean.QueryResult
;
import
net.opentsdb.client.bean.QueryResult
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.domain.Example
;
...
@@ -171,6 +175,7 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
...
@@ -171,6 +175,7 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
QueryResponse
response
;
QueryResponse
response
;
try
{
try
{
response
=
OpentsdbOkHttpClient
.
query
(
queryRequestExt
);
response
=
OpentsdbOkHttpClient
.
query
(
queryRequestExt
);
//没有数据时
if
(
response
.
getResults
().
size
()
==
0
)
{
if
(
response
.
getResults
().
size
()
==
0
)
{
response
=
enterWhenItIsARind
(
characterParamInfos
);
response
=
enterWhenItIsARind
(
characterParamInfos
);
}
}
...
@@ -242,6 +247,27 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
...
@@ -242,6 +247,27 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
}
}
return
in
;
return
in
;
});
});
//如果时间传0 默认取最后一条数据向前推1h
if
(
timeModelQuery
.
getStart
()
==
0
||
timeModelQuery
.
getEnd
()
==
0
)
{
QueryLastRequest
queryLastRequest
=
new
QueryLastRequest
();
LastDataPointQuery
lastDataPointQuery
=
new
LastDataPointQuery
();
lastDataPointQuery
.
setMetric
(
"C0A00101CFA01CBA00R002"
);
List
<
LastDataPointQuery
>
list
=
new
ArrayList
<>();
list
.
add
(
lastDataPointQuery
);
queryLastRequest
.
setQueries
(
list
);
QueryLastResponse
queryLastResponse
;
try
{
queryLastResponse
=
OpentsdbOkHttpClient
.
queryLast
(
queryLastRequest
);
//获取最后一条数据的时间
Long
timestamp
=
queryLastResponse
.
getResults
().
get
(
0
).
getTimestamp
();
//以这个时间向前推1h
timeModelQuery
.
setStart
(
timestamp
-
(
24
*
60
*
60
*
1000
));
timeModelQuery
.
setEnd
(
timestamp
);
}
catch
(
IOException
|
URISyntaxException
e
)
{
e
.
printStackTrace
();
}
}
QueryRequestExt
queryRequestExt
=
QueryRequestExt
.
builder
()
QueryRequestExt
queryRequestExt
=
QueryRequestExt
.
builder
()
.
start
(
timeModelQuery
.
getStart
()
+
""
)
.
start
(
timeModelQuery
.
getStart
()
+
""
)
.
end
(
timeModelQuery
.
getEnd
()
+
""
)
.
end
(
timeModelQuery
.
getEnd
()
+
""
)
...
@@ -249,7 +275,6 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
...
@@ -249,7 +275,6 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
for
(
CharacterParamInfo
characterParamInfo
:
characterParamInfos
)
{
for
(
CharacterParamInfo
characterParamInfo
:
characterParamInfos
)
{
QueryExt
build
=
QueryExt
.
builder
()
QueryExt
build
=
QueryExt
.
builder
()
.
aggregator
(
Aggregator
.
AVG
)
.
aggregator
(
Aggregator
.
AVG
)
.
downsample
(
"1s-avg-zero"
)
.
metric
(
characterParamInfo
.
getKksCode
())
.
metric
(
characterParamInfo
.
getKksCode
())
.
build
();
.
build
();
//填充统计类型
//填充统计类型
...
@@ -288,12 +313,23 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
...
@@ -288,12 +313,23 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
});
});
}
}
@Override
public
List
<
Frequency
>
getFrequency
(
String
toJSONString
)
{
//todo 调用C函数 获取频谱图
return
null
;
}
private
DataPower
buildDataPower
(
List
<
QueryResult
>
results
,
private
DataPower
buildDataPower
(
List
<
QueryResult
>
results
,
List
<
CharacterParamInfo
>
characterParamInfos
)
{
List
<
CharacterParamInfo
>
characterParamInfos
)
{
ResponseEnum
.
COLLECTION_NOT_ILLEGAL
.
assertCollectionNotILLEGAL
(
results
);
ResponseEnum
.
COLLECTION_NOT_ILLEGAL
.
assertCollectionNotILLEGAL
(
results
);
DataPower
dataPower
=
new
DataPower
();
DataPower
dataPower
=
new
DataPower
();
if
(
results
.
size
()
!=
0
)
{
QueryResult
queryResult
=
results
.
get
(
0
);
queryResult
.
getDps
().
keySet
().
forEach
(
arg
->
dataPower
.
getXAxis
().
add
(
arg
));
}
for
(
QueryResult
queryResult
:
results
)
{
for
(
QueryResult
queryResult
:
results
)
{
CharacterParamInfo
characterParamInfo
=
characterParamInfos
.
stream
()
CharacterParamInfo
characterParamInfo
=
characterParamInfos
.
stream
()
.
filter
(
arg
->
arg
.
getKksCode
().
equals
(
queryResult
.
getMetric
()))
.
filter
(
arg
->
arg
.
getKksCode
().
equals
(
queryResult
.
getMetric
()))
...
@@ -302,9 +338,8 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
...
@@ -302,9 +338,8 @@ public class CharacterParamServiceImpl extends BaseServiceImpl<String, Character
DataPower
.
PowerPoints
powerPoints
=
new
DataPower
.
PowerPoints
();
DataPower
.
PowerPoints
powerPoints
=
new
DataPower
.
PowerPoints
();
dataPower
.
getDataList
().
add
(
powerPoints
);
dataPower
.
getDataList
().
add
(
powerPoints
);
powerPoints
.
setName
(
cpName
);
powerPoints
.
setName
(
cpName
);
queryResult
.
getDps
().
keySet
().
forEach
(
arg
->
{
queryResult
.
getDps
().
keySet
().
forEach
(
arg
->
powerPoints
.
getValue
().
add
(
queryResult
.
getDps
().
get
(
arg
).
toString
());
powerPoints
.
getValue
().
add
(
queryResult
.
getDps
().
get
(
arg
).
toString
()));
});
if
(
powerPoints
.
getValue
().
size
()
==
0
)
{
if
(
powerPoints
.
getValue
().
size
()
==
0
)
{
powerPoints
.
getValue
().
add
(
"0"
);
powerPoints
.
getValue
().
add
(
"0"
);
}
}
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/impl/PlantInfoServiceImpl.java
View file @
5077fd40
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
.
impl
;
package
cn
.
wise
.
sc
.
energy
.
power
.
plant
.
business
.
service
.
impl
;
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.DeviceInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.DeviceInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.PlantInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.PlantInfo
;
import
cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo
;
import
cn.wise.sc.energy.power.plant.business.opentsdb.OpentsdbOkHttpClient
;
import
cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryExt
;
import
cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryRequestExt
;
import
cn.wise.sc.energy.power.plant.business.repository.DeviceInfoRepository
;
import
cn.wise.sc.energy.power.plant.business.repository.DeviceInfoRepository
;
import
cn.wise.sc.energy.power.plant.business.service.ICharacterParamService
;
import
cn.wise.sc.energy.power.plant.business.service.IPlantInfoService
;
import
cn.wise.sc.energy.power.plant.business.service.IPlantInfoService
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse
;
import
cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum
;
import
cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
lombok.Data
;
import
lombok.Data
;
import
net.opentsdb.client.api.query.response.QueryResponse
;
import
net.opentsdb.client.bean.Aggregator
;
import
net.opentsdb.client.bean.QueryResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
/**
/**
* @description: 电厂信息服务层实现
* @description: 电厂信息服务层实现
...
@@ -21,9 +35,13 @@ public class PlantInfoServiceImpl extends BaseServiceImpl<String, PlantInfo> imp
...
@@ -21,9 +35,13 @@ public class PlantInfoServiceImpl extends BaseServiceImpl<String, PlantInfo> imp
final
final
DeviceInfoRepository
deviceInfoRepository
;
DeviceInfoRepository
deviceInfoRepository
;
final
ICharacterParamService
iCharacterParamService
;
public
PlantInfoServiceImpl
(
DeviceInfoRepository
deviceInfoRepository
)
{
public
PlantInfoServiceImpl
(
DeviceInfoRepository
deviceInfoRepository
,
ICharacterParamService
iCharacterParamService
)
{
this
.
deviceInfoRepository
=
deviceInfoRepository
;
this
.
deviceInfoRepository
=
deviceInfoRepository
;
this
.
iCharacterParamService
=
iCharacterParamService
;
}
}
@Override
@Override
...
@@ -46,6 +64,78 @@ public class PlantInfoServiceImpl extends BaseServiceImpl<String, PlantInfo> imp
...
@@ -46,6 +64,78 @@ public class PlantInfoServiceImpl extends BaseServiceImpl<String, PlantInfo> imp
}
}
}
}
@Override
public
DataPower
getInitPower
(
String
plantId
,
String
deviceId
)
{
ResponseEnum
.
LICENCE_NOT_FOUND
.
assertNotEmpty
(
plantId
);
if
(
StrUtil
.
isBlank
(
deviceId
)){
deviceId
=
""
;
}
List
<
String
>
cpName
=
new
ArrayList
<>(
1
);
cpName
.
add
(
"燃机发电机有功功率"
);
List
<
CharacterParamInfoVo
>
characterParamInfoVos
=
iCharacterParamService
.
getCharacterByName
(
cpName
,
plantId
,
deviceId
);
QueryRequestExt
queryRequestExt
=
QueryRequestExt
.
builder
()
.
start
(
"400h-ago"
)
.
build
();
for
(
CharacterParamInfoVo
characterParamInfo
:
characterParamInfoVos
)
{
QueryExt
build
=
QueryExt
.
builder
()
.
aggregator
(
Aggregator
.
AVG
)
.
downsample
(
"1m-max-zero"
)
.
metric
(
characterParamInfo
.
getKksCode
())
.
build
();
queryRequestExt
.
addQuery
(
build
);
}
QueryResponse
response
;
try
{
response
=
OpentsdbOkHttpClient
.
query
(
queryRequestExt
);
if
(
response
.
getResults
().
size
()
==
0
){
return
null
;
}
}
catch
(
IOException
|
URISyntaxException
e
)
{
return
null
;
}
return
buildDataPower
(
characterParamInfoVos
,
response
);
}
private
DataPower
buildDataPower
(
List
<
CharacterParamInfoVo
>
characterParamInfos
,
QueryResponse
response
)
{
DataPower
rts
=
new
DataPower
();
List
<
Object
>
times
=
rts
.
getXAxis
();
List
<
QueryResult
>
results
=
response
.
getResults
();
//添加时间轴
if
(
results
.
size
()
>
0
)
{
results
.
get
(
0
).
getDps
().
keySet
().
forEach
(
arg
->
{
times
.
add
(
arg
);
});
}
//关联kksCode和名字
for
(
QueryResult
queryResult
:
results
)
{
Optional
<
CharacterParamInfoVo
>
first
=
characterParamInfos
.
stream
()
.
filter
(
arg
->
arg
.
getKksCode
().
equals
(
queryResult
.
getMetric
()))
.
findFirst
();
if
(!
first
.
isPresent
())
{
continue
;
}
String
cpName
=
first
.
get
().
getCpName
();
DataPower
.
PowerPoints
powerPoints
=
new
DataPower
.
PowerPoints
();
powerPoints
.
setName
(
cpName
);
queryResult
.
getDps
().
keySet
().
forEach
(
arg
->
{
Number
number
=
queryResult
.
getDps
().
get
(
arg
);
powerPoints
.
getValue
().
add
(
number
+
""
);
});
rts
.
getDataList
().
add
(
powerPoints
);
}
return
rts
;
}
@Data
@Data
public
static
class
DeviceParam
{
public
static
class
DeviceParam
{
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/service/impl/UserInfoServiceImpl.java
View file @
5077fd40
...
@@ -19,6 +19,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
...
@@ -19,6 +19,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.persistence.criteria.Path
;
import
javax.persistence.criteria.Path
;
import
javax.persistence.criteria.Predicate
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -52,21 +53,25 @@ public class UserInfoServiceImpl implements IUserInfoService {
...
@@ -52,21 +53,25 @@ public class UserInfoServiceImpl implements IUserInfoService {
}
}
@Override
@Override
public
BaseResponse
<
Page
<
UserInfo
>>
page
(
Integer
pageNo
,
Integer
pageSize
,
String
username
)
{
public
BaseResponse
<
Page
<
UserInfo
>>
page
(
Integer
pageNo
,
Integer
pageSize
,
String
username
,
String
plantId
)
{
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"id"
);
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"id"
);
Pageable
page
=
PageRequest
.
of
(
pageNo
,
pageSize
,
sort
);
Pageable
page
=
PageRequest
.
of
(
pageNo
,
pageSize
,
sort
);
Page
<
UserInfo
>
userInfoPage
;
Page
<
UserInfo
>
userInfoPage
;
if
(
StrUtil
.
isNotBlank
(
username
))
{
Specification
<
UserInfo
>
specification
=
(
root
,
query
,
criteriaBuilder
)
->
{
Path
<
Object
>
path
=
root
.
get
(
"username"
);
return
criteriaBuilder
.
equal
(
path
,
userInfoRepository
);
};
userInfoPage
=
userInfoRepository
.
findAll
(
specification
,
page
);
}
else
{
userInfoPage
=
userInfoRepository
.
findAll
(
page
);
}
Specification
<
UserInfo
>
specification
=
(
root
,
query
,
criteriaBuilder
)
->
{
Path
<
String
>
plantPath
=
root
.
get
(
"plantid"
);
Predicate
equalPlant
=
criteriaBuilder
.
equal
(
plantPath
,
plantId
);
if
(
StrUtil
.
isNotBlank
(
username
))
{
Path
<
Object
>
path
=
root
.
get
(
"username"
);
Predicate
equalUsername
=
criteriaBuilder
.
equal
(
path
,
username
);
return
criteriaBuilder
.
and
(
equalPlant
,
equalUsername
);
}
else
{
return
equalPlant
;
}
};
userInfoPage
=
userInfoRepository
.
findAll
(
specification
,
page
);
return
BaseResponse
.
okData
(
userInfoPage
);
return
BaseResponse
.
okData
(
userInfoPage
);
}
}
...
@@ -94,7 +99,10 @@ public class UserInfoServiceImpl implements IUserInfoService {
...
@@ -94,7 +99,10 @@ public class UserInfoServiceImpl implements IUserInfoService {
public
BaseResponse
<
Boolean
>
edit
(
UserInfoQuery
userInfo
)
{
public
BaseResponse
<
Boolean
>
edit
(
UserInfoQuery
userInfo
)
{
UserInfo
one
=
userInfoRepository
.
getOne
(
userInfo
.
getId
());
UserInfo
one
=
userInfoRepository
.
getOne
(
userInfo
.
getId
());
one
.
setPassword
(
passwordEncoder
.
encode
(
userInfo
.
getPassword
()));
if
(
StrUtil
.
isNotBlank
(
userInfo
.
getPassword
()))
{
one
.
setPassword
(
passwordEncoder
.
encode
(
userInfo
.
getPassword
()));
}
userInfoRepository
.
saveAndFlush
(
one
);
userInfoRepository
.
saveAndFlush
(
one
);
return
BaseResponse
.
okData
(
true
);
return
BaseResponse
.
okData
(
true
);
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/task/ScheduledModel.java
View file @
5077fd40
...
@@ -65,7 +65,7 @@ public class ScheduledModel {
...
@@ -65,7 +65,7 @@ public class ScheduledModel {
iCharacterParamService
.
getCharacterByName
(
characterNames
,
plantCode
,
""
);
iCharacterParamService
.
getCharacterByName
(
characterNames
,
plantCode
,
""
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
String
start
=
"1
30h
-ago"
;
String
start
=
"1
s
-ago"
;
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
...
@@ -130,7 +130,7 @@ public class ScheduledModel {
...
@@ -130,7 +130,7 @@ public class ScheduledModel {
iCharacterParamService
.
getCharacterByName
(
characterNames
,
plantCode
,
""
);
iCharacterParamService
.
getCharacterByName
(
characterNames
,
plantCode
,
""
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
String
start
=
"1
30h
-ago"
;
String
start
=
"1
s
-ago"
;
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
"2h-avg-zero"
);
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
"2h-avg-zero"
);
...
@@ -193,7 +193,7 @@ public class ScheduledModel {
...
@@ -193,7 +193,7 @@ public class ScheduledModel {
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
String
start
=
"1
30h
-ago"
;
String
start
=
"1
s
-ago"
;
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
...
@@ -274,7 +274,7 @@ public class ScheduledModel {
...
@@ -274,7 +274,7 @@ public class ScheduledModel {
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
String
start
=
"1
30h
-ago"
;
String
start
=
"1
s
-ago"
;
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
"2h-avg-zero"
);
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
"2h-avg-zero"
);
Long
time
=
response
.
keySet
().
iterator
().
next
();
Long
time
=
response
.
keySet
().
iterator
().
next
();
...
@@ -319,7 +319,7 @@ public class ScheduledModel {
...
@@ -319,7 +319,7 @@ public class ScheduledModel {
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
String
start
=
"1
30h
-ago"
;
String
start
=
"1
s
-ago"
;
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
...
@@ -394,7 +394,7 @@ public class ScheduledModel {
...
@@ -394,7 +394,7 @@ public class ScheduledModel {
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
String
start
=
"1
00h
-ago"
;
String
start
=
"1
s
-ago"
;
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
...
@@ -477,7 +477,7 @@ public class ScheduledModel {
...
@@ -477,7 +477,7 @@ public class ScheduledModel {
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
iCharacterParamService
.
getCharacterByName
(
characterNames
,
""
,
deviceId
);
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
List
<
String
>
KKsCodes
=
characterParamInfoVos
.
stream
()
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
.
map
(
CharacterParamInfoVo:
:
getKksCode
).
collect
(
Collectors
.
toList
());
String
start
=
"1
30h
-ago"
;
String
start
=
"1
s
-ago"
;
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
Map
<
Long
,
Map
<
String
,
Number
>>
response
=
iCharacterParamService
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
.
getRealTimeDataByKksCode
(
KKsCodes
,
start
,
""
);
...
...
power-bussiness/src/main/java/cn/wise/sc/energy/power/plant/business/utils/Utils.java
View file @
5077fd40
...
@@ -10,11 +10,15 @@ import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryExt;
...
@@ -10,11 +10,15 @@ import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryExt;
import
cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryRequestExt
;
import
cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryRequestExt
;
import
cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum
;
import
cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
net.opentsdb.client.api.query.request.QueryLastRequest
;
import
net.opentsdb.client.api.query.response.QueryLastResponse
;
import
net.opentsdb.client.api.query.response.QueryResponse
;
import
net.opentsdb.client.api.query.response.QueryResponse
;
import
net.opentsdb.client.bean.Aggregator
;
import
net.opentsdb.client.bean.Aggregator
;
import
net.opentsdb.client.bean.LastDataPointQuery
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -68,6 +72,7 @@ public class Utils {
...
@@ -68,6 +72,7 @@ public class Utils {
// }
// }
public
static
void
main
(
String
[]
args
)
throws
IOException
,
URISyntaxException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
,
URISyntaxException
{
QueryResponse
queryResponse
=
OpentsdbOkHttpClient
.
query
(
QueryRequestExt
.
builder
()
QueryResponse
queryResponse
=
OpentsdbOkHttpClient
.
query
(
QueryRequestExt
.
builder
()
.
start
(
"480h-ago"
)
.
start
(
"480h-ago"
)
.
build
()
.
build
()
...
@@ -77,6 +82,17 @@ public class Utils {
...
@@ -77,6 +82,17 @@ public class Utils {
.
metric
(
"C0A00101CFA01CBA00R002"
)
.
metric
(
"C0A00101CFA01CBA00R002"
)
.
build
()
.
build
()
));
));
QueryLastRequest
queryLastRequest
=
new
QueryLastRequest
();
LastDataPointQuery
lastDataPointQuery
=
new
LastDataPointQuery
();
lastDataPointQuery
.
setMetric
(
"C0A00101CFA01CBA00R002"
);
List
<
LastDataPointQuery
>
list
=
new
ArrayList
<>();
list
.
add
(
lastDataPointQuery
);
queryLastRequest
.
setQueries
(
list
);
QueryLastResponse
queryLastResponse
=
OpentsdbOkHttpClient
.
queryLast
(
queryLastRequest
);
System
.
out
.
println
(
JSON
.
toJSONString
(
queryLastRequest
));
System
.
out
.
println
(
""
);
}
}
}
}
power-bussiness/src/main/resources/application.yml
View file @
5077fd40
...
@@ -51,11 +51,10 @@ spring:
...
@@ -51,11 +51,10 @@ spring:
quorum
:
172.17.104.0:2181
quorum
:
172.17.104.0:2181
rootDir
:
hdfs://172.17.104.0:9000/hbase
rootDir
:
hdfs://172.17.104.0:9000/hbase
nodeParent
:
/hbase-unsecure
nodeParent
:
/hbase-unsecure
redisson
:
redisson
:
master-name
:
mymaster
master-name
:
mymaster
address
:
redis://127.0.0.1:637
8
address
:
redis://127.0.0.1:637
9
password
:
Risen12348765
#
password: Risen12348765
subscriptionConnectionMinimumIdleSize
:
1
subscriptionConnectionMinimumIdleSize
:
1
dnsMonitoring
:
false
dnsMonitoring
:
false
failedAttempts
:
2
failedAttempts
:
2
...
...
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