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
d5b587dd
Commit
d5b587dd
authored
Nov 30, 2022
by
litengwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_dl_3.6.0.6_Trage_1114' into develop_dl_3.6.0.6
parents
45cd4f2f
11854782
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
0 deletions
+96
-0
EquipmentSpecificIndex.java
...oin/equipmanage/common/entity/EquipmentSpecificIndex.java
+9
-0
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+77
-0
application-dev.properties
...ystem-equip/src/main/resources/application-dev.properties
+7
-0
EquipmentSpecificIndexMapper.xml
...rc/main/resources/mapper/EquipmentSpecificIndexMapper.xml
+3
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/EquipmentSpecificIndex.java
View file @
d5b587dd
...
...
@@ -150,4 +150,13 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField
(
exist
=
false
)
private
Integer
isTrend
;
@ApiModelProperty
(
value
=
"装备系统code"
)
@TableField
(
exist
=
false
)
private
String
specificCode
;
@ApiModelProperty
(
value
=
"装备定义名称"
)
@TableField
(
exist
=
false
)
private
String
equipmentName
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
d5b587dd
...
...
@@ -24,6 +24,7 @@ import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.utils.BeanUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -35,8 +36,11 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -90,6 +94,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
EquipmentSpecificMapper
equipmentSpecificMapper
;
@Autowired
protected
EmqKeeper
emqKeeper
;
@Autowired
FireFightingSystemMapper
FireFightingSystemMapper
;
static
IFireFightingSystemService
fireFightingSystemService
;
...
...
@@ -141,6 +148,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value
(
"${equipManage.name}"
)
private
String
serverName
;
@Value
(
"${state.code:code}"
)
private
String
stationCode
;
@Value
(
"${state.name:name}"
)
private
String
stationName
;
@Value
(
"${mqtt.vehicle.topic}"
)
private
String
carTopic
;
...
...
@@ -159,6 +172,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value
(
"${systemctl.sync.switch}"
)
private
Boolean
syncSwitch
;
@Value
(
"${is.open.telemetering:false}"
)
private
Boolean
isOpenTelemetering
;
@Value
(
"${systemctl.amos.switch}"
)
private
Boolean
amosSwitch
;
...
...
@@ -210,6 +226,19 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return
;
}
log
.
info
(
String
.
format
(
"收到mqtt消息:%s"
,
message
));
// 发送emq消息转kafka
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"topic"
,
topic
);
jsonObject
.
put
(
"data"
,
message
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
"emq.iot.created"
,
jsonObject
.
toString
().
getBytes
(),
1
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
if
(!
StringUtils
.
isEmpty
(
traceId
))
{
String
finalTraceId
=
traceId
;
List
<
IotDataVO
>
collect
=
iotDatalist
.
stream
().
map
(
x
->
{
...
...
@@ -293,6 +322,54 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if
(
equipmentSpecificIndex
.
getIsAlarm
()
!=
null
&&
1
==
equipmentSpecificIndex
.
getIsAlarm
())
{
equipmentSpecificAlarms
.
addAll
(
createIndexAlarmRecord
(
equipmentSpecificIndex
));
}
// 遥测遥信数据推送云端kafka
JSONObject
jsonObjectXf
=
new
JSONObject
();
jsonObjectXf
.
put
(
"data_class"
,
"realdata"
);
if
(
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
jsonObjectXf
.
put
(
"data_type"
,
"analog"
);
}
else
{
jsonObjectXf
.
put
(
"data_type"
,
"state"
);
}
String
date
=
DateUtils
.
date2LongStr
(
new
Date
());
jsonObjectXf
.
put
(
"op_type"
,
"subscribe_emergency"
);
JSONObject
jsonObjectCondition
=
new
JSONObject
();
jsonObjectCondition
.
put
(
"station_psr_id"
,
stationCode
);
jsonObjectCondition
.
put
(
"station_name"
,
stationName
);
jsonObjectCondition
.
put
(
"data_upload_time"
,
date
);
jsonObjectXf
.
put
(
"condition"
,
jsonObjectCondition
);
JSONObject
jsonObjectData
=
new
JSONObject
();
jsonObjectData
.
put
(
"psrId"
,
stationCode
);
jsonObjectData
.
put
(
"astId"
,
equipmentSpecificIndex
.
getSpecificCode
());
jsonObjectData
.
put
(
"equipType"
,
equipmentSpecificIndex
.
getEquipmentCode
());
jsonObjectData
.
put
(
"name"
,
equipmentSpecificIndex
.
getEquipmentSpecificName
()+
"-"
+
equipmentSpecificIndex
.
getEquipmentSpecificIndexName
());
if
(
value
.
equals
(
"true"
))
{
jsonObjectData
.
put
(
"value"
,
"1"
);
}
else
if
(
value
.
equals
(
"false"
))
{
jsonObjectData
.
put
(
"value"
,
"0"
);
}
else
{
jsonObjectData
.
put
(
"value"
,
value
);
}
jsonObjectData
.
put
(
"measurementType"
,
equipmentSpecificIndex
.
getEquipmentIndexKey
());
jsonObjectData
.
put
(
"dateTime"
,
date
);
jsonObjectData
.
put
(
"quality"
,
"0"
);
// 量测质量码:0 有效,1 无效
List
<
JSONObject
>
jsonObjects
=
Arrays
.
asList
(
jsonObjectData
);
jsonObjectXf
.
put
(
"data"
,
jsonObjects
);
// 遥测
if
(!
isOpenTelemetering
&&
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
}
else
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
"emq.xf.created"
,
jsonObjectXf
.
toString
().
getBytes
(),
1
,
false
);
log
.
info
(
"遥测遥信数据推送云端kafka成功"
);
}
catch
(
MqttException
e
)
{
log
.
error
(
"遥测遥信数据推送云端kafka失败=====>"
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
}
}
});
...
...
amos-boot-system-equip/src/main/resources/application-dev.properties
View file @
d5b587dd
...
...
@@ -94,3 +94,9 @@ equipment.plan.pump=92010600,92030600,92130400,92140200,92150300
# 电力使用
iot.code.prefix.have.used
=
# 站端标识
state.code
=
JP
state.name
=
NAME
# 是否开启遥测数据上报
is.open.telemetering
=
false
\ No newline at end of file
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificIndexMapper.xml
View file @
d5b587dd
...
...
@@ -48,9 +48,12 @@
wei.unit AS indexUnitName,
wes.org_code AS orgCode,
ed.`name` AS equipmentSpecificName,
ed.equipment_name AS equipmentName,
wes.iot_code AS iotCode,
wes.code AS specificCode,
wei.`name` AS equipmentSpecificIndexName,
wei.`value_enum` AS valueEnum,
wei.is_trend AS isTrend,
wes.qr_code AS qrCode,
wesi.update_date AS updateDate,
ed.code AS equipmentCode,
...
...
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