代码提交

This commit is contained in:
huangzj
2023-10-27 16:29:29 +08:00
parent 68146d493f
commit 42ea0a8136
2 changed files with 37 additions and 8 deletions

View File

@@ -132,6 +132,14 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
DevCountVO devCountVO = new DevCountVO();
String userRole = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(userRole, String.class);
if(CollectionUtils.isEmpty(strings)){
throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE);
}
userRole=strings.get(0);
List<String> device = roleEngineerDevService.getDevice();
if(CollectionUtils.isEmpty(device)){
devCountVO.setOnLineDevCount(0);
@@ -185,13 +193,20 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
List<EventDetailVO> harmonic = data.stream().filter(temp -> temp.getType() == 1).collect(Collectors.toList());
List<EventDetailVO> alarm = data.stream().filter(temp -> temp.getType() == 3).collect(Collectors.toList());
List<EventDetailVO> run = data.stream().filter(temp -> temp.getType() == 2).collect(Collectors.toList());
CsFeedbackQueryParm csFeedbackQueryParm = new CsFeedbackQueryParm();
csFeedbackQueryParm.setPageNum(1);
csFeedbackQueryParm.setPageSize(100000);
csFeedbackQueryParm.setStatus("1");
Page<CsFeedbackVO> data1 = feedBackFeignClient.queryFeedBackPage(csFeedbackQueryParm).getData();
List<CsFeedbackVO> collect = data1.getRecords().stream().filter(temp -> !Objects.equals(temp.getUserId(), RequestUtil.getUserIndex())).collect(Collectors.toList());
devCountVO.setFeedBackCount(collect.size());
if(Objects.equals(userRole,AppRoleEnum.APP_VIP_USER.getCode())||Objects.equals(userRole,AppRoleEnum.TOURIST.getCode())
||Objects.equals(userRole,AppRoleEnum.MARKET_USER.getCode())){
devCountVO.setFeedBackCount(0);
}else {
CsFeedbackQueryParm csFeedbackQueryParm = new CsFeedbackQueryParm();
csFeedbackQueryParm.setPageNum(1);
csFeedbackQueryParm.setPageSize(100000);
csFeedbackQueryParm.setStatus("1");
Page<CsFeedbackVO> data1 = feedBackFeignClient.queryFeedBackPage(csFeedbackQueryParm).getData();
List<CsFeedbackVO> collect = data1.getRecords().stream().filter(temp -> !Objects.equals(temp.getUserId(), RequestUtil.getUserIndex())).collect(Collectors.toList());
devCountVO.setFeedBackCount(collect.size());
}
//todo 后续添加警告数,事件数
devCountVO.setEventCount(event.size());
devCountVO.setAlarmCount(alarm.size());

View File

@@ -1,7 +1,10 @@
package com.njcn.cssystem.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.cssystem.mapper.CsFeedbackChatMapper;
import com.njcn.cssystem.pojo.param.CsFeedbackAuditParm;
import com.njcn.cssystem.pojo.param.CsFeedbackChatAddParm;
@@ -10,12 +13,15 @@ import com.njcn.cssystem.pojo.po.CsFeedbackChatPO;
import com.njcn.cssystem.pojo.po.CsFeedbackPO;
import com.njcn.cssystem.service.CsFeedbackChatService;
import com.njcn.cssystem.service.CsFeedbackService;
import com.njcn.user.enums.AppRoleEnum;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Objects;
/**
@@ -50,9 +56,17 @@ public class CsFeedbackChatServiceImpl extends ServiceImpl<CsFeedbackChatMapper,
public Boolean updateChatStatus(CsFeedbackChatCheckParm csFeedbackChatCheckParm) {
UpdateWrapper<CsFeedbackChatPO> updateWrapper = new UpdateWrapper<> ();
String userIndex = RequestUtil.getUserIndex();
String userRole = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(userRole, String.class);
if(CollectionUtils.isEmpty(strings)){
throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE);
}
userRole=strings.get(0);
CsFeedbackPO one = csFeedbackService.lambdaQuery().eq(CsFeedbackPO::getId, csFeedbackChatCheckParm.getId()).one();
/*如何非创建人添加一条聊天记录“反馈已收到,处理中”*/
if ((!Objects.equals(one.getCreateBy(),userIndex))&&Objects.equals(one.getStatus(),"1")) {
if ((!Objects.equals(one.getCreateBy(),userIndex))&&Objects.equals(one.getStatus(),"1")
&&(Objects.equals(userRole, AppRoleEnum.ENGINEERING_USER.getCode())||Objects.equals(userRole, AppRoleEnum.OPERATION_MANAGER.getCode()))) {
CsFeedbackChatPO csFeedbackChatPO = new CsFeedbackChatPO ();
csFeedbackChatPO.setUserId(RequestUtil.getUserIndex());