Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
c303ac6d
Commit
c303ac6d
authored
Aug 30, 2024
by
张帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kgd添加接口服务更新
parent
3b09a3e3
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
745 additions
and
55 deletions
+745
-55
pom.xml
...ule/amos-boot-module-api/amos-boot-module-kgd-api/pom.xml
+8
-1
ClientHandler.java
.../main/java/com/yeejoin/amos/kgd/config/ClientHandler.java
+45
-35
ConfigName.java
...src/main/java/com/yeejoin/amos/kgd/config/ConfigName.java
+28
-0
AnalysisResultMapper.java
...ava/com/yeejoin/amos/kgd/mapper/AnalysisResultMapper.java
+53
-0
AnalysisResult.java
.../main/java/com/yeejoin/amos/kgd/model/AnalysisResult.java
+38
-0
AnalysisResultService.java
...a/com/yeejoin/amos/kgd/service/AnalysisResultService.java
+12
-0
AnalysisResultServiceImpl.java
...join/amos/kgd/service/impl/AnalysisResultServiceImpl.java
+299
-0
AnalysisResultMapper.xml
...gd-api/src/main/resources/mapper/AnalysisResultMapper.xml
+103
-0
pom.xml
...e/amos-boot-module-biz/amos-boot-module-equip-biz/pom.xml
+1
-1
pom.xml
...ule/amos-boot-module-biz/amos-boot-module-fas-biz/pom.xml
+7
-1
RemoteSecurityService.java
...eejoin/amos/fas/business/feign/RemoteSecurityService.java
+1
-1
pom.xml
...ule/amos-boot-module-biz/amos-boot-module-jcs-biz/pom.xml
+2
-1
AnalysisResultController.java
...yeejoin/amos/kgd/controller/AnalysisResultController.java
+123
-0
RuleDangerService.java
...latentdanger/business/service/impl/RuleDangerService.java
+1
-1
AsyncTask.java
...a/com/yeejoin/amos/latentdanger/core/async/AsyncTask.java
+1
-1
RemoteSecurityService.java
...eejoin/amos/latentdanger/feign/RemoteSecurityService.java
+1
-1
RemoteSecurityService.java
...yeejoin/amos/maintenance/feign/RemoteSecurityService.java
+1
-1
RemoteSecurityService.java
.../com/yeejoin/amos/patrol/feign/RemoteSecurityService.java
+1
-1
RulePlanService.java
...os/supervision/business/service/impl/RulePlanService.java
+1
-1
RemoteSecurityService.java
...yeejoin/amos/supervision/feign/RemoteSecurityService.java
+1
-1
AlertCalledServiceImpl.java
...t/module/tzs/biz/service/impl/AlertCalledServiceImpl.java
+1
-1
AmoKGDApplication.java
...kgd/src/main/java/com/yeejoin/amos/AmoKGDApplication.java
+2
-2
application-dev.properties
...-system-kgd/src/main/resources/application-dev.properties
+11
-2
application.properties
...boot-system-kgd/src/main/resources/application.properties
+1
-1
pom.xml
pom.xml
+3
-2
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/pom.xml
View file @
c303ac6d
...
@@ -48,7 +48,14 @@
...
@@ -48,7 +48,14 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-security
</artifactId>
<version>
${amos.version}
</version>
</dependency>
<!-- j2cache 二级缓存 -->
<!-- j2cache 二级缓存 -->
<dependency>
<dependency>
<groupId>
net.oschina.j2cache
</groupId>
<groupId>
net.oschina.j2cache
</groupId>
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/java/com/yeejoin/amos/kgd/config/ClientHandler.java
View file @
c303ac6d
...
@@ -42,6 +42,8 @@ public class ClientHandler<path> implements Runnable {
...
@@ -42,6 +42,8 @@ public class ClientHandler<path> implements Runnable {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
try
{
try
{
// 获取输入流和输出流
// 获取输入流和输出流
InputStream
ips
=
socket
.
getInputStream
();
InputStream
ips
=
socket
.
getInputStream
();
// ips中,不是单纯的文件流,还有一些其他字段,所以要将单纯文件的部分过滤出来
// ips中,不是单纯的文件流,还有一些其他字段,所以要将单纯文件的部分过滤出来
...
@@ -64,18 +66,26 @@ public class ClientHandler<path> implements Runnable {
...
@@ -64,18 +66,26 @@ public class ClientHandler<path> implements Runnable {
private
String
upload2Maas
(
InputStream
inputStream
,
String
hostAndPort
,
String
filename
)
throws
IOException
{
private
String
upload2Maas
(
InputStream
inputStream
,
String
hostAndPort
,
String
filename
)
throws
IOException
{
Properties
properties
=
new
Properties
();
FileInputStream
input
=
new
FileInputStream
(
"amos-boot-system-kgd\\src\\main\\resources\\application-dev.properties"
);
properties
.
load
(
input
);
String
keyValue
=
properties
.
getProperty
(
"keyValue"
);
System
.
out
.
println
(
keyValue
);
AmosRequestContext
robotAuthentication
=
SpringContextHelper
.
getBean
(
AmosRequestContext
.
class
);
AmosRequestContext
robotAuthentication
=
SpringContextHelper
.
getBean
(
AmosRequestContext
.
class
);
if
(
Objects
.
nonNull
(
robotAuthentication
))
{
if
(
Objects
.
nonNull
(
robotAuthentication
))
{
//
String token = robotAuthentication.getToken();
String
token
=
robotAuthentication
.
getToken
();
//
String product = robotAuthentication.getProduct();
String
product
=
robotAuthentication
.
getProduct
();
//
String appKey = robotAuthentication.getAppKey();
String
appKey
=
robotAuthentication
.
getAppKey
();
String
token
=
"1121d8d2-915f-453e-8e20-1558566cefbb
"
;
// 如果token、失效,就去浏览器复制最新的token、
/* String token = "ae8d0003-128c-424f-9730-dc9923c395b1
"; // 如果token、失效,就去浏览器复制最新的token、
String product = "AMOS_STUDIO_WEB";
String product = "AMOS_STUDIO_WEB";
String
appKey
=
"AMOS_STUDIO"
;
String appKey = "AMOS_STUDIO";*/
//1, 上传到maas
//1, 上传到maas
String
uploadUrl
=
"http://"
+
hostAndPort
+
"/maas/
dsm
/excel/upload"
;
String
uploadUrl
=
"http://"
+
hostAndPort
+
"/maas/
maas/desktop
/excel/upload"
;
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
Resource
resource
=
new
InputStreamResource
(
inputStream
)
{
Resource
resource
=
new
InputStreamResource
(
inputStream
)
{
@Override
@Override
...
@@ -95,7 +105,8 @@ public class ClientHandler<path> implements Runnable {
...
@@ -95,7 +105,8 @@ public class ClientHandler<path> implements Runnable {
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
uploadUrl
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
uploadUrl
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
String
body
=
responseEntity
.
getBody
();
String
body
=
responseEntity
.
getBody
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
String
result
=
jsonObject
.
getString
(
"result"
);
// String result = jsonObject.getString("result");
String
result
=
jsonObject
.
getJSONObject
(
"result"
).
getString
(
"key"
);
String
path
=
jsonObject
.
getString
(
"path"
);
String
path
=
jsonObject
.
getString
(
"path"
);
if
(
jsonObject
.
getString
(
"status"
).
equals
(
"200"
))
{
if
(
jsonObject
.
getString
(
"status"
).
equals
(
"200"
))
{
log
.
info
(
"路径:"
+
path
+
"/"
+
result
);
log
.
info
(
"路径:"
+
path
+
"/"
+
result
);
...
@@ -108,7 +119,7 @@ public class ClientHandler<path> implements Runnable {
...
@@ -108,7 +119,7 @@ public class ClientHandler<path> implements Runnable {
Map
<
String
,
String
>
params2
=
new
HashMap
<>();
Map
<
String
,
String
>
params2
=
new
HashMap
<>();
params2
.
put
(
"connType"
,
"excel"
);
params2
.
put
(
"connType"
,
"excel"
);
params2
.
put
(
"detail"
,
"{\"location\":{\"type\":\"excel\",\"path\":\""
+
result
+
"\"}}"
);
params2
.
put
(
"detail"
,
"{\"location\":{\"type\":\"excel\",\"path\":\""
+
result
+
"\"}}"
);
params2
.
put
(
"subjectid"
,
"534de50c-bb8c-4450-87a0-557aac745a94"
);
params2
.
put
(
"subjectid"
,
keyValue
);
HttpEntity
<
Map
<
String
,
String
>>
requestEntity2
=
new
HttpEntity
<>(
params2
,
getHeader
(
token
,
product
,
appKey
,
hostAndPort
,
false
));
HttpEntity
<
Map
<
String
,
String
>>
requestEntity2
=
new
HttpEntity
<>(
params2
,
getHeader
(
token
,
product
,
appKey
,
hostAndPort
,
false
));
ResponseEntity
<
String
>
response2
=
restTemplate
.
exchange
(
connsUrl
,
HttpMethod
.
POST
,
requestEntity2
,
String
.
class
);
ResponseEntity
<
String
>
response2
=
restTemplate
.
exchange
(
connsUrl
,
HttpMethod
.
POST
,
requestEntity2
,
String
.
class
);
String
body2
=
response2
.
getBody
();
String
body2
=
response2
.
getBody
();
...
@@ -142,7 +153,7 @@ public class ClientHandler<path> implements Runnable {
...
@@ -142,7 +153,7 @@ public class ClientHandler<path> implements Runnable {
String
tablesUrl
=
"http://"
+
hostAndPort
+
"/maas/maas/desktop/tables"
;
String
tablesUrl
=
"http://"
+
hostAndPort
+
"/maas/maas/desktop/tables"
;
Map
<
String
,
String
>
params3
=
new
HashMap
<>();
Map
<
String
,
String
>
params3
=
new
HashMap
<>();
params3
.
put
(
"name"
,
filename
);
params3
.
put
(
"name"
,
filename
);
params3
.
put
(
"pid"
,
"534de50c-bb8c-4450-87a0-557aac745a94"
);
params3
.
put
(
"pid"
,
keyValue
);
params3
.
put
(
"connId"
,
connId
);
params3
.
put
(
"connId"
,
connId
);
// params3.add("config", sheetArray.get(0).toString());
// params3.add("config", sheetArray.get(0).toString());
params3
.
put
(
"config"
,
"{\"columnNameLineNumber\":1,\"skipEmptyLines\":true,\"skipEmptyColumns\":false,\"columnFormatter\":{\"zztest\":{\"name\":\"zztest\",\"alias\":\"zztest\",\"type\":\"VARCHAR\"},\"zz\":{\"name\":\"zz\",\"alias\":\"zz\",\"type\":\"VARCHAR\"}},\"sheet\":\"Sheet1\"}"
);
params3
.
put
(
"config"
,
"{\"columnNameLineNumber\":1,\"skipEmptyLines\":true,\"skipEmptyColumns\":false,\"columnFormatter\":{\"zztest\":{\"name\":\"zztest\",\"alias\":\"zztest\",\"type\":\"VARCHAR\"},\"zz\":{\"name\":\"zz\",\"alias\":\"zz\",\"type\":\"VARCHAR\"}},\"sheet\":\"Sheet1\"}"
);
...
@@ -153,32 +164,31 @@ public class ClientHandler<path> implements Runnable {
...
@@ -153,32 +164,31 @@ public class ClientHandler<path> implements Runnable {
String
result2
=
jsonObject3
.
getString
(
"result"
);
String
result2
=
jsonObject3
.
getString
(
"result"
);
String
path2
=
jsonObject3
.
getString
(
"path"
);
String
path2
=
jsonObject3
.
getString
(
"path"
);
//datasource(name:excel+时间戳)
// //datasource(name:excel+时间戳)
// 获取当前时间的时间戳
// // 获取当前时间的时间戳
long
timestamp
=
System
.
currentTimeMillis
();
// long timestamp = System.currentTimeMillis();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String
timestampStr
=
sdf
.
format
(
new
Date
(
timestamp
));
// String timestampStr = sdf.format(new Date(timestamp));
String
datasourceUrl
=
"http://"
+
hostAndPort
+
"/maas/dsm/datasources"
;
// String datasourceUrl = "http://" + hostAndPort + "/maas/dsm/datasources";
JSONObject
all
=
new
JSONObject
();
// JSONObject all = new JSONObject();
JSONObject
oneJson
=
new
JSONObject
();
// JSONObject oneJson = new JSONObject();
all
.
put
(
"filepath"
,
result
);
// all.put("filepath",result);
for
(
int
i
=
0
;
i
<
sheetArray
.
size
();
i
++)
{
// for (int i = 0; i < sheetArray.size(); i++) {
oneJson
.
put
(
sheets
[
i
],
sheetArray
.
get
(
i
));
// oneJson.put(sheets[i],sheetArray.get(i));
}
// }
all
.
put
(
"config"
,
oneJson
);
// all.put("config",oneJson);
Map
<
String
,
String
>
datasourceParams
=
new
HashMap
<>();
// Map<String, String> datasourceParams = new HashMap<>();
datasourceParams
.
put
(
"detail"
,
all
.
toString
());
// datasourceParams.put("detail", all.toString());
datasourceParams
.
put
(
"groupid"
,
"72684d79-5d28-4086-9f21-5b091b6675db"
);
// datasourceParams.put("groupid", "72684d79-5d28-4086-9f21-5b091b6675db");
datasourceParams
.
put
(
"subtype"
,
"excel"
);
// datasourceParams.put("subtype", "excel");
datasourceParams
.
put
(
"name"
,
"excel"
+
timestampStr
);
// datasourceParams.put("name", "excel"+timestampStr);
datasourceParams
.
put
(
"type"
,
"File"
);
// datasourceParams.put("type", "File");
HttpEntity
<
Map
<
String
,
String
>>
datasourceRequestEntity
=
new
HttpEntity
<>(
datasourceParams
,
getHeader
(
token
,
product
,
appKey
,
hostAndPort
,
false
));
// HttpEntity<Map<String, String>> datasourceRequestEntity = new HttpEntity<>(datasourceParams, getHeader(token,product,appKey,hostAndPort,false));
ResponseEntity
<
String
>
datasourceResponseEntity
=
restTemplate
.
exchange
(
datasourceUrl
,
HttpMethod
.
POST
,
datasourceRequestEntity
,
String
.
class
);
// ResponseEntity<String> datasourceResponseEntity = restTemplate.exchange(datasourceUrl, HttpMethod.POST, datasourceRequestEntity, String.class);
String
datasourceResponseEntityBody
=
datasourceResponseEntity
.
getBody
();
// String datasourceResponseEntityBody = datasourceResponseEntity.getBody();
log
.
info
(
"datasourceResponseEntityBody:"
+
datasourceResponseEntityBody
);
// log.info("datasourceResponseEntityBody:" + datasourceResponseEntityBody);
return
path
+
"/"
+
result
;
// return path + "/" + result;
}
}
return
null
;
return
null
;
}
}
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/java/com/yeejoin/amos/kgd/config/ConfigName.java
0 → 100644
View file @
c303ac6d
package
com
.
yeejoin
.
amos
.
kgd
.
config
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Properties
;
public
class
ConfigName
{
private
Properties
properties
=
new
Properties
();
public
ConfigName
(
String
path
)
{
try
{
InputStream
inputStream
=
new
FileInputStream
(
path
);
}
catch
(
IOException
e
){
e
.
printStackTrace
();
}
}
public
String
getProperty
(
String
key
)
{
return
properties
.
getProperty
(
key
);
}
public
static
void
main
(
String
[]
args
)
{
String
path
=
"D:\\KGD_7.31\\amos-boot-biz\\amos-boot-system-kgd\\src\\main\\resources\\application-dev.properties"
;
ConfigName
configName
=
new
ConfigName
(
path
);
String
data
=
configName
.
getProperty
(
"kgd.data.keyValue"
);
System
.
out
.
println
(
data
);
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/java/com/yeejoin/amos/kgd/mapper/AnalysisResultMapper.java
0 → 100644
View file @
c303ac6d
package
com
.
yeejoin
.
amos
.
kgd
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.kgd.model.AnalysisResult
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author Lizhou
* @description 针对表【analysis_result】的数据库操作Mapper
* @createDate 2024-07-31 17:07:12
* @Entity com.atguigu.pojo.AnalysisResult
*/
public
interface
AnalysisResultMapper
extends
BaseMapper
<
AnalysisResult
>
{
Integer
queryHighFrequencyNumber
(
@Param
(
"deviceId"
)
String
deviceId
);
List
<
AnalysisResult
>
queryHighFrequencyData
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"highFrequencyNumber"
)
Integer
highFrequencyNumber
);
List
<
AnalysisResult
>
queryHighFrequencyAnalysisData
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"highFrequencyNumber"
)
Integer
highFrequencyNumber
);
List
<
String
>
queryVarName
(
@Param
(
"deviceId"
)
String
deviceId
);
AnalysisResult
queryAnalysisData
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"varName"
)
String
varName
);
AnalysisResult
queryAnalysisResultRate
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"varName"
)
String
varName
);
List
<
AnalysisResult
>
querySwitchDataByDeviceId
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"switchNumber"
)
Integer
switchNumber
);
Integer
querySwitchTypeNumber
(
@Param
(
"deviceId"
)
String
deviceId
);
List
<
AnalysisResult
>
queryPredictionResult
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"varName"
)
String
varName
,
@Param
(
"predictiveNumber"
)
Integer
predictiveNumber
);
Integer
queryTemperatureTypeNumber
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"varName"
)
String
varName
);
List
<
AnalysisResult
>
queryTemperature
(
@Param
(
"deviceId"
)
String
deviceId
,
@Param
(
"temperatureNumber"
)
Integer
temperatureNumber
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/java/com/yeejoin/amos/kgd/model/AnalysisResult.java
0 → 100644
View file @
c303ac6d
package
com
.
yeejoin
.
amos
.
kgd
.
model
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @TableName analysis_result
*/
@TableName
(
value
=
"analysis_result"
)
@Data
public
class
AnalysisResult
implements
Serializable
{
private
Integer
id
;
private
String
samplingtime
;
private
String
deviceId
;
private
String
varType
;
private
String
varName
;
private
String
data
;
private
String
analysisData
;
private
String
analysisResult
;
private
String
analysisResultRate
;
private
String
predictResult
;
private
String
groupName
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/java/com/yeejoin/amos/kgd/service/AnalysisResultService.java
0 → 100644
View file @
c303ac6d
package
com
.
yeejoin
.
amos
.
kgd
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.kgd.model.AnalysisResult
;
/**
* @author Lizhou
* @description 针对表【analysis_result】的数据库操作Service
* @createDate 2024-07-31 17:07:12
*/
public
interface
AnalysisResultService
extends
IService
<
AnalysisResult
>
{
}
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/java/com/yeejoin/amos/kgd/service/impl/AnalysisResultServiceImpl.java
0 → 100644
View file @
c303ac6d
package
com
.
yeejoin
.
amos
.
kgd
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yeejoin.amos.kgd.mapper.AnalysisResultMapper
;
import
com.yeejoin.amos.kgd.model.AnalysisResult
;
import
com.yeejoin.amos.kgd.service.AnalysisResultService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
@Service
public
class
AnalysisResultServiceImpl
extends
ServiceImpl
<
AnalysisResultMapper
,
AnalysisResult
>
{
@Autowired
AnalysisResultMapper
analysisResultMapper
;
// 根据 deviceId ,根据设备ID查询数据,幅值与时间
public
JSONObject
getDataByDeviceId
(
String
deviceId
)
{
int
highFrequencyNumber
=
analysisResultMapper
.
queryHighFrequencyNumber
(
deviceId
);
List
<
AnalysisResult
>
analysisResultList
=
analysisResultMapper
.
queryHighFrequencyData
(
deviceId
,
highFrequencyNumber
);
if
(
analysisResultList
==
null
||
analysisResultList
.
isEmpty
())
{
return
null
;
}
JSONObject
result
=
new
JSONObject
();
JSONArray
jsonArray
=
new
JSONArray
();
for
(
AnalysisResult
analysisResult
:
analysisResultList
)
{
String
originData
=
analysisResult
.
getData
();
JSONObject
jsonData
=
JSONObject
.
parseObject
(
originData
);
JSONArray
seriesData
=
jsonData
.
getJSONArray
(
"幅值(m/s2)"
);
if
(
seriesData
==
null
)
{
seriesData
=
jsonData
.
getJSONArray
(
"幅值(A)"
);
jsonData
.
remove
(
"幅值(A)"
);
}
else
{
jsonData
.
remove
(
"幅值(m/s2)"
);
}
JSONArray
axisData
=
jsonData
.
getJSONArray
(
"时间(s)"
);
// 遍历axisData,将每个元素转换为int并重新设置
for
(
int
i
=
0
;
i
<
axisData
.
size
();
i
++)
{
int
value
=
axisData
.
getIntValue
(
i
);
// 获取并转换为int
axisData
.
set
(
i
,
value
);
// 重新设置为int类型的值
}
jsonData
.
remove
(
"时间(s)"
);
jsonData
.
put
(
"seriesData"
,
seriesData
);
jsonData
.
put
(
"axisData"
,
axisData
);
jsonData
.
put
(
"num"
,
analysisResult
.
getVarName
());
jsonArray
.
add
(
jsonData
);
}
result
.
put
(
"records"
,
jsonArray
);
System
.
out
.
println
(
"result:"
+
result
.
toString
());
return
result
;
}
// 根据 deviceId 查询 AnalysisData幅值与频率,返回 JSON 格式数据
public
JSONObject
getAnalysisDataByDeviceId
(
String
deviceId
)
{
int
highFrequencyNumber
=
analysisResultMapper
.
queryHighFrequencyNumber
(
deviceId
);
List
<
AnalysisResult
>
analysisResultList
=
analysisResultMapper
.
queryHighFrequencyAnalysisData
(
deviceId
,
highFrequencyNumber
);
if
(
analysisResultList
==
null
||
analysisResultList
.
isEmpty
()){
return
null
;
}
JSONObject
result
=
new
JSONObject
();
JSONArray
jsonArray
=
new
JSONArray
();
for
(
AnalysisResult
analysisResult
:
analysisResultList
)
{
JSONObject
jsonAnalysisData
=
JSONObject
.
parseObject
(
analysisResult
.
getAnalysisData
());
jsonAnalysisData
.
put
(
"seriesData"
,
jsonAnalysisData
.
getJSONArray
(
"幅值(dB)"
));
jsonAnalysisData
.
put
(
"axisData"
,
jsonAnalysisData
.
getJSONArray
(
"频率(Hz)"
));
jsonAnalysisData
.
remove
(
"幅值(dB)"
);
jsonAnalysisData
.
remove
(
"频率(Hz)"
);
jsonAnalysisData
.
put
(
"num"
,
analysisResult
.
getVarName
());
jsonArray
.
add
(
jsonAnalysisData
);
}
result
.
put
(
"records"
,
jsonArray
);
return
result
;
}
public
JSONArray
getVarNameByDeviceId
(
String
deviceId
){
List
<
String
>
varNameList
=
analysisResultMapper
.
queryVarName
(
deviceId
);
if
(
varNameList
==
null
||
varNameList
.
isEmpty
()){
return
null
;
}
JSONArray
jsonArray
=
new
JSONArray
();
for
(
int
i
=
0
;
i
<
varNameList
.
size
();
i
++){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"text"
,
varNameList
.
get
(
i
));
jsonObject
.
put
(
"value"
,
varNameList
.
get
(
i
));
jsonArray
.
add
(
jsonObject
);
}
return
jsonArray
;
}
public
JSONObject
getAnalysisDataByDeviceIdAndVarName
(
String
deviceId
,
String
varName
)
{
AnalysisResult
analysisResult
=
analysisResultMapper
.
queryAnalysisData
(
deviceId
,
varName
);
if
(
analysisResult
==
null
)
{
return
null
;
}
String
data
=
analysisResult
.
getData
();
JSONObject
jsonData
=
JSONObject
.
parseObject
(
data
);
JSONArray
seriesData
=
jsonData
.
getJSONArray
(
"幅值(m/s2)"
);
if
(
seriesData
==
null
)
{
seriesData
=
jsonData
.
getJSONArray
(
"幅值(A)"
);
jsonData
.
remove
(
"幅值(A)"
);
}
else
{
jsonData
.
remove
(
"幅值(m/s2)"
);
}
JSONArray
axisData
=
jsonData
.
getJSONArray
(
"时间(s)"
);
jsonData
.
remove
(
"时间(s)"
);
jsonData
.
put
(
"seriesData"
,
seriesData
);
jsonData
.
put
(
"axisData"
,
axisData
);
// jsonData.put("legend", axisData.size());
return
jsonData
;
}
public
JSONObject
getFaultRateByDeviceIdAndStatus
(
String
deviceId
,
String
varName
)
{
AnalysisResult
analysisResult
=
analysisResultMapper
.
queryAnalysisResultRate
(
deviceId
,
varName
);
if
(
analysisResult
.
getAnalysisResultRate
()
==
null
)
{
return
null
;
}
String
analysisResultRate
=
analysisResult
.
getAnalysisResultRate
();
JSONObject
jsonAnalysisResultRate
=
JSONObject
.
parseObject
(
analysisResultRate
);
// {"正常":0.97,"内圈2":0.01,"滚动体2":0.01,"外圈2":0.0}
// 转换成{"seriesDate":[0.97,0.01,0.01,0.0],"axisData":["正常","内圈2","滚动体2","外圈2"]}
JSONArray
seriesData
=
new
JSONArray
();
JSONArray
axisData
=
new
JSONArray
();
for
(
String
key
:
jsonAnalysisResultRate
.
keySet
())
{
axisData
.
add
(
key
);
seriesData
.
add
(
jsonAnalysisResultRate
.
get
(
key
));
}
JSONObject
jsonData
=
new
JSONObject
();
jsonData
.
put
(
"seriesData"
,
seriesData
);
jsonData
.
put
(
"axisData"
,
axisData
);
return
jsonData
;
}
public
JSONArray
getFaultTypeProportionByDeviceIdAndStatus
(
String
deviceId
,
String
varName
){
AnalysisResult
analysisResult
=
analysisResultMapper
.
queryAnalysisResultRate
(
deviceId
,
varName
);
if
(
analysisResult
.
getAnalysisResultRate
()
==
null
){
return
null
;
}
String
analysisResultRate
=
analysisResult
.
getAnalysisResultRate
();
JSONObject
jsonAnalysisResultRate
=
JSONObject
.
parseObject
(
analysisResultRate
);
// {"正常":0.97,"内圈2":0.01,"滚动体2":0.01,"外圈2":0.0}
// 转换成[{"name":"正常","value":0.97},{"name":"内圈2","value":0.01},{"name":"滚动体2","value":0.01},{"name":"外圈2","value":0.0}]
JSONArray
jsonArray
=
new
JSONArray
();
for
(
String
key
:
jsonAnalysisResultRate
.
keySet
())
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"name"
,
key
);
jsonObject
.
put
(
"value"
,
jsonAnalysisResultRate
.
get
(
key
));
jsonArray
.
add
(
jsonObject
);
}
return
jsonArray
;
}
public
JSONObject
getSwitchDataByDeviceId
(
String
deviceId
,
Integer
switchNumber
){
int
switchTypeNumber
=
analysisResultMapper
.
querySwitchTypeNumber
(
deviceId
);
List
<
AnalysisResult
>
analysisResultList
=
analysisResultMapper
.
querySwitchDataByDeviceId
(
deviceId
,
switchNumber
*
switchTypeNumber
);
if
(
analysisResultList
==
null
||
analysisResultList
.
isEmpty
())
{
return
null
;
}
Map
<
String
,
List
<
Integer
>>
map
=
new
HashMap
<>();
for
(
AnalysisResult
analysisResult:
analysisResultList
){
map
.
computeIfAbsent
(
analysisResult
.
getVarName
(),
k
->
new
ArrayList
<>()).
add
(
Integer
.
parseInt
(
analysisResult
.
getData
())
);
}
// 查询出来采样点的个数:
int
n
=
analysisResultList
.
size
()
/
switchTypeNumber
;
List
<
String
>
axisData
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
n
;
i
++){
AnalysisResult
analysisResult
=
analysisResultList
.
get
(
i
);
// long samplingTime = Long.parseLong(analysisResult.getSamplingtime());
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String time = sdf.format(new Date(Long.parseLong(String.valueOf(samplingTime)))); // 时间戳转换成时间
// axisData.add(time);
axisData
.
add
(
analysisResult
.
getSamplingtime
());
}
JSONObject
jsonObject
=
new
JSONObject
();
JSONArray
jsonArray
=
new
JSONArray
();
for
(
String
key:
map
.
keySet
()){
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"name"
,
key
);
json
.
put
(
"data"
,
map
.
get
(
key
));
jsonArray
.
add
(
json
);
}
jsonObject
.
put
(
"seriesData"
,
jsonArray
);
jsonObject
.
put
(
"axisData"
,
axisData
);
return
jsonObject
;
}
public
JSONObject
getPredictionResultByDeviceId
(
String
deviceId
,
String
varName
,
Integer
predictiveNumber
){
List
<
AnalysisResult
>
analysisResultList
=
analysisResultMapper
.
queryPredictionResult
(
deviceId
,
varName
,
predictiveNumber
);
if
(
analysisResultList
==
null
||
analysisResultList
.
isEmpty
())
{
return
null
;
}
JSONArray
seriesData
=
new
JSONArray
();
JSONArray
axisData
=
new
JSONArray
();
JSONObject
jsonPrediction
=
new
JSONObject
();
for
(
AnalysisResult
analysisResult
:
analysisResultList
)
{
String
predictResult
=
analysisResult
.
getPredictResult
();
seriesData
.
add
(
predictResult
);
// 時間錯轉換
// long samplingTime = Long.parseLong(analysisResult.getSamplingtime());
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String time = sdf.format(new Date(Long.parseLong(String.valueOf(samplingTime)))); // 时间戳转换成时间
// axisData.add(time);
axisData
.
add
(
analysisResult
.
getSamplingtime
());
}
jsonPrediction
.
put
(
"seriesData"
,
seriesData
);
jsonPrediction
.
put
(
"axisData"
,
axisData
);
return
jsonPrediction
;
}
// public JSONArray getTemperatureByDeviceId(String deviceId) {
// int temperatureNumber = analysisResultMapper.queryTemperatureNumber(deviceId);
// List<AnalysisResult> analysisResultList = analysisResultMapper.queryTemperatureData(deviceId, temperatureNumber);
// if (analysisResultList == null || analysisResultList.isEmpty()) {
// return null;
// }
// JSONObject result = new JSONObject();
// JSONArray jsonArray = new JSONArray();
// for (AnalysisResult analysisResult : analysisResultList) {
// String originData = analysisResult.getData();
// JSONObject jsonData = JSONObject.parseObject(originData);
// JSONArray seriesData = jsonData.getJSONArray("幅值(m/s2)");
// if(seriesData == null) {
// seriesData = jsonData.getJSONArray("幅值(A)");
// jsonData.remove("幅值(A)");
// }else{
// jsonData.remove("幅值(m/s2)");
// }
// JSONArray axisData = jsonData.getJSONArray("时间(s)");
// jsonData.remove("时间(s)");
// jsonData.put("seriesData", seriesData);
// jsonData.put("axisData", axisData);
// jsonData.put("num", analysisResult.getVarName());
// jsonArray.add(jsonData);
// }
// result.put("records", jsonArray);
// return result;
//
// }
public
JSONObject
getTemperatureByDeviceId
(
String
deviceId
){
int
temperatureTypeNumber
=
analysisResultMapper
.
queryTemperatureTypeNumber
(
deviceId
,
"低频"
);
List
<
AnalysisResult
>
analysisResultList
=
analysisResultMapper
.
queryTemperature
(
deviceId
,
temperatureTypeNumber
);
if
(
analysisResultList
==
null
||
analysisResultList
.
isEmpty
())
{
return
null
;
}
JSONObject
result
=
new
JSONObject
();
JSONArray
jsonArray
=
new
JSONArray
();
/* boolean toggle = true;
for(AnalysisResult analysisResult: analysisResultList){
String data = analysisResult.getData();
JSONObject jsonData = JSONObject.parseObject(data);
if (toggle){
jsonData.put("value", jsonData.get("幅值(℃)"));
jsonData.remove("幅值(℃)");
jsonData.put("name", analysisResult.getVarName());
}else {
jsonData.put("value1",jsonData.get("幅值(℃)"));
jsonData.remove("幅值(℃)");
jsonData.put("name1", analysisResult.getVarName());
}
jsonArray.add(jsonData);
toggle=!toggle;
}*/
for
(
int
i
=
0
;
i
<
analysisResultList
.
size
();
i
++)
{
AnalysisResult
analysisResult
=
analysisResultList
.
get
(
i
);
String
data
=
analysisResult
.
getData
();
JSONObject
jsonData
=
JSONObject
.
parseObject
(
data
);
if
(
i
%
2
==
0
){
result
.
put
(
"value"
,
jsonData
.
get
(
"幅值(℃)"
));
result
.
put
(
"name"
,
analysisResult
.
getVarName
());
}
else
{
result
.
put
(
"value1"
,
jsonData
.
get
(
"幅值(℃)"
));
result
.
put
(
"name1"
,
analysisResult
.
getVarName
());
jsonArray
.
add
(
result
);
result
=
new
JSONObject
();
}
}
result
.
put
(
"records"
,
jsonArray
);
return
result
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/resources/mapper/AnalysisResultMapper.xml
0 → 100644
View file @
c303ac6d
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.kgd.mapper.AnalysisResultMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yeejoin.amos.kgd.mapper.AnalysisResultMapper"
>
<id
property=
"id"
column=
"ID"
jdbcType=
"INTEGER"
/>
<result
property=
"samplingtime"
column=
"SamplingTime"
jdbcType=
"VARCHAR"
/>
<result
property=
"deviceId"
column=
"DEVICE_ID"
jdbcType=
"VARCHAR"
/>
<result
property=
"varType"
column=
"VAR_TYPE"
jdbcType=
"VARCHAR"
/>
<result
property=
"varName"
column=
"VAR_NAME"
jdbcType=
"VARCHAR"
/>
<result
property=
"data"
column=
"DATA"
jdbcType=
"VARCHAR"
/>
<result
property=
"analysisData"
column=
"ANALYSIS_DATA"
jdbcType=
"VARCHAR"
/>
<result
property=
"analysisResult"
column=
"ANALYSIS_RESULT"
jdbcType=
"VARCHAR"
/>
<result
property=
"analysisResultRate"
column=
"ANALYSIS_RESULT_RATE"
jdbcType=
"VARCHAR"
/>
<result
property=
"predictResult"
column=
"PREDICT_RESULT"
jdbcType=
"VARCHAR"
/>
<result
property=
"groupName"
column=
"GROUP_NAME"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
ID,SamplingTime,DEVICE_ID,
VAR_TYPE,VAR_NAME,DATA,
ANALYSIS_DATA,ANALYSIS_RESULT,ANALYSIS_RESULT_RATE,
PREDICT_RESULT,GROUP_NAME
</sql>
<select
id=
"queryHighFrequencyNumber"
resultType=
"java.lang.Integer"
>
select COUNT(DISTINCT VAR_NAME)
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频'
</select>
<select
id=
"queryHighFrequencyData"
resultType=
"com.yeejoin.amos.kgd.model.AnalysisResult"
>
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频'
order by SamplingTime desc
limit #{highFrequencyNumber}
</select>
<select
id=
"queryHighFrequencyAnalysisData"
resultType=
"com.yeejoin.amos.kgd.model.AnalysisResult"
>
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频'
order by SamplingTime desc
limit #{highFrequencyNumber}
</select>
<select
id=
"queryAnalysisResultRate"
resultType=
"com.yeejoin.amos.kgd.model.AnalysisResult"
>
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' and VAR_NAME=#{varName}
order by SamplingTime desc
limit 1
</select>
<select
id=
"querySwitchDataByDeviceId"
resultType=
"com.yeejoin.amos.kgd.model.AnalysisResult"
>
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='开关量'
order by SamplingTime desc
limit #{switchNumber};
</select>
<select
id=
"querySwitchTypeNumber"
resultType=
"java.lang.Integer"
>
select COUNT(DISTINCT VAR_NAME)
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='开关量'
</select>
<select
id=
"queryVarName"
resultType=
"java.lang.String"
>
select VAR_NAME from analysis_result where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' group by VAR_NAME order by VAR_NAME;
</select>
<select
id=
"queryPredictionResult"
resultType=
"com.yeejoin.amos.kgd.model.AnalysisResult"
>
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' and VAR_NAME=#{varName}
order by SamplingTime desc
limit #{predictiveNumber}
</select>
<select
id=
"queryAnalysisData"
resultType=
"com.yeejoin.amos.kgd.model.AnalysisResult"
>
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' and VAR_NAME=#{varName}
order by SamplingTime desc
limit 1
</select>
<select
id=
"queryTemperatureTypeNumber"
resultType=
"java.lang.Integer"
>
select COUNT(DISTINCT VAR_NAME)
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='低频'
</select>
<select
id=
"queryTemperature"
resultType=
"com.yeejoin.amos.kgd.model.AnalysisResult"
>
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='低频'
order by SamplingTime desc
limit #{temperatureNumber}
</select>
</mapper>
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/pom.xml
View file @
c303ac6d
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<groupId>
com.yeejoin
</groupId>
<artifactId>
visual-feign-morphic
</artifactId>
<artifactId>
visual-feign-morphic
</artifactId>
<version>
1.
6.3
-SNAPSHOT
</version>
<version>
1.
8.5
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<groupId>
org.typroject
</groupId>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-fas-biz/pom.xml
View file @
c303ac6d
...
@@ -78,6 +78,12 @@
...
@@ -78,6 +78,12 @@
<artifactId>
xmlworker
</artifactId>
<artifactId>
xmlworker
</artifactId>
<version>
5.5.9
</version>
<version>
5.5.9
</version>
</dependency>
</dependency>
</dependencies>
<dependency>
<groupId>
com.itextpdf
</groupId>
<artifactId>
itextpdf
</artifactId>
<version>
5.5.13
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
</project>
amos-boot-module/amos-boot-module-biz/amos-boot-module-fas-biz/src/main/java/com/yeejoin/amos/fas/business/feign/RemoteSecurityService.java
View file @
c303ac6d
...
@@ -146,7 +146,7 @@ public class RemoteSecurityService {
...
@@ -146,7 +146,7 @@ public class RemoteSecurityService {
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
FeignClientResult
feignClientResult
;
FeignClientResult
feignClientResult
;
try
{
try
{
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
);
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
,
null
);
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
}
catch
(
InnerInvokException
e
)
{
}
catch
(
InnerInvokException
e
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/pom.xml
View file @
c303ac6d
...
@@ -44,7 +44,8 @@
...
@@ -44,7 +44,8 @@
<dependency>
<dependency>
<groupId>
e-iceblue
</groupId>
<groupId>
e-iceblue
</groupId>
<artifactId>
spire.doc
</artifactId>
<artifactId>
spire.doc
</artifactId>
<version>
5.1.9
</version>
<!-- <version>5.1.9</version>-->
<version>
5.4.10
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<groupId>
com.amosframework.boot
</groupId>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-kgd-biz/src/main/java/com/yeejoin/amos/kgd/controller/AnalysisResultController.java
0 → 100644
View file @
c303ac6d
package
com
.
yeejoin
.
amos
.
kgd
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.kgd.service.AnalysisResultService
;
import
com.yeejoin.amos.kgd.service.impl.AnalysisResultServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
@RestController
@Api
(
tags
=
"数据Api"
)
@RequestMapping
(
value
=
"/data/select"
)
public
class
AnalysisResultController
{
@Autowired
AnalysisResultServiceImpl
analysisResultService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID查询数据,幅值与时间"
)
@RequestMapping
(
value
=
"/select"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectByDeviceId
(
@RequestParam
String
deviceId
){
JSONObject
jsonData
=
analysisResultService
.
getDataByDeviceId
(
deviceId
);
return
ResponseHelper
.
buildResponse
(
jsonData
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID查询,幅值与频率"
)
@RequestMapping
(
value
=
"/analysisAllData"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectAnalysisDataByDeviceId
(
@RequestParam
String
deviceId
){
JSONObject
jsonData
=
analysisResultService
.
getAnalysisDataByDeviceId
(
deviceId
);
return
ResponseHelper
.
buildResponse
(
jsonData
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备id、高频,查var_name的所有类别,下拉栏的"
)
@RequestMapping
(
value
=
"/varName"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectVarNameByDeviceId
(
@RequestParam
String
deviceId
){
JSONArray
jsonArray
=
analysisResultService
.
getVarNameByDeviceId
(
deviceId
);
return
ResponseHelper
.
buildResponse
(
jsonArray
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID和低频,查温度,data"
)
@RequestMapping
(
value
=
"/temperature"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectTemperatureByDeviceId
(
String
deviceId
){
JSONObject
jsonData
=
analysisResultService
.
getTemperatureByDeviceId
(
deviceId
);
return
ResponseHelper
.
buildResponse
(
jsonData
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID和varName查幅值与时间,data"
)
@RequestMapping
(
value
=
"/analysisData"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectAnalysisDataByDeviceIdAndStatus
(
@RequestParam
String
deviceId
,
@RequestParam
String
varName
){
JSONObject
jsonData
=
analysisResultService
.
getAnalysisDataByDeviceIdAndVarName
(
deviceId
,
varName
);
return
ResponseHelper
.
buildResponse
(
jsonData
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID和状态查故障率"
)
@RequestMapping
(
value
=
"/faultRate"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectFaultRateByDeviceIdAndStatus
(
@RequestParam
String
deviceId
,
@RequestParam
String
varName
){
JSONObject
jsonData
=
analysisResultService
.
getFaultRateByDeviceIdAndStatus
(
deviceId
,
varName
);
return
ResponseHelper
.
buildResponse
(
jsonData
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID和状态查故障类型占比"
)
@RequestMapping
(
value
=
"/faultTypeProportion"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectFaultTypeProportionByDeviceIdAndStatus
(
@RequestParam
String
deviceId
,
@RequestParam
String
varName
){
JSONArray
jsonArray
=
analysisResultService
.
getFaultTypeProportionByDeviceIdAndStatus
(
deviceId
,
varName
);
return
ResponseHelper
.
buildResponse
(
jsonArray
);
}
@Value
(
"${kgd.data.switchNumber}"
)
private
int
switchNumber
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID查询开关量信息"
)
@RequestMapping
(
value
=
"/switchData"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectSwitchDataByDeviceId
(
@RequestParam
String
deviceId
){
System
.
out
.
println
(
switchNumber
);
JSONObject
jsonData
=
analysisResultService
.
getSwitchDataByDeviceId
(
deviceId
,
switchNumber
);
return
ResponseHelper
.
buildResponse
(
jsonData
);
}
@Value
(
"${kgd.data.predictiveNumber}"
)
private
int
predictiveNumber
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据设备ID和varName查询最近n条预测结果"
)
@RequestMapping
(
value
=
"/predictiveTrend"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseModel
selectPredictionResultByDeviceId
(
@RequestParam
String
deviceId
,
@RequestParam
String
vaName
){
JSONObject
jsonData
=
analysisResultService
.
getPredictionResultByDeviceId
(
deviceId
,
vaName
,
predictiveNumber
);
return
ResponseHelper
.
buildResponse
(
jsonData
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/service/impl/RuleDangerService.java
View file @
c303ac6d
...
@@ -48,7 +48,7 @@ public class RuleDangerService {
...
@@ -48,7 +48,7 @@ public class RuleDangerService {
latentDangerRo
.
setTerminal
(
RuleConstant
.
APP
);
latentDangerRo
.
setTerminal
(
RuleConstant
.
APP
);
List
<
RoleModel
>
result
=
Privilege
.
roleClient
.
queryRoleList
(
roleName
,
null
).
getResult
();
List
<
RoleModel
>
result
=
Privilege
.
roleClient
.
queryRoleList
(
roleName
,
null
).
getResult
();
if
(
result
.
size
()
>
0
)
{
if
(
result
.
size
()
>
0
)
{
List
<
AgencyUserModel
>
userModels
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
String
.
valueOf
(
result
.
get
(
0
).
getSequenceNbr
()),
null
).
getResult
();
List
<
AgencyUserModel
>
userModels
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
String
.
valueOf
(
result
.
get
(
0
).
getSequenceNbr
()),
null
,
null
).
getResult
();
//只发送给本部门的人员
//只发送给本部门的人员
Long
pointId
=
latentDanger
.
getBizInfo
().
getLong
(
"pointId"
);
Long
pointId
=
latentDanger
.
getBizInfo
().
getLong
(
"pointId"
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/core/async/AsyncTask.java
View file @
c303ac6d
...
@@ -171,7 +171,7 @@ public class AsyncTask {
...
@@ -171,7 +171,7 @@ public class AsyncTask {
try
{
try
{
List
<
RoleModel
>
result
=
Privilege
.
roleClient
.
queryRoleList
(
roleName
,
null
).
getResult
();
List
<
RoleModel
>
result
=
Privilege
.
roleClient
.
queryRoleList
(
roleName
,
null
).
getResult
();
if
(
result
.
size
()
>
0
)
{
if
(
result
.
size
()
>
0
)
{
List
<
AgencyUserModel
>
userModels
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
String
.
valueOf
(
result
.
get
(
0
).
getSequenceNbr
()),
null
).
getResult
();
List
<
AgencyUserModel
>
userModels
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
String
.
valueOf
(
result
.
get
(
0
).
getSequenceNbr
()),
null
,
null
).
getResult
();
List
<
String
>
userIds
=
userModels
.
stream
().
map
(
AgencyUserModel:
:
getUserId
).
collect
(
Collectors
.
toList
());
List
<
String
>
userIds
=
userModels
.
stream
().
map
(
AgencyUserModel:
:
getUserId
).
collect
(
Collectors
.
toList
());
model
.
setRecivers
(
userIds
);
model
.
setRecivers
(
userIds
);
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/feign/RemoteSecurityService.java
View file @
c303ac6d
...
@@ -220,7 +220,7 @@ public class RemoteSecurityService {
...
@@ -220,7 +220,7 @@ public class RemoteSecurityService {
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
FeignClientResult
feignClientResult
;
FeignClientResult
feignClientResult
;
try
{
try
{
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
);
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
,
null
);
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
}
catch
(
InnerInvokException
e
)
{
}
catch
(
InnerInvokException
e
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/feign/RemoteSecurityService.java
View file @
c303ac6d
...
@@ -221,7 +221,7 @@ public class RemoteSecurityService {
...
@@ -221,7 +221,7 @@ public class RemoteSecurityService {
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
FeignClientResult
feignClientResult
;
FeignClientResult
feignClientResult
;
try
{
try
{
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
);
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
,
null
);
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
}
catch
(
InnerInvokException
e
)
{
}
catch
(
InnerInvokException
e
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/feign/RemoteSecurityService.java
View file @
c303ac6d
...
@@ -223,7 +223,7 @@ public class RemoteSecurityService {
...
@@ -223,7 +223,7 @@ public class RemoteSecurityService {
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
FeignClientResult
feignClientResult
;
FeignClientResult
feignClientResult
;
try
{
try
{
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
);
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
,
null
);
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
}
catch
(
InnerInvokException
e
)
{
}
catch
(
InnerInvokException
e
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/impl/RulePlanService.java
View file @
c303ac6d
...
@@ -122,7 +122,7 @@ public class RulePlanService {
...
@@ -122,7 +122,7 @@ public class RulePlanService {
Privilege
.
roleClient
.
queryRoleList
(
supervisionPersonChargerRole
,
null
).
getResult
();
Privilege
.
roleClient
.
queryRoleList
(
supervisionPersonChargerRole
,
null
).
getResult
();
if
(!
ValidationUtil
.
isEmpty
(
roleList
))
{
if
(!
ValidationUtil
.
isEmpty
(
roleList
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
String
.
valueOf
(
roleList
.
get
(
0
).
getSequenceNbr
()),
null
).
getResult
();
String
.
valueOf
(
roleList
.
get
(
0
).
getSequenceNbr
()),
null
,
null
).
getResult
();
if
(!
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
if
(!
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
List
<
String
>
finalUserIds
=
userIds
;
List
<
String
>
finalUserIds
=
userIds
;
agencyUserModelList
.
forEach
(
userModel
->
{
agencyUserModelList
.
forEach
(
userModel
->
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/feign/RemoteSecurityService.java
View file @
c303ac6d
...
@@ -226,7 +226,7 @@ public class RemoteSecurityService {
...
@@ -226,7 +226,7 @@ public class RemoteSecurityService {
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
List
<
AgencyUserModel
>
agencyUserModel
=
null
;
FeignClientResult
feignClientResult
;
FeignClientResult
feignClientResult
;
try
{
try
{
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
);
feignClientResult
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
RoleIds
,
null
,
null
);
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
agencyUserModel
=
(
List
<
AgencyUserModel
>)
feignClientResult
.
getResult
();
}
catch
(
InnerInvokException
e
)
{
}
catch
(
InnerInvokException
e
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/AlertCalledServiceImpl.java
View file @
c303ac6d
...
@@ -382,7 +382,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -382,7 +382,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Override
@Override
public
List
<
DutySeatDto
>
getSeatInfos
()
{
public
List
<
DutySeatDto
>
getSeatInfos
()
{
// 获取人员信息
// 获取人员信息
FeignClientResult
<
List
<
AgencyUserModel
>>
userListResult
=
Privilege
.
agencyUserClient
.
list
(
null
);
FeignClientResult
<
List
<
AgencyUserModel
>>
userListResult
=
Privilege
.
agencyUserClient
.
list
(
null
,
null
);
List
<
AgencyUserModel
>
userList
=
userListResult
.
getResult
();
List
<
AgencyUserModel
>
userList
=
userListResult
.
getResult
();
List
<
DutySeatDto
>
dutyList
=
new
ArrayList
<>();
List
<
DutySeatDto
>
dutyList
=
new
ArrayList
<>();
userList
.
stream
().
forEach
(
u
->
{
userList
.
stream
().
forEach
(
u
->
{
...
...
amos-boot-system-kgd/src/main/java/com/yeejoin/amos/AmoKGDApplication.java
View file @
c303ac6d
...
@@ -34,7 +34,8 @@ import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
...
@@ -34,7 +34,8 @@ import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
@MapperScan
({
"org.typroject.tyboot.demo.face.orm.dao*"
,
"org.typroject.tyboot.face.*.orm.dao*"
,
@MapperScan
({
"org.typroject.tyboot.demo.face.orm.dao*"
,
"org.typroject.tyboot.face.*.orm.dao*"
,
"org.typroject.tyboot.core.auth.face.orm.dao*"
,
"org.typroject.tyboot.component.*.face.orm.dao*"
,
"org.typroject.tyboot.core.auth.face.orm.dao*"
,
"org.typroject.tyboot.component.*.face.orm.dao*"
,
"com.yeejoin.amos.boot.module.*.api.mapper"
,
"com.yeejoin.amos.boot.biz.common.dao.mapper"
,
"com.yeejoin.amos.boot.module.*.api.mapper"
,
"com.yeejoin.amos.boot.biz.common.dao.mapper"
,
"com.yeejoin.amos.avic.face.orm.dao*"
})
"com.yeejoin.amos.avic.face.orm.dao*"
,
"com.yeejoin.amos.kgd.*"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin"
})
public
class
AmoKGDApplication
{
public
class
AmoKGDApplication
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AmoKGDApplication
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AmoKGDApplication
.
class
);
...
@@ -50,5 +51,4 @@ public class AmoKGDApplication {
...
@@ -50,5 +51,4 @@ public class AmoKGDApplication {
+
"Application Amos-Biz-Boot is running! Access URLs:\n\t"
+
"Swagger文档: \thttp://"
+
ip
+
":"
+
port
+
"Application Amos-Biz-Boot is running! Access URLs:\n\t"
+
"Swagger文档: \thttp://"
+
ip
+
":"
+
port
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
}
}
}
}
amos-boot-system-kgd/src/main/resources/application-dev.properties
View file @
c303ac6d
...
@@ -12,6 +12,11 @@ spring.redis.port=6379
...
@@ -12,6 +12,11 @@ spring.redis.port=6379
spring.redis.password
=
yeejoin@2020
spring.redis.password
=
yeejoin@2020
# mybaits-plus
mybatis-plus.mapper-locations
=
classpath:/mapper/*.xml
spring.cache.type
=
GENERIC
spring.cache.type
=
GENERIC
j2cache.open-spring-cache
=
true
j2cache.open-spring-cache
=
true
j2cache.cache-clean-mode
=
passive
j2cache.cache-clean-mode
=
passive
...
@@ -67,4 +72,9 @@ knife4j.basic.password=a1234560
...
@@ -67,4 +72,9 @@ knife4j.basic.password=a1234560
management.security.enabled
=
true
management.security.enabled
=
true
spring.security.user.name
=
admin
spring.security.user.name
=
admin
spring.security.user.password
=
a1234560
spring.security.user.password
=
\ No newline at end of file
kgd.data.switchNumber
=
10
kgd.data.predictiveNumber
=
10
keyValue
=
f348f867-0279-45ef-9162-3f1115e6fea8
amos-boot-system-kgd/src/main/resources/application.properties
View file @
c303ac6d
spring.application.name
=
AMOS-BIZ-KGD-API
spring.application.name
=
AMOS-BIZ-KGD-API
server.servlet.context-path
=
/kgd
server.servlet.context-path
=
/kgd
server.port
=
3300
2
server.port
=
3300
3
server.uri-encoding
=
UTF-8
server.uri-encoding
=
UTF-8
spring.profiles.active
=
dev
spring.profiles.active
=
dev
spring.jackson.time-zone
=
GMT+8
spring.jackson.time-zone
=
GMT+8
...
...
pom.xml
View file @
c303ac6d
...
@@ -24,8 +24,8 @@
...
@@ -24,8 +24,8 @@
<springboot.version>
2.3.11.RELEASE
</springboot.version>
<springboot.version>
2.3.11.RELEASE
</springboot.version>
<springcloud.version>
Hoxton.SR8
</springcloud.version>
<springcloud.version>
Hoxton.SR8
</springcloud.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
<tyboot-version>
1.1.2
0
</tyboot-version>
<tyboot-version>
1.1.2
4-SNAPSHOT
</tyboot-version>
<amos.version>
1.
6.6-SNAPSHOT
</amos.version>
<amos.version>
1.
8.5
</amos.version>
<itext.version>
7.1.1
</itext.version>
<itext.version>
7.1.1
</itext.version>
</properties>
</properties>
...
@@ -286,6 +286,7 @@
...
@@ -286,6 +286,7 @@
<name>
e-iceblue
</name>
<name>
e-iceblue
</name>
<url>
https://repo.e-iceblue.com/nexus/content/groups/public/
</url>
<url>
https://repo.e-iceblue.com/nexus/content/groups/public/
</url>
</repository>
</repository>
</repositories>
</repositories>
<modules>
<modules>
...
...
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