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
95526117
Commit
95526117
authored
Dec 29, 2020
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.区域建筑关系建立
parent
52af9353
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
290 additions
and
251 deletions
+290
-251
BasicEntity.java
...ain/java/com/yeejoin/amos/fas/dao/entity/BasicEntity.java
+3
-1
RiskSource.java
...main/java/com/yeejoin/amos/fas/dao/entity/RiskSource.java
+13
-0
RiskSourceController.java
...in/amos/fas/business/controller/RiskSourceController.java
+29
-25
IRiskSourceDao.java
...join/amos/fas/business/dao/repository/IRiskSourceDao.java
+2
-1
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+187
-222
IRiskSourceService.java
...n/amos/fas/business/service/intfc/IRiskSourceService.java
+16
-0
ManulInsertGenerator.java
...ava/com/yeejoin/amos/fas/config/ManulInsertGenerator.java
+25
-0
fas-2.0.1.xml
...utoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
+12
-0
dbTemplate_fire_equip.xml
...rt/src/main/resources/db/mapper/dbTemplate_fire_equip.xml
+3
-2
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/BasicEntity.java
View file @
95526117
...
@@ -10,6 +10,7 @@ import javax.persistence.GenerationType;
...
@@ -10,6 +10,7 @@ import javax.persistence.GenerationType;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
import
javax.persistence.MappedSuperclass
;
import
javax.persistence.MappedSuperclass
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
...
@@ -38,7 +39,8 @@ public class BasicEntity /*extends Resource*/ implements Serializable{
...
@@ -38,7 +39,8 @@ public class BasicEntity /*extends Resource*/ implements Serializable{
private
Date
createDate
=
new
Date
();
private
Date
createDate
=
new
Date
();
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
,
generator
=
"myid"
)
@GenericGenerator
(
name
=
"myid"
,
strategy
=
"com.yeejoin.amos.fas.config.ManulInsertGenerator"
)
@Column
(
name
=
"ID"
,
nullable
=
false
,
unique
=
true
)
@Column
(
name
=
"ID"
,
nullable
=
false
,
unique
=
true
)
public
long
getId
()
{
public
long
getId
()
{
return
id
;
return
id
;
...
...
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/RiskSource.java
View file @
95526117
...
@@ -79,6 +79,19 @@ public class RiskSource extends BasicEntity {
...
@@ -79,6 +79,19 @@ public class RiskSource extends BasicEntity {
private
String
routePath
;
private
String
routePath
;
/**
/**
* 同步源id
*/
private
Long
sourceId
;
public
Long
getSourceId
()
{
return
sourceId
;
}
public
void
setSourceId
(
Long
sourceId
)
{
this
.
sourceId
=
sourceId
;
}
/**
* 闪烁频率
* 闪烁频率
*/
*/
@Column
(
name
=
"flicker_frequency"
)
@Column
(
name
=
"flicker_frequency"
)
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/RiskSourceController.java
View file @
95526117
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo
;
import
com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo
;
import
com.yeejoin.amos.fas.business.action.model.ProtalDataRo
;
import
com.yeejoin.amos.fas.business.action.model.ProtalDataRo
;
...
@@ -36,10 +14,22 @@ import com.yeejoin.amos.fas.core.common.request.CommonPageable;
...
@@ -36,10 +14,22 @@ import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RestController
@RequestMapping
(
"/api/risksource"
)
@RequestMapping
(
"/api/risksource"
)
...
@@ -47,8 +37,6 @@ import io.swagger.annotations.ApiParam;
...
@@ -47,8 +37,6 @@ import io.swagger.annotations.ApiParam;
public
class
RiskSourceController
extends
BaseController
{
public
class
RiskSourceController
extends
BaseController
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
RiskSourceController
.
class
);
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
RiskSourceController
.
class
);
private
final
static
String
IS_RISK_AREA
=
"TRUE"
;
@Autowired
@Autowired
IRiskFactorService
iRiskFactorService
;
IRiskFactorService
iRiskFactorService
;
...
@@ -734,4 +722,20 @@ public class RiskSourceController extends BaseController {
...
@@ -734,4 +722,20 @@ public class RiskSourceController extends BaseController {
public
CommonResponse
queryFmeaByPointId
(
@PathVariable
Long
pointId
)
{
public
CommonResponse
queryFmeaByPointId
(
@PathVariable
Long
pointId
)
{
return
CommonResponseUtil
.
success
(
riskSourceService
.
queryFmeaByPointId
(
pointId
));
return
CommonResponseUtil
.
success
(
riskSourceService
.
queryFmeaByPointId
(
pointId
));
}
}
@Permission
@ApiOperation
(
value
=
"同步风险区域"
,
notes
=
"创建或者更新,对站调用"
)
@PostMapping
(
"/syn/region"
)
public
CommonResponse
synRegion
(
@RequestBody
List
<
RiskSource
>
list
){
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
compCode
=
getOrgCode
(
reginParams
);
return
CommonResponseUtil
.
success
(
riskSourceService
.
synRegion
(
getUserId
(),
compCode
,
list
));
}
@Permission
@ApiOperation
(
value
=
"删除建筑与风险区域关系"
,
notes
=
"对站调用"
)
@PutMapping
(
"/remove/bind"
)
public
CommonResponse
removeBind
(
@RequestParam
Long
instanceId
){
return
CommonResponseUtil
.
success
(
riskSourceService
.
removeBind
(
instanceId
));
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IRiskSourceDao.java
View file @
95526117
...
@@ -35,10 +35,11 @@ public interface IRiskSourceDao extends BaseDao<RiskSource, Long> {
...
@@ -35,10 +35,11 @@ public interface IRiskSourceDao extends BaseDao<RiskSource, Long> {
@Query
(
value
=
"select *from f_risk_source where is_region = 'TRUE' and parent_id > 0"
,
nativeQuery
=
true
)
@Query
(
value
=
"select *from f_risk_source where is_region = 'TRUE' and parent_id > 0"
,
nativeQuery
=
true
)
List
<
RiskSource
>
queryRiskAreaRpn
();
List
<
RiskSource
>
queryRiskAreaRpn
();
Optional
<
RiskSource
>
findByOrgCodeAndParentId
(
String
orgCode
,
Long
parentId
);
Optional
<
RiskSource
>
findByOrgCodeAndParentId
(
String
orgCode
,
Long
parentId
);
List
<
RiskSource
>
findByParentIdAndIsRegion
(
long
id
,
String
string
);
List
<
RiskSource
>
findByParentIdAndIsRegion
(
long
id
,
String
string
);
Optional
<
RiskSource
>
findByCode
(
String
riskSourceCode
);
Optional
<
RiskSource
>
findByCode
(
String
riskSourceCode
);
List
<
RiskSource
>
findBySourceId
(
Long
instanceId
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
95526117
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.Collectors
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
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.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.cache.Redis
;
import
org.typroject.tyboot.component.cache.enumeration.CacheType
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -49,39 +8,12 @@ import com.google.common.collect.Lists;
...
@@ -49,39 +8,12 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.fas.business.action.model.CheckInputItemRo
;
import
com.yeejoin.amos.fas.business.action.model.*
;
import
com.yeejoin.amos.fas.business.action.model.ContingencyRo
;
import
com.yeejoin.amos.fas.business.action.model.DeviceRo
;
import
com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo
;
import
com.yeejoin.amos.fas.business.action.model.ProtalDataRo
;
import
com.yeejoin.amos.fas.business.action.model.RiskSourceRuleRo
;
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.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.bo.BindRegionBo
;
import
com.yeejoin.amos.fas.business.bo.*
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgBo
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgContentBo
;
import
com.yeejoin.amos.fas.business.bo.MsgParamBo
;
import
com.yeejoin.amos.fas.business.bo.RpnCalculationBo
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaEquipmentPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaPointInputitemMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.RiskSourceMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IAlarmDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IDictDao
;
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.IFireEquipmentDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentPointDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRpnChangeLogDao
;
import
com.yeejoin.amos.fas.business.feign.IEquipManageFeign
;
import
com.yeejoin.amos.fas.business.feign.IEquipManageFeign
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer
;
import
com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer
;
...
@@ -91,17 +23,9 @@ import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
...
@@ -91,17 +23,9 @@ import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import
com.yeejoin.amos.fas.business.param.AlarmParam
;
import
com.yeejoin.amos.fas.business.param.AlarmParam
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.business.param.FmeaBindParam
;
import
com.yeejoin.amos.fas.business.param.FmeaBindParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService
;
import
com.yeejoin.amos.fas.business.service.intfc.*
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.service.intfc.IView3dService
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.*
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.util.DateUtils
;
import
com.yeejoin.amos.fas.business.util.JexlUtil
;
import
com.yeejoin.amos.fas.business.util.RpnUtils
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo
;
import
com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
...
@@ -109,30 +33,45 @@ import com.yeejoin.amos.fas.business.vo.TopicEntityVo;
...
@@ -109,30 +33,45 @@ import com.yeejoin.amos.fas.business.vo.TopicEntityVo;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.common.enums.CheckStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.CheckStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum
;
import
com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum
;
import
com.yeejoin.amos.fas.common.enums.RiskSourceRegionEum
;
import
com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum
;
import
com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.response.RegionTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RegionTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.StringUtil
;
import
com.yeejoin.amos.fas.core.util.StringUtil
;
import
com.yeejoin.amos.fas.dao.entity.Alarm
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData
;
import
com.yeejoin.amos.fas.dao.entity.Dict
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.EvaluationModel
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipmentData
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipmentPoint
;
import
com.yeejoin.amos.fas.dao.entity.Fmea
;
import
com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint
;
import
com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem
;
import
com.yeejoin.amos.fas.dao.entity.PreplanPicture
;
import
com.yeejoin.amos.fas.dao.entity.RiskFactor
;
import
com.yeejoin.amos.fas.dao.entity.RiskLevel
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.fas.dao.entity.RpnChangeLog
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
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.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.cache.Redis
;
import
org.typroject.tyboot.component.cache.enumeration.CacheType
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.Collectors
;
@Service
(
"riskSourceService"
)
@Service
(
"riskSourceService"
)
...
@@ -217,7 +156,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -217,7 +156,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
@Autowired
private
IDictDao
dictDao
;
private
IDictDao
dictDao
;
@Autowired
@Autowired
private
RedisTemplate
redisTemplate
;
private
RedisTemplate
redisTemplate
;
...
@@ -235,16 +174,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -235,16 +174,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
@Autowired
private
IRiskFactorDao
iRiskFactorDao
;
private
IRiskFactorDao
iRiskFactorDao
;
@Autowired
@Autowired
private
IEquipManageFeign
equipManageFeign
;
private
IEquipManageFeign
equipManageFeign
;
@Autowired
@Autowired
protected
HttpServletRequest
request
;
protected
HttpServletRequest
request
;
@Autowired
@Autowired
private
IEquipmentHandlerService
iEquipmentHandlerService
;
private
IEquipmentHandlerService
iEquipmentHandlerService
;
@Value
(
"${station.name}"
)
@Value
(
"${station.name}"
)
private
String
stationName
;
private
String
stationName
;
...
@@ -316,9 +255,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -316,9 +255,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
// }
// }
// return null;
// return null;
// }
// }
/**
/**
*
* 风险模型新增及维护时远程同步
* 风险模型新增及维护时远程同步
*
*
* @return CommonResponse
* @return CommonResponse
...
@@ -351,9 +289,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -351,9 +289,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
// }
// }
// return null;
// return null;
// }
// }
@Override
@Override
public
void
deleteRiskSource
(
String
appKey
,
String
product
,
String
token
,
String
success
,
Long
[]
riskSourceId
)
throws
Exception
{
public
void
deleteRiskSource
(
String
appKey
,
String
product
,
String
token
,
String
success
,
Long
[]
riskSourceId
)
throws
Exception
{
Set
<
Long
>
parentIds
=
new
LinkedHashSet
<>();
Set
<
Long
>
parentIds
=
new
LinkedHashSet
<>();
String
synMsg
=
null
;
String
synMsg
=
null
;
for
(
Long
rId
:
riskSourceId
)
{
for
(
Long
rId
:
riskSourceId
)
{
...
@@ -385,8 +322,46 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -385,8 +322,46 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public
void
deleteById
(
Long
id
)
{
public
void
deleteById
(
Long
id
)
{
iRiskSourceDao
.
deleteById
(
id
);
iRiskSourceDao
.
deleteById
(
id
);
}
}
@Override
public
List
<
RiskSource
>
synRegion
(
String
userId
,
String
compCode
,
List
<
RiskSource
>
list
)
{
List
<
RiskSource
>
entrys
=
new
ArrayList
<>();
list
.
forEach
(
r
->{
r
.
setOrgCode
(
compCode
);
r
.
setIsRegion
(
RiskSourceRegionEum
.
TRUE
.
getCode
());
//TODO 注意:id使用了调用接口方的id,这样代码修改量较小
Optional
<
RiskSource
>
op
=
iRiskSourceDao
.
findById
(
r
.
getId
());
if
(
op
.
isPresent
()){
//有就更新,业务只能调整上级
RiskSource
riskSource
=
op
.
get
();
riskSource
.
setParentId
(
r
.
getParentId
());
entrys
.
add
(
riskSource
);
}
else
{
//无则插入
//TODO 注意:id使用了调用接口方的id,这样代码修改量较小
r
.
setCreateDate
(
new
Date
());
r
.
setIsIndoor
(
Boolean
.
FALSE
);
r
.
setSourceId
(
r
.
getId
());
r
.
setCreateBy
(
userId
);
entrys
.
add
(
r
);
}
});
return
iRiskSourceDao
.
saveAll
(
entrys
);
}
@Override
public
Boolean
removeBind
(
Long
instanceId
)
{
List
<
RiskSource
>
exists
=
iRiskSourceDao
.
findBySourceId
(
instanceId
);
if
(!
CollectionUtils
.
isEmpty
(
exists
)){
exists
.
forEach
(
e
->{
e
.
setSourceId
(
null
);
});
exists
=
iRiskSourceDao
.
saveAll
(
exists
);
}
return
!
CollectionUtils
.
isEmpty
(
exists
);
}
/**
/**
*
* 风险模型删除时远程同步
* 风险模型删除时远程同步
*
*
* @return String
* @return String
...
@@ -413,7 +388,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -413,7 +388,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
// }
// }
// return null;
// return null;
// }
// }
@Override
@Override
public
Page
<
HashMap
<
String
,
Object
>>
queryRiskSourceByPage
(
CommonPageInfoParam
param
)
{
public
Page
<
HashMap
<
String
,
Object
>>
queryRiskSourceByPage
(
CommonPageInfoParam
param
)
{
long
total
=
riskSourceMapper
.
countPageData
(
param
);
long
total
=
riskSourceMapper
.
countPageData
(
param
);
...
@@ -599,9 +573,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -599,9 +573,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
public
void
alermContingency
(
String
batchNo
,
FireEquipment
fireEquipment
,
Equipment
equipment
)
throws
Exception
{
public
void
alermContingency
(
String
batchNo
,
FireEquipment
fireEquipment
,
Equipment
equipment
)
throws
Exception
{
Object
oldContingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
Object
oldContingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
...
@@ -618,7 +589,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -618,7 +589,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
contingencyRo
.
setEquipmentPosition3d
(
equipment
.
getPosition3d
());
contingencyRo
.
setEquipmentPosition3d
(
equipment
.
getPosition3d
());
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
)
{
...
@@ -647,25 +618,25 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -647,25 +618,25 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
}
}
// 获取遥信指标,暂不处理 ---20201111 code = 设备编码iot_code-指标项name_key
// 获取遥信指标,暂不处理 ---20201111 code = 设备编码iot_code-指标项name_key
List
<
Map
>
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"SWITCH"
);
//物联属性指标 and 为true或false
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"
);
//物联指标 非 true false
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
()));
}
}
contingencyRo
.
setTelemetryMap
(
telemetryMap
);
contingencyRo
.
setTelemetryMap
(
telemetryMap
);
log
.
debug
(
"开始调用规则"
);
log
.
debug
(
"开始调用规则"
);
Object
result
=
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
Object
result
=
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
log
.
debug
(
"规则调用返回=="
,
result
);
log
.
debug
(
"规则调用返回=="
,
result
);
ContingencyOriginalData
contingencyOriginalData
=
new
ContingencyOriginalData
();
ContingencyOriginalData
contingencyOriginalData
=
new
ContingencyOriginalData
();
BeanUtils
.
copyProperties
(
contingencyRo
,
contingencyOriginalData
);
BeanUtils
.
copyProperties
(
contingencyRo
,
contingencyOriginalData
);
...
@@ -801,24 +772,22 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -801,24 +772,22 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
// 今日安全
// 今日安全
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
dateString
=
formatter
.
format
(
new
Date
());
String
dateString
=
formatter
.
format
(
new
Date
());
String
topicOne
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"todaySafetyIndex"
);
String
topicOne
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"todaySafetyIndex"
);
webMqttComponent
.
publish
(
topicOne
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexInfoByDate
(
orgCode
,
dateString
)));
webMqttComponent
.
publish
(
topicOne
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexInfoByDate
(
orgCode
,
dateString
)));
// 巡检异常
// 巡检异常
String
topicTwo
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"fireSafety"
);
String
topicTwo
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"fireSafety"
);
webMqttComponent
.
publish
(
topicTwo
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"check"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTwo
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"check"
,
orgCode
)));
// 一周安全趋势
// 一周安全趋势
String
topicThree
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"weekSafetyIndex"
);
String
topicThree
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"weekSafetyIndex"
);
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexWeek
(
orgCode
)));
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexWeek
(
orgCode
)));
// 今日巡检
// 今日巡检
String
topicFour
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"todayCheckStatus"
);
String
topicFour
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"todayCheckStatus"
);
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getStatisticsCheck
(
orgCode
)));
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getStatisticsCheck
(
orgCode
)));
}
}
/**
/**
* 巡检消息规则推送
* 巡检消息规则推送
...
@@ -838,12 +807,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -838,12 +807,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
log
.
info
(
"巡检消息发送规则"
+
JSONObject
.
toJSONString
(
protalData
));
log
.
info
(
"巡检消息发送规则"
+
JSONObject
.
toJSONString
(
protalData
));
ruleTrigger
.
publish
(
protalData
,
"风险管控/patrol"
,
null
);
ruleTrigger
.
publish
(
protalData
,
"风险管控/patrol"
,
null
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
@Override
@Override
public
RiskSourceTreeResponse
queryRiskSourceDetailById
(
Long
id
)
{
public
RiskSourceTreeResponse
queryRiskSourceDetailById
(
Long
id
)
{
...
@@ -896,7 +863,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -896,7 +863,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
while
(
isRunning
)
{
while
(
isRunning
)
{
AlarmParam
deviceData
=
null
;
AlarmParam
deviceData
=
null
;
try
{
try
{
deviceData
=
blockingQueue
.
take
();
deviceData
=
blockingQueue
.
take
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"take alarmParam happened error"
,
e
);
log
.
error
(
"take alarmParam happened error"
,
e
);
}
}
...
@@ -904,8 +871,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -904,8 +871,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if
(
deviceData
==
null
)
{
if
(
deviceData
==
null
)
{
log
.
warn
(
"alarmParam is empty!"
);
log
.
warn
(
"alarmParam is empty!"
);
}
else
{
}
else
{
try
{
try
{
// Toke toke = cacheMap.getValue(TOKE);
// Toke toke = cacheMap.getValue(TOKE);
// if (toke == null) {
// if (toke == null) {
// toke = remoteSecurityService.come();
// toke = remoteSecurityService.come();
...
@@ -924,54 +891,54 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -924,54 +891,54 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
private
void
processDeivceData
(
AlarmParam
deviceData
)
{
private
void
processDeivceData
(
AlarmParam
deviceData
)
{
//处理设备和巡检数据
//处理设备和巡检数据
deviceData
.
setNodeState
(
deviceData
.
getState
());
deviceData
.
setNodeState
(
deviceData
.
getState
());
FireEquipmentPoint
fireEquipmentPoint
=
iFireEquipmentPointDao
.
findOneByCode
(
deviceData
.
getPointCode
());
FireEquipmentPoint
fireEquipmentPoint
=
iFireEquipmentPointDao
.
findOneByCode
(
deviceData
.
getPointCode
());
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
()))
{
Dict
dict
=
dictDao
.
getOne
(
fireEquipmentPoint
.
getAlarmType
());
Dict
dict
=
dictDao
.
getOne
(
fireEquipmentPoint
.
getAlarmType
());
fireEquipmentPointType
=
dict
.
getDictValue
();
fireEquipmentPointType
=
dict
.
getDictValue
();
}
}
// 根据监测点获取监测点设备信息
// 根据监测点获取监测点设备信息
Optional
<
FireEquipment
>
fireEquipment1
=
this
.
iFireEquipmentDao
.
findById
(
fireEquipmentPoint
.
getFireEquipmentId
());
Optional
<
FireEquipment
>
fireEquipment1
=
this
.
iFireEquipmentDao
.
findById
(
fireEquipmentPoint
.
getFireEquipmentId
());
FireEquipment
fireEquipment
=
null
;
FireEquipment
fireEquipment
=
null
;
if
(
fireEquipment1
.
isPresent
())
{
if
(
fireEquipment1
.
isPresent
())
{
fireEquipment
=
fireEquipment1
.
get
();
fireEquipment
=
fireEquipment1
.
get
();
}
}
Equipment
equipment
=
null
;
Equipment
equipment
=
null
;
if
(
fireEquipment
!=
null
)
{
if
(
fireEquipment
!=
null
)
{
Toke
toke
=
remoteSecurityService
.
getServerToken
();
Toke
toke
=
remoteSecurityService
.
getServerToken
();
//保存实时数据
//保存实时数据
// 根据监测点设备信息获取保护的重点装备
// 根据监测点设备信息获取保护的重点装备
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
fireEquipmentPoint
.
getFireEquipmentId
());
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
fireEquipmentPoint
.
getFireEquipmentId
());
deviceData
.
setMonitor
(
equipment
!=
null
?
equipment
.
getName
():
""
);
deviceData
.
setMonitor
(
equipment
!=
null
?
equipment
.
getName
()
:
""
);
deviceData
.
setId
(
String
.
valueOf
(
fireEquipment
.
getId
()));
deviceData
.
setId
(
String
.
valueOf
(
fireEquipment
.
getId
()));
deviceData
.
setCode
(
fireEquipment
.
getCode
());
deviceData
.
setCode
(
fireEquipment
.
getCode
());
saveFireEquipmentData
(
fireEquipmentPoint
,
fireEquipment
,
deviceData
,
fireEquipmentPointType
,
toke
);
saveFireEquipmentData
(
fireEquipmentPoint
,
fireEquipment
,
deviceData
,
fireEquipmentPointType
,
toke
);
DeviceRo
deviceRo
=
new
DeviceRo
();
DeviceRo
deviceRo
=
new
DeviceRo
();
deviceRo
.
setEquipmentId
(
equipment
.
getId
());
deviceRo
.
setEquipmentId
(
equipment
.
getId
());
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
);
}
}
}
}
}
}
}
}
/**
/**
* 预案执行
* 预案执行
*
*
...
@@ -982,51 +949,49 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -982,51 +949,49 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
*/
*/
@Async
@Async
void
dynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
FireEquipment
fireEquipment
,
Toke
toke
)
{
void
dynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
FireEquipment
fireEquipment
,
Toke
toke
)
{
Object
contingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
Object
contingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
String
batchNo
=
null
;
String
batchNo
=
null
;
// if (!ObjectUtils.isEmpty(contingencyRo)) {
// if (!ObjectUtils.isEmpty(contingencyRo)) {
// batchNo = ((ContingencyRo)contingencyRo).getBatchNo();
// batchNo = ((ContingencyRo)contingencyRo).getBatchNo();
// } else {
// } else {
// batchNo = UUID.randomUUID().toString();
// batchNo = UUID.randomUUID().toString();
// }
// }
batchNo
=
UUID
.
randomUUID
().
toString
();
batchNo
=
UUID
.
randomUUID
().
toString
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
try
{
alermContingency
(
batchNo
,
fireEquipment
,
equipment
);
alermContingency
(
batchNo
,
fireEquipment
,
equipment
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
@Async
@Async
public
void
triggerPlanDevice
(
DeviceRo
deviceRo
,
Equipment
equipment
,
Toke
toke
)
{
public
void
triggerPlanDevice
(
DeviceRo
deviceRo
,
Equipment
equipment
,
Toke
toke
)
{
try
{
try
{
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
Object
result1
=
ruleTrigger
.
publish
(
deviceRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
());
Object
result1
=
ruleTrigger
.
publish
(
deviceRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
@Override
@Override
@javax
.
transaction
.
Transactional
@javax
.
transaction
.
Transactional
public
String
processFireEqumtData
(
AlarmParam
deviceData
)
throws
Exception
{
public
String
processFireEqumtData
(
AlarmParam
deviceData
)
throws
Exception
{
EquipmentSpecificIndexVo
equipmentSpecificIndexVo
=
new
EquipmentSpecificIndexVo
();
EquipmentSpecificIndexVo
equipmentSpecificIndexVo
=
new
EquipmentSpecificIndexVo
();
equipmentSpecificIndexVo
.
setEquipmentSpecificId
(
Long
.
valueOf
(
deviceData
.
getPointCode
()));
equipmentSpecificIndexVo
.
setEquipmentSpecificId
(
Long
.
valueOf
(
deviceData
.
getPointCode
()));
equipmentSpecificIndexVo
.
setType
(
"FIREALARM"
);
equipmentSpecificIndexVo
.
setType
(
"FIREALARM"
);
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
topicEntity
.
setMessage
(
JSON
.
toJSONString
(
equipmentSpecificIndexVo
));
topicEntity
.
setMessage
(
JSON
.
toJSONString
(
equipmentSpecificIndexVo
));
String
data
=
JSON
.
toJSONString
(
topicEntity
);
String
data
=
JSON
.
toJSONString
(
topicEntity
);
System
.
out
.
println
(
data
);
System
.
out
.
println
(
data
);
iEquipmentHandlerService
.
handlerMqttMessage
(
""
,
data
);
iEquipmentHandlerService
.
handlerMqttMessage
(
""
,
data
);
// 格式化发送数据
// 格式化发送数据
// sendRiskSourceData(deviceData);
// sendRiskSourceData(deviceData);
//
//
...
@@ -1036,6 +1001,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1036,6 +1001,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
/**
/**
* webSocket向前台推送消防设备数据
* webSocket向前台推送消防设备数据
*
* @param param
* @param param
*/
*/
@Async
@Async
...
@@ -1051,14 +1017,14 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1051,14 +1017,14 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
// 推送设备状态信息
// 推送设备状态信息
Alarm
alarm
=
iAlarmDao
.
findByStatusTrueAndFireEquipmentPointCode
(
param
.
getPointCode
());
Alarm
alarm
=
iAlarmDao
.
findByStatusTrueAndFireEquipmentPointCode
(
param
.
getPointCode
());
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/monitorData"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/monitorData"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
view3dService
.
getEquipStatusList
(
alarm
.
getOrgCode
())));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
view3dService
.
getEquipStatusList
(
alarm
.
getOrgCode
())));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"推送前端数据失败-->"
+
JSON
.
toJSONString
(
param
));
log
.
error
(
"推送前端数据失败-->"
+
JSON
.
toJSONString
(
param
));
}
}
}
}
@Override
@Override
@Async
@Async
public
String
processFireEqumtData
(
FireEquimentDataRo
deviceData
)
throws
Exception
{
public
String
processFireEqumtData
(
FireEquimentDataRo
deviceData
)
throws
Exception
{
...
@@ -1095,22 +1061,21 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1095,22 +1061,21 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
/**
/**
* 设备消息规则推送
* 设备消息规则推送
*
*/
*/
@Async
@Async
void
fireEquipRuleMessagePush
(
AlarmParam
deviceData
,
Toke
toke
)
{
void
fireEquipRuleMessagePush
(
AlarmParam
deviceData
,
Toke
toke
)
{
String
bacthNo
=
UUID
.
randomUUID
().
toString
();
String
bacthNo
=
UUID
.
randomUUID
().
toString
();
FireEquimentDataRo
fireEquimentDataRo
=
new
FireEquimentDataRo
();
FireEquimentDataRo
fireEquimentDataRo
=
new
FireEquimentDataRo
();
deviceData
.
setBatchNo
(
bacthNo
);
deviceData
.
setBatchNo
(
bacthNo
);
BeanUtils
.
copyProperties
(
deviceData
,
fireEquimentDataRo
);
BeanUtils
.
copyProperties
(
deviceData
,
fireEquimentDataRo
);
try
{
try
{
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
log
.
info
(
"设备消息规则推送"
+
JSONObject
.
toJSONString
(
deviceData
));
log
.
info
(
"设备消息规则推送"
+
JSONObject
.
toJSONString
(
deviceData
));
ruleTrigger
.
publish
(
fireEquimentDataRo
,
"风险管控/fireEquiment"
,
null
);
ruleTrigger
.
publish
(
fireEquimentDataRo
,
"风险管控/fireEquiment"
,
null
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
...
@@ -1155,7 +1120,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1155,7 +1120,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* 推送告警数据
* 推送告警数据
* 影响区域:消防安全=>火灾告警
* 影响区域:消防安全=>火灾告警
*/
*/
String
topic
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"fireSafety"
);
String
topic
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"fireSafety"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"fire"
,
fireEquipmentPoint
.
getOrgCode
())));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"fire"
,
fireEquipmentPoint
.
getOrgCode
())));
}
}
...
@@ -1187,13 +1152,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1187,13 +1152,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* 推送设备状态
* 推送设备状态
* 影响区域:设备状态
* 影响区域:设备状态
*/
*/
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/monitorData"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/monitorData"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
view3dService
.
getEquipStatusList
(
fireEquipment
.
getOrgCode
())));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
view3dService
.
getEquipStatusList
(
fireEquipment
.
getOrgCode
())));
}
}
}
}
// String topic = String.format("/%s/%s/%s", serviceName, StationEnum.YINAN.getCode(),"telesignaling");S
// String topic = String.format("/%s/%s/%s", serviceName, StationEnum.YINAN.getCode(),"telesignaling");S
// webMqttComponent.publish(topic, JSON.toJSONString(deviceData));
// webMqttComponent.publish(topic, JSON.toJSONString(deviceData));
List
<
AlarmParam
>
list
=
new
ArrayList
<>();
List
<
AlarmParam
>
list
=
new
ArrayList
<>();
list
.
add
(
deviceData
);
list
.
add
(
deviceData
);
//保存所有数据(遥测,遥信)到mongo
//保存所有数据(遥测,遥信)到mongo
...
@@ -1288,20 +1253,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1288,20 +1253,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fmeaIds
.
forEach
(
fmeaId
->
rsDataQueue
.
addEquipmentMessage
(
fmeaId
,
monitor
,
st
));
fmeaIds
.
forEach
(
fmeaId
->
rsDataQueue
.
addEquipmentMessage
(
fmeaId
,
monitor
,
st
));
}
}
}
}
@Autowired
@Autowired
private
WebMqttComponent
webMqttComponent
;
private
WebMqttComponent
webMqttComponent
;
@Value
(
"${autoSys.push.type}"
)
@Value
(
"${autoSys.push.type}"
)
private
String
pushType
;
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
private
String
serviceName
;
@Async
@Async
public
void
sendAnalogue
(
EquipCommunicationData
data
)
{
public
void
sendAnalogue
(
EquipCommunicationData
data
)
{
try
{
try
{
redisTemplate
.
opsForHash
().
put
(
"Analogue"
,
data
.
getPointCode
(),
data
);
redisTemplate
.
opsForHash
().
put
(
"Analogue"
,
data
.
getPointCode
(),
data
);
// remoteWebSocketServer.sendMessage("plan", JSON.toJSONString(data));
// remoteWebSocketServer.sendMessage("plan", JSON.toJSONString(data));
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"analogue"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"analogue"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
data
));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
data
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -1487,7 +1452,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1487,7 +1452,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fmeaMapper
.
updateRpn
(
fmea
);
fmeaMapper
.
updateRpn
(
fmea
);
//2.计算上级风险值(风险点及父节点)
//2.计算上级风险值(风险点及父节点)
this
.
notifyRiskSource
(
newLevel
.
getOrgCode
(),
fmeaId
,
fmea
.
getRiskSourceId
(),
nofityType
,
jpushMsgBo
);
this
.
notifyRiskSource
(
newLevel
.
getOrgCode
(),
fmeaId
,
fmea
.
getRiskSourceId
(),
nofityType
,
jpushMsgBo
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
}
}
}
}
...
@@ -1592,7 +1557,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1592,7 +1557,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
//1.3.更新fmea的rpn、风险等级及newOid
//1.3.更新fmea的rpn、风险等级及newOid
fmeaMapper
.
updateRpn
(
fmea
);
fmeaMapper
.
updateRpn
(
fmea
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
//2.计算风险点rpn、rpni、riskLevelId
//2.计算风险点rpn、rpni、riskLevelId
this
.
notifyRiskSource
(
newLevel
.
getOrgCode
(),
fmeaId
,
fmea
.
getRiskSourceId
(),
notifyType
,
jpushMsgBo
);
this
.
notifyRiskSource
(
newLevel
.
getOrgCode
(),
fmeaId
,
fmea
.
getRiskSourceId
(),
notifyType
,
jpushMsgBo
);
...
@@ -1697,32 +1662,32 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1697,32 +1662,32 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
}
}
try
{
try
{
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/situationMap"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/situationMap"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRiskSourceSecondLevel
(
orgCode
)));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRiskSourceSecondLevel
(
orgCode
)));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreeHistogram"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreeHistogram"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRPNReport
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRPNReport
()));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreePie"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreePie"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForRiseUp
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForRiseUp
()));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
// 今日安全
// 今日安全
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
dateString
=
formatter
.
format
(
new
Date
());
String
dateString
=
formatter
.
format
(
new
Date
());
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
orgCode
=
riskSource
.
getOrgCode
();
orgCode
=
riskSource
.
getOrgCode
();
}
}
String
topicOne
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/todaySafetyIndex"
);
String
topicOne
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/todaySafetyIndex"
);
webMqttComponent
.
publish
(
topicOne
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexInfoByDate
(
orgCode
,
dateString
)));
webMqttComponent
.
publish
(
topicOne
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexInfoByDate
(
orgCode
,
dateString
)));
// 消防安全
// 消防安全
String
topicTow
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/fireSafety"
);
String
topicTow
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/fireSafety"
);
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"risk"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"risk"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"check"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"check"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"fire"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"fire"
,
orgCode
)));
// 一周安全趋势
// 一周安全趋势
String
topicThree
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"weekSafetyIndex"
);
String
topicThree
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"weekSafetyIndex"
);
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexWeek
(
orgCode
)));
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexWeek
(
orgCode
)));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -1754,37 +1719,37 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1754,37 +1719,37 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
iDataRefreshService
.
refreshViewData
(
DataRefreshTypeEum
.
rpn
.
getCode
());
iDataRefreshService
.
refreshViewData
(
DataRefreshTypeEum
.
rpn
.
getCode
());
try
{
try
{
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/situationMap"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/situationMap"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRiskSourceSecondLevel
(
riskSource
.
getOrgCode
())));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRiskSourceSecondLevel
(
riskSource
.
getOrgCode
())));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreeHistogram"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreeHistogram"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRPNReport
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRPNReport
()));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreePie"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreePie"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForRiseUp
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForRiseUp
()));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
// 今日安全
// 今日安全
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
dateString
=
formatter
.
format
(
new
Date
());
String
dateString
=
formatter
.
format
(
new
Date
());
String
orgCode
=
riskSource
.
getOrgCode
();
String
orgCode
=
riskSource
.
getOrgCode
();
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
orgCode
=
riskSource
.
getOrgCode
();
orgCode
=
riskSource
.
getOrgCode
();
}
}
String
topicOne
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/todaySafetyIndex"
);
String
topicOne
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/todaySafetyIndex"
);
webMqttComponent
.
publish
(
topicOne
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexInfoByDate
(
orgCode
,
dateString
)));
webMqttComponent
.
publish
(
topicOne
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexInfoByDate
(
orgCode
,
dateString
)));
// 消防安全
// 消防安全
String
topicTow
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/fireSafety"
);
String
topicTow
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/fireSafety"
);
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"risk"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"risk"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"check"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"check"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"fire"
,
orgCode
)));
webMqttComponent
.
publish
(
topicTow
,
JSON
.
toJSONString
(
view3dService
.
getSafetyExecuteListTop5
(
"fire"
,
orgCode
)));
// 一周安全趋势
// 一周安全趋势
String
topicThree
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"weekSafetyIndex"
);
String
topicThree
=
String
.
format
(
"/%s/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh"
,
"weekSafetyIndex"
);
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexWeek
(
orgCode
)));
webMqttComponent
.
publish
(
topicThree
,
JSON
.
toJSONString
(
view3dService
.
getSafetyIndexWeek
(
orgCode
)));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"数据获取失败"
,
e
);
log
.
error
(
"数据获取失败"
,
e
);
}
}
...
@@ -1861,7 +1826,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1861,7 +1826,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
JpushMsgContentBo
jpushMsgContentBo
=
jpushMsgBo
.
getMsg
();
JpushMsgContentBo
jpushMsgContentBo
=
jpushMsgBo
.
getMsg
();
Set
<
String
>
target
=
jpushMsgBo
.
getTarget
();
Set
<
String
>
target
=
jpushMsgBo
.
getTarget
();
target
.
remove
(
null
);
target
.
remove
(
null
);
if
(
jpushMsgContentBo
.
getSend
())
{
if
(
jpushMsgContentBo
.
getSend
())
{
PushMsgParam
pushMsgParam
=
new
PushMsgParam
();
PushMsgParam
pushMsgParam
=
new
PushMsgParam
();
pushMsgParam
.
setRecivers
(
Lists
.
newArrayList
(
target
));
pushMsgParam
.
setRecivers
(
Lists
.
newArrayList
(
target
));
pushMsgParam
.
setContent
(
jpushMsgContentBo
.
genMessage
());
pushMsgParam
.
setContent
(
jpushMsgContentBo
.
genMessage
());
...
@@ -1890,7 +1855,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1890,7 +1855,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSourceRuleRo
.
setTitle
(
msgContentBo
.
getSubject
());
riskSourceRuleRo
.
setTitle
(
msgContentBo
.
getSubject
());
riskSourceRuleRo
.
setRg
(
String
.
valueOf
(
rpnr
.
subtract
(
rpni
).
toBigInteger
()));
riskSourceRuleRo
.
setRg
(
String
.
valueOf
(
rpnr
.
subtract
(
rpni
).
toBigInteger
()));
try
{
try
{
log
.
info
(
"规则告警发送数据为"
+
JSONObject
.
toJSONString
(
riskSourceRuleRo
));
log
.
info
(
"规则告警发送数据为"
+
JSONObject
.
toJSONString
(
riskSourceRuleRo
));
ruleTrigger
.
publish
(
riskSourceRuleRo
,
"风险管控/riskSource"
,
null
);
// 没有配决策流,processIds传null即可
ruleTrigger
.
publish
(
riskSourceRuleRo
,
"风险管控/riskSource"
,
null
);
// 没有配决策流,processIds传null即可
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"调用规则异常"
,
e
);
log
.
error
(
"调用规则异常"
,
e
);
...
@@ -1939,16 +1904,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1939,16 +1904,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
@Override
@Override
public
void
batchSaveRegionUe4
(
List
<
BindRegionBo
>
regionBoList
,
String
orgCode
)
{
public
void
batchSaveRegionUe4
(
List
<
BindRegionBo
>
regionBoList
,
String
orgCode
)
{
riskSourceMapper
.
batchSaveRegionUe4
(
regionBoList
);
riskSourceMapper
.
batchSaveRegionUe4
(
regionBoList
);
try
{
try
{
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/situationMap"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/situationMap"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRiskSourceSecondLevel
(
orgCode
)));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRiskSourceSecondLevel
(
orgCode
)));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreeHistogram"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreeHistogram"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRPNReport
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryRPNReport
()));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreePie"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/riskDegreePie"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForRiseUp
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForRiseUp
()));
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"data/refresh/incidenceSeverityMatrix"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
queryForMatrix
()));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"数据获取失败"
,
e
);
log
.
error
(
"数据获取失败"
,
e
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IRiskSourceService.java
View file @
95526117
...
@@ -194,4 +194,20 @@ public interface IRiskSourceService {
...
@@ -194,4 +194,20 @@ public interface IRiskSourceService {
* @date 2020-9-9 11:53:36
* @date 2020-9-9 11:53:36
*/
*/
void
deleteById
(
Long
id
);
void
deleteById
(
Long
id
);
/**
* 同步创建/更新区域
* @param code userId
* @param compCode 公司编号
* @param list 同步数据支持多个
* @return List<RiskSource>
*/
List
<
RiskSource
>
synRegion
(
String
code
,
String
compCode
,
List
<
RiskSource
>
list
);
/**
* 解除绑定关系
* @param instanceId 解除者id
* @return Boolean
*/
Boolean
removeBind
(
Long
instanceId
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/ManulInsertGenerator.java
0 → 100644
View file @
95526117
package
com
.
yeejoin
.
amos
.
fas
.
config
;
import
org.hibernate.HibernateException
;
import
org.hibernate.engine.spi.SharedSessionContractImplementor
;
import
org.hibernate.id.IdentityGenerator
;
import
java.io.Serializable
;
/**
* 自定义的主键生成策略,如果填写了主键id,如果数据库中没有这条记录,则新增指定id的记录;否则更新记录
*
* 如果不填写主键id,则利用数据库本身的自增策略指定id
*/
public
class
ManulInsertGenerator
extends
IdentityGenerator
{
@Override
public
Serializable
generate
(
SharedSessionContractImplementor
s
,
Object
obj
)
throws
HibernateException
{
Serializable
id
=
s
.
getEntityPersister
(
null
,
obj
).
getClassMetadata
().
getIdentifier
(
obj
,
s
);
if
(
id
!=
null
&&
Long
.
parseLong
(
id
.
toString
())
>
0
)
{
return
id
;
}
else
{
return
super
.
generate
(
s
,
obj
);
}
}
}
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
View file @
95526117
...
@@ -587,4 +587,15 @@
...
@@ -587,4 +587,15 @@
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_user_id` varchar(20) NULL COMMENT '驻站消防队队长';
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_user_id` varchar(20) NULL COMMENT '驻站消防队队长';
</sql>
</sql>
</changeSet>
</changeSet>
<changeSet
author=
"shg"
id=
"1609226808866-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"source_id"
/>
</not>
</preConditions>
<comment>
f_risk_source add column source_id
</comment>
<sql>
alter table `f_risk_source` add column `source_id` bigint(20) DEFAULT NULL AFTER `status`;
</sql>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_fire_equip.xml
View file @
95526117
...
@@ -183,7 +183,7 @@
...
@@ -183,7 +183,7 @@
left join wl_equipment_index as ein on ind.equipment_index_id = ein.id
left join wl_equipment_index as ein on ind.equipment_index_id = ein.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as sce on str.source_id = sce.id
left join f_risk_source as sce on str.source_id = sce.
source_
id
) d
) d
WHERE
WHERE
1 = 1
1 = 1
...
@@ -298,8 +298,9 @@
...
@@ -298,8 +298,9 @@
LEFT JOIN wl_equipment we ON we.id = wed.equipment_id
LEFT JOIN wl_equipment we ON we.id = wed.equipment_id
LEFT JOIN wl_unit u ON u.id = we.unit_id
LEFT JOIN wl_unit u ON u.id = we.unit_id
LEFT JOIN wl_warehouse_structure ws ON ws.source_id = wsd.warehouse_structure_id
LEFT JOIN wl_warehouse_structure ws ON ws.source_id = wsd.warehouse_structure_id
left join f_risk_source as sce on sce.source_id = ws.source_id
WHERE
WHERE
ws.source_
id = #{riskSourceId}
sce.
id = #{riskSourceId}
GROUP BY
GROUP BY
wsd.equipment_detail_id,
wsd.equipment_detail_id,
wed.`name`
wed.`name`
...
...
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