前置日志优化

This commit is contained in:
xy
2026-01-08 20:16:45 +08:00
parent 4882151ccd
commit cccc73f211
8 changed files with 317 additions and 94 deletions

View File

@@ -6,13 +6,13 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csharmonic.param.CldWarnParam;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.csharmonic.service.CsEventUserPOService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -82,7 +82,7 @@ public class EventUserController extends BaseController {
@PostMapping("/frontWarnInfo")
@ApiOperation("前置告警信息")
@ApiImplicitParam(name = "baseParam", value = "基础查询数据", required = true)
public HttpResult<Page<CsEventPO>> frontWarnInfo(@RequestBody BaseParam baseParam) {
public HttpResult<Page<CsEventPO>> frontWarnInfo(@RequestBody CldWarnParam baseParam) {
String methodDescribe = getMethodDescribe("frontWarnInfo");
Page<CsEventPO> list = csEventUserPOService.getFrontWarnInfo(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);

View File

@@ -2,6 +2,7 @@ package com.njcn.csharmonic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csharmonic.param.CldWarnParam;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
@@ -32,5 +33,5 @@ public interface CsEventUserPOService extends IService<CsEventUserPO>{
Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage);
Page<CsEventPO> getFrontWarnInfo(BaseParam baseParam);
Page<CsEventPO> getFrontWarnInfo(CldWarnParam baseParam);
}

View File

@@ -18,6 +18,7 @@ import com.njcn.csdevice.pojo.po.Node;
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
import com.njcn.csharmonic.mapper.CsEventPOMapper;
import com.njcn.csharmonic.mapper.CsEventUserPOMapper;
import com.njcn.csharmonic.param.CldWarnParam;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
@@ -32,7 +33,6 @@ import com.njcn.system.api.EpdFeignClient;
import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.user.enums.AppRoleEnum;
import com.njcn.web.pojo.param.BaseParam;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
@@ -392,40 +392,43 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
if(!CollectionUtils.isEmpty(cldDevTree)){
cldDevTree = cldDevTree.get(0).getChildren();
}
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
//便携式就1层下边就是设备
List<String> portableDevIds = portableDevTree.stream().filter(
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).map(CsLedgerVO::getId).collect(Collectors.toList());
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
List<String> cldDevIds = cldDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
//便携式就1层下边就是设备
List<String> portableDevIds = portableDevTree.stream().filter(
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).map(CsLedgerVO::getId).collect(Collectors.toList());
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
List<String> cldDevIds = cldDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
devIds.addAll(portableDevIds);
devIds.addAll(governmentDevIds);
devIds.addAll(cldDevIds);
devIds.addAll(portableDevIds);
devIds.addAll(governmentDevIds);
devIds.addAll(cldDevIds);
} else {
devIds.add(csEventUserQueryPage.getDeviceId());
}
if (CollectionUtils.isEmpty(devIds)){
return returnpage;
@@ -515,7 +518,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
}
@Override
public Page<CsEventPO> getFrontWarnInfo(BaseParam baseParam) {
public Page<CsEventPO> getFrontWarnInfo(CldWarnParam baseParam) {
Page<CsEventPO> page = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
Map<String, Node> nodeMap = nodeList.stream().collect(Collectors.toMap(Node::getId, Function.identity()));
@@ -533,6 +536,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
.eq(CsEventPO::getType, 4)
.orderByDesc(CsEventPO::getStartTime);
if (ObjectUtil.isNotNull(baseParam.getLevel()) && StringUtil.isNotBlank(baseParam.getLevel())) {
queryWrapper.eq(CsEventPO::getLevel, Integer.valueOf(baseParam.getLevel()));
}
page = csEventPOMapper.selectPage(page, queryWrapper);
}
}

View File

@@ -2,6 +2,7 @@ package com.njcn.csharmonic.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@@ -194,16 +195,20 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
mainLineVO.setLineId(lineId);
if (linePO != null) {
mainLineVO.setLineName(linePO.getName());
if (linePO.getGovern().equals(0)) {
mainLineVO.setGovern("未治理");
}
if (linePO.getGovern().equals(1)) {
mainLineVO.setGovern("已治理");
if (ObjectUtil.isNotNull(linePO.getGovern())) {
if (linePO.getGovern().equals(0)) {
mainLineVO.setGovern("未治理");
}
if (linePO.getGovern().equals(1)) {
mainLineVO.setGovern("已治理");
}
}
mainLineVO.setObjType(linePO.getMonitorObj());
DictData dictData = dicDataFeignClient.getDicDataById(linePO.getMonitorObj()).getData();
if (dictData != null) {
mainLineVO.setObjType(dictData.getName());
if (ObjectUtil.isNotNull(linePO.getMonitorObj())) {
DictData dictData = dicDataFeignClient.getDicDataById(linePO.getMonitorObj()).getData();
if (dictData != null) {
mainLineVO.setObjType(dictData.getName());
}
}
}
MainLineStatLimitRateDetailsQueryParam detailsQueryParam = new MainLineStatLimitRateDetailsQueryParam();