Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
79838267
Commit
79838267
authored
Nov 19, 2020
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交mqtt推送代码
parent
38e19aba
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
998 additions
and
48 deletions
+998
-48
EquipmentRiskTypeEnum.java
.../yeejoin/amos/fas/common/enums/EquipmentRiskTypeEnum.java
+38
-0
EquipmentSpecific.java
...va/com/yeejoin/amos/fas/dao/entity/EquipmentSpecific.java
+111
-0
WebMqttSubscribe.java
...yeejoin/amos/fas/business/action/mq/WebMqttSubscribe.java
+99
-0
SafetyController.java
...eejoin/amos/fas/business/controller/SafetyController.java
+5
-1
EquipmentSpecificMapper.java
...amos/fas/business/dao/mapper/EquipmentSpecificMapper.java
+18
-0
FmeaEquipmentPointMapper.java
...mos/fas/business/dao/mapper/FmeaEquipmentPointMapper.java
+2
-0
HandlerMqttMessageImpl.java
...mos/fas/business/service/impl/HandlerMqttMessageImpl.java
+419
-0
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+8
-7
IEquipmentHandlerService.java
.../fas/business/service/intfc/IEquipmentHandlerService.java
+16
-0
EquipmentSpecificForRiskVo.java
...join/amos/fas/business/vo/EquipmentSpecificForRiskVo.java
+46
-0
EquipmentSpecificIndexVo.java
...eejoin/amos/fas/business/vo/EquipmentSpecificIndexVo.java
+113
-0
TopicEntityVo.java
.../java/com/yeejoin/amos/fas/business/vo/TopicEntityVo.java
+25
-0
PermissionAspect.java
...in/java/com/yeejoin/amos/fas/config/PermissionAspect.java
+41
-38
application-dev.properties
...utoSysStart/src/main/resources/application-dev.properties
+3
-0
application.properties
...ireAutoSysStart/src/main/resources/application.properties
+2
-2
dbTemplate_equipment_specific.xml
...ain/resources/db/mapper/dbTemplate_equipment_specific.xml
+28
-0
dbTemplate_fmea_equipment_point.xml
...n/resources/db/mapper/dbTemplate_fmea_equipment_point.xml
+14
-0
pom.xml
pom.xml
+10
-0
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/common/enums/EquipmentRiskTypeEnum.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
common
.
enums
;
/**
* @author keyong
* @title: EquipmentRiskTypeEnum
* <pre>
* @description: TODO
* </pre>
* @date 2020/11/10 13:40
*/
public
enum
EquipmentRiskTypeEnum
{
HZGJ
(
"alarm"
,
"火灾告警"
),
GZ
(
"trouble"
,
"故障"
);
private
String
code
;
private
String
type
;
EquipmentRiskTypeEnum
(
String
code
,
String
type
)
{
this
.
code
=
code
;
this
.
type
=
type
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/EquipmentSpecific.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
dao
.
entity
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.Table
;
/**
* @author keyong
* @title: EquipmentSpecific
* <pre>
* @description: TODO
* </pre>
* @date 2020/11/16 15:44
*/
@Entity
@Table
(
name
=
"wl_equipment_specific"
)
@NamedQuery
(
name
=
"EquipmentSpecific.findAll"
,
query
=
"SELECT e FROM EquipmentSpecific e"
)
public
class
EquipmentSpecific
extends
BasicEntity
{
@Column
(
name
=
"equipment_detail_id"
)
private
Long
equipmentDetailId
;
@Column
(
name
=
"qr_code"
)
private
String
qrCode
;
@Column
(
name
=
"single"
)
private
Boolean
single
;
@Column
(
name
=
"system_id"
)
private
Long
systemId
;
@Column
(
name
=
"iot_code"
)
private
String
iotCode
;
@Column
(
name
=
"org_code"
)
private
String
orgCode
;
@Column
(
name
=
"code"
)
private
String
code
;
public
void
setEquipmentDetailId
(
Long
equipmentDetailId
)
{
this
.
equipmentDetailId
=
equipmentDetailId
;
}
public
void
setQrCode
(
String
qrCode
)
{
this
.
qrCode
=
qrCode
;
}
public
void
setSingle
(
Boolean
single
)
{
this
.
single
=
single
;
}
public
void
setSystemId
(
Long
systemId
)
{
this
.
systemId
=
systemId
;
}
public
void
setIotCode
(
String
iotCode
)
{
this
.
iotCode
=
iotCode
;
}
public
void
setOrgCode
(
String
orgCode
)
{
this
.
orgCode
=
orgCode
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
Long
getEquipmentDetailId
()
{
return
equipmentDetailId
;
}
public
String
getQrCode
()
{
return
qrCode
;
}
public
Boolean
getSingle
()
{
return
single
;
}
public
Long
getSystemId
()
{
return
systemId
;
}
public
String
getIotCode
()
{
return
iotCode
;
}
public
String
getOrgCode
()
{
return
orgCode
;
}
public
String
getCode
()
{
return
code
;
}
public
EquipmentSpecific
(
Long
equipmentDetailId
,
String
qrCode
,
Boolean
single
,
Long
systemId
,
String
iotCode
,
String
orgCode
,
String
code
)
{
this
.
equipmentDetailId
=
equipmentDetailId
;
this
.
qrCode
=
qrCode
;
this
.
single
=
single
;
this
.
systemId
=
systemId
;
this
.
iotCode
=
iotCode
;
this
.
orgCode
=
orgCode
;
this
.
code
=
code
;
}
public
EquipmentSpecific
()
{
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/mq/WebMqttSubscribe.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
.
mq
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService
;
import
org.eclipse.paho.client.mqttv3.MqttConnectOptions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.integration.annotation.IntegrationComponentScan
;
import
org.springframework.integration.annotation.ServiceActivator
;
import
org.springframework.integration.channel.DirectChannel
;
import
org.springframework.integration.core.MessageProducer
;
import
org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory
;
import
org.springframework.integration.mqtt.core.MqttPahoClientFactory
;
import
org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter
;
import
org.springframework.integration.mqtt.support.DefaultPahoMessageConverter
;
import
org.springframework.messaging.Message
;
import
org.springframework.messaging.MessageChannel
;
import
org.springframework.messaging.MessageHandler
;
/**
* @author keyong
* @title: WebMqttSubscribe
* <pre>
* @description: Mqtt订阅消息类
* </pre>
* @date 2020/11/9 17:50
*/
@Configuration
@IntegrationComponentScan
public
class
WebMqttSubscribe
{
@Value
(
"${emqx.user-name}"
)
private
String
userName
;
@Value
(
"${emqx.password}"
)
private
String
password
;
@Value
(
"${emqx.broker}"
)
private
String
hostUrl
;
@Value
(
"${emqx.client-id}"
)
private
String
clientId
;
@Value
(
"${emqx.defaultTopic}"
)
private
String
defaultTopic
;
public
MqttPahoMessageDrivenChannelAdapter
adapter
;
@Autowired
IEquipmentHandlerService
equipmentHandlerService
;
@Bean
public
MqttConnectOptions
getMqttConnectOptions
()
{
MqttConnectOptions
mqttConnectOptions
=
new
MqttConnectOptions
();
mqttConnectOptions
.
setUserName
(
userName
);
mqttConnectOptions
.
setPassword
(
password
.
toCharArray
());
mqttConnectOptions
.
setServerURIs
(
new
String
[]{
hostUrl
});
mqttConnectOptions
.
setKeepAliveInterval
(
2
);
mqttConnectOptions
.
setAutomaticReconnect
(
true
);
return
mqttConnectOptions
;
}
@Bean
public
MqttPahoClientFactory
mqttPahoClientFactory
()
{
DefaultMqttPahoClientFactory
factory
=
new
DefaultMqttPahoClientFactory
();
factory
.
setConnectionOptions
(
getMqttConnectOptions
());
return
factory
;
}
@Bean
public
MessageChannel
mqttInputChannel
()
{
return
new
DirectChannel
();
}
@Bean
public
MessageProducer
inbound
()
{
adapter
=
new
MqttPahoMessageDrivenChannelAdapter
(
clientId
,
mqttPahoClientFactory
(),
defaultTopic
);
adapter
.
setConverter
(
new
DefaultPahoMessageConverter
());
adapter
.
setQos
(
0
);
adapter
.
setOutputChannel
(
mqttInputChannel
());
return
adapter
;
}
@Bean
@ServiceActivator
(
inputChannel
=
"mqttInputChannel"
)
public
MessageHandler
handler
()
{
return
new
MessageHandler
()
{
@Override
public
void
handleMessage
(
Message
<?>
message
)
{
String
topic
=
message
.
getHeaders
().
get
(
"mqtt_receivedTopic"
).
toString
();
String
msg
=
message
.
getPayload
().
toString
();
// 订阅之后的处理逻辑
equipmentHandlerService
.
handlerMqttMessage
(
topic
,
msg
);
}
};
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/SafetyController.java
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -32,15 +33,18 @@ public class SafetyController extends BaseController{
...
@@ -32,15 +33,18 @@ public class SafetyController extends BaseController{
@Autowired
@Autowired
private
RuleTrigger
ruleTrigger
;
private
RuleTrigger
ruleTrigger
;
@Autowired
IEquipmentHandlerService
equipmentHandlerService
;
/**
/**
* 保存登陆用户选择公司信息
* 保存登陆用户选择公司信息
*/
*/
@Permission
@ApiOperation
(
value
=
" 保存登陆用户选择公司信息"
,
notes
=
" 保存登陆用户选择公司信息"
)
@ApiOperation
(
value
=
" 保存登陆用户选择公司信息"
,
notes
=
" 保存登陆用户选择公司信息"
)
@PostMapping
(
value
=
"/save/curCompany"
)
@PostMapping
(
value
=
"/save/curCompany"
)
public
CommonResponse
saveCurCompany
(
@RequestBody
ReginParams
reginParams
)
{
public
CommonResponse
saveCurCompany
(
@RequestBody
ReginParams
reginParams
)
{
this
.
saveSelectedOrgInfo
(
reginParams
);
this
.
saveSelectedOrgInfo
(
reginParams
);
equipmentHandlerService
.
subscribeTopic
(
reginParams
);
return
CommonResponseUtil
.
success
();
return
CommonResponseUtil
.
success
();
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/EquipmentSpecificMapper.java
View file @
79838267
...
@@ -3,7 +3,9 @@ package com.yeejoin.amos.fas.business.dao.mapper;
...
@@ -3,7 +3,9 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.fas.business.vo.AssoEquipsVo
;
import
com.yeejoin.amos.fas.business.vo.AssoEquipsVo
;
import
com.yeejoin.amos.fas.business.vo.EquipmentPointVo
;
import
com.yeejoin.amos.fas.business.vo.EquipmentPointVo
;
import
com.yeejoin.amos.fas.business.vo.EquipmentSpecificForRiskVo
;
import
com.yeejoin.amos.fas.business.vo.EquipmentSpecificVo
;
import
com.yeejoin.amos.fas.business.vo.EquipmentSpecificVo
;
import
com.yeejoin.amos.fas.dao.entity.EquipmentSpecific
;
import
com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint
;
import
com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -51,4 +53,20 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo>
...
@@ -51,4 +53,20 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo>
* @return
* @return
*/
*/
List
<
EquipmentSpecificVo
>
getFireEquiments
(
@Param
(
"equipmentId"
)
String
equipmentId
,
@Param
(
"fname"
)
String
fname
);
List
<
EquipmentSpecificVo
>
getFireEquiments
(
@Param
(
"equipmentId"
)
String
equipmentId
,
@Param
(
"fname"
)
String
fname
);
String
findEquipNameById
(
@Param
(
"id"
)
long
id
);
/**
* <pre>
* @Description: 通过id查询
* </pre>
*
* @MethodName:
* @Param: [id]
* @Return: EquipmentSpecific
* @Throws
* @Author keyong
* @Date 2020/11/17 19:32
*/
EquipmentSpecificForRiskVo
getOneById
(
@Param
(
"id"
)
long
id
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/FmeaEquipmentPointMapper.java
View file @
79838267
...
@@ -30,4 +30,6 @@ public interface FmeaEquipmentPointMapper extends BaseMapper {
...
@@ -30,4 +30,6 @@ public interface FmeaEquipmentPointMapper extends BaseMapper {
void
updateStateByIds
(
@Param
(
"state"
)
Integer
state
,
void
updateStateByIds
(
@Param
(
"state"
)
Integer
state
,
@Param
(
"ids"
)
List
<
Long
>
ids
);
@Param
(
"ids"
)
List
<
Long
>
ids
);
List
<
FmeaEquipmentPoint
>
listFmeaByEquipIndexIdAndEquipId
(
@Param
(
"specificIndexId"
)
long
specificIndexId
,
@Param
(
"equipId"
)
long
equipId
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/HandlerMqttMessageImpl.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.fas.business.action.model.ContingencyRo
;
import
com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo
;
import
com.yeejoin.amos.fas.business.action.model.SetpEnum
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgBo
;
import
com.yeejoin.amos.fas.business.bo.MsgParamBo
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.param.AlarmParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService
;
import
com.yeejoin.amos.fas.business.service.intfc.IView3dService
;
import
com.yeejoin.amos.fas.business.util.JexlUtil
;
import
com.yeejoin.amos.fas.business.util.RpnUtils
;
import
com.yeejoin.amos.fas.business.util.StringUtil
;
import
com.yeejoin.amos.fas.business.vo.*
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum
;
import
com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @author keyong
* @title: HandlerMqttMessageImpl
* <pre>
* @description: 订阅装备信息系统消息处理类
* </pre>
* @date 2020/11/10 18:03
*/
@Service
(
"IEquipmentHandlerService"
)
public
class
HandlerMqttMessageImpl
implements
IEquipmentHandlerService
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
HandlerMqttMessageImpl
.
class
);
@Autowired
private
WebMqttSubscribe
webMqttSubscribe
;
@Value
(
"${equipManage.fegin.name}"
)
private
String
serverName
;
@Value
(
"${emqx.defaultTopic}"
)
private
String
defaultTopic
;
@Autowired
private
WebMqttComponent
webMqttComponent
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@Autowired
private
FireEquipPointMapper
fireEquipPointMapper
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
ImpAndFireEquipMapper
impAndFireEquipMapper
;
@Autowired
private
IPreplanPictureDao
iPreplanPictureDao
;
@Autowired
private
RuleTrigger
ruleTrigger
;
@Autowired
IContingencyOriginalDataDao
iContingencyOriginalDataDao
;
@Autowired
private
IDataRefreshService
iDataRefreshService
;
@Autowired
private
IView3dService
view3dService
;
@Autowired
private
FmeaEquipmentPointMapper
fmeaEquipmentPointMapper
;
@Autowired
private
FireEquipMapper
fireEquipMapper
;
@Autowired
EquipmentSpecificMapper
equipmentSpecificMapper
;
@Autowired
private
FmeaPointInputitemMapper
fmeaPointInputitemMapper
;
@Autowired
private
IEvaluationModelDao
iEvaluationModelDao
;
@Autowired
private
FmeaMapper
fmeaMapper
;
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
@Override
public
void
handlerMqttMessage
(
String
topic
,
String
data
)
{
TopicEntityVo
topicEntity
=
JSON
.
parseObject
(
data
,
TopicEntityVo
.
class
);
log
.
info
(
"iotCode 性能指标属于: "
+
topicEntity
.
getType
());
EquipmentSpecificIndexVo
equipmentSpecificIndex
=
JSONObject
.
parseObject
(
topicEntity
.
getMessage
(),
EquipmentSpecificIndexVo
.
class
);
long
eqSpecId
=
equipmentSpecificIndex
.
getEquipmentSpecificId
();
EquipmentSpecificForRiskVo
equipmentSpecific
=
equipmentSpecificMapper
.
getOneById
(
eqSpecId
);
Equipment
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
eqSpecId
);
Toke
toke
=
remoteSecurityService
.
getServerToken
();
AlarmParam
deviceData
=
new
AlarmParam
();
deviceData
.
setMonitor
(
equipment
!=
null
?
equipment
.
getName
()
:
""
);
deviceData
.
setId
(
String
.
valueOf
(
equipmentSpecific
.
getId
()));
deviceData
.
setCode
(
equipmentSpecific
.
getCode
());
if
(
EquipmentRiskTypeEnum
.
HZGJ
.
getType
().
equals
(
equipmentSpecificIndex
.
getType
()))
{
//设备告警处理逻辑
log
.
info
(
"(报警)Message type is: "
+
equipmentSpecificIndex
.
getType
());
// 报警触发调用规则服务
executeDynamicPlan
(
deviceData
,
equipment
,
equipmentSpecific
,
toke
);
}
else
if
(
EquipmentRiskTypeEnum
.
GZ
.
getType
().
equals
(
equipmentSpecificIndex
.
getType
()))
{
// 设备故障处理逻辑
log
.
info
(
"(故障)Message type is: "
+
equipmentSpecificIndex
.
getType
());
long
equipId
=
0
;
if
(
StringUtil
.
isNotEmpty
(
equipment
))
{
equipId
=
equipment
.
getId
();
}
long
specificIndexId
=
equipmentSpecificIndex
.
getId
();
notifyAlarm
(
equipmentSpecificIndex
,
1
);
// 是否关联风险点
List
<
FmeaEquipmentPoint
>
list
=
fmeaEquipmentPointMapper
.
listFmeaByEquipIndexIdAndEquipId
(
specificIndexId
,
equipId
);
if
(
list
.
size
()
>
0
)
{
// 关联风险点进行rpn,rpni值的修改
list
.
forEach
(
fmeaEqPoint
->
{
long
fmeaId
=
fmeaEqPoint
.
getFmeaId
();
updateFmeaRpn
(
fmeaId
);
});
}
else
{
// 没有关联风险点,三维页面消息推送
fireEquipRuleMessagePush
(
deviceData
,
toke
);
}
}
else
{
// 向三维推送实时值修改
log
.
info
(
"(监测)Message type is: "
+
equipmentSpecificIndex
.
getType
());
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
// content.put("id", fireEquipmentData.getId());
// content.put("label", fireEquipmentData.getEqPointName());
// content.put("changeDate", fireEquipmentData.getCreateDate());
// content.put("orgCode", fireEquipment.getOrgCode());
// content.put("status", deviceData.getSoe());
content
.
put
(
"id"
,
"id"
);
content
.
put
(
"label"
,
"eqPointName"
);
content
.
put
(
"changeDate"
,
new
Date
());
content
.
put
(
"orgCode"
,
"orgCode"
);
content
.
put
(
"status"
,
deviceData
.
getSoe
());
iDataRefreshService
.
sendRefreshDataWithArea
(
View3dRefreshAreaEum
.
monitor_data
.
getCode
(),
content
);
String
title
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
"yinan"
,
"data/refresh/monitorData"
);
webMqttComponent
.
publish
(
title
,
JSON
.
toJSONString
(
view3dService
.
getEquipStatusList
(
equipmentSpecific
.
getOrgCode
())));
}
}
@Override
public
void
subscribeTopic
(
ReginParams
reginParams
)
{
// 若登录系统则订阅装备数据
webMqttSubscribe
.
adapter
.
removeTopic
(
defaultTopic
);
String
orgCode
=
reginParams
.
getCompany
().
getOrgCode
();
String
topic
=
String
.
format
(
"%s.%s.%s%s"
,
serverName
,
orgCode
,
"equipment"
,
"/#"
);
String
[]
strs
=
webMqttSubscribe
.
adapter
.
getTopic
();
List
<
String
>
list
=
Stream
.
of
(
strs
).
collect
(
Collectors
.
toList
());
if
(
list
.
size
()
>
0
)
{
list
.
forEach
(
x
->
{
if
(!(
x
.
equals
(
topic
)))
{
webMqttSubscribe
.
adapter
.
addTopic
(
topic
);
}
});
}
else
{
webMqttSubscribe
.
adapter
.
addTopic
(
topic
);
}
}
/**
* <pre>
* @Description: rpn,rpni值修改
* </pre>
*
* @MethodName:
* @Param: [fmeaId]
* @Return: void
* @Throws
* @Author keyong
* @Date 2020/11/16 18:26
*/
public
void
updateFmeaRpn
(
long
fmeaId
)
{
Fmea
fmea
=
fmeaMapper
.
getById
(
fmeaId
);
BigDecimal
oidValue
=
new
BigDecimal
(
fmea
.
getOidValue
());
BigDecimal
sidValue
=
new
BigDecimal
(
fmea
.
getSidValue
());
BigDecimal
didValue
=
new
BigDecimal
(
fmea
.
getDidValue
());
// 计算rpni
BigDecimal
rpni
=
oidValue
.
multiply
(
sidValue
).
multiply
(
didValue
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
rpn
;
if
(
fmea
.
getNewEvaluationOid
()
==
null
)
{
EvaluationModel
evaluationModel
=
this
.
getEvaluationModel
(
fmeaId
);
if
(
evaluationModel
!=
null
)
{
// 已经绑定点位或者巡检点项且匹配到风险模型,则更新为计算后的结果
BigDecimal
newOidValue
=
new
BigDecimal
(
evaluationModel
.
getCoefficient
());
rpn
=
newOidValue
.
multiply
(
sidValue
).
multiply
(
didValue
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
fmea
.
setNewEvaluationOid
(
evaluationModel
.
getId
());
}
else
{
// 未绑定点位或者巡检点项或者匹配不到风险模型,则更新为rpn与rpni一致
fmea
.
setNewEvaluationOid
(
fmea
.
getEvaluationOid
());
rpn
=
rpni
;
}
}
else
{
BigDecimal
newOidValue
=
new
BigDecimal
(
fmea
.
getNewOidValue
());
rpn
=
newOidValue
.
multiply
(
sidValue
).
multiply
(
didValue
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
fmea
.
setRpni
(
rpni
);
fmea
.
setRpn
(
rpn
);
// 更新fmea
fmeaMapper
.
updateRpn
(
fmea
);
}
/**
* <pre>
* @Description: 设备消息规则推送
* </pre>
*
* @MethodName:
* @Param: [deviceData, toke]
* @Return: void
* @Throws
* @Author keyong
* @Date 2020/11/16 18:26
*/
@Async
void
fireEquipRuleMessagePush
(
AlarmParam
deviceData
,
Toke
toke
)
{
String
bacthNo
=
UUID
.
randomUUID
().
toString
();
FireEquimentDataRo
fireEquimentDataRo
=
new
FireEquimentDataRo
();
deviceData
.
setBatchNo
(
bacthNo
);
BeanUtils
.
copyProperties
(
deviceData
,
fireEquimentDataRo
);
try
{
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
log
.
info
(
"设备消息规则推送"
+
JSONObject
.
toJSONString
(
deviceData
));
ruleTrigger
.
publish
(
fireEquimentDataRo
,
"风险管控/fireEquiment"
,
null
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
/**
* <pre>
* @Description: 故障通知
* </pre>
*
* @MethodName:
* @Param: [fireEquipmentPoint, param]
* @Return: void
* @Throws
* @Author keyong
* @Date 2020/11/16 15:25
*/
private
void
notifyAlarm
(
EquipmentSpecificIndexVo
equipmentSpecificIndex
,
int
state
)
{
List
<
FmeaEquipmentPoint
>
fmeaEquipmentPoints
=
fmeaEquipmentPointMapper
.
listByEquipmentPointId
(
equipmentSpecificIndex
.
getId
());
Set
<
Long
>
fmeaIds
=
Sets
.
newHashSet
();
List
<
Long
>
ids
=
Lists
.
newArrayList
();
fmeaEquipmentPoints
.
forEach
(
fmeaEquipmentPoint
->
{
ids
.
add
(
fmeaEquipmentPoint
.
getId
());
fmeaIds
.
add
(
fmeaEquipmentPoint
.
getFmeaId
());
});
if
(
ids
.
size
()
>
0
)
{
fmeaEquipmentPointMapper
.
updateStateByIds
(
state
,
ids
);
}
final
Integer
st
=
state
;
String
monitor
=
equipmentSpecificMapper
.
findEquipNameById
(
equipmentSpecificIndex
.
getEquipmentSpecificId
());
RsDataQueue
rsDataQueue
=
RsDataQueue
.
getInstance
();
fmeaIds
.
forEach
(
fmeaId
->
rsDataQueue
.
addEquipmentMessage
(
fmeaId
,
monitor
,
st
));
}
private
EvaluationModel
getEvaluationModel
(
Long
fmeaId
)
{
List
<
FmeaEquipmentPoint
>
equipmentPoints
=
fmeaEquipmentPointMapper
.
listFmeaByFmeaId
(
fmeaId
);
List
<
FmeaPointInputitem
>
pointInputitems
=
fmeaPointInputitemMapper
.
listFmeaByFmeaId
(
fmeaId
);
Double
maxRate
=
RpnUtils
.
getMaxRate
(
equipmentPoints
,
pointInputitems
);
if
(
maxRate
!=
null
)
{
List
<
EvaluationModel
>
oModels
=
iEvaluationModelDao
.
findAllByType
(
"O"
);
EvaluationModel
oEvaluationModel
=
getBetweenModel
(
maxRate
,
oModels
);
return
oEvaluationModel
;
}
return
null
;
}
private
EvaluationModel
getBetweenModel
(
Double
maxRate
,
List
<
EvaluationModel
>
oModels
)
{
for
(
EvaluationModel
model
:
oModels
)
{
String
str
=
model
.
getDescribe
().
replaceAll
(
"O"
,
maxRate
.
toString
());
if
(
JexlUtil
.
convertToCode
(
str
))
{
return
model
;
}
}
return
null
;
}
/**
* <pre>
* @Description: 火警执行动态预案
* </pre>
*
* @MethodName:
* @Param:
* @Return: null
* @Throws
* @Author keyong
* @Date 2020/11/11 20:46
*/
@Async
void
executeDynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
EquipmentSpecificForRiskVo
equipmentSpecific
,
Toke
toke
)
{
String
batchNo
=
UUID
.
randomUUID
().
toString
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
alarmContingency
(
batchNo
,
equipmentSpecific
,
equipment
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
alarmContingency
(
String
batchNo
,
EquipmentSpecificForRiskVo
equipmentSpecific
,
Equipment
equipment
)
throws
Exception
{
Object
oldContingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
ContingencyRo
contingencyRo
=
new
ContingencyRo
();
contingencyRo
.
setBatchNo
(
batchNo
);
contingencyRo
.
setEquipmentId
(
String
.
valueOf
(
equipment
.
getId
()));
contingencyRo
.
setEquipmentName
(
equipment
.
getName
());
contingencyRo
.
setFireEquipmentId
(
String
.
valueOf
(
equipmentSpecific
.
getId
()));
contingencyRo
.
setFireEquipmentName
(
equipmentSpecific
.
getName
());
contingencyRo
.
setStep
(
SetpEnum
.
STEP0
.
getValue
());
contingencyRo
.
setConfirm
(
"NONE"
);
contingencyRo
.
setFireTruckRoute
(
equipment
.
getFireTruckRoute
());
contingencyRo
.
setRunstep
(
false
);
contingencyRo
.
setEquipmentPosition3d
(
equipment
.
getPosition3d
());
contingencyRo
.
setEquipmentCode
(
equipment
.
getCode
());
contingencyRo
.
setEquipmentOrgCode
(
equipment
.
getOrgCode
());
// Map cameraInfo = impAndFireEquipMapper.queryForCamera(String.valueOf(equipment.getId()));//查询重点设备关联视频点位,暂不处理
//
// if (cameraInfo != null) {
// contingencyRo.setCameraCodes(String.valueOf(cameraInfo.get("codes")));
// contingencyRo.setCameraIds(String.valueOf(cameraInfo.get("ids")));
// }
// contingencyRo.setMobile("13259783333");
// contingencyRo.setAdminName("admin");
// contingencyRo.setFireEquipmentPosition(fireEquipment.getPosition3d());
List
<
PreplanPicture
>
pictures
=
iPreplanPictureDao
.
findByEquipmentId
(
Long
.
valueOf
(
equipment
.
getId
()));
if
(!
CollectionUtils
.
isEmpty
(
pictures
))
{
for
(
PreplanPicture
picture
:
pictures
)
{
if
(
1
==
picture
.
getType
())
{
contingencyRo
.
setPicture1
(
picture
.
getPicture
());
}
if
(
2
==
picture
.
getType
())
{
contingencyRo
.
setPicture2
(
picture
.
getPicture
());
}
if
(
3
==
picture
.
getType
())
{
contingencyRo
.
setPicture3
(
picture
.
getPicture
());
}
if
(
4
==
picture
.
getType
())
{
contingencyRo
.
setPicture4
(
picture
.
getPicture
());
}
}
}
// 获取遥信指标,暂不处理 code = 设备编码iot_code-指标项name_key
List
<
Map
>
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"SWITCH"
);
//物联属性指标 and 为true或false
HashMap
<
String
,
Integer
>
telesignallingMap
=
new
HashMap
<>();
for
(
Map
map
:
points
)
{
telesignallingMap
.
put
(
map
.
get
(
"code"
)
+
""
,
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
||
"false"
.
equals
(
map
.
get
(
"value"
).
toString
()))
?
0
:
1
);
}
contingencyRo
.
setTelesignallingMap
(
telesignallingMap
);
// 获取遥测指标
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"ANALOGUE"
);
//物联指标 非 true false
HashMap
<
String
,
Double
>
telemetryMap
=
new
HashMap
<>();
for
(
Map
map
:
points
)
{
telemetryMap
.
put
(
map
.
get
(
"code"
)
+
""
,
Double
.
valueOf
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
?
"0"
:
map
.
get
(
"value"
).
toString
()));
}
contingencyRo
.
setTelemetryMap
(
telemetryMap
);
log
.
debug
(
"开始调用规则"
);
Object
result
=
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
log
.
debug
(
"规则调用返回=="
,
result
);
ContingencyOriginalData
contingencyOriginalData
=
new
ContingencyOriginalData
();
BeanUtils
.
copyProperties
(
contingencyRo
,
contingencyOriginalData
);
iContingencyOriginalDataDao
.
save
(
contingencyOriginalData
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
79838267
...
@@ -621,7 +621,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -621,7 +621,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
contingencyRo
.
setEquipmentCode
(
equipment
.
getCode
());
contingencyRo
.
setEquipmentCode
(
equipment
.
getCode
());
contingencyRo
.
setEquipmentOrgCode
(
equipment
.
getOrgCode
());
contingencyRo
.
setEquipmentOrgCode
(
equipment
.
getOrgCode
());
Map
cameraInfo
=
impAndFireEquipMapper
.
queryForCamera
(
String
.
valueOf
(
equipment
.
getId
()));
Map
cameraInfo
=
impAndFireEquipMapper
.
queryForCamera
(
String
.
valueOf
(
equipment
.
getId
()));
//查询重点设备关联视频点位,暂不处理
if
(
cameraInfo
!=
null
)
{
if
(
cameraInfo
!=
null
)
{
contingencyRo
.
setCameraCodes
(
String
.
valueOf
(
cameraInfo
.
get
(
"codes"
)));
contingencyRo
.
setCameraCodes
(
String
.
valueOf
(
cameraInfo
.
get
(
"codes"
)));
...
@@ -648,15 +648,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -648,15 +648,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
}
}
}
}
// 获取遥信指标
List
<
Map
>
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"SWITCH"
);
// 获取遥信指标,暂不处理 ---20201111 code = 设备编码iot_code-指标项name_key
List
<
Map
>
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"SWITCH"
);
//物联属性指标 and 为true或false
HashMap
<
String
,
Integer
>
telesignallingMap
=
new
HashMap
<>();
HashMap
<
String
,
Integer
>
telesignallingMap
=
new
HashMap
<>();
for
(
Map
map
:
points
)
{
for
(
Map
map
:
points
)
{
telesignallingMap
.
put
(
map
.
get
(
"code"
)
+
""
,
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
||
"false"
.
equals
(
map
.
get
(
"value"
).
toString
()))
?
0
:
1
);
telesignallingMap
.
put
(
map
.
get
(
"code"
)
+
""
,
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
||
"false"
.
equals
(
map
.
get
(
"value"
).
toString
()))
?
0
:
1
);
}
}
contingencyRo
.
setTelesignallingMap
(
telesignallingMap
);
contingencyRo
.
setTelesignallingMap
(
telesignallingMap
);
// 获取遥测指标
// 获取遥测指标
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"ANALOGUE"
);
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"ANALOGUE"
);
//物联指标 非 true false
HashMap
<
String
,
Double
>
telemetryMap
=
new
HashMap
<>();
HashMap
<
String
,
Double
>
telemetryMap
=
new
HashMap
<>();
for
(
Map
map
:
points
)
{
for
(
Map
map
:
points
)
{
telemetryMap
.
put
(
map
.
get
(
"code"
)
+
""
,
Double
.
valueOf
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
?
"0"
:
map
.
get
(
"value"
).
toString
()));
telemetryMap
.
put
(
map
.
get
(
"code"
)
+
""
,
Double
.
valueOf
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
?
"0"
:
map
.
get
(
"value"
).
toString
()));
...
@@ -933,7 +934,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -933,7 +934,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
)){
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
)){
fireEquipmentPoint
.
setValue
(
deviceData
.
getState
());
fireEquipmentPoint
.
setValue
(
deviceData
.
getState
());
updateFirePointValue
(
fireEquipmentPoint
.
getId
(),
deviceData
.
getState
());
updateFirePointValue
(
fireEquipmentPoint
.
getId
(),
deviceData
.
getState
());
//不需要
String
fireEquipmentPointType
=
null
;
String
fireEquipmentPointType
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
.
getAlarmType
()))
{
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
.
getAlarmType
()))
{
...
@@ -963,7 +964,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -963,7 +964,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
deviceRo
.
setPointCode
(
deviceData
.
getPointCode
());
deviceRo
.
setPointCode
(
deviceData
.
getPointCode
());
deviceRo
.
setValue
(
deviceData
.
getState
());
deviceRo
.
setValue
(
deviceData
.
getState
());
triggerPlanDevice
(
deviceRo
,
equipment
,
toke
);
triggerPlanDevice
(
deviceRo
,
equipment
,
toke
);
Boolean
have
=
impAndFireEquipMapper
.
existsAlarmPointByEqpPointIdAndEquipId
(
fireEquipmentPoint
.
getId
(),
equipment
.
getId
());
Boolean
have
=
impAndFireEquipMapper
.
existsAlarmPointByEqpPointIdAndEquipId
(
fireEquipmentPoint
.
getId
(),
equipment
.
getId
());
//判断重点设备关联该指标项,需要修改为新查询
if
(!
ObjectUtils
.
isEmpty
(
have
)
&&
have
)
{
if
(!
ObjectUtils
.
isEmpty
(
have
)
&&
have
)
{
//动态预案执行
//动态预案执行
dynamicPlan
(
deviceData
,
equipment
,
fireEquipment
,
toke
);
dynamicPlan
(
deviceData
,
equipment
,
fireEquipment
,
toke
);
...
@@ -1037,7 +1038,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1037,7 +1038,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
map
.
put
(
"value"
,
param
.
getState
());
map
.
put
(
"value"
,
param
.
getState
());
map
.
put
(
"id"
,
param
.
getPointCode
());
map
.
put
(
"id"
,
param
.
getPointCode
());
Map
<
String
,
Map
<
String
,
Object
>>
riskSourceMap
=
new
HashMap
();
Map
<
String
,
Map
<
String
,
Object
>>
riskSourceMap
=
new
HashMap
();
riskSourceMap
.
put
(
"equipments"
,
map
);
riskSourceMap
.
put
(
"equipments"
,
map
);
//这个需要确认下
remoteWebSocketServer
.
sendMessage
(
"equipmentMode"
,
JSON
.
toJSONString
(
riskSourceMap
));
remoteWebSocketServer
.
sendMessage
(
"equipmentMode"
,
JSON
.
toJSONString
(
riskSourceMap
));
// 推送设备状态信息
// 推送设备状态信息
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IEquipmentHandlerService.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
com.yeejoin.amos.fas.business.vo.ReginParams
;
/**
* @author keyong
* @title: IEquipmentHandler
* <pre>
* @description: 站端接受装备信息系统数据处理流程
* </pre>
* @date 2020/11/10 18:01
*/
public
interface
IEquipmentHandlerService
{
void
handlerMqttMessage
(
String
topic
,
String
message
);
void
subscribeTopic
(
ReginParams
reginParams
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/EquipmentSpecificForRiskVo.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author keyong
* @title: EquipmentSpecificForRiskVo
* <pre>
* @description: 实体装备Vo
* </pre>
* @date 2020/11/17 19:38
*/
@Data
public
class
EquipmentSpecificForRiskVo
{
@ApiModelProperty
(
value
=
"id"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"equipName"
)
private
String
name
;
@ApiModelProperty
(
value
=
"code"
)
private
String
code
;
@ApiModelProperty
(
value
=
"systemName"
)
private
String
systemName
;
@ApiModelProperty
(
value
=
"detailid"
)
private
Long
equipmentDetailId
;
@ApiModelProperty
(
value
=
"二维码"
)
private
String
qrCode
;
@ApiModelProperty
(
value
=
"管理方式(默认单件)"
)
private
int
single
;
@ApiModelProperty
(
value
=
"所属系统"
)
private
int
systemId
;
@ApiModelProperty
(
value
=
"物联code"
)
private
String
iotCode
;
@ApiModelProperty
(
value
=
"orgCode"
)
private
String
orgCode
;
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/EquipmentSpecificIndexVo.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
/**
* @author keyong
* @title: EquipmentSpecificIndexVo
* <pre>
* @description: 装备性能指标Vo
* </pre>
* @date 2020/11/11 16:49
*/
public
class
EquipmentSpecificIndexVo
{
// id
private
long
id
;
// 装备id
private
Long
equipmentSpecificId
;
// 性能指标value
private
String
value
;
// 性能指标id
private
Long
equipmentIndexId
;
// 性能指标name key
private
String
nameKey
;
// 装备编码
private
String
code
;
// 物联编码
private
String
iotCode
;
// 订阅类型
private
String
type
;
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
long
getId
()
{
return
id
;
}
public
void
setIotCode
(
String
iotCode
)
{
this
.
iotCode
=
iotCode
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getIotCode
()
{
return
iotCode
;
}
public
String
getType
()
{
return
type
;
}
public
Long
getEquipmentSpecificId
()
{
return
equipmentSpecificId
;
}
public
String
getValue
()
{
return
value
;
}
public
Long
getEquipmentIndexId
()
{
return
equipmentIndexId
;
}
public
String
getNameKey
()
{
return
nameKey
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setEquipmentSpecificId
(
Long
equipmentSpecificId
)
{
this
.
equipmentSpecificId
=
equipmentSpecificId
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
void
setEquipmentIndexId
(
Long
equipmentIndexId
)
{
this
.
equipmentIndexId
=
equipmentIndexId
;
}
public
void
setNameKey
(
String
nameKey
)
{
this
.
nameKey
=
nameKey
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
EquipmentSpecificIndexVo
()
{
}
public
EquipmentSpecificIndexVo
(
Long
equipmentSpecificId
,
String
value
,
Long
equipmentIndexId
,
String
nameKey
,
String
code
,
String
iotCode
,
String
type
)
{
this
.
equipmentSpecificId
=
equipmentSpecificId
;
this
.
value
=
value
;
this
.
equipmentIndexId
=
equipmentIndexId
;
this
.
nameKey
=
nameKey
;
this
.
code
=
code
;
this
.
iotCode
=
iotCode
;
this
.
type
=
type
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/TopicEntityVo.java
0 → 100644
View file @
79838267
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
/**
* @author keyong
* @title: TopicEntityVo
* <pre>
* @description: TODO
* </pre>
* @date 2020/11/13 10:02
*/
@Data
@ApiModel
(
description
=
"订阅主题Vo"
)
public
class
TopicEntityVo
{
private
String
topic
;
private
String
iotCode
;
private
String
message
;
private
String
type
;
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/PermissionAspect.java
View file @
79838267
...
@@ -4,6 +4,7 @@ package com.yeejoin.amos.fas.config;
...
@@ -4,6 +4,7 @@ package com.yeejoin.amos.fas.config;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.vo.DepartmentBo
;
import
com.yeejoin.amos.fas.business.vo.DepartmentBo
;
import
com.yeejoin.amos.fas.business.vo.RoleBo
;
import
com.yeejoin.amos.fas.business.vo.RoleBo
;
...
@@ -16,6 +17,7 @@ import org.slf4j.Logger;
...
@@ -16,6 +17,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -52,6 +54,7 @@ public class PermissionAspect {
...
@@ -52,6 +54,7 @@ public class PermissionAspect {
@Autowired
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
private
RemoteSecurityService
remoteSecurityService
;
// 前置通知,在方法执行之前
// 前置通知,在方法执行之前
@Before
(
value
=
"@annotation(Permission)"
)
@Before
(
value
=
"@annotation(Permission)"
)
public
void
PermissionCheck
(
JoinPoint
joinPoint
)
throws
PermissionException
{
public
void
PermissionCheck
(
JoinPoint
joinPoint
)
throws
PermissionException
{
...
@@ -75,44 +78,44 @@ public class PermissionAspect {
...
@@ -75,44 +78,44 @@ public class PermissionAspect {
if
(
joinPoint
.
getSignature
().
getName
().
equals
(
"saveCurCompany"
))
{
if
(
joinPoint
.
getSignature
().
getName
().
equals
(
"saveCurCompany"
))
{
return
;
return
;
}
}
FeignClientResult
feignClientResult
;
//
FeignClientResult feignClientResult;
AgencyUserModel
userModel
=
null
;
//
AgencyUserModel userModel=null;
try
{
//
try {
feignClientResult
=
Privilege
.
agencyUserClient
.
getme
();
//
feignClientResult = Privilege.agencyUserClient.getme();
userModel
=
(
AgencyUserModel
)
feignClientResult
.
getResult
();
//
userModel = (AgencyUserModel) feignClientResult.getResult();
//
}
catch
(
InnerInvokException
e
)
{
//
} catch (InnerInvokException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
String
userId
=
null
;
//
String userId = null;
ReginParams
regionParam
=
new
ReginParams
();
//
ReginParams regionParam = new ReginParams();
if
(
userModel
!=
null
){
//
if(userModel != null){
userId
=
userModel
.
getUserId
();
//
userId = userModel.getUserId();
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
userModel
.
getOrgRoles
();
//
Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
List
<
RoleModel
>
roleModels
=
null
;
//
List<RoleModel> roleModels = null;
if
(!
ObjectUtils
.
isEmpty
(
orgRoles
))
{
//
if(!ObjectUtils.isEmpty(orgRoles)) {
for
(
Map
.
Entry
<
Long
,
List
<
RoleModel
>>
entry
:
orgRoles
.
entrySet
())
{
//
for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
roleModels
=
entry
.
getValue
();
//
roleModels = entry.getValue();
break
;
//
break;
}
//
}
}
//
}
ReginParams
reginParams
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
userModel
.
getUserId
(),
token
)),
ReginParams
.
class
);
//
ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
if
(
reginParams
==
null
&&
userModel
.
getCompanys
().
size
()
>
0
){
//
if(reginParams == null && userModel.getCompanys().size() > 0){
CompanyModel
companyModel
=
userModel
.
getCompanys
().
get
(
0
);
//
CompanyModel companyModel = userModel.getCompanys().get(0);
//
List
<
DepartmentModel
>
deptList
=
remoteSecurityService
.
getDepartmentTreeByCompanyId
(
token
,
product
,
appKey
,
companyModel
.
getSequenceNbr
().
toString
());
//
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
if
(
deptList
.
size
()
>
0
){
//
if(deptList.size() > 0){
CompanyBo
companyBo
=
convertCompanyModelToBo
(
companyModel
);
//
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo
departmentBo
=
convertDepartmentModelToBo
(
deptList
.
get
(
0
));
//
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
regionParam
.
setCompany
(
companyBo
);
//
regionParam.setCompany(companyBo);
regionParam
.
setDepartment
(
departmentBo
);
//
regionParam.setDepartment(departmentBo);
}
//
}
if
(!
ObjectUtils
.
isEmpty
(
roleModels
)){
//
if(!ObjectUtils.isEmpty(roleModels)){
regionParam
.
setRole
(
convertRoleModelToBo
(
roleModels
.
get
(
0
)));
//
regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
}
//
}
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
regionParam
));
//
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
}
//
}
}
//
}
}
}
private
DepartmentBo
convertDepartmentModelToBo
(
DepartmentModel
departmentModel
){
private
DepartmentBo
convertDepartmentModelToBo
(
DepartmentModel
departmentModel
){
...
...
YeeAmosFireAutoSysStart/src/main/resources/application-dev.properties
View file @
79838267
...
@@ -52,6 +52,9 @@ emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
...
@@ -52,6 +52,9 @@ emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker
=
tcp://172.16.10.85:1883
emqx.broker
=
tcp://172.16.10.85:1883
emqx.user-name
=
super
emqx.user-name
=
super
emqx.password
=
a123456
emqx.password
=
a123456
# 只用于初始化
emqx.defaultTopic
=
mqtt_topic
Push.fegin.name
=
APPMESSAGEPUSHSERVICE-36
Push.fegin.name
=
APPMESSAGEPUSHSERVICE-36
...
...
YeeAmosFireAutoSysStart/src/main/resources/application.properties
View file @
79838267
...
@@ -46,8 +46,8 @@ spring.servlet.multipart.max-request-size=20MB
...
@@ -46,8 +46,8 @@ spring.servlet.multipart.max-request-size=20MB
#feginName
#feginName
visual.fegin.name
=
maas-visual
visual.fegin.name
=
maas-visual
dutyMode.fegin.name
=
AMOSDUTYMODE
dutyMode.fegin.name
=
AMOSDUTYMODE
#队站装备管理名称,主要用于风险区域同步至仓库货位
#队站装备管理名称,主要用于风险区域同步至仓库货位
和订阅装备信息系统
equipManage.fegin.name
=
AMOS-EQUIPMANAGE
-ZZY
equipManage.fegin.name
=
AMOS-EQUIPMANAGE
#是否开启将风险区域同步至仓库货位true开启,false关闭。默认关闭。
#是否开启将风险区域同步至仓库货位true开启,false关闭。默认关闭。
equipManage.fegin.isSyn
=
false
equipManage.fegin.isSyn
=
false
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_equipment_specific.xml
View file @
79838267
...
@@ -145,4 +145,31 @@
...
@@ -145,4 +145,31 @@
</if>
</if>
limit #{pageNumber},#{pageSize}
limit #{pageNumber},#{pageSize}
</select>
</select>
<select
id=
"findEquipNameById"
resultType=
"String"
>
select
wed.name
from
wl_equipment_specific wes
left join
wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
where
wes.id=#{id}
</select>
<select
id=
"getOneById"
resultType=
"com.yeejoin.amos.fas.business.vo.EquipmentSpecificForRiskVo"
>
select
wes.id as id,
wed.name as name,
wes.equipment_detail_id as equipmentDetailId,
wes.qr_code as qrCode,
wes.code as code,
wes.org_code as orgCode
from
wl_equipment_specific wes
left join
wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
where
wes.id=#{id}
</select>
</mapper>
</mapper>
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_fmea_equipment_point.xml
View file @
79838267
...
@@ -160,4 +160,17 @@
...
@@ -160,4 +160,17 @@
</foreach>
</foreach>
</update>
</update>
<select
id=
"listFmeaByEquipIndexIdAndEquipId"
resultType=
"com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint"
>
select
id,
fmea_id as fmeaId,
equipment_point_id as equipmentPointId,
state,
important_equipment_id as importantEquipmentId
from
f_fmea_equipment_point
where
equipment_point_id = #{specificIndexId} and important_equipment_id = #{equipId}
</select>
</mapper>
</mapper>
\ No newline at end of file
pom.xml
View file @
79838267
...
@@ -193,6 +193,16 @@
...
@@ -193,6 +193,16 @@
<artifactId>
jpush-client
</artifactId>
<artifactId>
jpush-client
</artifactId>
<version>
3.3.10
</version>
<version>
3.3.10
</version>
</dependency>
</dependency>
<!-- MQTT依赖 -->
<dependency>
<groupId>
org.springframework.integration
</groupId>
<artifactId>
spring-integration-stream
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.integration
</groupId>
<artifactId>
spring-integration-mqtt
</artifactId>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
...
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