Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
552903ac
提交
552903ac
authored
5月 11, 2022
作者:
方治民
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev_tml' of
https://gitlab.yiring.com/chemical-kesai/kshg-api
into dev_fzm
上级
bede2f8e
d8a69070
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
293 行增加
和
26 行删除
+293
-26
RehearsalPlanStatusEnum.java
...iring/app/constant/rehearsal/RehearsalPlanStatusEnum.java
+63
-0
RiskLevelEnum.java
...java/com/yiring/app/constant/rehearsal/RiskLevelEnum.java
+68
-0
AccidentSpotRepository.java
...m/yiring/app/domain/rehearsal/AccidentSpotRepository.java
+10
-10
RehearsalPlan.java
...n/java/com/yiring/app/domain/rehearsal/RehearsalPlan.java
+74
-0
AccidentSpotService.java
...com/yiring/app/service/rehearsal/AccidentSpotService.java
+22
-0
AccidentSpotServiceImpl.java
...g/app/service/rehearsal/impl/AccidentSpotServiceImpl.java
+28
-2
AccidentSpotController.java
.../com/yiring/app/web/rehearsal/AccidentSpotController.java
+25
-14
EvacuationZoneController.java
...om/yiring/app/web/rehearsal/EvacuationZoneController.java
+3
-0
没有找到文件。
app/src/main/java/com/yiring/app/constant/rehearsal/RehearsalPlanStatusEnum.java
0 → 100644
浏览文件 @
552903ac
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
constant
.
rehearsal
;
import
com.yiring.app.vo.CodeNameVo
;
import
java.util.ArrayList
;
import
java.util.List
;
import
lombok.Getter
;
/**
* 演练计划状态枚举(1:未启动, 2:进行中, 3:已结束)
* @author tml
* @version 1.0
* @date 2022/5/9 17:29
*/
public
enum
RehearsalPlanStatusEnum
{
/**
*未启动
*/
UN_START
(
1
,
"未启动"
),
/**
*进行中
*/
RUNNING
(
2
,
"进行中"
),
/**
* 已结束
*/
END
(
3
,
"已结束"
);
@Getter
private
final
Integer
code
;
@Getter
private
final
String
name
;
private
static
final
List
<
CodeNameVo
>
LIST
;
static
{
LIST
=
new
ArrayList
<>();
for
(
RehearsalPlanStatusEnum
item
:
values
())
{
LIST
.
add
(
new
CodeNameVo
(
item
.
getCode
(),
item
.
getName
()));
}
}
RehearsalPlanStatusEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
List
<
CodeNameVo
>
getAll
()
{
return
LIST
;
}
public
static
String
getByCode
(
Integer
code
)
{
for
(
RehearsalPlanStatusEnum
item
:
values
())
{
if
(
item
.
getCode
().
equals
(
code
))
{
return
item
.
getName
();
}
}
return
"未知状态"
;
}
}
app/src/main/java/com/yiring/app/constant/rehearsal/RiskLevelEnum.java
0 → 100644
浏览文件 @
552903ac
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
constant
.
rehearsal
;
import
com.yiring.app.vo.CodeNameVo
;
import
java.util.ArrayList
;
import
java.util.List
;
import
lombok.Getter
;
/**
* 演练计划风险等级枚举(1:红色风险, 2:橙色风险, 3:黄色风险, 4:蓝色风险)
* @author tml
* @version 1.0
* @date 2022/5/9 17:28
*/
public
enum
RiskLevelEnum
{
/**
* 红色风险
*/
RED
(
1
,
"红色风险"
),
/**
* 橙色风险
*/
ORANGE
(
2
,
"橙色风险"
),
/**
* 黄色风险
*/
YELLOW
(
3
,
"黄色风险"
),
/**
* 蓝色风险
*/
BLUE
(
4
,
"蓝色风险"
);
@Getter
private
final
Integer
code
;
@Getter
private
final
String
name
;
private
static
final
List
<
CodeNameVo
>
LIST
;
static
{
LIST
=
new
ArrayList
<>();
for
(
RiskLevelEnum
item
:
values
())
{
LIST
.
add
(
new
CodeNameVo
(
item
.
getCode
(),
item
.
getName
()));
}
}
RiskLevelEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
List
<
CodeNameVo
>
getAll
()
{
return
LIST
;
}
public
static
String
getByCode
(
Integer
code
)
{
for
(
RiskLevelEnum
item
:
values
())
{
if
(
item
.
getCode
().
equals
(
code
))
{
return
item
.
getName
();
}
}
return
"未知风险"
;
}
}
app/src/main/java/com/yiring/app/domain/rehearsal/AccidentSpotRepository.java
浏览文件 @
552903ac
...
@@ -43,22 +43,22 @@ public interface AccidentSpotRepository
...
@@ -43,22 +43,22 @@ public interface AccidentSpotRepository
List
<
AccidentSpot
>
findLikeName
(
String
name
);
List
<
AccidentSpot
>
findLikeName
(
String
name
);
/**
/**
* 批量
启用
* 批量
删除
* @param ids
事故点
id集
* @param ids id集
* @param now 当前时间
* @param now 当前时间
* @return
启用了多少
条数据
* @return
删除了几
条数据
*/
*/
@Query
(
"UPDATE AccidentSpot SET enable = true,updateTime = :now WHERE id in (:ids) AND deleted = false"
)
@Query
(
"UPDATE AccidentSpot SET deleted = true, updateTime = :now WHERE id IN (:ids)"
)
@Modifying
int
batchRemove
(
@Param
(
"ids"
)
Set
<
Long
>
ids
,
@Param
(
"now"
)
LocalDateTime
now
);
int
batchEnable
(
@Param
(
"ids"
)
Set
<
Long
>
ids
,
@Param
(
"now"
)
LocalDateTime
now
);
/**
/**
* 批量停用
* 批量
启用/
停用
* @param ids 事故点id集
* @param ids 事故点id集
* @param now 当前时间
* @param now 当前时间
* @return 停用了多少条数据
* @param enable true:启用 false:停用
* @return 启用/停用了多少条数据
*/
*/
@Query
(
"UPDATE AccidentSpot SET enable =
false ,updateTime = :now WHERE id in
(:ids) AND deleted = false"
)
@Query
(
"UPDATE AccidentSpot SET enable =
:enable ,updateTime = :now WHERE id IN
(:ids) AND deleted = false"
)
@Modifying
@Modifying
int
batch
UnEnable
(
@Param
(
"ids"
)
Set
<
Long
>
ids
,
@Param
(
"now"
)
LocalDateTime
now
);
int
batch
Enable
(
@Param
(
"ids"
)
Set
<
Long
>
ids
,
@Param
(
"enable"
)
boolean
enable
,
@Param
(
"now"
)
LocalDateTime
now
);
}
}
app/src/main/java/com/yiring/app/domain/rehearsal/RehearsalPlan.java
0 → 100644
浏览文件 @
552903ac
/* (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.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
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.Where
;
/**
* @author tml
* @version 1.0
* @date 2022/5/9 17:07
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@FieldNameConstants
@SuperBuilder
(
toBuilder
=
true
)
@Where
(
clause
=
"deleted = false"
)
@Table
(
name
=
"BS_REHEARSAL_PLAN"
)
@Comment
(
"演练计划信息"
)
public
class
RehearsalPlan
extends
BasicEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
5215681932640062553L
;
@Comment
(
"演练主题"
)
private
String
topical
;
@Comment
(
"事故点"
)
@ManyToOne
@JoinColumn
(
name
=
"accident_spot_id"
)
private
AccidentSpot
accidentSpot
;
@Comment
(
"周边范围(事故点周围多少米)"
)
private
Integer
scope
;
@Comment
(
"撤离区"
)
@ManyToOne
@JoinColumn
(
name
=
"evacuation_zone_id"
)
private
EvacuationZone
evacuationZone
;
@Comment
(
"风险程度(1:红色风险, 2:橙色风险, 3:黄色风险, 4:蓝色风险)"
)
private
Integer
riskLevel
;
@Comment
(
"事故信息"
)
private
String
accidentMsg
;
@Comment
(
"演练时间"
)
private
LocalDateTime
rehearsalTime
;
@Comment
(
"推送信息"
)
private
String
pushMsg
;
@Comment
(
"演练计划的状态(1:未启动, 2:进行中, 3:已结束)"
)
private
Integer
status
;
@Comment
(
"逻辑删除"
)
private
boolean
deleted
;
}
app/src/main/java/com/yiring/app/service/rehearsal/AccidentSpotService.java
浏览文件 @
552903ac
...
@@ -11,6 +11,7 @@ import com.yiring.common.param.IdParam;
...
@@ -11,6 +11,7 @@ import com.yiring.common.param.IdParam;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
java.util.Set
;
import
java.util.Set
;
import
javax.validation.Valid
;
/**
/**
* @author tml
* @author tml
...
@@ -40,6 +41,13 @@ public interface AccidentSpotService {
...
@@ -40,6 +41,13 @@ public interface AccidentSpotService {
Result
<
String
>
removeAccidentSpot
(
IdParam
param
);
Result
<
String
>
removeAccidentSpot
(
IdParam
param
);
/**
/**
* 批量删除事故点
* @param ids 事故点id集
* @return 是否成功
*/
Result
<
String
>
batchRemove
(
Set
<
Long
>
ids
);
/**
* 根据id查询事故点信息
* 根据id查询事故点信息
* @param param id
* @param param id
* @return 事故点信息
* @return 事故点信息
...
@@ -62,6 +70,20 @@ public interface AccidentSpotService {
...
@@ -62,6 +70,20 @@ public interface AccidentSpotService {
Result
<
PageVo
<
IdNameVo
>>
findAccidentList
(
String
name
);
Result
<
PageVo
<
IdNameVo
>>
findAccidentList
(
String
name
);
/**
/**
* 启用一个事故点
* @param idParam 事故点id
* @return 是否成功
*/
Result
<
String
>
enable
(
@Valid
IdParam
idParam
);
/**
* 停用一个事故点
* @param idParam 事故点id
* @return 是否成功
*/
Result
<
String
>
unEnable
(
@Valid
IdParam
idParam
);
/**
* 批量启用事故点
* 批量启用事故点
* @param ids 事故点id集
* @param ids 事故点id集
* @return 是否成功
* @return 是否成功
...
...
app/src/main/java/com/yiring/app/service/rehearsal/impl/AccidentSpotServiceImpl.java
浏览文件 @
552903ac
...
@@ -90,6 +90,12 @@ public class AccidentSpotServiceImpl implements AccidentSpotService {
...
@@ -90,6 +90,12 @@ public class AccidentSpotServiceImpl implements AccidentSpotService {
}
}
@Override
@Override
public
Result
<
String
>
batchRemove
(
Set
<
Long
>
ids
)
{
int
num
=
accidentSpotRepository
.
batchRemove
(
ids
,
LocalDateTime
.
now
());
return
Result
.
ok
(
"删除了"
+
num
+
"个事故点"
);
}
@Override
public
Result
<
AccidentSpotVo
>
findById
(
IdParam
param
)
{
public
Result
<
AccidentSpotVo
>
findById
(
IdParam
param
)
{
Optional
<
AccidentSpot
>
optional
=
accidentSpotRepository
.
findById
(
param
.
getId
());
Optional
<
AccidentSpot
>
optional
=
accidentSpotRepository
.
findById
(
param
.
getId
());
if
(
optional
.
isEmpty
())
{
if
(
optional
.
isEmpty
())
{
...
@@ -137,14 +143,34 @@ public class AccidentSpotServiceImpl implements AccidentSpotService {
...
@@ -137,14 +143,34 @@ public class AccidentSpotServiceImpl implements AccidentSpotService {
}
}
@Override
@Override
public
Result
<
String
>
enable
(
IdParam
idParam
)
{
Optional
<
AccidentSpot
>
optional
=
accidentSpotRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
EXPECTATION_FAILED
,
"要启用的事故点不存在"
);
}
optional
.
get
().
setEnable
(
true
);
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
unEnable
(
IdParam
idParam
)
{
Optional
<
AccidentSpot
>
optional
=
accidentSpotRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
EXPECTATION_FAILED
,
"要停用的事故点不存在"
);
}
optional
.
get
().
setEnable
(
false
);
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
batchEnable
(
Set
<
Long
>
ids
)
{
public
Result
<
String
>
batchEnable
(
Set
<
Long
>
ids
)
{
int
num
=
accidentSpotRepository
.
batchEnable
(
ids
,
LocalDateTime
.
now
());
int
num
=
accidentSpotRepository
.
batchEnable
(
ids
,
true
,
LocalDateTime
.
now
());
return
Result
.
ok
(
"启用了"
+
num
+
"个事故点"
);
return
Result
.
ok
(
"启用了"
+
num
+
"个事故点"
);
}
}
@Override
@Override
public
Result
<
String
>
batchUnEnable
(
Set
<
Long
>
ids
)
{
public
Result
<
String
>
batchUnEnable
(
Set
<
Long
>
ids
)
{
int
num
=
accidentSpotRepository
.
batch
UnEnable
(
ids
,
LocalDateTime
.
now
());
int
num
=
accidentSpotRepository
.
batch
Enable
(
ids
,
false
,
LocalDateTime
.
now
());
return
Result
.
ok
(
"停用了"
+
num
+
"个事故点"
);
return
Result
.
ok
(
"停用了"
+
num
+
"个事故点"
);
}
}
}
}
app/src/main/java/com/yiring/app/web/rehearsal/AccidentSpotController.java
浏览文件 @
552903ac
...
@@ -7,6 +7,7 @@ import com.yiring.app.param.rehearsal.AccidentSpotModifyParam;
...
@@ -7,6 +7,7 @@ import com.yiring.app.param.rehearsal.AccidentSpotModifyParam;
import
com.yiring.app.service.rehearsal.AccidentSpotService
;
import
com.yiring.app.service.rehearsal.AccidentSpotService
;
import
com.yiring.app.vo.IdNameVo
;
import
com.yiring.app.vo.IdNameVo
;
import
com.yiring.app.vo.rehearsal.AccidentSpotVo
;
import
com.yiring.app.vo.rehearsal.AccidentSpotVo
;
import
com.yiring.auth.param.IdsParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
...
@@ -16,10 +17,8 @@ import io.swagger.annotations.Api;
...
@@ -16,10 +17,8 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -58,6 +57,12 @@ public class AccidentSpotController {
...
@@ -58,6 +57,12 @@ public class AccidentSpotController {
return
accidentSpotService
.
removeAccidentSpot
(
param
);
return
accidentSpotService
.
removeAccidentSpot
(
param
);
}
}
@ApiOperation
(
"批量删除事故点"
)
@PostMapping
(
"/batchRemove"
)
public
Result
<
String
>
batchRemove
(
@Valid
IdsParam
idsParam
)
{
return
accidentSpotService
.
batchRemove
(
idsParam
.
toIds
());
}
@ApiOperation
(
"根据id查询事故点"
)
@ApiOperation
(
"根据id查询事故点"
)
@GetMapping
(
"/findById"
)
@GetMapping
(
"/findById"
)
public
Result
<
AccidentSpotVo
>
findById
(
@Valid
IdParam
param
)
{
public
Result
<
AccidentSpotVo
>
findById
(
@Valid
IdParam
param
)
{
...
@@ -87,21 +92,27 @@ public class AccidentSpotController {
...
@@ -87,21 +92,27 @@ public class AccidentSpotController {
return
accidentSpotService
.
findAccidentList
(
name
);
return
accidentSpotService
.
findAccidentList
(
name
);
}
}
@ApiOperation
(
"启用一个事故点"
)
@PostMapping
(
"/enable"
)
public
Result
<
String
>
enable
(
@Valid
IdParam
idParam
)
{
return
accidentSpotService
.
enable
(
idParam
);
}
@ApiOperation
(
"停用一个事故点"
)
@PostMapping
(
"/unEnable"
)
public
Result
<
String
>
unEnable
(
@Valid
IdParam
idParam
)
{
return
accidentSpotService
.
unEnable
(
idParam
);
}
@ApiOperation
(
"批量启用"
)
@ApiOperation
(
"批量启用"
)
@ApiImplicitParam
(
value
=
"事故点id集"
,
example
=
"1,2,3"
,
name
=
"ids"
)
@PostMapping
(
"/batchEnable"
)
@GetMapping
(
"/batchEnable"
)
public
Result
<
String
>
batchEnable
(
@Valid
IdsParam
idsParam
)
{
public
Result
<
String
>
batchEnable
(
return
accidentSpotService
.
batchEnable
(
idsParam
.
toIds
());
@RequestParam
(
value
=
"ids"
,
required
=
false
)
@NotEmpty
(
message
=
"请传入至少一个事故点"
)
Set
<
Long
>
ids
)
{
return
accidentSpotService
.
batchEnable
(
ids
);
}
}
@ApiOperation
(
"批量停用"
)
@ApiOperation
(
"批量停用"
)
@ApiImplicitParam
(
value
=
"事故点id集"
,
example
=
"1,2,3"
,
name
=
"ids"
)
@PostMapping
(
"/batchUnEnable"
)
@GetMapping
(
"/batchUnEnable"
)
public
Result
<
String
>
batchUnEnable
(
@Valid
IdsParam
idsParam
)
{
public
Result
<
String
>
batchUnEnable
(
return
accidentSpotService
.
batchUnEnable
(
idsParam
.
toIds
());
@RequestParam
(
value
=
"ids"
,
required
=
false
)
@NotEmpty
(
message
=
"请传入至少一个事故点"
)
Set
<
Long
>
ids
)
{
return
accidentSpotService
.
batchUnEnable
(
ids
);
}
}
}
}
app/src/main/java/com/yiring/app/web/rehearsal/EvacuationZoneController.java
浏览文件 @
552903ac
...
@@ -58,6 +58,9 @@ public class EvacuationZoneController {
...
@@ -58,6 +58,9 @@ public class EvacuationZoneController {
@ApiOperation
(
"查询撤离区下拉框"
)
@ApiOperation
(
"查询撤离区下拉框"
)
@GetMapping
(
"/findEvacuationPullDown"
)
@GetMapping
(
"/findEvacuationPullDown"
)
public
Result
<
PageVo
<
IdNameVo
>>
findEvacuationPullDown
(
String
name
)
{
public
Result
<
PageVo
<
IdNameVo
>>
findEvacuationPullDown
(
String
name
)
{
if
(
name
==
null
)
{
name
=
""
;
}
return
evacuationZoneService
.
findEvacuationPullDown
(
name
);
return
evacuationZoneService
.
findEvacuationPullDown
(
name
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论