Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
d9d4b466
提交
d9d4b466
authored
5月 18, 2022
作者:
涂茂林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:围栏报警数据管理
上级
634cf4de
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
544 行增加
和
53 行删除
+544
-53
LocationFenceAlarm.java
...va/com/yiring/app/domain/location/LocationFenceAlarm.java
+4
-0
LocationFenceAlarmRepository.java
...ing/app/domain/location/LocationFenceAlarmRepository.java
+1
-1
EvacuationZoneRepository.java
...yiring/app/domain/rehearsal/EvacuationZoneRepository.java
+1
-1
RehearsalPlan.java
...n/java/com/yiring/app/domain/rehearsal/RehearsalPlan.java
+0
-3
FenceAlarmExcel.java
.../com/yiring/app/excel/location/fence/FenceAlarmExcel.java
+76
-0
RehearsalPlanExcel.java
...va/com/yiring/app/excel/rehearsal/RehearsalPlanExcel.java
+8
-12
FenceAlarmConditionParam.java
...ng/app/param/location/fence/FenceAlarmConditionParam.java
+46
-0
RehearsalPlanAddParam.java
...com/yiring/app/param/rehearsal/RehearsalPlanAddParam.java
+0
-5
RehearsalPlanModifyParam.java
.../yiring/app/param/rehearsal/RehearsalPlanModifyParam.java
+0
-4
HistoryRouteServiceImpl.java
...ervice/analysis/history/impl/HistoryRouteServiceImpl.java
+3
-13
FenceAlarmService.java
.../yiring/app/service/location/fence/FenceAlarmService.java
+37
-0
FenceAlarmServiceImpl.java
...pp/service/location/fence/impl/FenceAlarmServiceImpl.java
+168
-0
RehearsalPlanServiceImpl.java
.../app/service/rehearsal/impl/RehearsalPlanServiceImpl.java
+1
-0
MapUtil.java
app/src/main/java/com/yiring/app/util/MapUtil.java
+34
-0
FenceAlarmVo.java
...n/java/com/yiring/app/vo/location/fence/FenceAlarmVo.java
+91
-0
RehearsalPlanVo.java
...ain/java/com/yiring/app/vo/rehearsal/RehearsalPlanVo.java
+2
-4
FenceAlarmController.java
...n/java/com/yiring/app/web/alarm/FenceAlarmController.java
+0
-9
FenceAlarmController.java
...m/yiring/app/web/location/fence/FenceAlarmController.java
+60
-0
AccidentSpotController.java
.../com/yiring/app/web/rehearsal/AccidentSpotController.java
+1
-1
RehearsalPlanController.java
...com/yiring/app/web/rehearsal/RehearsalPlanController.java
+11
-0
没有找到文件。
app/src/main/java/com/yiring/app/domain/location/LocationFenceAlarm.java
浏览文件 @
d9d4b466
...
...
@@ -88,5 +88,9 @@ public class LocationFenceAlarm extends BasicEntity implements Serializable {
public
String
text
()
{
return
this
.
text
;
}
public
static
Status
get
(
boolean
flag
)
{
return
flag
?
ING
:
OVER
;
}
}
}
app/src/main/java/com/yiring/app/domain/location/LocationFenceAlarmRepository.java
浏览文件 @
d9d4b466
...
...
@@ -26,7 +26,7 @@ public interface LocationFenceAlarmRepository
* @param now 当前时间
* @return 修改量
*/
@Query
(
"UPDATE LocationFenceAlarm SET status = 'OVER', updateTime = :now WHERE id IN(:ids)"
)
@Query
(
"UPDATE LocationFenceAlarm SET status = 'OVER', updateTime = :now
, endTime = :now
WHERE id IN(:ids)"
)
@Modifying
int
batchOver
(
@Param
(
"ids"
)
List
<
Long
>
ids
,
@Param
(
"now"
)
LocalDateTime
now
);
...
...
app/src/main/java/com/yiring/app/domain/rehearsal/EvacuationZoneRepository.java
浏览文件 @
d9d4b466
...
...
@@ -49,7 +49,7 @@ public interface EvacuationZoneRepository
* @param name 名称
* @return 撤离区列表
*/
@Query
(
"SELECT e FROM EvacuationZone e WHERE e.deleted = false AND e.name like %?1%"
)
@Query
(
"SELECT e FROM EvacuationZone e WHERE e.deleted = false AND
e.enable = true AND
e.name like %?1%"
)
List
<
EvacuationZone
>
findLikeName
(
String
name
);
/**
...
...
app/src/main/java/com/yiring/app/domain/rehearsal/RehearsalPlan.java
浏览文件 @
d9d4b466
...
...
@@ -63,9 +63,6 @@ public class RehearsalPlan extends BasicEntity implements Serializable {
@Comment
(
"演练时间"
)
private
LocalDateTime
rehearsalTime
;
@Comment
(
"推送信息"
)
private
String
pushMsg
;
@Comment
(
"演练计划的状态(1:未启动, 2:进行中, 3:已结束)"
)
private
Integer
status
;
...
...
app/src/main/java/com/yiring/app/excel/location/fence/FenceAlarmExcel.java
0 → 100644
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
location
.
fence
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.app.constant.alarm.FenceTypeEnum
;
import
com.yiring.app.domain.location.LocationFenceAlarm
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 17:23
*/
@ExcelModel
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
FenceAlarmExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
4526095986813965381L
;
@ExcelColumn
(
title
=
"地图名称"
)
private
String
mapName
;
@ExcelColumn
(
title
=
"围栏名称"
)
private
String
fenceName
;
@ExcelColumn
(
title
=
"围栏类别"
)
private
String
fenceTypeName
;
@ExcelColumn
(
title
=
"报警人员"
)
private
String
realName
;
@ExcelColumn
(
title
=
"标签号"
)
private
String
tagId
;
@ExcelColumn
(
title
=
"报警开始时间"
)
private
LocalDateTime
startTime
;
@ExcelColumn
(
title
=
"报警结束时间"
)
private
LocalDateTime
endTime
;
@ExcelColumn
(
title
=
"报警类型"
)
private
String
alarmTypeName
;
@ExcelColumn
(
title
=
"接收人"
)
private
String
recipient
;
@ExcelColumn
(
title
=
"报警状态"
)
private
String
statusName
;
public
static
FenceAlarmExcel
transform
(
LocationFenceAlarm
fenceAlarm
)
{
return
FenceAlarmExcel
.
builder
()
.
fenceName
(
fenceAlarm
.
getFence
().
getName
())
.
fenceTypeName
(
FenceTypeEnum
.
getByCode
(
fenceAlarm
.
getFence
().
getFenceType
()))
.
realName
(
fenceAlarm
.
getUser
().
getRealName
())
.
tagId
(
fenceAlarm
.
getTag
().
getCode
())
.
startTime
(
fenceAlarm
.
getStartTime
())
.
endTime
(
fenceAlarm
.
getEndTime
())
.
alarmTypeName
(
fenceAlarm
.
getType
().
getName
())
//todo
//.recipient()
.
statusName
(
fenceAlarm
.
getStatus
().
text
())
.
build
();
}
}
app/src/main/java/com/yiring/app/excel/rehearsal/RehearsalPlanExcel.java
浏览文件 @
d9d4b466
...
...
@@ -29,31 +29,28 @@ public class RehearsalPlanExcel implements Serializable {
@Serial
private
static
final
long
serialVersionUID
=
-
2976618459214077036L
;
@ExcelColumn
(
title
=
"演练主题"
)
@ExcelColumn
(
title
=
"演练主题"
,
width
=
10
)
private
String
topical
;
@ExcelColumn
(
title
=
"事故点"
)
@ExcelColumn
(
title
=
"事故点"
,
width
=
10
)
private
String
accidentSpotName
;
@ExcelColumn
(
title
=
"周边范围(m)"
)
@ExcelColumn
(
title
=
"周边范围(m)"
,
width
=
10
)
private
Integer
scope
;
@ExcelColumn
(
title
=
"撤离点"
)
@ExcelColumn
(
title
=
"撤离点"
,
width
=
10
)
private
String
evacuationZoneName
;
@ExcelColumn
(
title
=
"风险程度"
)
@ExcelColumn
(
title
=
"风险程度"
,
width
=
10
)
private
String
riskLevelName
;
@ExcelColumn
(
title
=
"事故信息"
)
@ExcelColumn
(
title
=
"事故信息"
,
width
=
10
)
private
String
accidentMsg
;
@ExcelColumn
(
title
=
"演练时间"
)
@ExcelColumn
(
title
=
"演练时间"
,
width
=
20
)
private
LocalDateTime
rehearsalTime
;
@ExcelColumn
(
title
=
"推送信息"
)
private
String
pushMsg
;
@ExcelColumn
(
title
=
"状态"
)
@ExcelColumn
(
title
=
"状态"
,
width
=
10
)
private
String
statusName
;
public
static
RehearsalPlanExcel
transform
(
RehearsalPlan
rehearsalPlan
)
{
...
...
@@ -66,7 +63,6 @@ public class RehearsalPlanExcel implements Serializable {
.
riskLevelName
(
RiskLevelEnum
.
getByCode
(
rehearsalPlan
.
getRiskLevel
()))
.
accidentMsg
(
rehearsalPlan
.
getAccidentMsg
())
.
rehearsalTime
(
rehearsalPlan
.
getRehearsalTime
())
.
pushMsg
(
rehearsalPlan
.
getPushMsg
())
.
statusName
(
RehearsalPlanStatusEnum
.
getByCode
(
rehearsalPlan
.
getStatus
()))
.
build
();
}
...
...
app/src/main/java/com/yiring/app/param/location/fence/FenceAlarmConditionParam.java
0 → 100644
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
fence
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 14:49
*/
@ApiModel
(
"围栏报警数据管理查询"
)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
FenceAlarmConditionParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
2397459299914947087L
;
@ApiModelProperty
(
value
=
"地图id"
,
example
=
"1"
)
private
Long
mapId
;
@ApiModelProperty
(
value
=
"围栏id"
,
example
=
"1"
)
private
Long
fenceId
;
@ApiModelProperty
(
value
=
"报警人员真名"
,
example
=
"张三"
)
private
String
realName
;
@ApiModelProperty
(
value
=
"报警状态"
,
example
=
"true|false"
)
private
Boolean
status
;
@ApiModelProperty
(
value
=
"报警开始时间"
,
example
=
"2022-05-06 14:00:00"
)
private
LocalDateTime
beginTime
;
@ApiModelProperty
(
value
=
"报警结束时间"
,
example
=
"2022-05-7 14:00:00"
)
private
LocalDateTime
endTime
;
}
app/src/main/java/com/yiring/app/param/rehearsal/RehearsalPlanAddParam.java
浏览文件 @
d9d4b466
...
...
@@ -55,10 +55,6 @@ public class RehearsalPlanAddParam implements Serializable {
@NotEmpty
(
message
=
"事故信息不能为空"
)
private
String
accidentMsg
;
@ApiModelProperty
(
value
=
"推送信息"
,
example
=
"气体泄露,请尽快逃离"
,
required
=
true
)
@NotEmpty
(
message
=
"推送信息不能为空"
)
private
String
pushMsg
;
public
RehearsalPlan
transform
()
{
AccidentSpot
accidentSpot
=
AccidentSpot
.
builder
().
id
(
accidentSpotId
).
build
();
EvacuationZone
evacuationZone
=
EvacuationZone
.
builder
().
id
(
evacuationZoneId
).
build
();
...
...
@@ -70,7 +66,6 @@ public class RehearsalPlanAddParam implements Serializable {
.
evacuationZone
(
evacuationZone
)
.
riskLevel
(
riskLevel
)
.
accidentMsg
(
accidentMsg
)
.
pushMsg
(
pushMsg
)
.
status
(
RehearsalPlanStatusEnum
.
UN_START
.
getCode
())
.
deleted
(
false
)
.
build
();
...
...
app/src/main/java/com/yiring/app/param/rehearsal/RehearsalPlanModifyParam.java
浏览文件 @
d9d4b466
...
...
@@ -51,9 +51,6 @@ public class RehearsalPlanModifyParam implements Serializable {
@ApiModelProperty
(
value
=
"事故信息"
,
example
=
"气体泄露"
)
private
String
accidentMsg
;
@ApiModelProperty
(
value
=
"推送信息"
,
example
=
"气体泄露,请尽快逃离"
)
private
String
pushMsg
;
public
RehearsalPlan
transform
()
{
AccidentSpot
accidentSpot
=
AccidentSpot
.
builder
().
id
(
accidentSpotId
).
build
();
EvacuationZone
evacuationZone
=
EvacuationZone
.
builder
().
id
(
evacuationZoneId
).
build
();
...
...
@@ -66,7 +63,6 @@ public class RehearsalPlanModifyParam implements Serializable {
.
evacuationZone
(
evacuationZone
)
.
riskLevel
(
riskLevel
)
.
accidentMsg
(
accidentMsg
)
.
pushMsg
(
pushMsg
)
.
build
();
}
}
app/src/main/java/com/yiring/app/service/analysis/history/impl/HistoryRouteServiceImpl.java
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
analysis
.
history
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.yiring.app.constant.RedisKey
;
import
com.yiring.app.domain.location.LocationLog
;
import
com.yiring.app.domain.location.LocationLogRepository
;
import
com.yiring.app.excel.analysis.history.HistoryRouteExcel
;
import
com.yiring.app.param.analysis.history.HistoryRouteConditionParam
;
import
com.yiring.app.service.analysis.history.HistoryRouteService
;
import
com.yiring.app.util.MapUtil
;
import
com.yiring.app.vo.analysis.history.HistoryRouteVo
;
import
com.yiring.app.vo.map.MapVo
;
import
com.yiring.common.core.Redis
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.vo.PageVo
;
...
...
@@ -45,26 +43,18 @@ public class HistoryRouteServiceImpl implements HistoryRouteService {
private
LocationLogRepository
locationLogRepository
;
@Resource
private
Redis
redis
;
private
MapUtil
mapUtil
;
@Override
public
Result
<
PageVo
<
HistoryRouteVo
>>
findByCondition
(
HistoryRouteConditionParam
param
)
{
Specification
<
LocationLog
>
specification
=
getSpecification
(
param
);
ArrayList
<
MapVo
.
MapVoReuslt
>
list1
=
new
ArrayList
<>();
Object
map
=
redis
.
get
(
RedisKey
.
ZY_MAP_AREAS
);
String
mapString
=
JSONArray
.
toJSONString
(
map
);
List
<
MapVo
.
MapVoReuslt
>
mapVo
=
JSONArray
.
parseArray
(
mapString
,
MapVo
.
MapVoReuslt
.
class
);
List
<
LocationLog
>
list
=
locationLogRepository
.
findAll
(
specification
);
List
<
HistoryRouteVo
>
voList
=
list
.
stream
()
.
map
(
e
->
{
HistoryRouteVo
routeVo
=
HistoryRouteVo
.
transform
(
e
);
for
(
MapVo
.
MapVoReuslt
item
:
mapVo
)
{
if
(
item
.
getId
().
equals
(
e
.
getAreaId
().
intValue
()))
{
routeVo
.
setMapName
(
item
.
getName
());
break
;
}
}
routeVo
.
setMapName
(
mapUtil
.
getMapName
(
e
.
getAreaId
().
intValue
()));
return
routeVo
;
})
.
collect
(
Collectors
.
toList
());
...
...
app/src/main/java/com/yiring/app/service/location/fence/FenceAlarmService.java
0 → 100644
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
location
.
fence
;
import
com.yiring.app.param.location.fence.FenceAlarmConditionParam
;
import
com.yiring.app.vo.IdNameVo
;
import
com.yiring.app.vo.location.fence.FenceAlarmVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 16:24
*/
public
interface
FenceAlarmService
{
/**
* 查询围栏报警数据列表
* @param param 查询条件
* @param pageParam 分页参数
* @return 报警数据
*/
Result
<
PageVo
<
FenceAlarmVo
>>
findList
(
FenceAlarmConditionParam
param
,
PageParam
pageParam
);
/**
* 查询围栏下拉框
* @return 围栏id和名称
*/
Result
<
PageVo
<
IdNameVo
>>
findFenceList
();
/**
* 导出围栏报警数据
* @param param 查询条件
*/
void
export
(
FenceAlarmConditionParam
param
,
HttpServletResponse
response
);
}
app/src/main/java/com/yiring/app/service/location/fence/impl/FenceAlarmServiceImpl.java
0 → 100644
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
location
.
fence
.
impl
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.yiring.app.domain.location.LocationFence
;
import
com.yiring.app.domain.location.LocationFenceAlarm
;
import
com.yiring.app.domain.location.LocationFenceAlarmRepository
;
import
com.yiring.app.domain.location.LocationFenceRepository
;
import
com.yiring.app.excel.location.fence.FenceAlarmExcel
;
import
com.yiring.app.param.location.fence.FenceAlarmConditionParam
;
import
com.yiring.app.service.location.fence.FenceAlarmService
;
import
com.yiring.app.util.MapUtil
;
import
com.yiring.app.vo.IdNameVo
;
import
com.yiring.app.vo.location.fence.FenceAlarmVo
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Join
;
import
javax.persistence.criteria.JoinType
;
import
javax.persistence.criteria.Predicate
;
import
javax.servlet.http.HttpServletResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 16:27
*/
@Slf4j
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
FenceAlarmServiceImpl
implements
FenceAlarmService
{
@Resource
private
LocationFenceAlarmRepository
locationFenceAlarmRepository
;
@Resource
private
LocationFenceRepository
locationFenceRepository
;
@Resource
private
MapUtil
mapUtil
;
@Override
public
Result
<
PageVo
<
FenceAlarmVo
>>
findList
(
FenceAlarmConditionParam
param
,
PageParam
pageParam
)
{
Pageable
pageable
=
PageParam
.
toPageable
(
pageParam
);
Specification
<
LocationFenceAlarm
>
specification
=
getSpecification
(
param
);
Page
<
LocationFenceAlarm
>
page
=
locationFenceAlarmRepository
.
findAll
(
specification
,
pageable
);
List
<
FenceAlarmVo
>
voList
=
page
.
get
()
.
map
(
e
->
{
FenceAlarmVo
vo
=
FenceAlarmVo
.
transform
(
e
);
vo
.
setMapName
(
mapUtil
.
getMapName
(
e
.
getAreaId
().
intValue
()));
return
vo
;
})
.
collect
(
Collectors
.
toList
());
PageVo
<
FenceAlarmVo
>
pageVo
=
PageVo
.
build
(
voList
,
voList
.
size
());
return
Result
.
ok
(
pageVo
);
}
@Override
public
Result
<
PageVo
<
IdNameVo
>>
findFenceList
()
{
List
<
LocationFence
>
list
=
locationFenceRepository
.
findAll
();
List
<
IdNameVo
>
voList
=
list
.
stream
()
.
map
(
e
->
new
IdNameVo
(
e
.
getId
(),
e
.
getName
()))
.
collect
(
Collectors
.
toList
());
PageVo
<
IdNameVo
>
pageVo
=
PageVo
.
build
(
voList
,
voList
.
size
());
return
Result
.
ok
(
pageVo
);
}
@Override
public
void
export
(
FenceAlarmConditionParam
param
,
HttpServletResponse
response
)
{
Specification
<
LocationFenceAlarm
>
specification
=
getSpecification
(
param
);
List
<
LocationFenceAlarm
>
list
=
locationFenceAlarmRepository
.
findAll
(
specification
);
List
<
FenceAlarmExcel
>
excelList
=
list
.
stream
()
.
map
(
e
->
{
FenceAlarmExcel
excel
=
FenceAlarmExcel
.
transform
(
e
);
excel
.
setMapName
(
mapUtil
.
getMapName
(
e
.
getAreaId
().
intValue
()));
return
excel
;
})
.
collect
(
Collectors
.
toList
());
try
(
DefaultStreamExcelBuilder
<
FenceAlarmExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
FenceAlarmExcel
.
class
)
.
threadPool
(
Executors
.
newFixedThreadPool
(
2
))
.
rowHeight
(
14
)
.
titleRowHeight
(
14
)
.
style
(
"cell->vertical-align:center;text-align:center"
,
"title->vertical-align:center;text-align:center;font-weight:bold;font-family:等线"
)
.
start
()
)
{
streamExcelBuilder
.
append
(
excelList
);
String
fileName
=
URLEncoder
.
encode
(
"围栏报警数据列表.xlsx"
,
StandardCharsets
.
UTF_8
);
response
.
setContentType
(
"application/octet-stream"
);
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
fileName
);
OutputStream
out
=
response
.
getOutputStream
();
Workbook
workbook
=
streamExcelBuilder
.
fixedTitles
().
build
();
workbook
.
write
(
out
);
workbook
.
close
();
out
.
flush
();
out
.
close
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
RuntimeException
(
"报警类型列表导出失败: "
+
e
.
getMessage
());
}
}
private
Specification
<
LocationFenceAlarm
>
getSpecification
(
FenceAlarmConditionParam
param
)
{
return
(
root
,
query
,
criteriaBuilder
)
->
{
ArrayList
<
Predicate
>
list
=
new
ArrayList
<>();
if
(
param
.
getMapId
()
!=
null
)
{
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
LocationFenceAlarm
.
Fields
.
areaId
),
param
.
getMapId
()));
}
if
(
param
.
getFenceId
()
!=
null
)
{
LocationFence
fence
=
LocationFence
.
builder
().
id
(
param
.
getFenceId
()).
build
();
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
LocationFenceAlarm
.
Fields
.
fence
),
fence
));
}
if
(
param
.
getRealName
()
!=
null
)
{
Join
<
Object
,
Object
>
join
=
root
.
join
(
LocationFenceAlarm
.
Fields
.
user
,
JoinType
.
LEFT
);
list
.
add
(
criteriaBuilder
.
equal
(
join
.
get
(
User
.
Fields
.
realName
),
param
.
getRealName
()));
}
if
(
param
.
getStatus
()
!=
null
)
{
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
LocationFenceAlarm
.
Fields
.
status
),
LocationFenceAlarm
.
Status
.
get
(
param
.
getStatus
())
)
);
}
if
(
param
.
getBeginTime
()
!=
null
)
{
list
.
add
(
criteriaBuilder
.
greaterThanOrEqualTo
(
root
.
get
(
LocationFenceAlarm
.
Fields
.
startTime
),
param
.
getBeginTime
()
)
);
}
if
(
param
.
getEndTime
()
!=
null
)
{
list
.
add
(
criteriaBuilder
.
lessThanOrEqualTo
(
root
.
get
(
LocationFenceAlarm
.
Fields
.
endTime
),
param
.
getEndTime
())
);
}
Predicate
[]
array
=
list
.
toArray
(
new
Predicate
[
0
]);
return
criteriaBuilder
.
and
(
array
);
};
}
}
app/src/main/java/com/yiring/app/service/rehearsal/impl/RehearsalPlanServiceImpl.java
浏览文件 @
d9d4b466
...
...
@@ -237,6 +237,7 @@ public class RehearsalPlanServiceImpl implements RehearsalPlanService {
return
Result
.
no
(
Status
.
EXPECTATION_FAILED
,
"演练计划已经启动过了"
);
}
rehearsalPlan
.
setStatus
(
RehearsalPlanStatusEnum
.
RUNNING
.
getCode
());
rehearsalPlan
.
setRehearsalTime
(
LocalDateTime
.
now
());
//事故点信息
AccidentSpot
accidentSpot
=
rehearsalPlan
.
getAccidentSpot
();
Integer
scope
=
rehearsalPlan
.
getScope
();
...
...
app/src/main/java/com/yiring/app/util/MapUtil.java
0 → 100644
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
util
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yiring.app.constant.RedisKey
;
import
com.yiring.app.vo.map.MapVo
;
import
com.yiring.common.core.Redis
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.springframework.stereotype.Component
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 16:58
*/
@Component
public
class
MapUtil
{
@Resource
private
Redis
redis
;
public
String
getMapName
(
Integer
mapId
)
{
Object
map
=
redis
.
get
(
RedisKey
.
ZY_MAP_AREAS
);
String
mapString
=
JSONArray
.
toJSONString
(
map
);
List
<
MapVo
.
MapVoReuslt
>
mapVo
=
JSONArray
.
parseArray
(
mapString
,
MapVo
.
MapVoReuslt
.
class
);
for
(
MapVo
.
MapVoReuslt
item
:
mapVo
)
{
if
(
item
.
getId
().
equals
(
mapId
))
{
return
item
.
getName
();
}
}
return
"未知地图"
;
}
}
app/src/main/java/com/yiring/app/vo/location/fence/FenceAlarmVo.java
0 → 100644
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
location
.
fence
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.constant.alarm.FenceTypeEnum
;
import
com.yiring.app.domain.location.LocationFenceAlarm
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 15:15
*/
@ApiModel
(
"围栏报警数据管理"
)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
FenceAlarmVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
8259241388552022873L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"地图id"
,
example
=
"1"
)
private
Long
mapId
;
@ApiModelProperty
(
value
=
"地图名称"
,
example
=
"总图"
)
private
String
mapName
;
@ApiModelProperty
(
value
=
"围栏名称"
,
example
=
"一号围栏"
)
private
String
fenceName
;
@ApiModelProperty
(
value
=
"围栏类别code"
,
example
=
"1"
)
private
Integer
fenceType
;
@ApiModelProperty
(
value
=
"围栏类别名称"
,
example
=
"普通围栏"
)
private
String
fenceTypeName
;
@ApiModelProperty
(
value
=
"报警人员名称"
,
example
=
"张三"
)
private
String
realName
;
@ApiModelProperty
(
value
=
"标签号"
,
example
=
"BTT1"
)
private
String
tagId
;
@ApiModelProperty
(
value
=
"报警开始时间"
,
example
=
"2022-05-04 13:00:00"
)
private
LocalDateTime
startTime
;
@ApiModelProperty
(
value
=
"报警结束时间"
,
example
=
"2022-05-04 13:00:00"
)
private
LocalDateTime
endTime
;
@ApiModelProperty
(
value
=
"报警类型"
,
example
=
"超员报警"
)
private
String
alarmTypeName
;
@ApiModelProperty
(
value
=
"接收人"
,
example
=
"李四"
)
private
String
recipient
;
@ApiModelProperty
(
value
=
"报警状态"
,
example
=
"报警中"
)
private
String
statusName
;
public
static
FenceAlarmVo
transform
(
LocationFenceAlarm
fenceAlarm
)
{
return
FenceAlarmVo
.
builder
()
.
id
(
fenceAlarm
.
getId
())
.
mapId
(
fenceAlarm
.
getAreaId
())
.
fenceName
(
fenceAlarm
.
getFence
().
getName
())
.
fenceType
(
fenceAlarm
.
getFence
().
getFenceType
())
.
fenceTypeName
(
FenceTypeEnum
.
getByCode
(
fenceAlarm
.
getFence
().
getFenceType
()))
.
realName
(
fenceAlarm
.
getUser
().
getRealName
())
.
tagId
(
fenceAlarm
.
getTag
().
getCode
())
.
startTime
(
fenceAlarm
.
getStartTime
())
.
endTime
(
fenceAlarm
.
getEndTime
())
.
alarmTypeName
(
fenceAlarm
.
getType
().
getName
())
//todo
//.recipient()
.
statusName
(
fenceAlarm
.
getStatus
().
text
())
.
build
();
}
}
app/src/main/java/com/yiring/app/vo/rehearsal/RehearsalPlanVo.java
浏览文件 @
d9d4b466
...
...
@@ -38,6 +38,7 @@ public class RehearsalPlanVo implements Serializable {
@ApiModelProperty
(
value
=
"演练主题"
,
example
=
"红色演练"
)
private
String
topical
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"事故点id"
,
example
=
"1522844636060585984"
)
private
Long
accidentSpotId
;
...
...
@@ -47,6 +48,7 @@ public class RehearsalPlanVo implements Serializable {
@ApiModelProperty
(
value
=
"周边范围(事故点周围多少米)"
,
example
=
"50"
)
private
Integer
scope
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"撤离区id"
,
example
=
"1523562795864428544"
)
private
Long
evacuationZoneId
;
...
...
@@ -65,9 +67,6 @@ public class RehearsalPlanVo implements Serializable {
@ApiModelProperty
(
value
=
"演练时间"
,
example
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
rehearsalTime
;
@ApiModelProperty
(
value
=
"推送信息"
,
example
=
"气体泄露,请尽快逃离"
)
private
String
pushMsg
;
@ApiModelProperty
(
value
=
"演练计划的状态code"
,
example
=
"1"
)
private
Integer
status
;
...
...
@@ -88,7 +87,6 @@ public class RehearsalPlanVo implements Serializable {
.
riskLevelName
(
RiskLevelEnum
.
getByCode
(
rehearsalPlan
.
getRiskLevel
()))
.
accidentMsg
(
rehearsalPlan
.
getAccidentMsg
())
.
rehearsalTime
(
rehearsalPlan
.
getRehearsalTime
())
.
pushMsg
(
rehearsalPlan
.
getPushMsg
())
.
status
(
rehearsalPlan
.
getStatus
())
.
statusName
(
RehearsalPlanStatusEnum
.
getByCode
(
rehearsalPlan
.
getStatus
()))
.
build
();
...
...
app/src/main/java/com/yiring/app/web/alarm/FenceAlarmController.java
deleted
100644 → 0
浏览文件 @
634cf4de
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
alarm
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 14:41
*/
public
class
FenceAlarmController
{}
app/src/main/java/com/yiring/app/web/location/fence/FenceAlarmController.java
0 → 100644
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
location
.
fence
;
import
com.yiring.app.param.location.fence.FenceAlarmConditionParam
;
import
com.yiring.app.service.location.fence.FenceAlarmService
;
import
com.yiring.app.vo.IdNameVo
;
import
com.yiring.app.vo.location.fence.FenceAlarmVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.Objects
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author tml
* @version 1.0
* @date 2022/5/17 14:41
*/
@Api
(
tags
=
"围栏报警数据管理"
)
@Validated
@RestController
@RequestMapping
(
"/fence/alarm"
)
public
class
FenceAlarmController
{
@Resource
private
FenceAlarmService
fenceAlarmService
;
@ApiOperation
(
"查询围栏报警数据列表"
)
@GetMapping
(
"/findList"
)
public
Result
<
PageVo
<
FenceAlarmVo
>>
findList
(
@Valid
FenceAlarmConditionParam
param
,
@Valid
PageParam
pageParam
)
{
if
(
Objects
.
isNull
(
pageParam
.
getSortField
()))
{
pageParam
.
setSortField
(
BasicEntity
.
Fields
.
createTime
);
pageParam
.
setSortOrder
(
Sort
.
Direction
.
DESC
);
}
return
fenceAlarmService
.
findList
(
param
,
pageParam
);
}
@ApiOperation
(
"查询围栏下拉框"
)
@GetMapping
(
"/findFenceList"
)
public
Result
<
PageVo
<
IdNameVo
>>
findFenceList
()
{
return
fenceAlarmService
.
findFenceList
();
}
@ApiOperation
(
value
=
"导出围栏报警数据"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@GetMapping
(
"/export"
)
public
void
export
(
@Valid
FenceAlarmConditionParam
param
,
HttpServletResponse
response
)
{
fenceAlarmService
.
export
(
param
,
response
);
}
}
app/src/main/java/com/yiring/app/web/rehearsal/AccidentSpotController.java
浏览文件 @
d9d4b466
...
...
@@ -84,7 +84,7 @@ public class AccidentSpotController {
}
@ApiOperation
(
"事故点名下拉框"
)
@ApiImplicitParam
(
value
=
"事故点名(全模糊)"
,
name
=
"name"
,
example
=
"事故"
,
required
=
true
)
@ApiImplicitParam
(
value
=
"事故点名(全模糊)"
,
name
=
"name"
,
example
=
"事故"
)
@GetMapping
(
"/findAccidentList"
)
public
Result
<
PageVo
<
IdNameVo
>>
findAccidentList
(
String
name
)
{
if
(
name
==
null
)
{
...
...
app/src/main/java/com/yiring/app/web/rehearsal/RehearsalPlanController.java
浏览文件 @
d9d4b466
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
rehearsal
;
import
com.yiring.app.constant.rehearsal.RiskLevelEnum
;
import
com.yiring.app.domain.alarm.AlarmType
;
import
com.yiring.app.param.rehearsal.RehearsalPlanAddParam
;
import
com.yiring.app.param.rehearsal.RehearsalPlanConditionParam
;
import
com.yiring.app.param.rehearsal.RehearsalPlanModifyParam
;
import
com.yiring.app.param.rehearsal.RehearsalPlanPlaybackParam
;
import
com.yiring.app.service.rehearsal.RehearsalPlanService
;
import
com.yiring.app.vo.CodeNameVo
;
import
com.yiring.app.vo.rehearsal.RehearsalPlanRealTimeVo
;
import
com.yiring.app.vo.rehearsal.RehearsalPlanVo
;
import
com.yiring.common.core.Result
;
...
...
@@ -15,6 +17,7 @@ import com.yiring.common.param.PageParam;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
java.util.Objects
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -76,6 +79,14 @@ public class RehearsalPlanController {
return
rehearsalPlanService
.
findList
(
conditionParam
,
pageParam
);
}
@ApiOperation
(
value
=
"查询风险等级"
)
@GetMapping
(
"/findRiskLevel"
)
public
Result
<
PageVo
<
CodeNameVo
>>
findRiskLevel
()
{
List
<
CodeNameVo
>
list
=
RiskLevelEnum
.
getAll
();
PageVo
<
CodeNameVo
>
pageVo
=
PageVo
.
build
(
list
,
list
.
size
());
return
Result
.
ok
(
pageVo
);
}
@ApiOperation
(
value
=
"导出演练计划"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@GetMapping
(
"/export"
)
public
void
export
(
@Valid
RehearsalPlanConditionParam
conditionParam
,
HttpServletResponse
response
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论