Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
8e991fd8
Commit
8e991fd8
authored
Sep 16, 2023
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交批量确认警情
parent
6e20d9bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
8 deletions
+107
-8
EquipmentSpecificAlarmLog.java
.../equipmanage/common/entity/EquipmentSpecificAlarmLog.java
+4
-0
HandleBatchConfirmEnum.java
...join/equipmanage/common/enums/HandleBatchConfirmEnum.java
+22
-0
ConfirmAlarmServiceImpl.java
...oin/equipmanage/service/impl/ConfirmAlarmServiceImpl.java
+81
-8
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/EquipmentSpecificAlarmLog.java
View file @
8e991fd8
...
...
@@ -241,4 +241,8 @@ public class EquipmentSpecificAlarmLog extends BaseEntity {
@ApiModelProperty
(
value
=
"站编码"
)
@TableField
(
value
=
"station_code"
)
private
String
stationCode
;
@ApiModelProperty
(
value
=
"批量确认"
)
@TableField
(
exist
=
false
)
private
String
handleConfirm
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/HandleBatchConfirmEnum.java
0 → 100644
View file @
8e991fd8
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* @author keyong
* @title: HandleBatchConfirmEnum
* <pre>
* @description: TODO
* </pre>
* @date 2023/9/12 10:59
*/
@AllArgsConstructor
@Getter
public
enum
HandleBatchConfirmEnum
{
SINGLE
(
"isSingle"
,
"当前一个设备"
),
ALL
(
"isAll"
,
"全部设备"
);
private
String
code
;
private
String
name
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/ConfirmAlarmServiceImpl.java
View file @
8e991fd8
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo
;
...
...
@@ -24,6 +25,7 @@ import com.yeejoin.equipmanage.service.*;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
...
...
@@ -37,6 +39,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
ConfirmAlarmServiceImpl
extends
ServiceImpl
<
ConfirmAlarmMapper
,
EquipmentSpecificAlarm
>
implements
IConfirmAlarmService
{
...
...
@@ -189,7 +192,9 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
ent
.
setConfirmUserName
(
userModel
.
getRealName
());
EquipmentSpecificAlarmLog
alarmLog
=
equipmentSpecificAlarmLogService
.
getById
(
ent
.
getId
());
List
<
EquipmentSpecificAlarmLog
>
list
=
null
;
String
handleConfirm
=
ent
.
getHandleConfirm
();
int
isBatch
=
0
;
if
(!
ObjectUtils
.
isEmpty
(
alarmLog
))
{
Long
equipmentSpecificAlarmId
=
alarmLog
.
getEquipmentSpecificAlarmId
();
ent
.
setEquipmentSpecificAlarmId
(
equipmentSpecificAlarmId
);
...
...
@@ -209,7 +214,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
// 警情处理确认后消除更新value 为false,否则灯还在闪
LambdaUpdateWrapper
<
EquipmentSpecificIndex
>
updateWrapper
=
new
LambdaUpdateWrapper
<
EquipmentSpecificIndex
>().
set
(
EquipmentSpecificIndex:
:
getValue
,
"false"
).
set
(
EquipmentSpecificIndex:
:
getUpdateDate
,
new
Date
()).
set
(
EquipmentSpecificIndex:
:
getUpdateDate
,
new
Date
()).
eq
(
EquipmentSpecificIndex:
:
getEquipmentSpecificId
,
alarm
.
getEquipmentSpecificId
()).
eq
(
EquipmentSpecificIndex:
:
getEquipmentIndexKey
,
alarm
.
getEquipmentSpecificIndexKey
());
iEquipmentSpecificIndexSerivce
.
update
(
updateWrapper
);
...
...
@@ -224,7 +229,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
// 如果是批量确警,先查询,再确警,用于批量消息推送
isBatch
=
ent
.
getIsBatch
();
if
(
isBatch
==
1
)
{
list
=
equipmentSpecificAlarmLogService
.
getIsConfirmByAlarmId
(
alarmLog
.
getEquipmentSpecificId
(),
alarmLog
.
getEquipmentSpecificIndexKey
(),
"0"
);
list
=
equipmentSpecificAlarmLogService
.
getIsConfirmByAlarmId
(
alarmLog
.
getEquipmentSpecificId
(),
alarmLog
.
getEquipmentSpecificIndexKey
(),
"0"
);
}
}
if
(
ent
.
getType
()
!=
null
)
{
...
...
@@ -245,13 +250,81 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
ent
.
setResolveResult
(
dateString
+
" "
+
userModel
.
getRealName
()
+
" 进行警情确认处理。"
);
}
if
(
ent
.
getIsBatch
()
==
0
){
i
=
equipmentSpecificAlarmLogMapper
.
updateById
(
ent
);
if
(
StringUtils
.
isNotEmpty
(
handleConfirm
)
&&
HandleBatchConfirmEnum
.
SINGLE
.
getCode
().
equalsIgnoreCase
(
handleConfirm
))
{
QueryWrapper
<
EquipmentSpecificAlarmLog
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"equipment_specific_id"
,
ent
.
getEquipmentSpecificId
()).
isNull
(
"confirm_date"
);
List
<
EquipmentSpecificAlarmLog
>
logs
=
equipmentSpecificAlarmLogMapper
.
selectList
(
wrapper
);
if
(
0
<
logs
.
size
())
{
for
(
EquipmentSpecificAlarmLog
x
:
logs
)
{
x
.
setConfirmType
(
ent
.
getConfirmType
());
x
.
setConfirmTypeName
(
ent
.
getConfirmTypeName
());
x
.
setConfirmDate
(
new
Date
());
x
.
setConfirmUser
(
ent
.
getConfirmUser
());
x
.
setType
(
ent
.
getType
());
x
.
setResolveResult
(
ent
.
getResolveResult
());
x
.
setAlarmReason
(
ent
.
getAlarmReason
());
}
equipmentSpecificAlarmLogService
.
updateBatchById
(
logs
);
}
}
else
if
(
StringUtils
.
isNotEmpty
(
handleConfirm
)
&&
HandleBatchConfirmEnum
.
ALL
.
getCode
().
equalsIgnoreCase
(
handleConfirm
))
{
QueryWrapper
<
EquipmentSpecificAlarmLog
>
logQueryWrapper
=
new
QueryWrapper
<>();
logQueryWrapper
.
isNull
(
"confirm_date"
);
List
<
EquipmentSpecificAlarmLog
>
logList
=
equipmentSpecificAlarmLogMapper
.
selectList
(
logQueryWrapper
);
if
(
0
<
logList
.
size
())
{
for
(
EquipmentSpecificAlarmLog
x
:
logList
)
{
x
.
setConfirmType
(
ent
.
getConfirmType
());
x
.
setConfirmTypeName
(
ent
.
getConfirmTypeName
());
x
.
setConfirmDate
(
new
Date
());
x
.
setConfirmUser
(
ent
.
getConfirmUser
());
x
.
setType
(
ent
.
getType
());
x
.
setResolveResult
(
ent
.
getResolveResult
());
x
.
setAlarmReason
(
ent
.
getAlarmReason
());
}
equipmentSpecificAlarmLogService
.
updateBatchById
(
logList
);
}
}
else
{
i
=
equipmentSpecificAlarmLogMapper
.
updateById
(
ent
);
}
}
else
{
LambdaUpdateWrapper
<
EquipmentSpecificAlarmLog
>
updateWrapper
=
new
LambdaUpdateWrapper
<
EquipmentSpecificAlarmLog
>().
eq
(
EquipmentSpecificAlarmLog:
:
getEquipmentSpecificId
,
ent
.
getEquipmentSpecificId
()).
eq
(
EquipmentSpecificAlarmLog:
:
getEquipmentSpecificIndexKey
,
ent
.
getEquipmentSpecificIndexKey
())
.
isNull
(
EquipmentSpecificAlarmLog:
:
getConfirmDate
);
i
=
equipmentSpecificAlarmLogMapper
.
update
(
ent
,
updateWrapper
);
if
(
StringUtils
.
isNotEmpty
(
handleConfirm
)
&&
HandleBatchConfirmEnum
.
SINGLE
.
getCode
().
equalsIgnoreCase
(
handleConfirm
))
{
QueryWrapper
<
EquipmentSpecificAlarmLog
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"equipment_specific_id"
,
ent
.
getEquipmentSpecificId
()).
isNull
(
"confirm_date"
);
List
<
EquipmentSpecificAlarmLog
>
logs
=
equipmentSpecificAlarmLogMapper
.
selectList
(
wrapper
);
if
(
0
<
logs
.
size
())
{
for
(
EquipmentSpecificAlarmLog
x
:
logs
)
{
x
.
setConfirmType
(
ent
.
getConfirmType
());
x
.
setConfirmTypeName
(
ent
.
getConfirmTypeName
());
x
.
setConfirmDate
(
new
Date
());
x
.
setConfirmUser
(
ent
.
getConfirmUser
());
x
.
setType
(
ent
.
getType
());
x
.
setResolveResult
(
ent
.
getResolveResult
());
x
.
setAlarmReason
(
ent
.
getAlarmReason
());
}
equipmentSpecificAlarmLogService
.
updateBatchById
(
logs
);
}
}
else
if
(
StringUtils
.
isNotEmpty
(
handleConfirm
)
&&
HandleBatchConfirmEnum
.
ALL
.
getCode
().
equalsIgnoreCase
(
handleConfirm
))
{
QueryWrapper
<
EquipmentSpecificAlarmLog
>
logQueryWrapper
=
new
QueryWrapper
<>();
logQueryWrapper
.
isNull
(
"confirm_date"
);
List
<
EquipmentSpecificAlarmLog
>
logList
=
equipmentSpecificAlarmLogMapper
.
selectList
(
logQueryWrapper
);
if
(
0
<
logList
.
size
())
{
for
(
EquipmentSpecificAlarmLog
x
:
logList
)
{
x
.
setConfirmType
(
ent
.
getConfirmType
());
x
.
setConfirmTypeName
(
ent
.
getConfirmTypeName
());
x
.
setConfirmDate
(
new
Date
());
x
.
setConfirmUser
(
ent
.
getConfirmUser
());
x
.
setType
(
ent
.
getType
());
x
.
setResolveResult
(
ent
.
getResolveResult
());
x
.
setAlarmReason
(
ent
.
getAlarmReason
());
}
equipmentSpecificAlarmLogService
.
updateBatchById
(
logList
);
}
}
else
{
LambdaUpdateWrapper
<
EquipmentSpecificAlarmLog
>
updateWrapper
=
new
LambdaUpdateWrapper
<
EquipmentSpecificAlarmLog
>().
eq
(
EquipmentSpecificAlarmLog:
:
getEquipmentSpecificId
,
ent
.
getEquipmentSpecificId
()).
eq
(
EquipmentSpecificAlarmLog:
:
getEquipmentSpecificIndexKey
,
ent
.
getEquipmentSpecificIndexKey
())
.
isNull
(
EquipmentSpecificAlarmLog:
:
getConfirmDate
);
i
=
equipmentSpecificAlarmLogMapper
.
update
(
ent
,
updateWrapper
);
}
}
//int i = confirmAlarmMapper.confirmAlam(ent);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment