App事件一键已读功能调整
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -37,6 +35,9 @@ public class CsEventUserQueryParam {
|
||||
*/
|
||||
private List<String> target;
|
||||
|
||||
/**
|
||||
* '暂态事件'0 '稳态事件'1 '运行告警'3 '运行事件'2
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 状态(0:未读取 1:已读取)
|
||||
|
||||
@@ -7,9 +7,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.constant.LogInfo;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.api.NodeFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
@@ -26,6 +28,7 @@ import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.harmonic.utils.PublicDataUtils;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -64,6 +67,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
private final CsEventPOMapper csEventPOMapper;
|
||||
private final NodeFeignClient nodeFeignClient;
|
||||
private final CsDeviceUserFeignClient csDeviceUserFeignClient;
|
||||
|
||||
@Override
|
||||
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
|
||||
@@ -207,21 +211,39 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
csEventUserQueryParam.setUserId(RequestUtil.getUserIndex());
|
||||
//getEventIds传空一键已读
|
||||
if(CollectionUtil.isEmpty(csEventUserQueryParam.getEventIds())){
|
||||
List<EventDetailVO> list = this.queryUserEventList(csEventUserQueryParam);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
List<String> collect = list.stream().map(EventDetailVO::getId).collect(Collectors.toList());
|
||||
|
||||
this.lambdaUpdate().in(CsEventUserPO::getEventId,collect).
|
||||
eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
|
||||
set(CsEventUserPO::getStatus,1).update();
|
||||
//暂态数据和运行事件和之前一样逻辑
|
||||
if (Objects.equals(csEventUserQueryParam.getType(), "0") || Objects.equals(csEventUserQueryParam.getType(), "2")) {
|
||||
List<EventDetailVO> list = this.queryUserEventList(csEventUserQueryParam);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
List<String> collect = list.stream().map(EventDetailVO::getId).collect(Collectors.toList());
|
||||
this.lambdaUpdate().in(CsEventUserPO::getEventId,collect).
|
||||
eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
|
||||
set(CsEventUserPO::getStatus,1).update();
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
//稳态
|
||||
else if (Objects.equals(csEventUserQueryParam.getType(), "1")) {
|
||||
List<String> harmonicList = csDeviceUserFeignClient.getIdList("1").getData();
|
||||
if (CollectionUtil.isNotEmpty(harmonicList)) {
|
||||
this.lambdaUpdate().in(CsEventUserPO::getEventId,harmonicList).
|
||||
eq(CsEventUserPO::getUserId,RequestUtil.getUserIndex()).
|
||||
set(CsEventUserPO::getStatus,1).update();
|
||||
}
|
||||
}
|
||||
//运行告警
|
||||
else if (Objects.equals(csEventUserQueryParam.getType(), "3")) {
|
||||
List<String> alarmList = csDeviceUserFeignClient.getIdList("3").getData();
|
||||
if (CollectionUtil.isNotEmpty(alarmList)) {
|
||||
this.lambdaUpdate().in(CsEventUserPO::getEventId,alarmList).
|
||||
eq(CsEventUserPO::getUserId,RequestUtil.getUserIndex()).
|
||||
set(CsEventUserPO::getStatus,1).update();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.lambdaUpdate().in(CsEventUserPO::getEventId,csEventUserQueryParam.getEventIds()).
|
||||
eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
|
||||
set(CsEventUserPO::getStatus,1).update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user