This commit is contained in:
2024-10-24 10:13:48 +08:00
parent 054fa20bab
commit 0eeedf8f35
4 changed files with 11 additions and 16 deletions

View File

@@ -1,5 +1,3 @@
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.njcn.web.utils.RestTemplateUtil; import com.njcn.web.utils.RestTemplateUtil;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.junit.Test; import org.junit.Test;

View File

@@ -4,10 +4,7 @@ package com.njcn.prepare.harmonic.api.device;
import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.device.fallback.DeviceAbnormalFeignClientFallbackFactory; import com.njcn.prepare.harmonic.api.device.fallback.DeviceAbnormalFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.api.line.fallback.DayDataFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.DeviceAbnormaStatisticsParam; import com.njcn.prepare.harmonic.pojo.param.DeviceAbnormaStatisticsParam;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@@ -20,5 +17,5 @@ import org.springframework.web.bind.annotation.RequestBody;
public interface DeviceAbnormalFeignClient { public interface DeviceAbnormalFeignClient {
@PostMapping("/statistics") @PostMapping("/statistics")
public HttpResult<Boolean> dailyDeviceAbnormaStatistics (@RequestBody DeviceAbnormaStatisticsParam param); HttpResult<Boolean> dailyDeviceAbnormaStatistics (@RequestBody DeviceAbnormaStatisticsParam param);
} }

View File

@@ -6,11 +6,9 @@ import cn.hutool.core.date.DateUtil;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.pq.pojo.po.PqsTopMsg; import com.njcn.device.pq.pojo.po.PqsTopMsg;
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
import com.njcn.influx.deprecated.InfluxDBPublicParam; import com.njcn.influx.deprecated.InfluxDBPublicParam;
import com.njcn.influx.pojo.po.PqsCommunicate; import com.njcn.influx.pojo.po.PqsCommunicate;
import com.njcn.influx.utils.InfluxDbUtils; import com.njcn.influx.utils.InfluxDbUtils;
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatOnlineRateDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.device.DeviceAbnormaStatisticsMapper; import com.njcn.prepare.harmonic.mapper.mysql.device.DeviceAbnormaStatisticsMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam; import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.po.line.AlarmPO; import com.njcn.prepare.harmonic.pojo.mysql.po.line.AlarmPO;

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode; import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil; import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -166,8 +167,8 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
return deptList.stream() return deptList.stream()
.filter(deptVO -> deptVO.getId().equals(deptIndex)) .filter(deptVO -> deptVO.getId().equals(deptIndex))
.peek(deptFirst -> { .peek(deptFirst -> {
if (!Objects.isNull(deptFirst.getPid())){ if (!Objects.isNull(deptFirst.getPid())) {
deptFirst.setLevel(deptFirst.getPids().split(",").length - 1); deptFirst.setLevel(deptFirst.getPids().split(StrPool.COMMA).length - 1);
} }
deptFirst.setChildren(getChildren(deptFirst, deptList)); deptFirst.setChildren(getChildren(deptFirst, deptList));
}) })
@@ -182,7 +183,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
} }
List<String> useMonitorIds = deptTem.stream().map(Dept::getId).collect(Collectors.toList()); List<String> useMonitorIds = deptTem.stream().map(Dept::getId).collect(Collectors.toList());
List<String> resultDeptId = deptTem.stream().map(item -> item.getPids().split(",")).flatMap(Arrays::stream).distinct().collect(Collectors.toList()); List<String> resultDeptId = deptTem.stream().map(item -> item.getPids().split(StrPool.COMMA)).flatMap(Arrays::stream).distinct().collect(Collectors.toList());
resultDeptId.addAll(useMonitorIds); resultDeptId.addAll(useMonitorIds);
List<Integer> deptType = WebUtil.filterDeptType(); List<Integer> deptType = WebUtil.filterDeptType();
@@ -453,7 +454,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
*/ */
@Override @Override
public List<DeptDTO> getDepSonDetailByDeptId(String deptId) { public List<DeptDTO> getDepSonDetailByDeptId(String deptId) {
List<Dept> result ; List<Dept> result;
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Dept::getPid, deptId). lambdaQueryWrapper.eq(Dept::getPid, deptId).
@@ -480,7 +481,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
List<Dept> upDeptList = allDept.stream() List<Dept> upDeptList = allDept.stream()
.filter(dept -> dept.getId().equals(deptId)) .filter(dept -> dept.getId().equals(deptId))
.collect(Collectors.toList()); .collect(Collectors.toList());
if(CollectionUtil.isEmpty(upDeptList)){ if (CollectionUtil.isEmpty(upDeptList)) {
return new ArrayList<>(); return new ArrayList<>();
} }
upDeptList.addAll(getParentDept(upDeptList, allDept)); upDeptList.addAll(getParentDept(upDeptList, allDept));
@@ -490,12 +491,13 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
/** /**
* 找出当前部门的父级部门 * 找出当前部门的父级部门
*
* @param upDeptList 当前部门 * @param upDeptList 当前部门
* @param allDept 所有部门 * @param allDept 所有部门
* @return 父级部门 * @return 父级部门
*/ */
private List<Dept> getParentDept(List<Dept> upDeptList, List<Dept> allDept) { private List<Dept> getParentDept(List<Dept> upDeptList, List<Dept> allDept) {
if(CollectionUtil.isEmpty(upDeptList)){ if (CollectionUtil.isEmpty(upDeptList)) {
return new ArrayList<>(); return new ArrayList<>();
} else { } else {
List<Dept> parentDeptList = new ArrayList<>(); List<Dept> parentDeptList = new ArrayList<>();