Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
75be7cd2
提交
75be7cd2
authored
5月 14, 2022
作者:
涂茂林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:演练计划
上级
c28135da
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
42 个修改的文件
包含
1085 行增加
和
73 行删除
+1085
-73
AlarmType.java
app/src/main/java/com/yiring/app/domain/alarm/AlarmType.java
+23
-0
LocationAlarmRule.java
...ava/com/yiring/app/domain/location/LocationAlarmRule.java
+3
-3
LocationTagRepository.java
...com/yiring/app/domain/location/LocationTagRepository.java
+28
-1
RehearsalPlanLog.java
...ava/com/yiring/app/domain/rehearsal/RehearsalPlanLog.java
+63
-0
RehearsalPlanLogRepository.java
...ring/app/domain/rehearsal/RehearsalPlanLogRepository.java
+23
-0
RehearsalPlanRepository.java
.../yiring/app/domain/rehearsal/RehearsalPlanRepository.java
+16
-0
LocationAlarmRuleExcel.java
...com/yiring/app/excel/location/LocationAlarmRuleExcel.java
+17
-13
RehearsalPlanExcel.java
...va/com/yiring/app/excel/rehearsal/RehearsalPlanExcel.java
+73
-0
AlarmTypeModifyParam.java
...java/com/yiring/app/param/alarm/AlarmTypeModifyParam.java
+0
-1
LocationFenceModifyParam.java
...ng/app/param/location/fence/LocationFenceModifyParam.java
+0
-1
AlarmRuleBatchAddParam.java
...iring/app/param/location/rule/AlarmRuleBatchAddParam.java
+29
-0
AlarmRuleBatchModifyParam.java
...ng/app/param/location/rule/AlarmRuleBatchModifyParam.java
+29
-0
LocationAlarmRuleAddParam.java
...ng/app/param/location/rule/LocationAlarmRuleAddParam.java
+17
-7
LocationAlarmRuleModifyParam.java
...app/param/location/rule/LocationAlarmRuleModifyParam.java
+14
-5
AccidentSpotModifyParam.java
...m/yiring/app/param/rehearsal/AccidentSpotModifyParam.java
+0
-2
EvacuationZoneModifyParam.java
...yiring/app/param/rehearsal/EvacuationZoneModifyParam.java
+0
-2
RehearsalPlanAddParam.java
...com/yiring/app/param/rehearsal/RehearsalPlanAddParam.java
+78
-0
RehearsalPlanConditionParam.java
...ring/app/param/rehearsal/RehearsalPlanConditionParam.java
+43
-0
RehearsalPlanModifyParam.java
.../yiring/app/param/rehearsal/RehearsalPlanModifyParam.java
+72
-0
RehearsalPlanPlaybackParam.java
...iring/app/param/rehearsal/RehearsalPlanPlaybackParam.java
+36
-0
AlarmService.java
.../main/java/com/yiring/app/service/alarm/AlarmService.java
+1
-1
AlarmServiceImpl.java
...a/com/yiring/app/service/alarm/impl/AlarmServiceImpl.java
+4
-5
DistrictServiceImpl.java
...yiring/app/service/district/impl/DistrictServiceImpl.java
+1
-1
LocationFenceServiceImpl.java
...service/location/fence/impl/LocationFenceServiceImpl.java
+1
-1
LocationAlarmRuleService.java
...g/app/service/location/rule/LocationAlarmRuleService.java
+18
-2
LocationAlarmRuleServiceImpl.java
...vice/location/rule/impl/LocationAlarmRuleServiceImpl.java
+41
-7
RehearsalPlanService.java
...om/yiring/app/service/rehearsal/RehearsalPlanService.java
+92
-0
AccidentSpotServiceImpl.java
...g/app/service/rehearsal/impl/AccidentSpotServiceImpl.java
+1
-1
RehearsalPlanServiceImpl.java
.../app/service/rehearsal/impl/RehearsalPlanServiceImpl.java
+0
-0
GeoUtils.java
app/src/main/java/com/yiring/app/util/GeoUtils.java
+12
-0
CodeNameVo.java
app/src/main/java/com/yiring/app/vo/CodeNameVo.java
+3
-0
IdNameVo.java
app/src/main/java/com/yiring/app/vo/IdNameVo.java
+3
-0
LocationAlarmRuleVo.java
.../com/yiring/app/vo/location/rule/LocationAlarmRuleVo.java
+10
-0
AccidentSpotVo.java
...main/java/com/yiring/app/vo/rehearsal/AccidentSpotVo.java
+3
-0
EvacuationZoneVo.java
...in/java/com/yiring/app/vo/rehearsal/EvacuationZoneVo.java
+3
-0
RehearsalPlanRealTimeVo.java
.../com/yiring/app/vo/rehearsal/RehearsalPlanRealTimeVo.java
+40
-0
RehearsalPlanVo.java
...ain/java/com/yiring/app/vo/rehearsal/RehearsalPlanVo.java
+96
-0
UserLocationVo.java
...main/java/com/yiring/app/vo/rehearsal/UserLocationVo.java
+40
-0
AlarmTypeController.java
...in/java/com/yiring/app/web/alarm/AlarmTypeController.java
+2
-6
LocationAlarmRuleController.java
...ng/app/web/location/rule/LocationAlarmRuleController.java
+16
-13
RehearsalPlanController.java
...com/yiring/app/web/rehearsal/RehearsalPlanController.java
+133
-0
application-dev.yml
app/src/main/resources/application-dev.yml
+1
-1
没有找到文件。
app/src/main/java/com/yiring/app/domain/alarm/AlarmType.java
浏览文件 @
75be7cd2
...
...
@@ -4,6 +4,7 @@ package com.yiring.app.domain.alarm;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.Objects
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.experimental.FieldNameConstants
;
...
...
@@ -68,4 +69,26 @@ public class AlarmType implements Serializable {
@Comment
(
value
=
"是否删除"
)
@Column
(
nullable
=
false
)
private
Boolean
deleted
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
AlarmType
alarmType
=
(
AlarmType
)
o
;
return
(
Objects
.
equals
(
id
,
alarmType
.
id
)
&&
Objects
.
equals
(
name
,
alarmType
.
name
)
&&
Objects
.
equals
(
fenceType
,
alarmType
.
fenceType
)
&&
Objects
.
equals
(
relevanceParam
,
alarmType
.
relevanceParam
)
&&
Objects
.
equals
(
comment
,
alarmType
.
comment
)
&&
Objects
.
equals
(
createTime
,
alarmType
.
createTime
)
&&
Objects
.
equals
(
lastUpdateTime
,
alarmType
.
lastUpdateTime
)
&&
Objects
.
equals
(
deleted
,
alarmType
.
deleted
)
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
id
,
name
,
fenceType
,
relevanceParam
,
comment
,
createTime
,
lastUpdateTime
,
deleted
);
}
}
app/src/main/java/com/yiring/app/domain/location/LocationAlarmRule.java
浏览文件 @
75be7cd2
...
...
@@ -55,9 +55,9 @@ public class LocationAlarmRule extends BasicEntity implements Serializable {
private
String
informManner
;
@Comment
(
"报警类型"
)
@ManyTo
One
@
JoinColumn
(
name
=
"alarm_type_id"
)
private
AlarmType
alarmType
;
@ManyTo
Many
@
ToString
.
Exclude
private
Set
<
AlarmType
>
alarmTypes
;
@Comment
(
value
=
"是否删除"
)
@Column
(
nullable
=
false
)
...
...
app/src/main/java/com/yiring/app/domain/location/LocationTagRepository.java
浏览文件 @
75be7cd2
...
...
@@ -2,8 +2,11 @@
package
com
.
yiring
.
app
.
domain
.
location
;
import
java.io.Serializable
;
import
java.util.List
;
import
org.locationtech.jts.geom.Geometry
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
/**
...
...
@@ -14,4 +17,28 @@ import org.springframework.stereotype.Repository;
@Repository
public
interface
LocationTagRepository
extends
JpaRepository
<
LocationTag
,
Serializable
>,
JpaSpecificationExecutor
<
LocationTag
>
{}
extends
JpaRepository
<
LocationTag
,
Serializable
>,
JpaSpecificationExecutor
<
LocationTag
>
{
/**
* 查询在指定区域内的所有标签
* @param geometry 指定区域
* @return 标签
*/
@Query
(
value
=
"SELECT * FROM BS_LOCATION_TAG bl WHERE ST_Contains(?1, bl.point)"
,
nativeQuery
=
true
)
List
<
LocationTag
>
findInArea
(
Geometry
geometry
);
/**
* 查询在指定区域内的所有标签数量
* @param geometry 指定区域
* @return 标签数量
*/
@Query
(
value
=
"SELECT count(*) FROM BS_LOCATION_TAG bl WHERE ST_Contains(?1, bl.point)"
,
nativeQuery
=
true
)
int
findInAreaNum
(
Geometry
geometry
);
/**
* 根据多个员工id查询定位标签
* @param userIds 员工id集
* @return 定位标签
*/
@Query
(
value
=
"SELECT * FROM BS_LOCATION_TAG WHERE user_id IN (?1)"
,
nativeQuery
=
true
)
List
<
LocationTag
>
findByUserIds
(
List
<
Long
>
userIds
);
}
app/src/main/java/com/yiring/app/domain/rehearsal/RehearsalPlanLog.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
rehearsal
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.*
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Type
;
import
org.locationtech.jts.geom.Geometry
;
/**
* @author tml
* @version 1.0
* @date 2022/5/10 10:56
*/
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
(
toBuilder
=
true
)
@FieldNameConstants
@Entity
//@Where(clause = "deleted = false")
@Table
(
name
=
"BS_REHEARSAL_PLAN_LOG"
)
@Comment
(
"演练计划实施数据"
)
public
class
RehearsalPlanLog
extends
BasicEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
6920108507160621905L
;
@Comment
(
"演练计划"
)
@OneToOne
@JoinColumn
(
name
=
"rehearsal_plan_id"
)
private
RehearsalPlan
rehearsalPlan
;
@Comment
(
"开始时间"
)
private
LocalDateTime
beginTime
;
@Comment
(
"结束时间"
)
private
LocalDateTime
endTime
;
@Comment
(
"开始时事故点人数"
)
private
Integer
accidentPeopleNum
;
@Comment
(
"事故点内员工id集"
)
private
String
userIds
;
@Comment
(
"结束时撤离区人数"
)
private
Integer
evacuationPeopleNum
;
@Comment
(
"事故点影响范围的空间信息"
)
@Type
(
type
=
"jts_geometry"
)
@Column
(
columnDefinition
=
"geometry"
)
private
Geometry
geometry
;
}
app/src/main/java/com/yiring/app/domain/rehearsal/RehearsalPlanLogRepository.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
rehearsal
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
* @author tml
* @version 1.0
* @date 2022/5/11 17:04
*/
@Repository
public
interface
RehearsalPlanLogRepository
extends
JpaRepository
<
RehearsalPlanLog
,
Serializable
>,
JpaSpecificationExecutor
<
RehearsalPlanLog
>
{
/**
* 根据演练计划查询演练计划实施数据
* @param rehearsalPlan 演练计划
* @return 演练计划实施数据
*/
RehearsalPlanLog
findByRehearsalPlan
(
RehearsalPlan
rehearsalPlan
);
}
app/src/main/java/com/yiring/app/domain/rehearsal/RehearsalPlanRepository.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
rehearsal
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
* @author tml
* @version 1.0
* @date 2022/5/10 10:49
*/
@Repository
public
interface
RehearsalPlanRepository
extends
JpaRepository
<
RehearsalPlan
,
Serializable
>,
JpaSpecificationExecutor
<
RehearsalPlan
>
{}
app/src/main/java/com/yiring/app/excel/location/LocationAlarmRuleExcel.java
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
location
;
import
com.alibaba.fastjson.JSON
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.app.vo.location.rule.LocationAlarmRuleVo
;
import
com.yiring.app.constant.alarm.InformMannerEnum
;
import
com.yiring.app.domain.location.LocationAlarmRule
;
import
com.yiring.auth.domain.user.User
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.List
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
...
...
@@ -29,7 +33,7 @@ public class LocationAlarmRuleExcel implements Serializable {
@ExcelColumn
(
title
=
"地图名称"
)
private
String
mapName
;
@ExcelColumn
(
title
=
"电子围栏名称"
)
@ExcelColumn
(
title
=
"电子围栏名称"
,
width
=
15
)
private
String
fenceName
;
@ExcelColumn
(
title
=
"接收人"
,
width
=
20
)
...
...
@@ -38,25 +42,25 @@ public class LocationAlarmRuleExcel implements Serializable {
@ExcelColumn
(
title
=
"通知方式"
,
width
=
18
)
private
String
informManner
;
public
static
LocationAlarmRuleExcel
transform
(
LocationAlarmRule
Vo
locationAlarmRuleVo
)
{
StringBuilder
users
=
new
StringBuilder
();
public
static
LocationAlarmRuleExcel
transform
(
LocationAlarmRule
locationAlarmRule
)
{
StringBuilder
users
Builder
=
new
StringBuilder
();
StringBuilder
informManner
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
locationAlarmRuleVo
.
getUsers
().
size
();
i
++)
{
if
(
i
!=
0
)
{
users
.
append
(
", "
);
}
users
.
append
(
locationAlarmRuleVo
.
getUsers
().
get
(
i
).
getRealName
());
List
<
Integer
>
informMannerList
=
JSON
.
parseArray
(
locationAlarmRule
.
getInformManner
(),
Integer
.
class
);
for
(
User
user
:
locationAlarmRule
.
getUsers
())
{
usersBuilder
.
append
(
", "
);
usersBuilder
.
append
(
user
.
getRealName
());
}
for
(
int
i
=
0
;
i
<
locationAlarmRuleVo
.
getInformManner
().
size
();
i
++)
{
String
users
=
usersBuilder
.
substring
(
2
);
for
(
int
i
=
0
;
i
<
informMannerList
.
size
();
i
++)
{
if
(
i
!=
0
)
{
informManner
.
append
(
", "
);
}
informManner
.
append
(
locationAlarmRuleVo
.
getInformManner
().
get
(
i
).
getName
(
));
informManner
.
append
(
InformMannerEnum
.
getByCode
(
informMannerList
.
get
(
i
)
));
}
return
LocationAlarmRuleExcel
.
builder
()
.
mapName
(
locationAlarmRule
Vo
.
getMapName
())
.
fenceName
(
locationAlarmRule
Vo
.
getFence
Name
())
.
mapName
(
locationAlarmRule
.
getMapName
())
.
fenceName
(
locationAlarmRule
.
getLocationFence
().
get
Name
())
.
users
(
users
.
toString
())
.
informManner
(
informManner
.
toString
())
.
build
();
...
...
app/src/main/java/com/yiring/app/excel/rehearsal/RehearsalPlanExcel.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
rehearsal
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.app.constant.rehearsal.RehearsalPlanStatusEnum
;
import
com.yiring.app.constant.rehearsal.RiskLevelEnum
;
import
com.yiring.app.domain.rehearsal.RehearsalPlan
;
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/10 13:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ExcelModel
public
class
RehearsalPlanExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
2976618459214077036L
;
@ExcelColumn
(
title
=
"演练主题"
)
private
String
topical
;
@ExcelColumn
(
title
=
"事故点"
)
private
String
accidentSpotName
;
@ExcelColumn
(
title
=
"周边范围(m)"
)
private
Integer
scope
;
@ExcelColumn
(
title
=
"撤离点"
)
private
String
evacuationZoneName
;
@ExcelColumn
(
title
=
"风险程度"
)
private
String
riskLevelName
;
@ExcelColumn
(
title
=
"事故信息"
)
private
String
accidentMsg
;
@ExcelColumn
(
title
=
"演练时间"
)
private
LocalDateTime
rehearsalTime
;
@ExcelColumn
(
title
=
"推送信息"
)
private
String
pushMsg
;
@ExcelColumn
(
title
=
"状态"
)
private
String
statusName
;
public
static
RehearsalPlanExcel
transform
(
RehearsalPlan
rehearsalPlan
)
{
return
RehearsalPlanExcel
.
builder
()
.
topical
(
rehearsalPlan
.
getTopical
())
.
accidentSpotName
(
rehearsalPlan
.
getAccidentSpot
().
getName
())
.
scope
(
rehearsalPlan
.
getScope
())
.
evacuationZoneName
(
rehearsalPlan
.
getEvacuationZone
().
getName
())
.
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/alarm/AlarmTypeModifyParam.java
浏览文件 @
75be7cd2
...
...
@@ -58,7 +58,6 @@ public class AlarmTypeModifyParam implements Serializable {
.
fenceType
(
fenceType
)
.
relevanceParam
(
relevanceParam
)
.
comment
(
comment
)
.
deleted
(
false
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/location/fence/LocationFenceModifyParam.java
浏览文件 @
75be7cd2
...
...
@@ -70,7 +70,6 @@ public class LocationFenceModifyParam {
.
geometry
(
geometry
)
.
residenceTime
(
residenceTime
)
.
threshold
(
threshold
)
.
enable
(
false
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/location/rule/AlarmRuleBatchAddParam.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
rule
;
import
io.swagger.annotations.ApiModel
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.Set
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/11 14:17
*/
@ApiModel
(
"批量添加配置报警类别的报警规则"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AlarmRuleBatchAddParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
7123885270967732491L
;
private
Set
<
LocationAlarmRuleAddParam
>
params
;
}
app/src/main/java/com/yiring/app/param/location/rule/AlarmRuleBatchModifyParam.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
rule
;
import
io.swagger.annotations.ApiModel
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.Set
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/12 9:46
*/
@ApiModel
(
"批量修改配置报警类别的报警规则"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AlarmRuleBatchModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
9160183461478867656L
;
private
Set
<
LocationAlarmRuleModifyParam
>
params
;
}
app/src/main/java/com/yiring/app/param/location/rule/LocationAlarmRuleAddParam.java
浏览文件 @
75be7cd2
...
...
@@ -14,6 +14,7 @@ import java.io.Serial;
import
java.io.Serializable
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
lombok.AllArgsConstructor
;
...
...
@@ -36,6 +37,12 @@ public class LocationAlarmRuleAddParam implements Serializable {
@Serial
private
static
final
long
serialVersionUID
=
388296602724939033L
;
/**
* 这个字段给前端标识用,后端无意义
*/
@ApiModelProperty
(
value
=
"标识ID,无意义"
)
private
Integer
tabId
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"地图id"
,
example
=
"1"
,
required
=
true
)
@NotNull
(
message
=
"地图id不能为空"
)
...
...
@@ -49,16 +56,16 @@ public class LocationAlarmRuleAddParam implements Serializable {
@NotNull
(
message
=
"电子围栏id不能为空"
)
private
Long
fenceId
;
@ApiModelProperty
(
value
=
"报警类型id"
,
example
=
"1"
,
required
=
true
)
@Not
Null
(
message
=
"报警类型id不能为空"
)
private
Long
alarmId
;
@ApiModelProperty
(
value
=
"报警类型id"
,
required
=
true
)
@Not
Empty
(
message
=
"报警类型id不能为空"
)
private
Set
<
Long
>
alarmIds
;
@ApiModelProperty
(
value
=
"接收人集合(id)"
,
required
=
true
)
@Not
Null
(
message
=
"接收人id不能为空"
)
@Not
Empty
(
message
=
"接收人id不能为空"
)
private
Set
<
Long
>
users
;
@ApiModelProperty
(
value
=
"通知方式集合"
,
required
=
true
)
@Not
Null
(
message
=
"通知方式不能为空"
)
@Not
Empty
(
message
=
"通知方式不能为空"
)
private
Set
<
Integer
>
informManner
;
public
LocationAlarmRule
transform
()
{
...
...
@@ -67,7 +74,10 @@ public class LocationAlarmRuleAddParam implements Serializable {
for
(
Long
item
:
this
.
users
)
{
set
.
add
(
User
.
builder
().
id
(
item
).
build
());
}
AlarmType
alarmType
=
AlarmType
.
builder
().
id
(
alarmId
).
build
();
Set
<
AlarmType
>
alarmTypes
=
alarmIds
.
stream
()
.
map
(
e
->
AlarmType
.
builder
().
id
(
e
).
build
())
.
collect
(
Collectors
.
toSet
());
String
json
=
JSON
.
toJSONString
(
informManner
);
return
LocationAlarmRule
.
builder
()
...
...
@@ -75,7 +85,7 @@ public class LocationAlarmRuleAddParam implements Serializable {
.
mapName
(
mapName
)
.
locationFence
(
locationFence
)
.
users
(
set
)
.
alarmType
(
alarmType
)
.
alarmType
s
(
alarmTypes
)
.
informManner
(
json
)
.
deleted
(
false
)
.
build
();
...
...
app/src/main/java/com/yiring/app/param/location/rule/LocationAlarmRuleModifyParam.java
浏览文件 @
75be7cd2
...
...
@@ -12,6 +12,7 @@ import java.io.Serial;
import
java.io.Serializable
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
lombok.AllArgsConstructor
;
...
...
@@ -34,6 +35,12 @@ public class LocationAlarmRuleModifyParam implements Serializable {
@Serial
private
static
final
long
serialVersionUID
=
388296602724939033L
;
/**
* 这个字段给前端标识用,后端无意义
*/
@ApiModelProperty
(
value
=
"标识ID,无意义"
)
private
Integer
tabId
;
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
,
required
=
true
)
@NotEmpty
(
message
=
"规则id不能为空"
)
private
Long
id
;
...
...
@@ -44,9 +51,9 @@ public class LocationAlarmRuleModifyParam implements Serializable {
@ApiModelProperty
(
value
=
"地图名称"
,
example
=
"一层"
,
required
=
true
)
private
String
mapName
;
@ApiModelProperty
(
value
=
"报警类型id"
,
example
=
"1"
,
required
=
true
)
@ApiModelProperty
(
value
=
"报警类型id"
,
required
=
true
)
@NotNull
(
message
=
"报警类型id不能为空"
)
private
Long
alarmId
;
private
Set
<
Long
>
alarmIds
;
@ApiModelProperty
(
value
=
"电子围栏id"
,
example
=
"1"
,
required
=
true
)
private
Long
fenceId
;
...
...
@@ -63,7 +70,10 @@ public class LocationAlarmRuleModifyParam implements Serializable {
for
(
Long
item
:
this
.
users
)
{
set
.
add
(
User
.
builder
().
id
(
item
).
build
());
}
AlarmType
alarmType
=
AlarmType
.
builder
().
id
(
alarmId
).
build
();
Set
<
AlarmType
>
alarmTypes
=
alarmIds
.
stream
()
.
map
(
e
->
AlarmType
.
builder
().
id
(
e
).
build
())
.
collect
(
Collectors
.
toSet
());
String
json
=
JSON
.
toJSONString
(
informManner
);
return
LocationAlarmRule
.
builder
()
...
...
@@ -72,9 +82,8 @@ public class LocationAlarmRuleModifyParam implements Serializable {
.
mapName
(
mapName
)
.
locationFence
(
locationFence
)
.
users
(
set
)
.
alarmType
(
alarmType
)
.
alarmType
s
(
alarmTypes
)
.
informManner
(
json
)
.
deleted
(
false
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/rehearsal/AccidentSpotModifyParam.java
浏览文件 @
75be7cd2
...
...
@@ -66,8 +66,6 @@ public class AccidentSpotModifyParam implements Serializable {
.
video
(
video
)
.
timeoutDuration
(
timeoutDuration
)
.
threshold
(
threshold
)
.
enable
(
false
)
.
deleted
(
false
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/rehearsal/EvacuationZoneModifyParam.java
浏览文件 @
75be7cd2
...
...
@@ -64,8 +64,6 @@ public class EvacuationZoneModifyParam implements Serializable {
.
video
(
video
)
.
timeoutDuration
(
timeoutDuration
)
.
threshold
(
threshold
)
.
enable
(
false
)
.
deleted
(
false
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/rehearsal/RehearsalPlanAddParam.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
rehearsal
;
import
com.yiring.app.constant.rehearsal.RehearsalPlanStatusEnum
;
import
com.yiring.app.domain.rehearsal.AccidentSpot
;
import
com.yiring.app.domain.rehearsal.EvacuationZone
;
import
com.yiring.app.domain.rehearsal.RehearsalPlan
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/10 11:29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel
(
"演练计划新增param"
)
public
class
RehearsalPlanAddParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
6574628197950618904L
;
@ApiModelProperty
(
value
=
"演练主题"
,
example
=
"红色演练"
,
required
=
true
)
@NotEmpty
(
message
=
"演练主题不能为空"
)
private
String
topical
;
@ApiModelProperty
(
value
=
"事故点id"
,
example
=
"1522844636060585984"
,
required
=
true
)
@NotNull
(
message
=
"事故点id不能为空"
)
private
Long
accidentSpotId
;
@ApiModelProperty
(
value
=
"周边范围(事故点周围多少米)"
,
example
=
"50"
,
required
=
true
)
@NotNull
(
message
=
"周边范围不能为空"
)
private
Integer
scope
;
@ApiModelProperty
(
value
=
"撤离区id"
,
example
=
"1523562795864428544"
,
required
=
true
)
@NotNull
(
message
=
"撤离区id不能为空"
)
private
Long
evacuationZoneId
;
@ApiModelProperty
(
value
=
"风险程度"
,
example
=
"1"
,
required
=
true
)
@NotNull
(
message
=
"撤离区id不能为空"
)
private
Integer
riskLevel
;
@ApiModelProperty
(
value
=
"事故信息"
,
example
=
"气体泄露"
,
required
=
true
)
@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
();
return
RehearsalPlan
.
builder
()
.
topical
(
topical
)
.
accidentSpot
(
accidentSpot
)
.
scope
(
scope
)
.
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/RehearsalPlanConditionParam.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
rehearsal
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
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/10 11:29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel
(
"演练计划查询条件param"
)
public
class
RehearsalPlanConditionParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
6574628197950618904L
;
@ApiModelProperty
(
value
=
"风险程度"
,
example
=
"1"
)
private
Integer
riskLevel
;
@ApiModelProperty
(
value
=
"状态"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"开始时间"
,
example
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
beginTime
;
@ApiModelProperty
(
value
=
"结束时间"
,
example
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
endTime
;
}
app/src/main/java/com/yiring/app/param/rehearsal/RehearsalPlanModifyParam.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
rehearsal
;
import
com.yiring.app.domain.rehearsal.AccidentSpot
;
import
com.yiring.app.domain.rehearsal.EvacuationZone
;
import
com.yiring.app.domain.rehearsal.RehearsalPlan
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotNull
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/10 11:29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel
(
"演练计划修改param"
)
public
class
RehearsalPlanModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
6574628197950618904L
;
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
,
required
=
true
)
@NotNull
(
message
=
"id不能为空"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"演练主题"
,
example
=
"红色演练"
)
private
String
topical
;
@ApiModelProperty
(
value
=
"事故点id"
,
example
=
"1522844636060585984"
)
private
Long
accidentSpotId
;
@ApiModelProperty
(
value
=
"周边范围(事故点周围多少米)"
,
example
=
"50"
)
private
Integer
scope
;
@ApiModelProperty
(
value
=
"撤离区id"
,
example
=
"1523562795864428544"
)
private
Long
evacuationZoneId
;
@ApiModelProperty
(
value
=
"风险程度"
,
example
=
"1"
)
private
Integer
riskLevel
;
@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
();
return
RehearsalPlan
.
builder
()
.
id
(
id
)
.
topical
(
topical
)
.
accidentSpot
(
accidentSpot
)
.
scope
(
scope
)
.
evacuationZone
(
evacuationZone
)
.
riskLevel
(
riskLevel
)
.
accidentMsg
(
accidentMsg
)
.
pushMsg
(
pushMsg
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/rehearsal/RehearsalPlanPlaybackParam.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
rehearsal
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.validation.constraints.NotNull
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/12 11:56
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel
(
"演练计划查看回放param"
)
public
class
RehearsalPlanPlaybackParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
5765142306154131375L
;
@ApiModelProperty
(
value
=
"演练计划id"
,
example
=
"1"
,
required
=
true
)
@NotNull
(
message
=
"演练计划id不能为空"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"看回放的开始时间(不传则默认演练开始的时间)"
)
private
LocalDateTime
beginTime
;
}
app/src/main/java/com/yiring/app/service/alarm/AlarmService.java
浏览文件 @
75be7cd2
...
...
@@ -58,5 +58,5 @@ public interface AlarmService {
* @param conditionParam 条件
* @param response response
*/
void
exportAlarmType
(
AlarmConditionParam
conditionParam
,
HttpServletResponse
response
,
PageParam
pageParam
);
void
exportAlarmType
(
AlarmConditionParam
conditionParam
,
HttpServletResponse
response
);
}
app/src/main/java/com/yiring/app/service/alarm/impl/AlarmServiceImpl.java
浏览文件 @
75be7cd2
...
...
@@ -79,7 +79,7 @@ public class AlarmServiceImpl implements AlarmService {
}
alarmType
=
optional
.
get
();
}
JpaUtil
.
copyNotNullProperties
(
param
,
alarmType
);
JpaUtil
.
copyNotNullProperties
(
param
.
transform
()
,
alarmType
);
return
Result
.
ok
();
}
...
...
@@ -114,11 +114,10 @@ public class AlarmServiceImpl implements AlarmService {
}
@Override
public
void
exportAlarmType
(
AlarmConditionParam
conditionParam
,
HttpServletResponse
response
,
PageParam
pageParam
)
{
Pageable
pageable
=
PageParam
.
toPageable
(
pageParam
);
public
void
exportAlarmType
(
AlarmConditionParam
conditionParam
,
HttpServletResponse
response
)
{
Specification
<
AlarmType
>
specification
=
getSpecification
(
conditionParam
);
Page
<
AlarmType
>
page
=
alarmTypeRepository
.
findAll
(
specification
,
pageable
);
List
<
AlarmTypeExcel
>
list
=
page
.
get
().
map
(
AlarmTypeExcel:
:
transform
).
collect
(
Collectors
.
toList
());
List
<
AlarmType
>
page
=
alarmTypeRepository
.
findAll
(
specification
);
List
<
AlarmTypeExcel
>
list
=
page
.
stream
().
map
(
AlarmTypeExcel:
:
transform
).
collect
(
Collectors
.
toList
());
try
(
DefaultStreamExcelBuilder
<
AlarmTypeExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
AlarmTypeExcel
.
class
)
...
...
app/src/main/java/com/yiring/app/service/district/impl/DistrictServiceImpl.java
浏览文件 @
75be7cd2
...
...
@@ -68,7 +68,7 @@ public class DistrictServiceImpl implements DistrictService {
district
=
optional
.
get
();
}
//只修改要修改的值
JpaUtil
.
copyNotNullProperties
(
param
,
district
);
JpaUtil
.
copyNotNullProperties
(
param
.
transform
()
,
district
);
return
Result
.
ok
();
}
...
...
app/src/main/java/com/yiring/app/service/location/fence/impl/LocationFenceServiceImpl.java
浏览文件 @
75be7cd2
...
...
@@ -82,7 +82,7 @@ public class LocationFenceServiceImpl implements LocationFenceService {
}
locationFence
=
optional
.
get
();
}
JpaUtil
.
copyNotNullProperties
(
param
,
locationFence
);
JpaUtil
.
copyNotNullProperties
(
param
.
transform
()
,
locationFence
);
return
Result
.
ok
();
}
...
...
app/src/main/java/com/yiring/app/service/location/rule/LocationAlarmRuleService.java
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
location
.
rule
;
import
com.yiring.app.param.location.rule.AlarmRuleBatchModifyParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleAddParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleModifyParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleParam
;
...
...
@@ -10,7 +11,9 @@ import com.yiring.common.core.Result;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
/**
* @author tml
...
...
@@ -26,6 +29,13 @@ public interface LocationAlarmRuleService {
Result
<
String
>
addRule
(
LocationAlarmRuleAddParam
param
);
/**
* 批量添加
* @param params 规则信息
* @return 是否成功
*/
Result
<
String
>
batchAdd
(
@Valid
Set
<
LocationAlarmRuleAddParam
>
params
);
/**
* 修改一条规则
* @param param 规则信息
* @return 是否成功
...
...
@@ -33,6 +43,13 @@ public interface LocationAlarmRuleService {
Result
<
String
>
modifyRule
(
LocationAlarmRuleModifyParam
param
);
/**
* 批量修改规则
* @param params 规则信息
* @return 是否成功
*/
Result
<
String
>
batchModify
(
AlarmRuleBatchModifyParam
params
);
/**
* 删除一条规则
* @param idParam 规则id
* @return 是否成功
...
...
@@ -58,9 +75,8 @@ public interface LocationAlarmRuleService {
* 导出电子围栏规则
* @param param 条件
* @param response response
* @param pageParam 分页参数
*/
void
exportAlarmRule
(
LocationAlarmRuleParam
param
,
HttpServletResponse
response
,
PageParam
pageParam
);
void
exportAlarmRule
(
LocationAlarmRuleParam
param
,
HttpServletResponse
response
);
/**
* 根据电子围栏名称模糊查询围栏id和名称
...
...
app/src/main/java/com/yiring/app/service/location/rule/impl/LocationAlarmRuleServiceImpl.java
浏览文件 @
75be7cd2
...
...
@@ -9,6 +9,7 @@ import com.yiring.app.domain.location.LocationAlarmRuleRepository;
import
com.yiring.app.domain.location.LocationFence
;
import
com.yiring.app.domain.location.LocationFenceRepository
;
import
com.yiring.app.excel.location.LocationAlarmRuleExcel
;
import
com.yiring.app.param.location.rule.AlarmRuleBatchModifyParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleAddParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleModifyParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleParam
;
...
...
@@ -69,6 +70,16 @@ public class LocationAlarmRuleServiceImpl implements LocationAlarmRuleService {
}
@Override
public
Result
<
String
>
batchAdd
(
Set
<
LocationAlarmRuleAddParam
>
params
)
{
List
<
LocationAlarmRule
>
list
=
params
.
stream
()
.
map
(
LocationAlarmRuleAddParam:
:
transform
)
.
collect
(
Collectors
.
toList
());
List
<
LocationAlarmRule
>
flush
=
locationAlarmRuleRepository
.
saveAllAndFlush
(
list
);
return
Result
.
ok
(
"已成功添加"
+
flush
.
size
()
+
"条规则"
);
}
@Override
public
Result
<
String
>
modifyRule
(
LocationAlarmRuleModifyParam
param
)
{
LocationAlarmRule
locationAlarmRule
=
param
.
transform
();
Optional
<
LocationAlarmRule
>
optional
=
locationAlarmRuleRepository
.
findById
(
param
.
getId
());
...
...
@@ -80,6 +91,17 @@ public class LocationAlarmRuleServiceImpl implements LocationAlarmRuleService {
}
@Override
public
Result
<
String
>
batchModify
(
AlarmRuleBatchModifyParam
params
)
{
for
(
LocationAlarmRuleModifyParam
item
:
params
.
getParams
())
{
Result
<
String
>
result
=
modifyRule
(
item
);
if
(
Status
.
OK
.
value
()
!=
result
.
getStatus
())
{
return
result
;
}
}
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
removeRule
(
IdParam
idParam
)
{
Optional
<
LocationAlarmRule
>
optional
=
locationAlarmRuleRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
...
...
@@ -144,14 +166,26 @@ public class LocationAlarmRuleServiceImpl implements LocationAlarmRuleService {
}
@Override
public
void
exportAlarmRule
(
LocationAlarmRuleParam
param
,
HttpServletResponse
response
,
PageParam
pageParam
)
{
Result
<
PageVo
<
LocationAlarmRuleVo
>>
result
=
findByCondition
(
param
,
pageParam
);
if
(
Status
.
OK
.
value
()
!=
result
.
getStatus
())
{
return
;
public
void
exportAlarmRule
(
LocationAlarmRuleParam
param
,
HttpServletResponse
response
)
{
Specification
<
LocationAlarmRule
>
specification
=
getSpecification
(
param
);
Set
<
Integer
>
informManner
=
param
.
getInformManner
();
List
<
LocationAlarmRule
>
list
=
locationAlarmRuleRepository
.
findAll
(
specification
);
if
(!
CollectionUtils
.
isEmpty
(
informManner
))
{
list
=
list
.
stream
()
.
filter
(
e
->
{
for
(
Integer
item
:
informManner
)
{
boolean
contains
=
e
.
getInformManner
().
contains
(
item
.
toString
());
if
(!
contains
)
{
return
false
;
}
}
return
true
;
})
.
collect
(
Collectors
.
toList
());
}
List
<
LocationAlarmRuleExcel
>
excelList
=
result
.
getBody
()
.
getData
()
List
<
LocationAlarmRuleExcel
>
excelList
=
list
.
stream
()
.
map
(
LocationAlarmRuleExcel:
:
transform
)
.
collect
(
Collectors
.
toList
());
...
...
app/src/main/java/com/yiring/app/service/rehearsal/RehearsalPlanService.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
rehearsal
;
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.vo.rehearsal.RehearsalPlanRealTimeVo
;
import
com.yiring.app.vo.rehearsal.RehearsalPlanVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
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/10 14:18
*/
public
interface
RehearsalPlanService
{
/**
* 添加一条演练计划
* @param param 演练计划信息
* @return 是否成功
*/
Result
<
String
>
addOne
(
RehearsalPlanAddParam
param
);
/**
* 修改一条演练计划
* @param param 演练计划信息
* @return 是否成功
*/
Result
<
String
>
modifyOne
(
RehearsalPlanModifyParam
param
);
/**
* 删除一条演练计划
* @param idParam 演练计划id
* @return 是否成功
*/
Result
<
String
>
removeOne
(
IdParam
idParam
);
/**
* 查询一条演练计划信息
* @param idParam 演练计划id
* @return 演练计划信息
*/
Result
<
RehearsalPlanVo
>
findOne
(
IdParam
idParam
);
/**
* 查询演练计划列表
* @param conditionParam 条件参数
* @param pageParam 分页参数
* @return 演练计划列表
*/
Result
<
PageVo
<
RehearsalPlanVo
>>
findList
(
RehearsalPlanConditionParam
conditionParam
,
PageParam
pageParam
);
/**
* 导出演练计划
* @param conditionParam 条件参数
* @param response response
*/
void
export
(
RehearsalPlanConditionParam
conditionParam
,
HttpServletResponse
response
);
/**
* 启动一个演练计划
* @param idParam 演练计划id
* @return 是否成功
*/
Result
<
String
>
start
(
IdParam
idParam
);
/**
* 停止一个演练计划
* @param idParam 演练计划id
* @return 是否成功
*/
Result
<
String
>
stop
(
IdParam
idParam
);
/**
* 查看演练(实时)
* @param idParam 演练计划id
* @return 实时信息
*/
Result
<
RehearsalPlanRealTimeVo
>
findRealTime
(
IdParam
idParam
);
/**
* 查看回放
* @param param 演练计划id和时间
* @return 回放信息
*/
Result
<
PageVo
<
RehearsalPlanRealTimeVo
>>
findPlayback
(
RehearsalPlanPlaybackParam
param
);
}
app/src/main/java/com/yiring/app/service/rehearsal/impl/AccidentSpotServiceImpl.java
浏览文件 @
75be7cd2
...
...
@@ -75,7 +75,7 @@ public class AccidentSpotServiceImpl implements AccidentSpotService {
}
accidentSpot
=
optional
.
get
();
}
JpaUtil
.
copyNotNullProperties
(
param
,
accidentSpot
);
JpaUtil
.
copyNotNullProperties
(
param
.
transform
()
,
accidentSpot
);
return
Result
.
ok
();
}
...
...
app/src/main/java/com/yiring/app/service/rehearsal/impl/RehearsalPlanServiceImpl.java
0 → 100644
浏览文件 @
75be7cd2
差异被折叠。
点击展开。
app/src/main/java/com/yiring/app/util/GeoUtils.java
浏览文件 @
75be7cd2
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.yiring.app.util.zy.LonLatUtil
;
import
lombok.experimental.UtilityClass
;
import
org.locationtech.jts.geom.Coordinate
;
import
org.locationtech.jts.geom.Geometry
;
import
org.locationtech.jts.geom.GeometryFactory
;
import
org.locationtech.jts.geom.Point
;
...
...
@@ -112,4 +113,15 @@ public class GeoUtils {
double
y
=
minY
+
(
maxY
-
minY
)
*
Math
.
random
();
return
factory
.
createPoint
(
new
Coordinate
(
x
,
y
,
z
));
}
/**
* 将一个空间信息向外扩张
* @param geometry 空间信息
* @param length 扩张长度(米)
* @return 扩张后的空间信息
*/
public
static
Geometry
expandGeometry
(
Geometry
geometry
,
Integer
length
)
{
double
degree
=
length
/
(
2
*
Math
.
PI
*
6371004
)
*
360
;
return
geometry
.
buffer
(
degree
);
}
}
app/src/main/java/com/yiring/app/vo/CodeNameVo.java
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
...
...
@@ -27,6 +29,7 @@ public class CodeNameVo implements Serializable {
private
static
final
long
serialVersionUID
=
-
7565315836652536620L
;
@ApiModelProperty
(
value
=
"code"
,
example
=
"1"
,
required
=
true
)
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Integer
code
;
@ApiModelProperty
(
value
=
"name"
,
example
=
"名称"
,
required
=
true
)
...
...
app/src/main/java/com/yiring/app/vo/IdNameVo.java
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
...
...
@@ -25,6 +27,7 @@ public class IdNameVo implements Serializable {
@Serial
private
static
final
long
serialVersionUID
=
-
8990274383112436122L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
,
required
=
true
)
private
Long
id
;
...
...
app/src/main/java/com/yiring/app/vo/location/rule/LocationAlarmRuleVo.java
浏览文件 @
75be7cd2
...
...
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import
com.yiring.app.constant.alarm.InformMannerEnum
;
import
com.yiring.app.domain.location.LocationAlarmRule
;
import
com.yiring.app.vo.CodeNameVo
;
import
com.yiring.app.vo.IdNameVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.auth.domain.user.User
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -61,6 +62,9 @@ public class LocationAlarmRuleVo implements Serializable {
@ApiModelProperty
(
value
=
"通知方式集合"
,
required
=
true
)
private
List
<
CodeNameVo
>
informManner
;
@ApiModelProperty
(
value
=
"报警类型id"
,
required
=
true
)
private
List
<
IdNameVo
>
alarmTypeIds
;
public
static
LocationAlarmRuleVo
transform
(
LocationAlarmRule
locationAlarmRule
)
{
Set
<
User
>
users
=
locationAlarmRule
.
getUsers
();
List
<
UserVo
>
userVos
=
users
.
stream
().
map
(
UserVo:
:
transformDept
).
collect
(
Collectors
.
toList
());
...
...
@@ -70,6 +74,11 @@ public class LocationAlarmRuleVo implements Serializable {
for
(
Integer
item
:
list
)
{
codeNameVos
.
add
(
new
CodeNameVo
(
item
,
InformMannerEnum
.
getByCode
(
item
)));
}
List
<
IdNameVo
>
alarmTypeList
=
locationAlarmRule
.
getAlarmTypes
()
.
stream
()
.
map
(
e
->
new
IdNameVo
(
e
.
getId
(),
e
.
getName
()))
.
collect
(
Collectors
.
toList
());
return
LocationAlarmRuleVo
.
builder
()
.
id
(
locationAlarmRule
.
getId
())
...
...
@@ -79,6 +88,7 @@ public class LocationAlarmRuleVo implements Serializable {
.
fenceName
(
locationAlarmRule
.
getLocationFence
().
getName
())
.
users
(
userVos
)
.
informManner
(
codeNameVos
)
.
alarmTypeIds
(
alarmTypeList
)
.
build
();
}
}
app/src/main/java/com/yiring/app/vo/rehearsal/AccidentSpotVo.java
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
rehearsal
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.domain.rehearsal.AccidentSpot
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -27,6 +29,7 @@ public class AccidentSpotVo implements Serializable {
@Serial
private
static
final
long
serialVersionUID
=
-
7696351020089245510L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"事故点id"
,
example
=
"1"
)
private
Long
id
;
...
...
app/src/main/java/com/yiring/app/vo/rehearsal/EvacuationZoneVo.java
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
rehearsal
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.domain.rehearsal.EvacuationZone
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -27,6 +29,7 @@ public class EvacuationZoneVo implements Serializable {
@Serial
private
static
final
long
serialVersionUID
=
919152196104921261L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"撤离区id"
,
example
=
"1"
)
private
Long
id
;
...
...
app/src/main/java/com/yiring/app/vo/rehearsal/RehearsalPlanRealTimeVo.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
rehearsal
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author tml
* @version 1.0
* @date 2022/5/12 11:40
*/
@ApiModel
(
"演练计划实时数据VO"
)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
RehearsalPlanRealTimeVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2540857588207414303L
;
@ApiModelProperty
(
value
=
"该数据的时间"
)
private
LocalDateTime
time
;
@ApiModelProperty
(
value
=
"演练开始时在危险区域的人数"
)
private
Integer
beginPeopleNum
;
@ApiModelProperty
(
value
=
"已在撤离区的人数"
,
example
=
"20"
)
private
Integer
evacuationPeopleNum
;
private
List
<
UserLocationVo
>
userLocation
;
}
app/src/main/java/com/yiring/app/vo/rehearsal/RehearsalPlanVo.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
rehearsal
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.constant.rehearsal.RehearsalPlanStatusEnum
;
import
com.yiring.app.constant.rehearsal.RiskLevelEnum
;
import
com.yiring.app.domain.rehearsal.RehearsalPlan
;
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/10 13:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel
(
"演练计划VO"
)
public
class
RehearsalPlanVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
6580835031371232948L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
,
required
=
true
)
private
Long
id
;
@ApiModelProperty
(
value
=
"演练主题"
,
example
=
"红色演练"
)
private
String
topical
;
@ApiModelProperty
(
value
=
"事故点id"
,
example
=
"1522844636060585984"
)
private
Long
accidentSpotId
;
@ApiModelProperty
(
value
=
"事故点名称"
,
example
=
"事故点1"
)
private
String
accidentSpotName
;
@ApiModelProperty
(
value
=
"周边范围(事故点周围多少米)"
,
example
=
"50"
)
private
Integer
scope
;
@ApiModelProperty
(
value
=
"撤离区id"
,
example
=
"1523562795864428544"
)
private
Long
evacuationZoneId
;
@ApiModelProperty
(
value
=
"撤离点名称"
,
example
=
"撤离点1"
)
private
String
evacuationZoneName
;
@ApiModelProperty
(
value
=
"风险程度code"
,
example
=
"1"
)
private
Integer
riskLevel
;
@ApiModelProperty
(
value
=
"风险等级名称"
,
example
=
"红色风险"
)
private
String
riskLevelName
;
@ApiModelProperty
(
value
=
"事故信息"
,
example
=
"气体泄露"
)
private
String
accidentMsg
;
@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
;
@ApiModelProperty
(
value
=
"演练计划的状态名称"
,
example
=
"未开始"
)
private
String
statusName
;
public
static
RehearsalPlanVo
transform
(
RehearsalPlan
rehearsalPlan
)
{
return
RehearsalPlanVo
.
builder
()
.
id
(
rehearsalPlan
.
getId
())
.
topical
(
rehearsalPlan
.
getTopical
())
.
accidentSpotId
(
rehearsalPlan
.
getAccidentSpot
().
getId
())
.
accidentSpotName
(
rehearsalPlan
.
getAccidentSpot
().
getName
())
.
scope
(
rehearsalPlan
.
getScope
())
.
evacuationZoneId
(
rehearsalPlan
.
getEvacuationZone
().
getId
())
.
evacuationZoneName
(
rehearsalPlan
.
getEvacuationZone
().
getName
())
.
riskLevel
(
rehearsalPlan
.
getRiskLevel
())
.
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/vo/rehearsal/UserLocationVo.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
rehearsal
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.locationtech.jts.geom.Point
;
/**
* @author tml
* @version 1.0
* @date 2022/5/12 11:48
*/
@ApiModel
(
"员工位置信息VO"
)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
UserLocationVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
7996875376293325311L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"员工id"
,
example
=
"1"
)
private
Long
userId
;
@ApiModelProperty
(
value
=
"员工姓名"
,
example
=
"1"
)
private
String
realmName
;
@ApiModelProperty
(
value
=
"员工坐标"
)
private
Point
point
;
}
app/src/main/java/com/yiring/app/web/alarm/AlarmTypeController.java
浏览文件 @
75be7cd2
...
...
@@ -98,11 +98,7 @@ public class AlarmTypeController {
@ApiOperation
(
value
=
"报警类型导出"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@PostMapping
(
"/exportAlarmType"
)
public
void
exportAlarmType
(
@Valid
AlarmConditionParam
conditionParam
,
HttpServletResponse
response
,
@Valid
PageParam
pageParam
)
{
alarmService
.
exportAlarmType
(
conditionParam
,
response
,
pageParam
);
public
void
exportAlarmType
(
@Valid
AlarmConditionParam
conditionParam
,
HttpServletResponse
response
)
{
alarmService
.
exportAlarmType
(
conditionParam
,
response
);
}
}
app/src/main/java/com/yiring/app/web/location/rule/LocationAlarmRuleController.java
浏览文件 @
75be7cd2
...
...
@@ -3,9 +3,7 @@ package com.yiring.app.web.location.rule;
import
com.yiring.app.constant.alarm.InformMannerEnum
;
import
com.yiring.app.domain.alarm.AlarmType
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleAddParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleModifyParam
;
import
com.yiring.app.param.location.rule.LocationAlarmRuleParam
;
import
com.yiring.app.param.location.rule.*
;
import
com.yiring.app.service.location.rule.LocationAlarmRuleService
;
import
com.yiring.app.vo.CodeNameVo
;
import
com.yiring.app.vo.IdNameVo
;
...
...
@@ -26,10 +24,7 @@ import lombok.extern.slf4j.Slf4j;
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.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author tml
...
...
@@ -52,12 +47,24 @@ public class LocationAlarmRuleController {
return
locationAlarmRuleService
.
addRule
(
param
);
}
@ApiOperation
(
value
=
"批量添加电子围栏报警规则"
)
@PostMapping
(
"/batchAdd"
)
public
Result
<
String
>
batchAdd
(
@Valid
@RequestBody
AlarmRuleBatchAddParam
params
)
{
return
locationAlarmRuleService
.
batchAdd
(
params
.
getParams
());
}
@ApiOperation
(
value
=
"修改一条电子围栏报警规则"
)
@PostMapping
(
"/modifyRule"
)
public
Result
<
String
>
modifyRule
(
@Valid
LocationAlarmRuleModifyParam
param
)
{
return
locationAlarmRuleService
.
modifyRule
(
param
);
}
@ApiOperation
(
value
=
"批量修改电子围栏报警规则"
)
@PostMapping
(
"/batchModify"
)
public
Result
<
String
>
batchModify
(
@Valid
@RequestBody
AlarmRuleBatchModifyParam
params
)
{
return
locationAlarmRuleService
.
batchModify
(
params
);
}
@ApiOperation
(
value
=
"删除一条电子围栏报警规则"
)
@PostMapping
(
"/removeRule"
)
public
Result
<
String
>
removeRule
(
@Valid
IdParam
idParam
)
{
...
...
@@ -93,12 +100,8 @@ public class LocationAlarmRuleController {
@ApiOperation
(
value
=
"导出电子围栏报警规则"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@PostMapping
(
"/exportAlarmRule"
)
public
void
exportAlarmRule
(
@Valid
LocationAlarmRuleParam
param
,
HttpServletResponse
response
,
@Valid
PageParam
pageParam
)
{
locationAlarmRuleService
.
exportAlarmRule
(
param
,
response
,
pageParam
);
public
void
exportAlarmRule
(
@Valid
LocationAlarmRuleParam
param
,
HttpServletResponse
response
)
{
locationAlarmRuleService
.
exportAlarmRule
(
param
,
response
);
}
@ApiOperation
(
"围栏信息下拉框"
)
...
...
app/src/main/java/com/yiring/app/web/rehearsal/RehearsalPlanController.java
0 → 100644
浏览文件 @
75be7cd2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
rehearsal
;
import
com.yiring.app.domain.alarm.AlarmType
;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.domain.location.LocationTagRepository
;
import
com.yiring.app.domain.rehearsal.AccidentSpot
;
import
com.yiring.app.domain.rehearsal.AccidentSpotRepository
;
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.rehearsal.RehearsalPlanRealTimeVo
;
import
com.yiring.app.vo.rehearsal.RehearsalPlanVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
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
java.util.Optional
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
org.locationtech.jts.geom.Geometry
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author tml
* @version 1.0
* @date 2022/5/10 14:08
*/
@RestController
@Api
(
tags
=
"RehearsalPlan(演练计划)"
)
@RequestMapping
(
"/rehearsal/plan"
)
public
class
RehearsalPlanController
{
@Resource
private
RehearsalPlanService
rehearsalPlanService
;
@Resource
LocationTagRepository
locationTagRepository
;
@Resource
AccidentSpotRepository
accidentSpotRepository
;
@ApiOperation
(
"添加一条演练计划"
)
@PostMapping
(
"/addOne"
)
public
Result
<
String
>
addOne
(
@Valid
RehearsalPlanAddParam
param
)
{
return
rehearsalPlanService
.
addOne
(
param
);
}
@ApiOperation
(
"修改一条演练计划"
)
@PostMapping
(
"/modifyOne"
)
public
Result
<
String
>
modifyOne
(
@Valid
RehearsalPlanModifyParam
param
)
{
return
rehearsalPlanService
.
modifyOne
(
param
);
}
@ApiOperation
(
"删除一条演练计划"
)
@PostMapping
(
"/removeOne"
)
public
Result
<
String
>
removeOne
(
@Valid
IdParam
idParam
)
{
return
rehearsalPlanService
.
removeOne
(
idParam
);
}
@ApiOperation
(
"查询一条演练计划"
)
@GetMapping
(
"/findOne"
)
public
Result
<
RehearsalPlanVo
>
findOne
(
@Valid
IdParam
idParam
)
{
return
rehearsalPlanService
.
findOne
(
idParam
);
}
@ApiOperation
(
"查询演练计划列表"
)
@GetMapping
(
"/findList"
)
public
Result
<
PageVo
<
RehearsalPlanVo
>>
findList
(
@Valid
RehearsalPlanConditionParam
conditionParam
,
@Valid
PageParam
pageParam
)
{
if
(
Objects
.
isNull
(
pageParam
.
getSortField
()))
{
pageParam
.
setSortField
(
AlarmType
.
Fields
.
createTime
);
pageParam
.
setSortOrder
(
Sort
.
Direction
.
DESC
);
}
return
rehearsalPlanService
.
findList
(
conditionParam
,
pageParam
);
}
@ApiOperation
(
value
=
"导出演练计划"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@GetMapping
(
"/export"
)
public
void
export
(
@Valid
RehearsalPlanConditionParam
conditionParam
,
HttpServletResponse
response
)
{
rehearsalPlanService
.
export
(
conditionParam
,
response
);
}
@ApiOperation
(
"启动一个演练计划"
)
@PostMapping
(
"/start"
)
public
Result
<
String
>
start
(
@Valid
IdParam
idParam
)
{
return
rehearsalPlanService
.
start
(
idParam
);
}
@ApiOperation
(
"停止一个演练计划"
)
@PostMapping
(
"/stop"
)
public
Result
<
String
>
stop
(
@Valid
IdParam
idParam
)
{
return
rehearsalPlanService
.
stop
(
idParam
);
}
@ApiOperation
(
"查看演练(实时)"
)
@GetMapping
(
"/findRealTime"
)
public
Result
<
RehearsalPlanRealTimeVo
>
findRealTime
(
@Valid
IdParam
idParam
)
{
return
rehearsalPlanService
.
findRealTime
(
idParam
);
}
@ApiOperation
(
"查看回放(每次查询一分钟的回放信息)"
)
@GetMapping
(
"/findPlayback"
)
public
Result
<
PageVo
<
RehearsalPlanRealTimeVo
>>
findPlayback
(
@Valid
RehearsalPlanPlaybackParam
param
)
{
return
rehearsalPlanService
.
findPlayback
(
param
);
}
@PostMapping
(
"/test"
)
public
Geometry
test
(
@RequestBody
Geometry
geometry
)
{
double
degree
=
100
/
(
2
*
Math
.
PI
*
6371004
)
*
360
;
return
geometry
.
buffer
(
degree
);
}
@GetMapping
(
"/get"
)
public
List
<
LocationTag
>
get
()
{
Optional
<
AccidentSpot
>
optional
=
accidentSpotRepository
.
findById
(
1524292027951353856L
);
Geometry
geometry
=
optional
.
get
().
getGeometry
();
List
<
LocationTag
>
inArea
=
locationTagRepository
.
findInArea
(
geometry
);
System
.
out
.
println
(
inArea
);
return
inArea
;
}
}
app/src/main/resources/application-dev.yml
浏览文件 @
75be7cd2
...
...
@@ -91,7 +91,7 @@ zy-config:
host
:
project.yz-online.com
# RabbitMQ 订阅配置
rabbitmq
:
enabled
:
tru
e
enabled
:
fals
e
host
:
${zy-config.host}
port
:
672
username
:
admin
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论