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
989e3531
Commit
989e3531
authored
Apr 29, 2020
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. f_safety_index_change_log 新增字段创建日期-全景监控
2.修改安全指数流水服务-全景监控
parent
c39590ad
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
103 deletions
+74
-103
DataRefreshTypeEum.java
...com/yeejoin/amos/fas/common/enums/DataRefreshTypeEum.java
+1
-0
SafetyIndexChangeLog.java
...com/yeejoin/amos/fas/dao/entity/SafetyIndexChangeLog.java
+17
-24
View3dController.java
...eejoin/amos/fas/business/controller/View3dController.java
+5
-5
View3dServiceImpl.java
...oin/amos/fas/business/service/impl/View3dServiceImpl.java
+34
-70
IView3dService.java
...ejoin/amos/fas/business/service/intfc/IView3dService.java
+3
-2
application.properties
...ireAutoSysStart/src/main/resources/application.properties
+2
-2
fas-2.0.1.xml
...utoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
+12
-0
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/common/enums/DataRefreshTypeEum.java
View file @
989e3531
...
...
@@ -8,6 +8,7 @@ public enum DataRefreshTypeEum {
/**
* 数据刷新触发原因
*/
dateChange
(
"日切"
,
"dateChange"
),
rpn
(
"rpn变化"
,
"rpn"
),
alarm
(
"设备报警"
,
"alarm"
),
planTask
(
"检查任务"
,
"planTask"
),
...
...
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/SafetyIndexChangeLog.java
View file @
989e3531
package
com
.
yeejoin
.
amos
.
fas
.
dao
.
entity
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Lob
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* The persistent class for the fire_car database table.
*
* 安全指数日流水
*/
@Entity
@Table
(
name
=
"f_safety_index_change_log"
)
@NamedQuery
(
name
=
"SafetyIndexChangeLog.findAll"
,
query
=
"SELECT s FROM SafetyIndexChangeLog s"
)
public
class
SafetyIndexChangeLog
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
public
class
SafetyIndexChangeLog
extends
BasicEntity
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"ID"
,
nullable
=
false
,
unique
=
true
)
private
Long
id
;
/**
* 安全指数
*/
@Column
(
name
=
"safety_index"
)
private
BigDecimal
safetyIndex
;
/**
* 流水日期
*/
@Column
(
name
=
"collect_date"
)
private
Date
collectDate
;
/**
* 机构
*/
@Column
(
name
=
"org_code"
)
private
String
orgCode
;
/**
* 备注
*/
@Column
(
name
=
"remark"
)
private
String
remark
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
BigDecimal
getSafetyIndex
()
{
return
safetyIndex
;
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/View3dController.java
View file @
989e3531
...
...
@@ -203,11 +203,11 @@ public class View3dController extends BaseController {
return
CommonResponseUtil
.
success
(
view3dService
.
get3dPointsByModel
(
orgCode
,
model
));
}
@Scheduled
(
cron
=
"${param.safetyIndex
c
hange.cron}"
)
@ApiOperation
(
value
=
"
更新安全指数"
,
notes
=
"更新安全指数
"
)
@GetMapping
(
value
=
"safetyIndex/
refresh
"
)
public
CommonResponse
safetyIndex
Refresh
(
){
view3dService
.
safetyIndex
Refresh
(
);
@Scheduled
(
cron
=
"${param.safetyIndex
C
hange.cron}"
)
@ApiOperation
(
value
=
"
安全指数日流生成"
,
notes
=
"安全指数日流生成定时任务
"
)
@GetMapping
(
value
=
"safetyIndex/
schJobTest
"
)
public
CommonResponse
safetyIndex
Log
(
@ApiParam
(
value
=
"格式:yyyy-MM-dd"
,
required
=
false
)
@RequestParam
(
required
=
false
)
String
runData
){
view3dService
.
safetyIndex
LogGenJob
(
runData
);
return
CommonResponseUtil
.
success
();
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/View3dServiceImpl.java
View file @
989e3531
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.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
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.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -31,42 +12,33 @@ import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.View3dMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireCarDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireStationDao
;
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.ISafetyIndexChangeLogDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.feign.IDutyModeServer
;
import
com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer
;
import
com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService
;
import
com.yeejoin.amos.fas.business.service.intfc.IView3dService
;
import
com.yeejoin.amos.fas.business.vo.ErrorContentVo
;
import
com.yeejoin.amos.fas.business.vo.ExceptionRegionVo
;
import
com.yeejoin.amos.fas.business.vo.SafetyIndexDetailVo
;
import
com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo
;
import
com.yeejoin.amos.fas.business.vo.View3dNodeVo
;
import
com.yeejoin.amos.fas.common.enums.CheckStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.PlanTaskDetailStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum
;
import
com.yeejoin.amos.fas.common.enums.RpnChangeTypeEum
;
import
com.yeejoin.amos.fas.common.enums.StatisticsErrorTypeEum
;
import
com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum
;
import
com.yeejoin.amos.fas.business.vo.*
;
import
com.yeejoin.amos.fas.common.enums.*
;
import
com.yeejoin.amos.fas.core.common.request.DateUtil
;
import
com.yeejoin.amos.fas.core.common.response.RegionTreeResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.core.util.StringUtil
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.FireCar
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.FireStation
;
import
com.yeejoin.amos.fas.dao.entity.RiskLevel
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.fas.dao.entity.SafetyIndexChangeLog
;
import
com.yeejoin.amos.fas.dao.entity.WaterResource
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
com.yeejoin.amos.fas.exception.YeeException
;
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.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author DELL
...
...
@@ -105,6 +77,9 @@ public class View3dServiceImpl implements IView3dService {
@Value
(
"${param.system.online.date}"
)
private
String
onLineDate
;
@Autowired
private
IDataRefreshService
iDataRefreshService
;
@Override
...
...
@@ -510,37 +485,26 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public
void
safetyIndexRefresh
()
{
try
{
List
<
RiskSource
>
riskSources
=
iRiskSourceDao
.
findByParentId
(
0
l
);
List
<
SafetyIndexChangeLog
>
sageTyIndexs
=
new
ArrayList
<>();
sageTyIndexs
=
riskSources
.
stream
().
map
(
riskSource
->
{
public
void
safetyIndexLogGenJob
(
String
runData
)
{
Date
collectDate
=
StringUtil
.
isNotEmpty
(
runData
)
?
DateUtil
.
formatDate
(
runData
,
DateUtil
.
DATE_DEFAULT_FORMAT
)
:
DateUtil
.
getDayBefore
(
new
Date
());
//1.安全指数流水生成
try
{
List
<
RiskSource
>
riskSources
=
iRiskSourceDao
.
findByParentId
(
0L
);
List
<
SafetyIndexChangeLog
>
safetyIndexChangeLogs
=
new
ArrayList
<>();
safetyIndexChangeLogs
=
riskSources
.
stream
().
map
(
riskSource
->
{
SafetyIndexChangeLog
safetyIndexChangeLog
=
new
SafetyIndexChangeLog
();
safetyIndexChangeLog
.
setOrgCode
(
riskSource
.
getOrgCode
());
double
changeRpnToSafetyIndex
=
this
.
changeRpnToSafetyIndex
(
riskSource
.
getRpn
());
safetyIndexChangeLog
.
setSafetyIndex
(
BigDecimal
.
valueOf
(
changeRpnToSafetyIndex
));
safetyIndexChangeLog
.
setCollectDate
(
new
Date
()
);
safetyIndexChangeLog
.
setCollectDate
(
collectDate
);
return
safetyIndexChangeLog
;
}).
collect
(
Collectors
.
toList
());;
iSafetyIndexChangeLogDao
.
saveAll
(
sageTyIndexs
);
}
catch
(
Exception
e
)
{
log
.
error
(
"更新失败: "
+
e
.
getMessage
());
e
.
printStackTrace
();
}
this
.
sendRefreshDate
();
}
//推送刷新数据消息
private
void
sendRefreshDate
()
{
HashMap
<
String
,
String
>
message
=
new
HashMap
<>();
message
.
put
(
"refreshType"
,
View3dRefreshAreaEum
.
all
.
getCode
());
try
{
remoteWebSocketServer
.
sendMessage
(
"refreshDate"
,
JSON
.
toJSONString
(
message
));
iSafetyIndexChangeLogDao
.
saveAll
(
safetyIndexChangeLogs
);
}
catch
(
Exception
e
)
{
log
.
error
(
"推送消息失败!!!"
);
e
.
printStackTrace
();
log
.
error
(
"安全指数流水生成失败: "
+
e
.
getMessage
());
}
//2.通知日切进行数据刷新
iDataRefreshService
.
refreshViewData
(
DataRefreshTypeEum
.
dateChange
.
getCode
());
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IView3dService.java
View file @
989e3531
...
...
@@ -128,7 +128,8 @@ public interface IView3dService {
CommonResponse
get3dPointsByModel
(
String
orgCode
,
String
model
);
/**
* 刷新安全指数
* 安全指数流水生成
* @param runData 日切日期
*/
void
safetyIndex
Refresh
(
);
void
safetyIndex
LogGenJob
(
String
runData
);
}
YeeAmosFireAutoSysStart/src/main/resources/application.properties
View file @
989e3531
...
...
@@ -44,7 +44,7 @@ spring.http.multipart.MaxRequestSize = 50480000
windows.img.path
=
D:
\\
linux.img.path
=
/
#
param.safetyIndex
c
hange.cron
=
0 0 2 * * ?
dutyMode.fegin.name
=
AMOSDUTYMODE
param.safetyIndex
C
hange.cron
=
0 0 2 * * ?
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
View file @
989e3531
...
...
@@ -182,4 +182,15 @@
<column
name=
"type"
/>
</createIndex>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1588140925893-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_safety_index_change_log"
columnName=
"create_date"
/>
</not>
</preConditions>
<comment>
f_safety_index_change_log add column create_date
</comment>
<sql>
alter table `f_safety_index_change_log` add column `create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
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