右上角接口
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
package com.njcn.gather.event.transientes.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
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.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
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;
|
||||
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.UserLedgerStatisticVO;
|
||||
import com.njcn.gather.event.transientes.service.*;
|
||||
import com.njcn.gather.event.transientes.service.impl.MsgEventInfoServiceImpl;
|
||||
import com.njcn.gather.event.transientes.websocket.WebSocketServer;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-06-23
|
||||
* @Description:
|
||||
*/
|
||||
@Api(tags = "暂降接收")
|
||||
@RequestMapping("right")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class EventRightController extends BaseController {
|
||||
|
||||
private final EventRightService eventRightService;
|
||||
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/rightEvent")
|
||||
@ApiOperation("接收远程推送的暂态事件")
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||
public HttpResult<Object> rightEvent(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("rightEvent");
|
||||
UserLedgerStatisticVO userLedgerStatisticVO = eventRightService.userLedgerStatistic(largeScreenCountParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userLedgerStatisticVO, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -200,16 +200,29 @@ public class LargeScreenCountController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deviceDTOList, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/areaDevCount")
|
||||
@ApiOperation("区域终端统计")
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<RegionDevCountVO>> areaDevCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("areaDevCount");
|
||||
List<RegionDevCountVO> result = largeScreenCountService.regionDevCount(largeScreenCountParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/regionDevCount")
|
||||
@ApiOperation("区域终端统计")
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<RegionDevCountVO>> regionDevCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("regionDevCount");
|
||||
public HttpResult<List<RegionDevCountVO>> rightUserStatistic(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("rightUserStatistic");
|
||||
List<RegionDevCountVO> result = largeScreenCountService.regionDevCount(largeScreenCountParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
||||
final String authorizationHeader = request.getHeader("Authorization");
|
||||
/* final String authorizationHeader = request.getHeader("Authorization");
|
||||
String username = null;
|
||||
String jwt = null;
|
||||
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
|
||||
@@ -65,7 +65,7 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
||||
usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.gather.event.transientes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
||||
|
||||
public interface PqUserLedgerMapper extends BaseMapper<PqUserLedgerPO> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.njcn.gather.event.transientes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqUserLineAssPO;
|
||||
|
||||
public interface PqUserLineAssMapper extends BaseMapper<PqUserLineAssPO> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.gather.event.transientes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
|
||||
|
||||
public interface PqsDicTreeMapper extends BaseMapper<PqsDicTreePO> {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.gather.event.transientes.pojo;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DicTreeEnum {
|
||||
|
||||
BJ_USER("BJ_USER","半导体及精密加工"),
|
||||
OI_USER("OI_USER","其他敏感用户"),
|
||||
OT_USER("OT_USER","其他干扰源用户"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String dicName;
|
||||
|
||||
|
||||
DicTreeEnum(String code, String dicName) {
|
||||
this.code = code;
|
||||
this.dicName = dicName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.njcn.gather.event.transientes.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-07-28
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "pq_user_ledger")
|
||||
public class PqUserLedgerPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
@TableField(value = "id")
|
||||
private String id;
|
||||
|
||||
@TableField(value = "POWER_SUPPLY_AREA")
|
||||
private String powerSupplyArea;
|
||||
|
||||
@TableField(value = "CUSTOMER_NAME")
|
||||
private String customerName;
|
||||
|
||||
@TableField(value = "ELECTRICITY_ADDRESS")
|
||||
private String electricityAddress;
|
||||
|
||||
@TableField(value = "INDUSTRY_TYPE")
|
||||
private String industryType;
|
||||
|
||||
@TableField(value = "VOLTAGE_LEVEL")
|
||||
private String voltageLevel;
|
||||
|
||||
@TableField(value = "IMPORTANT_LEVEL")
|
||||
private String importantLevel;
|
||||
|
||||
@TableField(value = "SUBSTATION_NAME")
|
||||
private String substationName;
|
||||
|
||||
@TableField(value = "BUSBAR_NAME")
|
||||
private String busbarName;
|
||||
|
||||
@TableField(value = "OPERATION_UNIT")
|
||||
private String operationUnit;
|
||||
|
||||
@TableField(value = "MANUFACTURER")
|
||||
private String manufacturer;
|
||||
|
||||
@TableField(value = "BIG_OBJ_TYPE")
|
||||
private String bigObjType;
|
||||
|
||||
@TableField(value = "SMALL_OBJ_TYPE")
|
||||
private String smallObjType;
|
||||
|
||||
/**
|
||||
* 设备或对象的分类小类
|
||||
*/
|
||||
@TableField(value = "CREATE_BY")
|
||||
private String createBy;
|
||||
|
||||
@TableField(value = "UPDATE_BY")
|
||||
private String updateBy;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间(自动填充)
|
||||
*/
|
||||
@TableField(value = "CREATE_TIME")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间(自动填充)
|
||||
*/
|
||||
@TableField(value = "UPDATE_TIME")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.gather.event.transientes.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-07-28
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "pq_user_line_ass")
|
||||
public class PqUserLineAssPO {
|
||||
|
||||
@TableField(value = "USER_INDEX")
|
||||
private String userIndex;
|
||||
|
||||
@TableField(value = "LINE_INDEX")
|
||||
private Integer lineIndex;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.gather.event.transientes.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-07-28
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "PQS_DICTREE")
|
||||
public class PqsDicTreePO {
|
||||
@TableId // 标记主键字段
|
||||
@TableField(value ="ID") // 显式指定列名(默认按字段名映射,可省略)
|
||||
private String id;
|
||||
|
||||
@TableField(value ="NAME")
|
||||
private String name;
|
||||
|
||||
@TableField(value ="CODE")
|
||||
private String code;
|
||||
|
||||
@TableField(value ="PARENT_ID")
|
||||
private String parentId;
|
||||
|
||||
@TableField(value ="DIC_VALUE")
|
||||
private String dicValue;
|
||||
|
||||
@TableField(value ="CREATE_BY")
|
||||
private String createBy;
|
||||
|
||||
@TableField(value ="CREATE_TIME")
|
||||
private Date createTime;
|
||||
|
||||
@TableField(value ="UPDATE_BY")
|
||||
private String updateBy;
|
||||
|
||||
@TableField(value ="UPDATE_TIME")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.gather.event.transientes.pojo.vo;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-07-28
|
||||
* @Description: 大屏右侧实体
|
||||
*/
|
||||
@Data
|
||||
public class UserLedgerStatisticVO {
|
||||
|
||||
private Integer importNum;
|
||||
|
||||
private Integer importDevNum;
|
||||
|
||||
private Integer otherImportNum;
|
||||
|
||||
private Integer otherImportDevNum;
|
||||
|
||||
private Integer otherNum;
|
||||
|
||||
private Integer otherDevNum;
|
||||
|
||||
private List<Inner> innerList;
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
public static class Inner{
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
private Integer count;
|
||||
|
||||
private List<Inner> children;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -34,14 +34,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent").permitAll() // 允许访问认证接口
|
||||
//.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent").permitAll() // 允许访问认证接口
|
||||
.antMatchers("/**").permitAll() // 允许访问认证接口
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS); // 使用无状态会话
|
||||
|
||||
// http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.njcn.gather.event.transientes.service;
|
||||
|
||||
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.vo.UserLedgerStatisticVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EventRightService {
|
||||
|
||||
|
||||
UserLedgerStatisticVO userLedgerStatistic(LargeScreenCountParam param);
|
||||
}
|
||||
@@ -54,4 +54,6 @@ public interface LargeScreenCountService {
|
||||
List<DeviceDTO> devDetail(LargeScreenCountParam largeScreenCountParam);
|
||||
|
||||
List<RegionDevCountVO> regionDevCount(LargeScreenCountParam largeScreenCountParam);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.njcn.gather.event.transientes.service.impl;
|
||||
|
||||
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.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||
import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLinedetail;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||
import com.njcn.gather.event.devcie.service.PqDeviceService;
|
||||
import com.njcn.gather.event.devcie.service.PqLineService;
|
||||
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
||||
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
|
||||
import com.njcn.gather.event.transientes.mapper.PqsDicTreeMapper;
|
||||
import com.njcn.gather.event.transientes.pojo.DicTreeEnum;
|
||||
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.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.UserLedgerStatisticVO;
|
||||
import com.njcn.gather.event.transientes.service.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-06-30
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class EventRightServiceImpl implements EventRightService {
|
||||
|
||||
|
||||
private final PqUserLineAssMapper pqUserLineAssMapper;
|
||||
|
||||
private final PqUserLedgerMapper pqUserLedgerMapper;
|
||||
|
||||
private final PqsDicTreeMapper pqsDicTreeMapper;
|
||||
|
||||
private final PqsEventdetailService pqsEventdetailService;
|
||||
|
||||
private final MsgEventConfigService msgEventConfigService;
|
||||
|
||||
private final PqLineService pqLineService;
|
||||
private final CommGeneralService commGeneralService;
|
||||
|
||||
|
||||
@Override
|
||||
public UserLedgerStatisticVO userLedgerStatistic(LargeScreenCountParam param) {
|
||||
UserLedgerStatisticVO result = new UserLedgerStatisticVO();
|
||||
|
||||
List<Integer> lineIds = commGeneralService.getLineIdsByDept(param);
|
||||
|
||||
//获取当前用户权限能获取到的用户台账信息
|
||||
LambdaQueryWrapper<PqUserLineAssPO> assQuery = new LambdaQueryWrapper<>();
|
||||
assQuery.in(PqUserLineAssPO::getLineIndex, lineIds);
|
||||
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(assQuery);
|
||||
List<String> assUserIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
|
||||
//获取字典树
|
||||
List<PqsDicTreePO> dicTreeList = pqsDicTreeMapper.selectList(new LambdaQueryWrapper<>());
|
||||
List<PqsDicTreePO> touList = dicTreeList.stream().filter(it -> Objects.equals(it.getParentId(), "0")).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()));
|
||||
|
||||
|
||||
//查询时间段的暂降事件
|
||||
LambdaQueryWrapper<PqsEventdetail> eventQuery = new LambdaQueryWrapper<>();
|
||||
eventQuery.between(PqsEventdetail::getTimeid, DateUtil.parse(param.getSearchBeginTime()), DateUtil.parse(param.getSearchBeginTime()))
|
||||
.in(PqsEventdetail::getWavetype, msgEventConfigService.getEventType());
|
||||
|
||||
LambdaQueryWrapper<PqLine> lineQuery = new LambdaQueryWrapper<>();
|
||||
if (lineIds.size() > 1000) {
|
||||
List<List<Integer>> listLineIds = CollUtil.split(lineIds, 1000);
|
||||
eventQuery.and(w -> {
|
||||
for (List<Integer> ids : listLineIds) {
|
||||
w.or(wIn -> wIn.in(PqsEventdetail::getLineid, ids));
|
||||
}
|
||||
});
|
||||
lineQuery.and(w -> {
|
||||
for (List<Integer> ids : listLineIds) {
|
||||
w.or(wIn -> wIn.in(PqLine::getLineIndex, ids));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
eventQuery.in(PqsEventdetail::getLineid, lineIds);
|
||||
|
||||
lineQuery.in(PqLine::getLineIndex, lineIds);
|
||||
}
|
||||
List<PqsEventdetail> eventdetailList = pqsEventdetailService.list(eventQuery);
|
||||
List<PqLine> lineList = pqLineService.list(lineQuery);
|
||||
|
||||
List<PqUserLedgerPO> pqUserLedgerPOList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId, assUserIds));
|
||||
Map<String, List<PqUserLedgerPO>> userMap = pqUserLedgerPOList.stream().collect(Collectors.groupingBy(PqUserLedgerPO::getBigObjType));
|
||||
|
||||
List<UserLedgerStatisticVO.Inner> innerList = new ArrayList<>();
|
||||
treeMap.forEach((tree, obj) -> {
|
||||
//获取对象大类的用户
|
||||
List<PqUserLedgerPO> oneList = userMap.get(obj.getId());
|
||||
|
||||
if (tree.equals(DicTreeEnum.BJ_USER.getCode())) {
|
||||
Integer[] count = getEventCount(oneList, assList, eventdetailList, lineList,true);
|
||||
result.setImportNum(count[0]);
|
||||
result.setImportDevNum(count[1]);
|
||||
} else if (tree.equals(DicTreeEnum.OI_USER.getCode())) {
|
||||
Integer[] count = getEventCount(oneList, assList, eventdetailList, lineList,true);
|
||||
result.setOtherImportNum(count[0]);
|
||||
result.setOtherImportDevNum(count[1]);
|
||||
} else if (tree.equals(DicTreeEnum.OT_USER.getCode())) {
|
||||
Integer[] count = getEventCount(oneList, assList, eventdetailList, lineList,true);
|
||||
result.setOtherNum(count[0]);
|
||||
result.setOtherDevNum(count[1]);
|
||||
}
|
||||
|
||||
UserLedgerStatisticVO.Inner inner = new UserLedgerStatisticVO.Inner();
|
||||
inner.setName(obj.getName());
|
||||
inner.setCount(0);
|
||||
|
||||
List<UserLedgerStatisticVO.Inner> childrenList = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(oneList)) {
|
||||
Map<String, List<PqUserLedgerPO>> smallMap = oneList.stream().collect(Collectors.groupingBy(PqUserLedgerPO::getSmallObjType));
|
||||
smallMap.forEach((key, userList) -> {
|
||||
UserLedgerStatisticVO.Inner item = new UserLedgerStatisticVO.Inner();
|
||||
Integer[] count = getEventCount(userList, assList, eventdetailList, lineList, false);
|
||||
item.setCount(count[1]);
|
||||
item.setName(dicTreeMap.containsKey(key) ? dicTreeMap.get(key).getName() : "/");
|
||||
childrenList.add(item);
|
||||
});
|
||||
inner.setChildren(childrenList);
|
||||
innerList.add(inner);
|
||||
}
|
||||
});
|
||||
|
||||
result.setInnerList(innerList);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Integer[] getEventCount(List<PqUserLedgerPO> oneList, List<PqUserLineAssPO> assList, List<PqsEventdetail> pqsEventdetailList, List<PqLine> lineList,boolean devFlag) {
|
||||
Integer[] count = new Integer[]{0, 0};
|
||||
//用户的id
|
||||
if(CollUtil.isNotEmpty(oneList)){
|
||||
List<String> userIds = oneList.stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
||||
//获取用户关联监测点
|
||||
List<Integer> lineTemIds = assList.stream().filter(it -> userIds.contains(it.getUserIndex())).map(PqUserLineAssPO::getLineIndex).distinct().collect(Collectors.toList());
|
||||
//用户的暂降事件次数
|
||||
long eventCount = pqsEventdetailList.stream().filter(it -> lineTemIds.contains(it.getLineid())).count();
|
||||
count[0] = (int) eventCount;
|
||||
if(devFlag) {
|
||||
long devCount = lineList.stream().filter(it -> lineTemIds.contains(it.getLineIndex())).map(PqLine::getDevIndex).distinct().count();
|
||||
count[1] = (int) devCount;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -939,6 +939,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private List<EventDetailVO> change(List<PqsEventdetail> list,List<MsgEventInfo> handleMsg){
|
||||
List<EventDetailVO> result = new ArrayList<>();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
|
||||
Reference in New Issue
Block a user