1.对象树接口
This commit is contained in:
@@ -12,6 +12,7 @@ import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
|||||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
@@ -47,13 +48,8 @@ import java.util.stream.Collectors;
|
|||||||
@Api(tags = "通用台账查询")
|
@Api(tags = "通用台账查询")
|
||||||
public class CsCommTerminalController extends BaseController {
|
public class CsCommTerminalController extends BaseController {
|
||||||
|
|
||||||
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
|
|
||||||
|
|
||||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
private final CsCommTerminalService commTerminalService;
|
||||||
|
|
||||||
private final CsLinePOService csLinePOService;
|
|
||||||
private final UserFeignClient userFeignClient;
|
|
||||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户获取设备信息
|
* 根据用户获取设备信息
|
||||||
@@ -64,7 +60,7 @@ public class CsCommTerminalController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||||
public HttpResult<List<String>> getDevIdsByUser(@RequestParam("userId") String userId) {
|
public HttpResult<List<String>> getDevIdsByUser(@RequestParam("userId") String userId) {
|
||||||
String methodDescribe = getMethodDescribe("getDevIdsByUser");
|
String methodDescribe = getMethodDescribe("getDevIdsByUser");
|
||||||
List<String> devIds = commGetDevIds(userId);
|
List<String> devIds = commTerminalService.commGetDevIds(userId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devIds, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devIds, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,19 +73,8 @@ public class CsCommTerminalController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||||
public HttpResult<List<String>> getLineIdsByUser(@RequestParam("userId") String userId) {
|
public HttpResult<List<String>> getLineIdsByUser(@RequestParam("userId") String userId) {
|
||||||
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
||||||
List<String> devIds = commGetDevIds(userId);
|
List<String> lineIds = commTerminalService.getLineIdsByUser(userId);
|
||||||
if(CollUtil.isNotEmpty(devIds)){
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineIds, methodDescribe);
|
||||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId).in(CsLinePO::getDeviceId,devIds)
|
|
||||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
|
||||||
if(CollUtil.isEmpty(poList)){
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
|
||||||
}else {
|
|
||||||
List<String> result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -101,37 +86,12 @@ public class CsCommTerminalController extends BaseController {
|
|||||||
@ApiOperation("根据登录用户id获取电能质量用户id集合")
|
@ApiOperation("根据登录用户id获取电能质量用户id集合")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||||
public HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId) {
|
public HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId) {
|
||||||
String methodDescribe = getMethodDescribe("getPqUserIdsByUser");
|
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
||||||
|
List<String> lineIds = commTerminalService.getPqUserIdsByUser(userId);
|
||||||
List<String> devIds = commGetDevIds(userId);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineIds, methodDescribe);
|
||||||
if(CollUtil.isNotEmpty(devIds)){
|
|
||||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
|
||||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
|
||||||
if(CollUtil.isEmpty(poList)){
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
|
||||||
}else {
|
|
||||||
List<String> result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<String> commGetDevIds(String userId){
|
|
||||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
|
||||||
List<String> devIds;
|
|
||||||
if(userVO.getType().equals(UserType.SUPER_ADMINISTRATOR ) || userVO.getType().equals(UserType.ADMINISTRATOR )){
|
|
||||||
devIds = csEquipmentDeliveryService.getAll().stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
|
||||||
}else {
|
|
||||||
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
|
||||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
|
||||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
|
||||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
return devIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过监测点获取监测点数据单位
|
* 通过监测点获取监测点数据单位
|
||||||
@@ -144,11 +104,7 @@ public class CsCommTerminalController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "lineId", value = "实体", required = true)
|
@ApiImplicitParam(name = "lineId", value = "实体", required = true)
|
||||||
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) {
|
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) {
|
||||||
String methodDescribe = getMethodDescribe("lineUnitDetail");
|
String methodDescribe = getMethodDescribe("lineUnitDetail");
|
||||||
|
PqsDeviceUnit pqsDeviceUnit = commTerminalService.lineUnitDetail(lineId);
|
||||||
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(lineId);
|
|
||||||
if(Objects.isNull(pqsDeviceUnit)){
|
|
||||||
pqsDeviceUnit = new PqsDeviceUnit();
|
|
||||||
}
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,16 @@ public class CsLedgerController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/objTree")
|
||||||
|
@ApiOperation("三层对象用户树")
|
||||||
|
public HttpResult<List<CsLedgerVO>> objTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("getProjectTree");
|
||||||
|
List<CsLedgerVO> list = csLedgerService.objTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增台账信息")
|
@ApiOperation("新增台账信息")
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CsCommTerminalService {
|
||||||
|
|
||||||
|
|
||||||
|
List<String> getLineIdsByUser(String userId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<String> getPqUserIdsByUser(String userId);
|
||||||
|
|
||||||
|
|
||||||
|
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||||
|
|
||||||
|
|
||||||
|
List<String> commGetDevIds(String userId);
|
||||||
|
}
|
||||||
@@ -77,6 +77,9 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
|||||||
|
|
||||||
List<CsLedgerVO> getztProjectTree();
|
List<CsLedgerVO> getztProjectTree();
|
||||||
|
|
||||||
|
|
||||||
|
List<CsLedgerVO> objTree();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备集合获取项目和工程
|
* 根据设备集合获取项目和工程
|
||||||
* @param id
|
* @param id
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||||
|
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||||
|
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||||
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
|
import com.njcn.user.api.UserFeignClient;
|
||||||
|
import com.njcn.user.pojo.constant.UserType;
|
||||||
|
import com.njcn.user.pojo.vo.UserVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-12-23
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||||
|
|
||||||
|
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
|
||||||
|
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||||
|
private final CsLinePOService csLinePOService;
|
||||||
|
private final UserFeignClient userFeignClient;
|
||||||
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLineIdsByUser(String userId) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
List<String> devIds = commGetDevIds(userId);
|
||||||
|
if (CollUtil.isEmpty(devIds)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId).in(CsLinePO::getDeviceId, devIds)
|
||||||
|
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
if (CollUtil.isNotEmpty(poList)) {
|
||||||
|
result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getPqUserIdsByUser(String userId) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
List<String> devIds = commGetDevIds(userId);
|
||||||
|
if (CollUtil.isEmpty(devIds)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
||||||
|
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
if (CollUtil.isNotEmpty(poList)) {
|
||||||
|
result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PqsDeviceUnit lineUnitDetail(String lineId) {
|
||||||
|
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(lineId);
|
||||||
|
if(Objects.isNull(pqsDeviceUnit)){
|
||||||
|
pqsDeviceUnit = new PqsDeviceUnit();
|
||||||
|
}
|
||||||
|
return pqsDeviceUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> commGetDevIds(String userId) {
|
||||||
|
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||||
|
List<String> devIds;
|
||||||
|
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||||
|
devIds = csEquipmentDeliveryService.getAll().stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||||
|
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||||
|
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return devIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.controller.project.EngineeringController;
|
import com.njcn.csdevice.controller.project.EngineeringController;
|
||||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
@@ -18,13 +20,18 @@ import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
|||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
|
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||||
|
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
import com.njcn.system.pojo.po.Area;
|
import com.njcn.system.pojo.po.Area;
|
||||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.enums.AppRoleEnum;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
|
import com.njcn.user.pojo.constant.UserType;
|
||||||
|
import com.njcn.user.pojo.vo.UserVO;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@@ -59,6 +66,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
private final EngineeringController engineeringController;
|
private final EngineeringController engineeringController;
|
||||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||||
|
private final CsCommTerminalServiceImpl csCommTerminalServiceImpl;
|
||||||
|
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||||
|
private final UserFeignClient userFeignClient;
|
||||||
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLedgerVO> getLedgerTree() {
|
public List<CsLedgerVO> getLedgerTree() {
|
||||||
@@ -269,6 +282,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
}
|
}
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||||
private void checkDevSetData(List<CsLedgerVO> ledgerVOS) {
|
private void checkDevSetData(List<CsLedgerVO> ledgerVOS) {
|
||||||
Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
||||||
@@ -643,9 +657,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable.setChildren(wxProjectList);
|
portable.setChildren(wxProjectList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CsLedgerVO government = new CsLedgerVO();
|
CsLedgerVO government = new CsLedgerVO();
|
||||||
government.setLevel(0);
|
government.setLevel(0);
|
||||||
government.setName(DataParam.GOVERNANCE_SYSTEM);
|
government.setName(DataParam.GOVERNANCE_SYSTEM);
|
||||||
@@ -664,6 +675,80 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLedgerVO> objTree() {
|
||||||
|
List<CsLedgerVO> result = new ArrayList<>();
|
||||||
|
String userId = RequestUtil.getUserIndex();
|
||||||
|
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||||
|
List<String> devIds;
|
||||||
|
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||||
|
devIds = csEquipmentDeliveryService.getAll().stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||||
|
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||||
|
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(devIds)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId).in(CsLinePO::getDeviceId, devIds)
|
||||||
|
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
if (CollUtil.isEmpty(poList)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
|
List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||||
|
Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||||
|
|
||||||
|
List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||||
|
Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||||
|
|
||||||
|
List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()]).collect(Collectors.toList());
|
||||||
|
List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||||
|
|
||||||
|
List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||||
|
projectList.forEach(pro->{
|
||||||
|
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||||
|
csLedgerVO.setId(pro.getId());
|
||||||
|
csLedgerVO.setPid(pro.getPid());
|
||||||
|
csLedgerVO.setLevel(pro.getLevel());
|
||||||
|
|
||||||
|
List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||||
|
if(lineMap.containsKey(pro.getId())){
|
||||||
|
List<String> ids = lineMap.get(pro.getId());
|
||||||
|
List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
|
objTemIds.forEach(it->{
|
||||||
|
CsLedgerVO inner = new CsLedgerVO();
|
||||||
|
inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||||
|
inner.setId(it);
|
||||||
|
inner.setLevel(2);
|
||||||
|
temObjList.add(inner);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
csLedgerVO.setChildren(temObjList);
|
||||||
|
realProjectList.add(csLedgerVO);
|
||||||
|
});
|
||||||
|
|
||||||
|
List<String> gcIds = projectList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.ENGINEERING_LEVEL.getCode()]).collect(Collectors.toList());
|
||||||
|
List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||||
|
|
||||||
|
List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||||
|
gcList.forEach(gc->{
|
||||||
|
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||||
|
csLedgerVO.setId(gc.getId());
|
||||||
|
csLedgerVO.setPid(gc.getPid());
|
||||||
|
csLedgerVO.setLevel(gc.getLevel());
|
||||||
|
|
||||||
|
List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||||
|
csLedgerVO.setChildren(proList);
|
||||||
|
realGcList.add(csLedgerVO);
|
||||||
|
});
|
||||||
|
return realGcList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||||
List<CsLedgerVO> result = new ArrayList<>();
|
List<CsLedgerVO> result = new ArrayList<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user