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
e4c6a07c
Commit
e4c6a07c
authored
Dec 05, 2025
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广固增加南瑞接口调用
parent
bf2517d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
167 additions
and
53 deletions
+167
-53
NRApiInvocationController.java
...oin/equipmanage/controller/NRApiInvocationController.java
+16
-9
NrApiInvocationImpl.java
...yeejoin/equipmanage/service/impl/NrApiInvocationImpl.java
+132
-0
SyncDataServiceImpl.java
...yeejoin/equipmanage/service/impl/SyncDataServiceImpl.java
+2
-30
application-dev.properties
...ystem-equip/src/main/resources/application-dev.properties
+17
-14
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/NRApiInvocationController.java
View file @
e4c6a07c
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
com.alibaba.fastjson.JSON
Object
;
import
com.yeejoin.equipmanage.
common.utils.CommonResponseUti
l
;
import
com.alibaba.fastjson.JSON
Array
;
import
com.yeejoin.equipmanage.
service.impl.NrApiInvocationImp
l
;
import
com.yeejoin.equipmanage.service.impl.SyncDataServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -12,27 +14,32 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
@RestController
@Api
(
tags
=
"南瑞Api调用"
)
@RequestMapping
(
value
=
"/nrApi"
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
class
NRApiInvocationController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
NRApiInvocationController
.
class
);
@Autowired
private
SyncDataServiceImpl
syncDataService
;
@Autowired
private
NrApiInvocationImpl
invocation
;
@RequestMapping
(
value
=
"/getRealTimeData"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"get"
,
value
=
"获取南瑞实时数据"
)
public
ResponseModel
<
JSONObject
>
getRealTimeData
()
{
public
JSONArray
getRealTimeData
()
{
try
{
return
CommonResponseUtil
.
success
(
syncDataService
.
getNrRealTime
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
JSONArray
nrRealTime
=
invocation
.
getNrRealTime
();
logger
.
info
(
"获取南瑞实时数据aaaaaaaaaa"
,
nrRealTime
);
return
nrRealTime
;
}
catch
(
Exception
e
)
{
logger
.
info
(
"获取南瑞实时数据"
,
e
);
return
new
JSONArray
();
}
return
CommonResponseUtil
.
failure
();
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/NrApiInvocationImpl.java
0 → 100644
View file @
e4c6a07c
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.equipmanage.common.datasync.vo.RequestVo
;
import
com.yeejoin.equipmanage.common.utils.HttpContentTypeUtil
;
import
com.yeejoin.equipmanage.utils.DcsUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.time.temporal.ChronoUnit
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
public
class
NrApiInvocationImpl
{
@Value
(
"${dcs.x.hw.id}"
)
private
String
xHwId
;
@Value
(
"${dcs.x.hw.appKey}"
)
private
String
xHwAppKey
;
@Autowired
private
DcsUtil
dcsUtil
;
@Value
(
"${dcs.url.realtime.key}"
)
private
String
realtimeKey
;
@Value
(
"${dcs.url.yxfs.key}"
)
private
String
yxfsKey
;
@Value
(
"${operation.date}"
)
private
String
operationDate
;
@Value
(
"${dcs.url.realtime.datatype}"
)
private
String
datatype
;
@Value
(
"${dcs.url.realtime}"
)
private
String
realtimeUrl
;
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
NrApiInvocationImpl
.
class
);
public
JSONArray
getNrRealTime
()
throws
Exception
{
String
authorization
=
dcsUtil
.
getDcsToken
();
JSONArray
objects
=
new
JSONArray
();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
headerMap
.
put
(
"Authorization"
,
authorization
);
headerMap
.
put
(
"token"
,
authorization
.
split
(
" "
)[
1
]);
headerMap
.
put
(
"X-HW-ID"
,
xHwId
);
headerMap
.
put
(
"X-HW-APPKEY"
,
xHwAppKey
);
if
(
StringUtils
.
isNotBlank
(
authorization
))
{
RequestVo
requestVo
=
new
RequestVo
();
requestVo
.
setId
(
1L
);
requestVo
.
setClientId
(
"serv-x01"
);
Map
<
String
,
Object
>
bodyMap
=
new
HashMap
<>();
bodyMap
.
put
(
"datatype"
,
datatype
);
bodyMap
.
put
(
"keys"
,
Arrays
.
asList
(
realtimeKey
.
split
(
","
)));
// bodyMap.put("datatype","state");
// bodyMap.put("keys", Arrays.asList("3940656019406849",
// "3940656019472385",
// "3940656019537921",
// "3940656019144705",
// "3940656019210241",
// "3940656019275777",
// "3940656019341313"));
requestVo
.
setBody
(
bodyMap
);
logger
.
info
(
"===============告警存入header:"
+
JSON
.
toJSONString
(
headerMap
)
+
";\n==================告警存入body: "
+
JSON
.
toJSONString
(
requestVo
));
String
data
=
HttpContentTypeUtil
.
sendHttpPostJsonWithHeader
(
realtimeUrl
,
JSON
.
toJSONString
(
requestVo
),
headerMap
);
bodyMap
.
put
(
"keys"
,
Arrays
.
asList
(
yxfsKey
.
split
(
","
)));
requestVo
.
setBody
(
bodyMap
);
//String s = "{\"code\":\"2023\",\"id\":1,\"message\":\"获取实时信号值成功\",\"body\":{\"values\":[{\"time_stamp\":\"2025-12-04 15:55:56.000\",\"value\":4417.724609375,\"key\":\"0000YC000101004B14\",\"quality\":0},{\"time_stamp\":\"2025-12-04 15:55:56.000\",\"value\":0.67138671875,\"key\":\"0000YC000101004623\",\"quality\":0},{\"time_stamp\":\"2025-12-04 15:55:41.000\",\"value\":0.79345703125,\"key\":\"0000YC000101004624\",\"quality\":0}]}}";
logger
.
info
(
"===============告警推送联调返回数据:"
+
data
);
logger
.
info
(
"===============告警推送联调返回数据结果:"
+
JSONObject
.
parseObject
(
data
));
JSONArray
jsonArray
=
JSONObject
.
parseObject
(
data
).
getJSONObject
(
"body"
).
getJSONArray
(
"values"
);
String
yxfs
=
HttpContentTypeUtil
.
sendHttpPostJsonWithHeader
(
realtimeUrl
,
JSON
.
toJSONString
(
requestVo
),
headerMap
);
logger
.
info
(
"===============告警推送联调返回数据结果:"
+
yxfs
);
JSONArray
yxfsArr
=
JSONObject
.
parseObject
(
yxfs
).
getJSONObject
(
"body"
).
getJSONArray
(
"values"
);
JSONArray
filteredArr
=
new
JSONArray
(
yxfsArr
.
stream
()
.
filter
(
obj
->
obj
instanceof
JSONObject
)
.
map
(
obj
->
(
JSONObject
)
obj
)
.
filter
(
obj
->
{
Object
v
=
obj
.
get
(
"value"
);
if
(
v
instanceof
Number
)
{
return
((
Number
)
v
).
doubleValue
()
==
1.0
;
}
return
false
;
}).
collect
(
Collectors
.
toList
())
);
jsonArray
.
addAll
(
filteredArr
);
JSONObject
yxsj
=
new
JSONObject
();
yxsj
.
put
(
"key"
,
"tyrq"
);
yxsj
.
put
(
"value"
,
operationDate
);
JSONObject
safeDay
=
new
JSONObject
();
safeDay
.
put
(
"key"
,
"safeDay"
);
LocalDate
opDate
=
LocalDate
.
parse
(
operationDate
);
safeDay
.
put
(
"value"
,
ChronoUnit
.
DAYS
.
between
(
opDate
,
LocalDate
.
now
()));
jsonArray
.
add
(
yxsj
);
jsonArray
.
add
(
safeDay
);
objects
.
addAll
(
jsonArray
);
logger
.
info
(
"===============告警推送联调返回数据结果1111111:"
+
jsonArray
);
}
return
objects
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/SyncDataServiceImpl.java
View file @
e4c6a07c
...
...
@@ -63,6 +63,8 @@ public class SyncDataServiceImpl implements ISyncDataService {
@Value
(
"${dcs.url.realtime}"
)
private
String
realtimeUrl
;
@Value
(
"${dcs.x.hw.id}"
)
private
String
xHwId
;
...
...
@@ -544,35 +546,5 @@ public class SyncDataServiceImpl implements ISyncDataService {
public
JSONObject
getNrRealTime
()
throws
InterruptedException
{
try
{
String
authorization
=
dcsUtil
.
getDcsToken
();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
headerMap
.
put
(
"Authorization"
,
authorization
);
headerMap
.
put
(
"token"
,
authorization
.
split
(
" "
)[
1
]);
headerMap
.
put
(
"X-HW-ID"
,
xHwId
);
headerMap
.
put
(
"X-HW-APPKEY"
,
xHwAppKey
);
if
(
StringUtils
.
isNotBlank
(
authorization
))
{
RequestVo
requestVo
=
new
RequestVo
();
requestVo
.
setId
(
1L
);
requestVo
.
setClientId
(
"serv-x01"
);
Map
<
String
,
Object
>
bodyMap
=
new
HashMap
<>();
bodyMap
.
put
(
"datatype"
,
"analog"
);
bodyMap
.
put
(
"keys"
,
Arrays
.
asList
(
"0000YC000101004B14"
,
"0000YC000101004623"
,
"0000YC000101004624"
));
requestVo
.
setBody
(
bodyMap
);
logger
.
info
(
"===============告警存入header:"
+
JSON
.
toJSONString
(
headerMap
)
+
";\n==================告警存入body: "
+
JSON
.
toJSONString
(
requestVo
));
String
s
=
HttpContentTypeUtil
.
sendHttpPostJsonWithHeader
(
realtimeUrl
,
JSON
.
toJSONString
(
requestVo
),
headerMap
);
logger
.
info
(
"===============告警推送联调返回数据:"
+
JSON
.
toJSONString
(
s
));
return
JSONObject
.
parseObject
(
s
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"getNrRealTime数据接口请求异常:"
+
e
.
getMessage
());
}
return
null
;
}
}
amos-boot-system-equip/src/main/resources/application-dev.properties
View file @
e4c6a07c
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://
172.16.10.216:3306
/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.url
=
jdbc:mysql://
39.100.71.139:3307
/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username
=
root
spring.datasource.password
=
ENC(ooSbV2vO5UUB3BuAVYjYxm4OVY4rCv275/HxXJNz+Nbf2I8EjuylP9tTh30s2j7g)
spring.datasource.password
=
Yeejoin@2020
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name
=
DatebookHikariCP
spring.datasource.hikari.minimum-idle
=
3
...
...
@@ -17,20 +17,20 @@ eureka.instance.prefer-ip-address = true
#服务实例ip地址,若eureka.instance.prefer-ip-address=false,ip-address设置失效,一般情况不用设置。
#eureka.instance.ip-address= 172.16.3.135
#eureka服务ip配置,可填写固定ip地址
eureka.instance.hostname
=
172.16.10.216
eureka.instance.hostname
=
39.100.71.139
#eureka服务配置的校验账号及密码,配置需和eureka服务后台配置文件中一致
#eureka????????????,????eureka???????????
spring.security.user.name
=
admin
spring.security.user.password
=
ENC(8Avkl0Wjal6xBOWKXQ+X1QCbtDt3n1JZS7dHehmtYFTPYNd+6diNNogVGZCPVHjE)
spring.security.user.password
=
a1234650
eureka.client.serviceUrl.defaultZone
=
http://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:10001/eureka/
##########eureka配置信息###############
#redis
spring.redis.database
=
1
spring.redis.host
=
172.16.10.216
spring.redis.host
=
39.100.71.139
spring.redis.port
=
6379
spring.redis.password
=
ENC(/T7d22Zy0QgL+Ff1+FC81syDFAVOpo4CoWrDVUELyjR2XEXuk+gmNnzkyK3B5ibi)
spring.redis.password
=
yeejoin@2020
spring.redis.lettuce.pool.max-active
=
200
spring.redis.lettuce.pool.max-wait
=
-1
spring.redis.lettuce.pool.max-idle
=
10
...
...
@@ -40,18 +40,18 @@ spring.redis.expire.time=30000
## emqx
emqx.clean-session
=
true
emqx.client-id
=
${spring.application.name}-${security-random-int}
emqx.broker
=
tcp://
172.16.10.216
:1883
emqx.broker
=
tcp://
39.100.71.139
:1883
emqx.user-name
=
admin
emqx.password
=
ENC(GGQmxuyl6uOxAsDhjRo+USgUybWC8Ns4Q7mlnyq3JqJE9LsFgYBNK8gzJ7H/Znw+)
emqx.password
=
public
emqx.client-user-name
=
admin
emqx.client-password
=
ENC(GGQmxuyl6uOxAsDhjRo+USgUybWC8Ns4Q7mlnyq3JqJE9LsFgYBNK8gzJ7H/Znw+)
mqtt.scene.host
=
mqtt://
172.16.10.216
:8083/mqtt
emqx.client-password
=
public
mqtt.scene.host
=
mqtt://
39.100.71.139
:8083/mqtt
mqtt.client.product.id
=
mqtt
mqtt.topic
=
topic_mqtt
spring.mqtt.completionTimeout
=
3000
# influxDB
spring.influx.url
=
http://172.16.1
0.216
:8086
spring.influx.password
=
ENC(ooSbV2vO5UUB3BuAVYjYxm4OVY4rCv275/HxXJNz+Nbf2I8EjuylP9tTh30s2j7g)
spring.influx.url
=
http://172.16.1
1.201
:8086
spring.influx.password
=
Yeejoin@2020
spring.influx.user
=
root
spring.influx.database
=
iot_platform
spring.influx.retention_policy
=
default
...
...
@@ -62,7 +62,7 @@ spring.influx.bufferLimit=20000
#系统机器人账号
amos.system.user.user-name
=
gw_ys4
amos.system.user.password
=
ENC(7tDiqwjMIbE4TjngEimbmaXzvBC1/nlGrIDNPd1z6rBCr72XvCPcDzrIMkKQChuB)
amos.system.user.password
=
a1234650
amos.system.user.app-key
=
studio_normalapp_3056965
amos.system.user.product
=
STUDIO_APP_WEB
security.productApp
=
STUDIO_APP_MOBILE
...
...
@@ -103,11 +103,14 @@ dcs.source.type=\u9ad8\u7ea7\u5e94\u7528
dcs.url.sendalarm
=
http://172.21.101.101/v1/cs/alarm-service/appalarm/sendalarm
#南瑞实时查询数据接口调用
dcs.url.realtime
=
http://172.21.101.101/v1/cs/realdata-service/data/realtime
dcs.url.realtime.key
=
0000YC0001010040A5,0000YC000101004099,0000YC000101004237,0000YC00010100422B
dcs.url.yxfs.key
=
0000YC0001010040A5,0000YC000101004099, 0000YC000101004237,0000YC00010100422B
dcs.url.realtime.datatype
=
state
#################################################################################
#\u7CFB\u7EDF\u4E0A\u7EBF\u65F6\u95F4
param.system.online.date
=
2019-02-12
operation.date
=
2019-02-12
############数字1.0视频接入服务配置,其他版本不支持##################################
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站1.0使用时开启
...
...
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