This commit is contained in:
huangzj
2023-07-13 13:41:21 +08:00
parent 55b40c0ce8
commit 595474ee10
18 changed files with 540 additions and 146 deletions

View File

@@ -0,0 +1,45 @@
package com.njcn.csdevice.controller.project;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
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.common.utils.HttpResultUtil;
import com.njcn.csdevice.pojo.param.CsLineTopologyTemplateParm;
import com.njcn.csdevice.pojo.vo.CsTopologyDiagramTemplateVO;
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* (cs_line_topology_template)表控制层
*
* @author xxxxx
*/
@RestController
@Slf4j
@RequestMapping("/lineTemplate")
@Api(tags = " 监测点位置模板")
@AllArgsConstructor
public class CsLineTopologyTemplateController extends BaseController {
private final CsLineTopologyTemplateService csLineTopologyTemplateService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
@PostMapping("/addLineTemplate")
@ApiOperation("上传拓扑图模板监测点位置")
@ApiImplicitParam(name = "csLineTopologyTemplateParms", value = "扑图模板监测点位置", required = true)
public HttpResult<Boolean> addLineTemplate(@RequestBody List<CsLineTopologyTemplateParm> csLineTopologyTemplateParms){
String methodDescribe = getMethodDescribe("addLineTemplate");
Boolean flag = csLineTopologyTemplateService.add(csLineTopologyTemplateParms);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,flag, methodDescribe);
}
}

View File

@@ -0,0 +1,65 @@
package com.njcn.csdevice.controller.project;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.common.utils.HttpResultUtil;
import com.njcn.csdevice.pojo.param.AppProjectAddParm;
import com.njcn.csdevice.pojo.param.AppProjectAuditParm;
import com.njcn.csdevice.pojo.param.AppProjectQueryParm;
import com.njcn.csdevice.pojo.po.AppProjectPO;
import com.njcn.csdevice.pojo.vo.AppProjectVO;
import com.njcn.csdevice.service.RoleEngineerDevService;
import com.njcn.csdevice.service.impl.RoleEngineerDevServiceImpl;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/27 10:54【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Slf4j
@RestController
@RequestMapping("/roleEngineerDev")
@Api(tags = " 角色工程设备")
@AllArgsConstructor
public class RoleEngineerDevController extends BaseController {
private final RoleEngineerDevService roleEngineerDevService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getRoleengineer")
@ApiOperation("角色工程查询")
public HttpResult<List<String>> getRoleengineer(){
String methodDescribe = getMethodDescribe("getRoleengineer");
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, roleengineer, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDevice")
@ApiOperation("角色设备查询")
public HttpResult<List<String>> getDevice(){
String methodDescribe = getMethodDescribe("getDevice");
List<String> device = roleEngineerDevService.getDevice();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, device, methodDescribe);
}
}

View File

@@ -31,7 +31,7 @@ import java.util.List;
@RestController
@Slf4j
@RequestMapping("/topologyTemplate")
@Api(tags = " 拓扑图-监测点")
@Api(tags = " 拓扑图模板")
@AllArgsConstructor
public class TopologyTemplateController extends BaseController {

View File

@@ -1,8 +1,13 @@
package com.njcn.csdevice.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csdevice.pojo.param.CsLineTopologyTemplateParm;
import com.njcn.csdevice.pojo.po.CsLineTopologyTemplate;
/**
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
import java.util.List;
/**
*
* Description:
* Date: 2023/7/10 18:30【需求编号】
@@ -13,4 +18,7 @@ import com.njcn.csdevice.pojo.po.CsLineTopologyTemplate;
public interface CsLineTopologyTemplateService extends IService<CsLineTopologyTemplate>{
}
Boolean add(List<CsLineTopologyTemplateParm> csLineTopologyTemplateParms);
List<CsLineTopologyTemplateVO> queryByTopoId(String topoId);
}

View File

@@ -1,141 +1,15 @@
package com.njcn.csdevice.service;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.csdevice.mapper.*;
import com.njcn.csdevice.pojo.po.*;
import com.njcn.user.enums.AppRoleEnum;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* Description:
* Date: 2023/6/27 9:28【需求编号】
* Date: 2023/7/11 16:26【需求编号】
*
* @author clam
* @version V1.0.0
*/
@RequiredArgsConstructor
@Service
public class RoleEngineerDevService {
private final CsEngineeringUserMapper csEngineeringUserMapper;
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
private final CsLedgerMapper csLedgerMapper;
private final CsEngineeringMapper csEngineeringMapper;
private final CsTouristDataPOMapper csTouristDataPOMapper;
public List<String> getRoleengineer(){
String role = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(role, String.class);
if(CollectionUtils.isEmpty(strings)){
return new ArrayList<>();
}
role=strings.get(0);
String userIndex = RequestUtil.getUserIndex();
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
List<String> collect = new ArrayList<>();
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
csDeviceUserPOQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.clear();
csLedgerQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
csDeviceUserPOQueryWrapper.and(wq -> {
wq.eq("primary_user_id", userIndex)
.or()
.eq("sub_user_id",userIndex);
});
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
if(CollectionUtils.isEmpty(collect1)){
return collect;
}else{
csLedgerQueryWrapper.in("id",collect1).eq("level",2);
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
List<String> collect2 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
csLedgerQueryWrapper.clear();
csLedgerQueryWrapper.in("id",collect2).eq("level",1);
csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
List<String> collect3 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
collect.addAll(collect3);
collect = collect.stream().distinct().collect(Collectors.toList());
return collect;
}
}
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
//todo查询配置的游客工程
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
collect =csEngineeringPOS.stream().map(CsEngineeringPO::getId).collect(Collectors.toList());
}
return collect;
}
public List<String> getDevice(){
String role = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(role, String.class);
if(CollectionUtils.isEmpty(strings)){
return new ArrayList<>();
}
role=strings.get(0);
String userIndex = RequestUtil.getUserIndex();
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
List<String> collect = new ArrayList<>();
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
csDeviceUserPOQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
csDeviceUserPOQueryWrapper.and(wq -> {
wq.eq("primary_user_id", userIndex)
.or()
.eq("sub_user_id",userIndex);
});
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
return collect1;
}
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
csLedgerQueryWrapper.clear();
csLedgerQueryWrapper.eq("level",2).eq("state",1);
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
collect = csLedgers.stream().map(CsLedger::getId).distinct().collect(Collectors.toList());
}
return collect;
}
public interface RoleEngineerDevService {
List<String> getRoleengineer();
List<String> getDevice();
}

View File

@@ -17,7 +17,6 @@ import com.njcn.csdevice.pojo.po.CsEngineeringUserPO;
import com.njcn.csdevice.pojo.po.CsLedger;
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
import com.njcn.csdevice.service.CsEngineeringService;
import com.njcn.csdevice.service.RoleEngineerDevService;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.pojo.po.Area;
@@ -51,7 +50,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
private final RedisUtil redisUtil;
private final CsLedgerMapper csLedgerMapper;
private final CsEngineeringUserMapper csEngineeringUserMapper;
private final RoleEngineerDevService roleEngineerDevService;
private final RoleEngineerDevServiceImpl roleEngineerDevService;

View File

@@ -1,11 +1,20 @@
package com.njcn.csdevice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.mapper.CsLineTopologyTemplateMapper;
import com.njcn.csdevice.pojo.param.CsLineTopologyTemplateParm;
import com.njcn.csdevice.pojo.po.CsLedger;
import com.njcn.csdevice.pojo.po.CsLineTopologyTemplate;
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
*
* Description:
@@ -17,4 +26,33 @@ import org.springframework.stereotype.Service;
@Service
public class CsLineTopologyTemplateServiceImpl extends ServiceImpl<CsLineTopologyTemplateMapper, CsLineTopologyTemplate> implements CsLineTopologyTemplateService {
@Override
public Boolean add(List<CsLineTopologyTemplateParm> csLineTopologyTemplateParms) {
List<CsLineTopologyTemplate> csLineTopologyTemplates = new ArrayList<>();
QueryWrapper<CsLineTopologyTemplate> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("",csLineTopologyTemplateParms.get(0).getTopoId());
this.remove(queryWrapper);
csLineTopologyTemplateParms.stream().forEach(csLineTopologyTemplateParm -> {
CsLineTopologyTemplate cs = new CsLineTopologyTemplate();
BeanUtils.copyProperties(csLineTopologyTemplateParm, cs);
cs.setStatus("1");
csLineTopologyTemplates.add(cs);
});
boolean b = this.saveBatch(csLineTopologyTemplates);
return b;
}
@Override
public List<CsLineTopologyTemplateVO> queryByTopoId(String topoId) {
List<CsLineTopologyTemplate> list = new ArrayList<>();
list = this.lambdaQuery().eq(CsLineTopologyTemplate::getTopoId, topoId).eq(CsLineTopologyTemplate::getStatus, 1).list();
List<CsLineTopologyTemplateVO> collect = list.stream().map(csLineTopologyTemplate -> {
CsLineTopologyTemplateVO vo = new CsLineTopologyTemplateVO();
BeanUtils.copyProperties(csLineTopologyTemplate, vo);
return vo;
}).collect(Collectors.toList());
return collect;
}
}

View File

@@ -7,7 +7,9 @@ import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.mapper.CsTopologyDiagramTemplateMapper;
import com.njcn.csdevice.pojo.po.CsTopologyDiagramTemplate;
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
import com.njcn.csdevice.pojo.vo.CsTopologyDiagramTemplateVO;
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
import com.njcn.csdevice.service.CsTopologyDiagramTemplateService;
import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
@@ -33,7 +35,7 @@ import java.util.stream.Collectors;
public class CsTopologyDiagramTemplateServiceImpl extends ServiceImpl<CsTopologyDiagramTemplateMapper, CsTopologyDiagramTemplate> implements CsTopologyDiagramTemplateService {
private final FileStorageUtil fileStorageUtil;
private final CsLineTopologyTemplateService csLineTopologyTemplateService;
@Override
@Transactional(rollbackFor = {Exception.class})
public String uploadImage(MultipartFile issuesFile) {
@@ -61,6 +63,8 @@ public class CsTopologyDiagramTemplateServiceImpl extends ServiceImpl<CsTopology
BeanUtils.copyProperties(temp, vo);
vo.setFilePath(fileStorageUtil.getFileUrl(vo.getFilePath()));
List<CsLineTopologyTemplateVO> csLineTopologyTemplateVOS = csLineTopologyTemplateService.queryByTopoId(temp.getId());
vo.setCsLineTopologyTemplateVOList(csLineTopologyTemplateVOS);
return vo;
}).collect(Collectors.toList());
return collect;

View File

@@ -0,0 +1,143 @@
package com.njcn.csdevice.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.csdevice.mapper.*;
import com.njcn.csdevice.pojo.po.*;
import com.njcn.csdevice.service.RoleEngineerDevService;
import com.njcn.user.enums.AppRoleEnum;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* Description:
* Date: 2023/6/27 9:28【需求编号】
*
* @author clam
* @version V1.0.0
*/
@RequiredArgsConstructor
@Service
public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
private final CsEngineeringUserMapper csEngineeringUserMapper;
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
private final CsLedgerMapper csLedgerMapper;
private final CsEngineeringMapper csEngineeringMapper;
private final CsTouristDataPOMapper csTouristDataPOMapper;
@Override
public List<String> getRoleengineer(){
String role = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(role, String.class);
if(CollectionUtils.isEmpty(strings)){
return new ArrayList<>();
}
role=strings.get(0);
String userIndex = RequestUtil.getUserIndex();
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
List<String> collect = new ArrayList<>();
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
csDeviceUserPOQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.clear();
csLedgerQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
csDeviceUserPOQueryWrapper.and(wq -> {
wq.eq("primary_user_id", userIndex)
.or()
.eq("sub_user_id",userIndex);
});
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
if(CollectionUtils.isEmpty(collect1)){
return collect;
}else{
csLedgerQueryWrapper.in("id",collect1).eq("level",2);
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
List<String> collect2 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
csLedgerQueryWrapper.clear();
csLedgerQueryWrapper.in("id",collect2).eq("level",1);
csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
List<String> collect3 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
collect.addAll(collect3);
collect = collect.stream().distinct().collect(Collectors.toList());
return collect;
}
}
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
//todo查询配置的游客工程
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
collect =csEngineeringPOS.stream().map(CsEngineeringPO::getId).collect(Collectors.toList());
}
return collect;
}
@Override
public List<String> getDevice(){
String role = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(role, String.class);
if(CollectionUtils.isEmpty(strings)){
return new ArrayList<>();
}
role=strings.get(0);
String userIndex = RequestUtil.getUserIndex();
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
List<String> collect = new ArrayList<>();
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
csDeviceUserPOQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.clear();
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
csDeviceUserPOQueryWrapper.and(wq -> {
wq.eq("primary_user_id", userIndex)
.or()
.eq("sub_user_id",userIndex);
});
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
return collect1;
}
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
csLedgerQueryWrapper.clear();
csLedgerQueryWrapper.eq("level",2).eq("state",1);
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
collect = csLedgers.stream().map(CsLedger::getId).distinct().collect(Collectors.toList());
}
return collect;
}
}