合并代码
This commit is contained in:
@@ -36,7 +36,11 @@
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pq-device-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>user-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.influxdb</groupId>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <功能描述>
|
||||
*
|
||||
* @author wr
|
||||
* @createTime: 2022-12-13
|
||||
*/
|
||||
@Data
|
||||
public class DeptLevelVO implements Serializable {
|
||||
|
||||
private String id;
|
||||
private String pid;
|
||||
private String pids;
|
||||
private String name;
|
||||
private String code;
|
||||
private Integer specialType;
|
||||
private String area;
|
||||
private String remark;
|
||||
private Integer sort;
|
||||
private Integer type;
|
||||
|
||||
//子孙部门
|
||||
List<DeptLevelVO> deptList;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* <功能描述>
|
||||
*
|
||||
* @author wr
|
||||
* @createTime: 2022-12-14
|
||||
*/
|
||||
@Data
|
||||
public class RStatEventVO {
|
||||
|
||||
@ApiModelProperty(value = "单位ID")
|
||||
private String orgNo;
|
||||
|
||||
@ApiModelProperty(value = "暂态指标类型Id,字典表ID")
|
||||
private String eventType;
|
||||
|
||||
@ApiModelProperty(value = "日均发生暂态监测点数(根据 发生暂态监测点数 取平均值)")
|
||||
private Integer eventMeasurementAverage;
|
||||
|
||||
@ApiModelProperty(value = "累计发生暂态监测点数(监测点暂态指标超标明细日表)")
|
||||
private Integer eventMeasurementAccrued;
|
||||
|
||||
@ApiModelProperty(value = "暂态指标发生频次(日表的暂态指标发生次数之和/日表的发生暂态监测点数之和)")
|
||||
private Float eventFreq;
|
||||
|
||||
@ApiModelProperty(value = "暂态指标发生次数(日表的暂态指标发生次数之和)")
|
||||
private Integer eventCount;
|
||||
|
||||
@ApiModelProperty(value = "日均发生暂态监测点数占比(根据 日均发生暂态监测点数占比 取平均值)")
|
||||
private Float eventMeasurementRatioAverage;
|
||||
|
||||
@ApiModelProperty(value = "累计发生暂态监测点数占比(此表的累计发生暂态监测点数/区域统计表中的区域分类统计月表中的发生暂态的监测点数)")
|
||||
private Float eventMeasurementRatioAccrued;
|
||||
|
||||
@ApiModelProperty(value = "数据类型,字典表(01:主网测点 02:配网测点)")
|
||||
private String dataType;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.njcn.event.utils;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.event.pojo.vo.DeptLevelVO;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <功能描述>
|
||||
*
|
||||
* @author wr
|
||||
* @createTime: 2022-12-14
|
||||
*/
|
||||
public class DeptUtil {
|
||||
|
||||
/***
|
||||
* 获取层级部门信息(展示下级部门)
|
||||
* @param deptDTOList
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
public static List<DeptDTO> getDeptSubsetVOList(List<DeptDTO> deptDTOList, String deptId){
|
||||
//获取子部门
|
||||
List<DeptDTO> directDeptInfos = deptDTOList.stream()
|
||||
.filter(deptDTO -> deptDTO.getPid().equals(deptId))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(directDeptInfos)) {
|
||||
//没有直接子部门,获取当前部门所有信息
|
||||
List<DeptDTO> dept = deptDTOList.stream()
|
||||
.filter(deptDTO -> deptDTO.getId().equals(deptId))
|
||||
.collect(Collectors.toList());
|
||||
return dept;
|
||||
}
|
||||
return directDeptInfos;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 获取层级部门信息(展示下级部门,但是数据是包含下部门的所有部门)
|
||||
* @param deptDTOList
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
public static List<DeptLevelVO> getDeptLevelVOList(List<DeptDTO> deptDTOList, String deptId){
|
||||
//获取子部门
|
||||
List<DeptDTO> directDeptInfos = deptDTOList.stream()
|
||||
.filter(deptDTO -> deptDTO.getPid().equals(deptId))
|
||||
.collect(Collectors.toList());
|
||||
List<DeptLevelVO> deptLevelVOS = new ArrayList<>();
|
||||
if (CollectionUtil.isEmpty(directDeptInfos)) {
|
||||
//没有直接子部门,获取当前部门所有信息
|
||||
List<DeptDTO> dept = deptDTOList.stream()
|
||||
.filter(deptDTO -> deptDTO.getId().equals(deptId))
|
||||
.collect(Collectors.toList());
|
||||
deptLevelVOS = BeanUtil.copyToList(dept, DeptLevelVO.class);
|
||||
}else{
|
||||
DeptLevelVO deptLevelVO;
|
||||
for (DeptDTO deptDTO : directDeptInfos) {
|
||||
//添加当前部门,添加当前部门下的子部门
|
||||
deptLevelVO = BeanUtil.copyProperties(deptDTO, DeptLevelVO.class);
|
||||
deptLevelVOS.add(deptLevelVO);
|
||||
|
||||
//筛选上级部门pids包含该id的所有部门
|
||||
List<DeptDTO> descendantDeptDTO = deptDTOList.stream()
|
||||
.filter(d -> d.getPids().contains(deptDTO.getId()))
|
||||
.collect(Collectors.toList());
|
||||
//获取当前部门
|
||||
List<DeptDTO> dept = deptDTOList.stream()
|
||||
.filter(dto -> dto.getId().equals(deptDTO.getId()))
|
||||
.collect(Collectors.toList());
|
||||
descendantDeptDTO.addAll(dept);
|
||||
|
||||
List<DeptLevelVO> seedList = BeanUtil.copyToList(descendantDeptDTO, DeptLevelVO.class);
|
||||
deptLevelVO.setDeptList(seedList);
|
||||
}
|
||||
}
|
||||
return deptLevelVOS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user