添加右侧弹框接口
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -20,6 +21,7 @@ import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
||||
import com.njcn.gather.event.transientes.pojo.param.SimulationMsgParam;
|
||||
import com.njcn.gather.event.transientes.pojo.po.*;
|
||||
import com.njcn.gather.event.transientes.pojo.vo.EventDetailVO;
|
||||
import com.njcn.gather.event.transientes.pojo.vo.UserLedgerStatisticVO;
|
||||
import com.njcn.gather.event.transientes.service.*;
|
||||
import com.njcn.gather.event.transientes.service.impl.MsgEventInfoServiceImpl;
|
||||
@@ -79,4 +81,14 @@ public class EventRightController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/rightEventOpen")
|
||||
@ApiOperation("右侧表头点击事件")
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||
public HttpResult<Object> rightEventOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("rightEventOpen");
|
||||
Page<EventDetailVO> page = eventRightService.rightEventOpen(largeScreenCountParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.gather.event.transientes.pojo.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-07-30
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
public class RedisConstant {
|
||||
|
||||
public static final String REDIS_DEPT_INDEX ="LineCache:";
|
||||
|
||||
}
|
||||
@@ -36,4 +36,9 @@ public class LargeScreenCountParam extends BaseParam {
|
||||
private LocalDate startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate endTime;
|
||||
|
||||
@ApiModelProperty(value = "字典树 对象大类")
|
||||
private String bigObjType;
|
||||
@ApiModelProperty(value = "字典树 对象大小")
|
||||
private String smallObjType;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.event.transientes.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||
@@ -11,6 +12,8 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.njcn.gather.event.transientes.pojo.constant.RedisConstant.REDIS_DEPT_INDEX;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-06-25
|
||||
@@ -40,4 +43,10 @@ public class CommGeneralService {
|
||||
}
|
||||
|
||||
|
||||
public List<Integer> getLineIdsByRedis(String deptId){
|
||||
List<Integer> deptLineIds = (List<Integer>) redisUtil.getObjectByKey( REDIS_DEPT_INDEX+ StrUtil.DASHED+deptId);
|
||||
return deptLineIds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.njcn.gather.event.transientes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
||||
import com.njcn.gather.event.transientes.pojo.param.PqUserLedgerParam;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
||||
import com.njcn.gather.event.transientes.pojo.vo.EventDetailVO;
|
||||
import com.njcn.gather.event.transientes.pojo.vo.UserLedgerStatisticVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -13,5 +17,8 @@ public interface EventRightService {
|
||||
UserLedgerStatisticVO userLedgerStatistic(LargeScreenCountParam param);
|
||||
|
||||
|
||||
Page<EventDetailVO> rightEventOpen(LargeScreenCountParam param);
|
||||
|
||||
|
||||
List<UserLedgerStatisticVO.Inner> rightImportUser(LargeScreenCountParam param);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.njcn.gather.event.transientes.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
import com.njcn.gather.event.devcie.service.PqLineService;
|
||||
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
||||
@@ -14,8 +18,12 @@ import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqUserLineAssPO;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqsEventdetail;
|
||||
import com.njcn.gather.event.transientes.pojo.vo.EventDetailVO;
|
||||
import com.njcn.gather.event.transientes.pojo.vo.LedgerCountVO;
|
||||
import com.njcn.gather.event.transientes.pojo.vo.UserLedgerStatisticVO;
|
||||
import com.njcn.gather.event.transientes.service.*;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -48,6 +56,11 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
private final PqLineService pqLineService;
|
||||
private final CommGeneralService commGeneralService;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final static String NAME_KEY = "LineCache:";
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public UserLedgerStatisticVO userLedgerStatistic(LargeScreenCountParam param) {
|
||||
@@ -63,7 +76,7 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
|
||||
//获取字典树
|
||||
List<PqsDicTreePO> dicTreeList = pqsDicTreeMapper.selectList(new LambdaQueryWrapper<>());
|
||||
List<PqsDicTreePO> touList = dicTreeList.stream().filter(it -> Objects.equals(it.getParentId(), "0")).collect(Collectors.toList());
|
||||
List<PqsDicTreePO> touList = dicTreeList.stream().filter(it -> Objects.equals(it.getCode(), DicTreeEnum.BJ_USER.getCode())||Objects.equals(it.getCode(), DicTreeEnum.OI_USER.getCode())||Objects.equals(it.getCode(), DicTreeEnum.OT_USER.getCode())).collect(Collectors.toList());
|
||||
Map<String, PqsDicTreePO> treeMap = touList.stream().collect(Collectors.toMap(PqsDicTreePO::getCode, Function.identity()));
|
||||
|
||||
Map<String, PqsDicTreePO> dicTreeMap = dicTreeList.stream().collect(Collectors.toMap(PqsDicTreePO::getId, Function.identity()));
|
||||
@@ -139,11 +152,77 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EventDetailVO> rightEventOpen(LargeScreenCountParam param) {
|
||||
Page<EventDetailVO> result = new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param));
|
||||
List<Integer> deptLineIds = commGeneralService.getLineIdsByRedis(param.getDeptId());
|
||||
|
||||
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex,deptLineIds));
|
||||
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
|
||||
LambdaQueryWrapper<PqUserLedgerPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(PqUserLedgerPO::getId,userIds);
|
||||
if(StrUtil.isNotBlank(param.getBigObjType())){
|
||||
//对象大类不为空
|
||||
lambdaQueryWrapper.eq(PqUserLedgerPO::getBigObjType,param.getBigObjType());
|
||||
}
|
||||
if(StrUtil.isNotBlank(param.getSmallObjType())){
|
||||
//对象大类不为空
|
||||
lambdaQueryWrapper.eq(PqUserLedgerPO::getSmallObjType,param.getSmallObjType());
|
||||
}
|
||||
List<PqUserLedgerPO> pqUserLedgerPOList = pqUserLedgerMapper.selectList(lambdaQueryWrapper);
|
||||
Map<String,PqUserLedgerPO> pqMap = pqUserLedgerPOList.stream().collect(Collectors.toMap(PqUserLedgerPO::getId,Function.identity()));
|
||||
List<String> pUserIds = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
||||
List<Integer> lineUseList = assList.stream().filter(it->pUserIds.contains(it.getUserIndex())).map(PqUserLineAssPO::getLineIndex).distinct().collect(Collectors.toList());
|
||||
|
||||
//查询时间段的暂降事件
|
||||
LambdaQueryWrapper<PqsEventdetail> eventQuery = new LambdaQueryWrapper<>();
|
||||
eventQuery.between(PqsEventdetail::getTimeid, DateUtil.parse(param.getSearchBeginTime()), DateUtil.endOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
||||
.in(PqsEventdetail::getWavetype, msgEventConfigService.getEventType());
|
||||
|
||||
if (lineUseList.size() > 1000) {
|
||||
List<List<Integer>> listLineIds = CollUtil.split(lineUseList, 1000);
|
||||
eventQuery.and(w -> {
|
||||
for (List<Integer> ids : listLineIds) {
|
||||
w.or(wIn -> wIn.in(PqsEventdetail::getLineid, ids));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
eventQuery.in(PqsEventdetail::getLineid, lineUseList);
|
||||
}
|
||||
Page<PqsEventdetail> page = pqsEventdetailService.page(new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),eventQuery);
|
||||
List<PqsEventdetail> temResultList = page.getRecords();
|
||||
if(CollUtil.isEmpty(temResultList)){
|
||||
return result;
|
||||
}
|
||||
|
||||
List<Integer> ids = temResultList.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
|
||||
List<LedgerBaseInfoDTO> dtoList = pqLineService.getBaseLineInfo(ids);
|
||||
Map<Integer,LedgerBaseInfoDTO> lineMap = dtoList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId,Function.identity()));
|
||||
Map<Integer,List<String>> temMap = assList.stream().filter(it->ids.contains(it.getLineIndex())).collect(Collectors.groupingBy(PqUserLineAssPO::getLineIndex,Collectors.mapping(PqUserLineAssPO::getUserIndex,Collectors.toList())));
|
||||
|
||||
List<EventDetailVO> resultList = new ArrayList<>();
|
||||
for(PqsEventdetail pqsEventdetail : temResultList){
|
||||
EventDetailVO eventDetailVO = new EventDetailVO();
|
||||
BeanUtil.copyProperties(pqsEventdetail,eventDetailVO);
|
||||
List<String> userTemIds = temMap.get(pqsEventdetail.getLineid());
|
||||
String objName = userTemIds.stream().peek(it->pqMap.get(it).getCustomerName()).collect(Collectors.joining(StrUtil.COMMA));
|
||||
eventDetailVO.setObjName(objName);
|
||||
LedgerBaseInfoDTO dto = lineMap.get(pqsEventdetail.getLineid());
|
||||
eventDetailVO.setBdname(dto.getStationName());
|
||||
eventDetailVO.setLineid(dto.getLineId());
|
||||
resultList.add(eventDetailVO);
|
||||
}
|
||||
result.setTotal(page.getTotal());
|
||||
result.setRecords(resultList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserLedgerStatisticVO.Inner> rightImportUser(LargeScreenCountParam param) {
|
||||
List<UserLedgerStatisticVO.Inner> result = new ArrayList<>();
|
||||
|
||||
List<Integer> deptLineIds = commGeneralService.getLineIdsByDept(param);
|
||||
List<Integer> deptLineIds = commGeneralService.getLineIdsByRedis(param.getDeptId());
|
||||
|
||||
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().eq(PqUserLedgerPO::getIsShow,1));
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
|
||||
Reference in New Issue
Block a user