增加事件处理详情

This commit is contained in:
lxj 2025-08-22 17:44:33 +08:00
parent 73e47e5127
commit 49401d42ba
10 changed files with 84 additions and 36 deletions

View File

@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 请填写功能名称
* 事件附件
* 前端访问路由地址为:/system/alarmEventAttachments
*
* @author mocheng
@ -39,41 +39,37 @@ public class SisAlarmEventAttachmentsController extends BaseController {
private final ISisAlarmEventAttachmentsService sisAlarmEventAttachmentsService;
/**
* 查询请填写功能名称列表
* 查询事件附件列表
*/
@SaCheckPermission("system:alarmEventAttachments:list")
@GetMapping("/list")
public TableDataInfo<SisAlarmEventAttachmentsVo> list(SisAlarmEventAttachmentsBo bo, PageQuery pageQuery) {
return sisAlarmEventAttachmentsService.queryPageList(bo, pageQuery);
}
/**
* 查询请填写功能名称列表
* 查询事件附件列表
*/
@SaCheckPermission("system:alarmEventAttachments:list")
@GetMapping("/query/{alarmId}")
public R<List<SisAlarmEventAttachmentsVo>> queryListByAlarmId(@PathVariable("alarmId") String alarmId) {
public R<List<SisAlarmEventAttachmentsVo>> queryListByAlarmId(@PathVariable("alarmId") Long alarmId) {
return R.ok(sisAlarmEventAttachmentsService.queryListByAlarmId(alarmId));
}
/**
* 导出请填写功能名称列表
* 导出事件附件列表
*/
@SaCheckPermission("system:alarmEventAttachments:export")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@Log(title = "事件附件", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(SisAlarmEventAttachmentsBo bo, HttpServletResponse response) {
List<SisAlarmEventAttachmentsVo> list = sisAlarmEventAttachmentsService.queryList(bo);
ExcelUtil.exportExcel(list, "【请填写功能名称】", SisAlarmEventAttachmentsVo.class, response);
ExcelUtil.exportExcel(list, "事件附件", SisAlarmEventAttachmentsVo.class, response);
}
/**
* 获取请填写功能名称详细信息
* 获取事件附件详细信息
*
* @param id 主键
*/
@SaCheckPermission("system:alarmEventAttachments:query")
@GetMapping("/{id}")
public R<SisAlarmEventAttachmentsVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
@ -81,10 +77,9 @@ public class SisAlarmEventAttachmentsController extends BaseController {
}
/**
* 新增请填写功能名称
* 新增事件附件
*/
@SaCheckPermission("system:alarmEventAttachments:add")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@Log(title = "事件附件", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SisAlarmEventAttachmentsBo bo) {
@ -92,10 +87,9 @@ public class SisAlarmEventAttachmentsController extends BaseController {
}
/**
* 修改请填写功能名称
* 修改事件附件
*/
@SaCheckPermission("system:alarmEventAttachments:edit")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@Log(title = "事件附件", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SisAlarmEventAttachmentsBo bo) {
@ -103,12 +97,11 @@ public class SisAlarmEventAttachmentsController extends BaseController {
}
/**
* 删除请填写功能名称
* 删除事件附件
*
* @param ids 主键串
*/
@SaCheckPermission("system:alarmEventAttachments:remove")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@Log(title = "事件附件", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("ids") Long[] ids) {

View File

@ -103,4 +103,13 @@ public class SisAlarmEventProcessController extends BaseController {
@PathVariable("ids") Long[] ids) {
return toAjax(sisAlarmEventProcessService.deleteWithValidByIds(List.of(ids), true));
}
/**
* 查询处理结果信息
*/
@GetMapping("/query/result/{alarmId}")
public R<SisAlarmEventProcessVo> queryResult(@PathVariable("alarmId") Long alarmId) {
return R.ok(sisAlarmEventProcessService.queryResult(alarmId));
}
}

View File

@ -23,7 +23,7 @@ public class AlarmCompleteBo {
/**
* 附件信息(任务完成上传的图片或者文件)
*/
private List<String> attachments;
private List<Long> attachments;
}

View File

@ -1,19 +1,15 @@
package org.dromara.sis.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.sis.domain.SisAlarmEventProcess;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.sis.domain.SisAlarmEventProcess;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -77,4 +73,8 @@ public class SisAlarmEventProcessVo implements Serializable {
*/
private Integer state;
/**
* 附件列表
*/
private List<SisAlarmEventAttachmentsVo> attachments;
}

View File

@ -22,7 +22,6 @@ public class HikApiService {
@Resource
private HikEqpConfig hikEqpConfig;
private static final String URL_PREFIX = "http://127.0.0.1/eqp/hik/";
private static final String LOGIN_URI = "login";
private static final String LOGOUT_URI = "logout";
private static final String CHANNEL_LIST = "channel/list";

View File

@ -80,6 +80,6 @@ public interface ISisAlarmEventAttachmentsService {
* @param alarmId 告警id
* @return 返回附件列表
*/
List<SisAlarmEventAttachmentsVo> queryListByAlarmId(String alarmId);
List<SisAlarmEventAttachmentsVo> queryListByAlarmId(Long alarmId);
}

View File

@ -74,4 +74,11 @@ public interface ISisAlarmEventProcessService {
* @return 返回是否写入成功
*/
Boolean insert(SisAlarmEventProcess process);
/**
* 查询事件处理结果
* @param alarmId 处理结果信息
* @return 返回处理结果
*/
SisAlarmEventProcessVo queryResult(Long alarmId);
}

View File

@ -138,7 +138,7 @@ public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttach
@Override
public List<SisAlarmEventAttachmentsVo> queryListByAlarmId(String alarmId) {
public List<SisAlarmEventAttachmentsVo> queryListByAlarmId(Long alarmId) {
LambdaQueryWrapper<SisAlarmEventAttachments> lqw = Wrappers.lambdaQuery();
lqw.eq(SisAlarmEventAttachments::getEventId, alarmId);
return baseMapper.selectVoList(lqw);

View File

@ -11,8 +11,10 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.sis.domain.SisAlarmEventProcess;
import org.dromara.sis.domain.bo.SisAlarmEventProcessBo;
import org.dromara.sis.domain.vo.SisAlarmEventAttachmentsVo;
import org.dromara.sis.domain.vo.SisAlarmEventProcessVo;
import org.dromara.sis.mapper.SisAlarmEventProcessMapper;
import org.dromara.sis.service.ISisAlarmEventAttachmentsService;
import org.dromara.sis.service.ISisAlarmEventProcessService;
import org.springframework.stereotype.Service;
@ -32,6 +34,7 @@ import java.util.Map;
public class SisAlarmEventProcessServiceImpl implements ISisAlarmEventProcessService {
private final SisAlarmEventProcessMapper baseMapper;
private final ISisAlarmEventAttachmentsService sisAlarmEventAttachmentsService;
/**
* 查询告警信息处理流程记录
@ -139,4 +142,19 @@ public class SisAlarmEventProcessServiceImpl implements ISisAlarmEventProcessSer
public Boolean insert(SisAlarmEventProcess process) {
return baseMapper.insert(process) > 0;
}
@Override
public SisAlarmEventProcessVo queryResult(Long alarmId) {
LambdaQueryWrapper<SisAlarmEventProcess> lqw = Wrappers.lambdaQuery();
lqw.eq(SisAlarmEventProcess::getAlarmId, alarmId);
lqw.eq(SisAlarmEventProcess::getState, 40);
SisAlarmEventProcessVo sisAlarmEventProcessVo = baseMapper.selectVoById(alarmId);
if (sisAlarmEventProcessVo == null) {
return null;
}
// 加载附件列表
List<SisAlarmEventAttachmentsVo> sisAlarmEventAttachmentsVos = sisAlarmEventAttachmentsService.queryListByAlarmId(alarmId);
sisAlarmEventProcessVo.setAttachments(sisAlarmEventAttachmentsVos);
return sisAlarmEventProcessVo;
}
}

View File

@ -208,11 +208,23 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
alarmEvents.setServBeginTime(now);
alarmEvents.setServEndTime(DateUtil.offset(now, DateField.HOUR, 2));
alarmEvents.setDescription(EventSmallTypeEnum.SMART_REPORT_ZJCR.getDesc());
int insert = this.baseMapper.insert(alarmEvents);
log.info("写入报警事件表完成num={}", insert);
// 写入事件处理表
SisAlarmEventProcess alarmEventProcess = new SisAlarmEventProcess();
alarmEventProcess.setId(0L);
alarmEventProcess.setAlarmId(0L);
alarmEventProcess.setSolveId(0L);
alarmEventProcess.setSolveName("");
alarmEventProcess.setState(0);
alarmEventProcess.setWorkReply("");
alarmEventProcess.setWorkReplyTime(new Date());
alarmEventProcess.setReceiveTaskTag(0L);
alarmEventProcess.setTenantId("");
// 写入附件表
// 上传图片
List<SisAlarmEventAttachments> ls = new ArrayList<>();
if (smallImg != null && smallImg.length > 0) {
ls.add(createEventAttachments(smallImg, alarmEvents, sisDeviceManage));
@ -303,13 +315,13 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
@Override
public Boolean complete(AlarmCompleteBo bo) {
LoginUser loginUser = LoginHelper.getLoginUser();
// 验证工单状态
// 验证状态
SisAlarmEventsVo sisAlarmEventsVo = this.baseMapper.selectVoById(bo.getAlarmId());
if (sisAlarmEventsVo == null) {
throw new RuntimeException("工单信息不存在!");
throw new RuntimeException("告警信息不存在!");
}
if (sisAlarmEventsVo.getState().equals(AlarmStatus.REPORTED.getCode())) {
throw new RuntimeException("当前工单已指派,请刷新后重新指派!");
throw new RuntimeException("当前告警已指派,请刷新后重新指派!");
}
Date now = new Date();
SisAlarmEvents events = new SisAlarmEvents();
@ -332,6 +344,16 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
process.setReceiveTaskTag(0L);
Boolean insert = alarmEventProcessService.insert(process);
log.info("事件处理信息写入完成,result= {}", insert);
if (CollUtil.isNotEmpty(bo.getAttachments())) {
bo.getAttachments().forEach(item -> {
SisAlarmEventAttachments eventAttachments = new SisAlarmEventAttachments();
eventAttachments.setEventId(process.getId());
eventAttachments.setOssId(item);
eventAttachments.setType(1L);
});
}
return true;
}
}