feat(harmonic): 新增前置调试日志和事件统计功能

- 添加获取前置调试日志接口,支持按时间和关键词筛选
- 实现暂降原因和暂降类型统计数据查询功能
- 新增CsEventLogsVo和CsEventReasonAndTypeVo数据传输对象
- 优化事件查询逻辑,支持多等级告警筛选
- 修复设备交付服务中的空指针异常问题
- 移除设备使用状态修改的日志记录功能
- 更新事件用户服务中的前置信息显示逻辑
This commit is contained in:
xy
2026-06-13 11:33:31 +08:00
parent b2e9597839
commit ad7835f0db
14 changed files with 330 additions and 48 deletions

View File

@@ -1,6 +1,6 @@
package com.njcn.cssystem.service.impl;
import com.alibaba.fastjson.JSONArray;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,13 +10,10 @@ import com.njcn.cssystem.mapper.CsLogsPOMapper;
import com.njcn.cssystem.pojo.po.CsLogsPO;
import com.njcn.cssystem.service.CsLogsPOService;
import com.njcn.web.pojo.param.BaseParam;
import com.njcn.web.utils.RequestUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
* Description:
@@ -32,6 +29,7 @@ public class CsLogsPOServiceImpl extends ServiceImpl<CsLogsPOMapper, CsLogsPO> i
public void addLog(DeviceLogDTO deviceLogDTO) {
CsLogsPO csPO = new CsLogsPO();
BeanUtils.copyProperties(deviceLogDTO,csPO);
csPO.setUserName(deviceLogDTO.getUserIndex());
csPO.setCreateBy(deviceLogDTO.getUserIndex());
csPO.setUpdateBy(deviceLogDTO.getUserIndex());
this.save(csPO);
@@ -39,14 +37,19 @@ public class CsLogsPOServiceImpl extends ServiceImpl<CsLogsPOMapper, CsLogsPO> i
@Override
public IPage<CsLogsPO> queryPage(BaseParam baseParam) {
String beginDay = LocalDateTimeUtil.format(
LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(baseParam.getSearchBeginTime(), "yyyy-MM-dd")),
"yyyy-MM-dd HH:mm:ss"
);
String endDay = LocalDateTimeUtil.format(
LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(baseParam.getSearchEndTime(), "yyyy-MM-dd")),
"yyyy-MM-dd HH:mm:ss"
);
Page<CsLogsPO> returnpage = new Page<> (baseParam.getPageNum ( ), baseParam.getPageSize ( ));
String username = RequestUtil.getUsername();
String userRole = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(userRole, String.class);
QueryWrapper<CsLogsPO> csLogsPOQueryWrapper = new QueryWrapper<>();
csLogsPOQueryWrapper.lambda()
.ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()).
le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),CsLogsPO::getCreateTime,baseParam.getSearchEndTime()).orderByDesc(CsLogsPO::getCreateTime);
.ge(StringUtils.isNotBlank(beginDay),CsLogsPO::getCreateTime,beginDay).
le(StringUtils.isNotBlank(beginDay),CsLogsPO::getCreateTime,endDay).orderByDesc(CsLogsPO::getCreateTime);
IPage<CsLogsPO> list = this.getBaseMapper().selectPage(returnpage,csLogsPOQueryWrapper);
return list;
}