物联用户权限功能添加
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.csdevice.api;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -22,4 +23,10 @@ public interface CsDeviceUserFeignClient {
|
||||
|
||||
@PostMapping("/findUserById")
|
||||
HttpResult<List<String>> findUserById(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/findDevByUserId")
|
||||
HttpResult<List<String>> findDevByUserId(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/channelDevByUserId")
|
||||
HttpResult<List<String>> channelDevByUserId(@RequestBody UserDevParam param);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.api.fallback.CsLedgerFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -42,5 +47,12 @@ public interface CsLedgerFeignClient {
|
||||
@PostMapping("/getAllLedger")
|
||||
HttpResult<List<CsLedgerVO>> getAllLedger();
|
||||
|
||||
@PostMapping("/getInfoByIds")
|
||||
HttpResult<List<DevDetailDTO>> getInfoByIds(@RequestBody @Validated List<String> list);
|
||||
|
||||
@PostMapping("/getDevInfoByEngineerIds")
|
||||
@ApiOperation("根据工程获取设备信息")
|
||||
HttpResult<List<DevDetailDTO>> getDevInfoByEngineerIds(@RequestBody @Validated List<String> list);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -38,6 +39,18 @@ public class CsDeviceUserClientFallbackFactory implements FallbackFactory<CsDevi
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> findDevByUserId(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据用户Id查询设备集合",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> channelDevByUserId(UserDevParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据用户Id解绑设备集合异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,18 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLed
|
||||
log.error("{}异常,降级处理,异常为:{}","获取台账树所有数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DevDetailDTO>> getInfoByIds(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据设备集合查询工程,设备信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DevDetailDTO>> getDevInfoByEngineerIds(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据工程获取设备信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,4 +105,27 @@ public class CsLineParam extends BaseEntity {
|
||||
* 运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)
|
||||
*/
|
||||
private Integer runStatus;
|
||||
|
||||
/**
|
||||
* 短路容量
|
||||
*/
|
||||
private Integer shortCircuitCapacity;
|
||||
|
||||
/**
|
||||
* 设备容量
|
||||
*/
|
||||
private Integer devCapacity;
|
||||
|
||||
/**
|
||||
* 基准容量
|
||||
*/
|
||||
private Integer basicCapacity;
|
||||
|
||||
/**
|
||||
* 协议容量
|
||||
*/
|
||||
private Integer protocolCapacity;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserDevParam implements Serializable {
|
||||
|
||||
@ApiModelProperty(value="用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value="设备集合id")
|
||||
private List<String> list;
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ 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.enums.DeviceOperate;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
@@ -140,4 +141,24 @@ public class DeviceUserController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/findDevByUserId")
|
||||
@ApiOperation("根据用户Id查询设备集合")
|
||||
@ApiImplicitParam(name = "id", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> findDevByUserId(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("findDevByUserId");
|
||||
List<String> list = csDeviceUserPOService.findDevByUserId(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/channelDevByUserId")
|
||||
@ApiOperation("根据用户Id解绑设备集合")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<String>> channelDevByUserId(@RequestBody UserDevParam param){
|
||||
String methodDescribe = getMethodDescribe("channelDevByUserId");
|
||||
csDeviceUserPOService.channelDevByUserId(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -405,4 +405,13 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getRunPortableDev")
|
||||
@ApiOperation("获取在运的便携式设备")
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getRunPortableDev(){
|
||||
String methodDescribe = getMethodDescribe("getRunPortableDev");
|
||||
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getRunPortableDev();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -165,5 +165,25 @@ public class CsLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getInfoByIds")
|
||||
@ApiOperation("根据设备集合查询工程,设备信息")
|
||||
@ApiImplicitParam(name = "list", value = "查询条件", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getInfoByIds(@RequestBody @Validated List<String> list){
|
||||
String methodDescribe = getMethodDescribe("getInfoByIds");
|
||||
List<DevDetailDTO> details = csLedgerService.getInfoByIds(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDevInfoByEngineerIds")
|
||||
@ApiOperation("根据工程获取设备信息")
|
||||
@ApiImplicitParam(name = "list", value = "查询条件", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getDevInfoByEngineerIds(@RequestBody @Validated List<String> list){
|
||||
String methodDescribe = getMethodDescribe("getDevInfoByEngineerIds");
|
||||
List<DevDetailDTO> details = csLedgerService.getDevInfoByEngineerIds(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
from
|
||||
cs_equipment_delivery
|
||||
<where>
|
||||
1=1
|
||||
dev_access_method = 'MQTT'
|
||||
<if test="queryParam.process != null and queryParam.process !=''">
|
||||
and process = #{queryParam.process}
|
||||
</if>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
@@ -48,4 +49,8 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
||||
* @return
|
||||
*/
|
||||
List<String> findUserById(String devId);
|
||||
|
||||
List<String> findDevByUserId(String userId);
|
||||
|
||||
void channelDevByUserId(UserDevParam param);
|
||||
}
|
||||
|
||||
@@ -193,4 +193,6 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
|
||||
List<CsEquipmentDeliveryPO> getListByIds(List<String> devList);
|
||||
|
||||
List<CsEquipmentDeliveryPO> getRunPortableDev();
|
||||
|
||||
}
|
||||
|
||||
@@ -85,4 +85,8 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getProAndEngineer(List<String> id);
|
||||
|
||||
CsLedgerVO cldTree();
|
||||
|
||||
List<DevDetailDTO> getInfoByIds(List<String> list);
|
||||
|
||||
List<DevDetailDTO> getDevInfoByEngineerIds(List<String> list);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -12,6 +11,7 @@ import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsDeviceUserPOMapper;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsMarketDataMapper;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
@@ -51,22 +51,17 @@ import static java.util.Objects.isNull;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper, CsDeviceUserPO> implements CsDeviceUserPOService{
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
private final ICsLedgerService iCsLedgerService;
|
||||
// private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
|
||||
private final AppLineTopologyDiagramService appLineTopologyDiagramService;
|
||||
|
||||
private final CsTouristDataPOService csTouristDataPOService;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final CsMarketDataMapper csMarketDataMapper;
|
||||
private final EventUserFeignClient eventUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
private final FeedBackFeignClient feedBackFeignClient;
|
||||
private final IMqttUserService mqttUserService;
|
||||
|
||||
@@ -407,4 +402,22 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findDevByUserId(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getPrimaryUserId,userId).list();
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
result = list.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelDevByUserId(UserDevParam param) {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,param.getUserId())
|
||||
.in(CsDeviceUserPO::getDeviceId,param.getList());
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -985,6 +986,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId,devList).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsEquipmentDeliveryPO> getRunPortableDev() {
|
||||
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
||||
DictTreeVO vo = dictTreeFeignClient.queryByCode(DicDataEnum.PORTABLE.getCode()).getData();
|
||||
if (ObjectUtil.isNotNull(vo)) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
||||
result = this.list(lambdaQueryWrapper);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据前置机id获取装置数量
|
||||
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.controller.project.EngineeringController;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
@@ -22,6 +24,8 @@ import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -53,6 +57,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final EngineeringController engineeringController;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLedgerTree() {
|
||||
@@ -190,10 +196,29 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setName(DataParam.portableDev);
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
//针对未启用的装置判断
|
||||
List<CsLedgerVO> ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//根据当前用户获取便携式设备
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
List<String> finalResult = result;
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0") && finalResult.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||
.collect(Collectors.toMap(
|
||||
CsLedgerVO::getId,
|
||||
@@ -376,10 +401,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
|
||||
//针对未启用的装置判断
|
||||
List<CsLedgerVO> ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
List<String> finalResult = result;
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0") && finalResult.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||
.collect(Collectors.toMap(
|
||||
CsLedgerVO::getId,
|
||||
@@ -743,6 +786,57 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
return government;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getInfoByIds(List<String> list) {
|
||||
List<DevDetailDTO> details = new ArrayList<>();
|
||||
List<CsLedger> ledgers = this.listByIds(list);
|
||||
Set<String> enginingeringIds = new HashSet<>();
|
||||
ledgers.forEach(item->{
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
if(Objects.equals(item.getPid(),"0")){
|
||||
device.setEquipmentName(item.getName());
|
||||
device.setEquipmentId(item.getId());
|
||||
device.setProjectId("/");
|
||||
device.setProjectName("/");
|
||||
device.setEngineeringid("/");
|
||||
device.setEngineeringName("/");
|
||||
details.add(device);
|
||||
} else {
|
||||
enginingeringIds.add(item.getPids().split(",")[1]);
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(enginingeringIds)) {
|
||||
List<CsLedger> engineer = this.listByIds(enginingeringIds);
|
||||
engineer.forEach(item->{
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEngineeringid(item.getId());
|
||||
detail.setEngineeringName(item.getName());
|
||||
details.add(detail);
|
||||
});
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getDevInfoByEngineerIds(List<String> list) {
|
||||
List<DevDetailDTO> details = new ArrayList<>();
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(CsLedger::getPid, list);
|
||||
List<CsLedger> project = this.list(queryWrapper);
|
||||
//工程id
|
||||
List<String> projectIds = project.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||
List<CsLedger> dev = this.list(queryWrapper2);
|
||||
dev.forEach(item->{
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEquipmentName(item.getName());
|
||||
detail.setEquipmentId(item.getId());
|
||||
details.add(detail);
|
||||
});
|
||||
return details;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子节点
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.access.utils.ChannelObjectUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.csdevice.param.IcdLedgerParam;
|
||||
import com.njcn.csdevice.param.IcdParam;
|
||||
@@ -23,6 +24,8 @@ import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.mq.message.BZEventMessage;
|
||||
import com.njcn.mq.template.BZEventMessageTemplate;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
@@ -58,6 +61,7 @@ class IcdServiceImpl implements IcdService {
|
||||
private final EventFeignClient eventFeignClient;
|
||||
private final ICsTerminalLogsService csTerminalLogsService;
|
||||
private final ICsTerminalReplyService csTerminalReplyService;
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final DateTimeFormatter microsecondFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
||||
|
||||
@Override
|
||||
@@ -123,7 +127,6 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addLedgerInfo(IcdLedgerParam param) {
|
||||
// 第一种:全流程创建
|
||||
if (isAllIndicesNull(param)) {
|
||||
@@ -579,7 +582,8 @@ class IcdServiceImpl implements IcdService {
|
||||
&& ObjectUtil.isNull(param.getDevIndex());
|
||||
}
|
||||
|
||||
private void handleFullProcessCreation(@NotNull IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFullProcessCreation(@NotNull IcdLedgerParam param) {
|
||||
if (ObjectUtil.isNotNull(param.getEngineering())) {
|
||||
CsEngineeringPO po1 = csEngineeringService.addEngineering(param.getEngineering());
|
||||
param.setEngineeringIndex(po1.getId());
|
||||
@@ -587,15 +591,18 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleFromEngineeringCreation(IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromEngineeringCreation(IcdLedgerParam param) {
|
||||
createProjectAndDevices(param);
|
||||
}
|
||||
|
||||
private void handleFromProjectCreation(IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromProjectCreation(IcdLedgerParam param) {
|
||||
saveDevicesAndLines(param);
|
||||
}
|
||||
|
||||
private void handleFromDeviceCreation(IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromDeviceCreation(IcdLedgerParam param) {
|
||||
saveLines(param);
|
||||
}
|
||||
|
||||
@@ -628,8 +635,8 @@ class IcdServiceImpl implements IcdService {
|
||||
saveLines(param);
|
||||
}
|
||||
|
||||
private void saveLines(IcdLedgerParam param) {
|
||||
List<CsLinePO> list = new ArrayList<>();
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveLines(IcdLedgerParam param) {
|
||||
List<CsLineParam> lineList = param.getLine();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
boolean result = checkAndAlertDuplicates(lineList);
|
||||
@@ -651,7 +658,10 @@ class IcdServiceImpl implements IcdService {
|
||||
line.setDevId(param.getDevIndex());
|
||||
}
|
||||
CsLinePO po = csLinePOService.addCldLine(line);
|
||||
list.add(po);
|
||||
//新增监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(line.getVolGrade().floatValue(), line.getProtocolCapacity().floatValue(),line.getDevCapacity().floatValue(),line.getShortCircuitCapacity().floatValue(),0,0);
|
||||
overlimit.setId(po.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
}
|
||||
|
||||
//新增台账日志
|
||||
|
||||
@@ -61,26 +61,24 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
});
|
||||
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);
|
||||
if (!CollectionUtils.isEmpty(collect1)) {
|
||||
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();
|
||||
if(CollectionUtils.isEmpty(collect2)){
|
||||
if (CollectionUtils.isEmpty(collect2)) {
|
||||
return collect;
|
||||
}
|
||||
csLedgerQueryWrapper.in("id",collect2).eq("level",1);
|
||||
csLedgerQueryWrapper.in("id", collect2).eq("level", 1);
|
||||
csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect3 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(collect3)){
|
||||
return collect;
|
||||
if (CollectionUtils.isEmpty(collect3)) {
|
||||
return collect;
|
||||
}
|
||||
collect.addAll(collect3);
|
||||
collect = collect.stream().distinct().collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
return collect;
|
||||
|
||||
} else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||
Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||
@@ -94,7 +92,9 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
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())||Objects.equals(role,"bxs_user")){
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||
}
|
||||
@@ -196,7 +196,9 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
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())||Objects.equals(role,"bxs_user")){
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
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);
|
||||
|
||||
@@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "cs_configuration")
|
||||
@TableName(value = "cs_configuration")
|
||||
public class CsConfigurationPO extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.cssystem.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class WlUserParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "工程id集合")
|
||||
private List<String> engineeringList;
|
||||
|
||||
@ApiModelProperty(value = "便携式设备id")
|
||||
private List<String> portableDevList;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.cssystem.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class WlUserVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "工程集合")
|
||||
private List<EngineeringVo> engineeringList;
|
||||
|
||||
@ApiModelProperty(value = "便携式设备集合")
|
||||
private List<portableDevVo> portableDevList;
|
||||
|
||||
|
||||
@Data
|
||||
public static class EngineeringVo implements Serializable{
|
||||
|
||||
@ApiModelProperty(value = "工程id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class portableDevVo implements Serializable{
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.njcn.cssystem.controller;
|
||||
|
||||
|
||||
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.common.utils.LogUtil;
|
||||
import com.njcn.cssystem.pojo.param.WlUserParam;
|
||||
import com.njcn.cssystem.pojo.vo.WlUserVo;
|
||||
import com.njcn.cssystem.service.IWlUserService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-12
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wlUser")
|
||||
@Api(tags = "用户设备分配")
|
||||
@AllArgsConstructor
|
||||
public class WlUserController extends BaseController {
|
||||
|
||||
private final IWlUserService wlUserService;
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||
@PostMapping("/selectDevByUserId")
|
||||
@ApiOperation("根据用户id查询工程和便携式设备")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<WlUserVo> selectDevByUserId(@RequestParam @Validated String userId ) {
|
||||
String methodDescribe = getMethodDescribe("selectDevByUserId");
|
||||
LogUtil.njcnDebug(log, "{},用户数据为:{}", methodDescribe, userId);
|
||||
WlUserVo vo = wlUserService.selectDevByUserId(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/addUserDev")
|
||||
@ApiOperation("用户绑定工程和便携式设备")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<WlUserVo> addUserDev(@RequestBody @Validated WlUserParam param) {
|
||||
String methodDescribe = getMethodDescribe("addUserDev");
|
||||
LogUtil.njcnDebug(log, "{},参数:{}", methodDescribe, param);
|
||||
wlUserService.addUserDev(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@PostMapping("/deleteUserDev")
|
||||
@ApiOperation("用户取消绑定工程和便携式设备")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<WlUserVo> deleteUserDev(@RequestBody @Validated WlUserParam param) {
|
||||
String methodDescribe = getMethodDescribe("deleteUserDev");
|
||||
LogUtil.njcnDebug(log, "{},参数:{}", methodDescribe, param);
|
||||
wlUserService.deleteUserDev(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cssystem.service;
|
||||
|
||||
import com.njcn.cssystem.pojo.param.WlUserParam;
|
||||
import com.njcn.cssystem.pojo.vo.WlUserVo;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
public interface IWlUserService {
|
||||
|
||||
WlUserVo selectDevByUserId(String userId);
|
||||
|
||||
void addUserDev(WlUserParam param);
|
||||
|
||||
void deleteUserDev(WlUserParam param);
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.njcn.cssystem.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.cssystem.pojo.param.WlUserParam;
|
||||
import com.njcn.cssystem.pojo.vo.WlUserVo;
|
||||
import com.njcn.cssystem.service.IWlUserService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class WlUserServiceImpl implements IWlUserService {
|
||||
|
||||
private final CsDeviceUserFeignClient csDeviceUserFeignClient;
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
public WlUserVo selectDevByUserId(String userId) {
|
||||
WlUserVo wlUserVo = new WlUserVo();
|
||||
List<WlUserVo.EngineeringVo> list1 = new ArrayList<>();
|
||||
List<WlUserVo.portableDevVo> list2 = new ArrayList<>();
|
||||
//根据用户信息获取设备信息
|
||||
List<String> devList = csDeviceUserFeignClient.findDevByUserId(userId).getData();
|
||||
//根据设备查询工程信息
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
List<DevDetailDTO> ledger = csLedgerFeignClient.getInfoByIds(devList).getData();
|
||||
ledger.forEach(item->{
|
||||
if (Objects.equals(item.getEngineeringid(),"/")) {
|
||||
WlUserVo.portableDevVo portableDevVo = new WlUserVo.portableDevVo();
|
||||
portableDevVo.setId(item.getEquipmentId());
|
||||
portableDevVo.setName(item.getEquipmentName());
|
||||
list2.add(portableDevVo);
|
||||
} else {
|
||||
WlUserVo.EngineeringVo engineeringVo = new WlUserVo.EngineeringVo();
|
||||
engineeringVo.setId(item.getEngineeringid());
|
||||
engineeringVo.setName(item.getEngineeringName());
|
||||
list1.add(engineeringVo);
|
||||
}
|
||||
});
|
||||
}
|
||||
wlUserVo.setEngineeringList(list1);
|
||||
wlUserVo.setPortableDevList(list2);
|
||||
return wlUserVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUserDev(WlUserParam param) {
|
||||
List<String> devList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(param.getEngineeringList())) {
|
||||
//根据工程id获取设备id
|
||||
List<DevDetailDTO> dto = csLedgerFeignClient.getDevInfoByEngineerIds(param.getEngineeringList()).getData();
|
||||
if (CollectionUtil.isNotEmpty(dto)) {
|
||||
devList.addAll(dto.stream().map(DevDetailDTO::getEquipmentId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(param.getPortableDevList())) {
|
||||
devList.addAll(param.getPortableDevList());
|
||||
}
|
||||
//存储用户和设备的关系
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
List<CsDeviceUserPO> list = new ArrayList<>();
|
||||
devList.forEach(item->{
|
||||
CsDeviceUserPO po = new CsDeviceUserPO();
|
||||
po.setPrimaryUserId(param.getUserId());
|
||||
po.setSubUserId(param.getUserId());
|
||||
po.setDeviceId(item);
|
||||
po.setStatus("1");
|
||||
list.add(po);
|
||||
});
|
||||
csDeviceUserFeignClient.add(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserDev(WlUserParam param) {
|
||||
List<String> devList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(param.getEngineeringList())) {
|
||||
//根据工程id获取设备id
|
||||
List<DevDetailDTO> dto = csLedgerFeignClient.getDevInfoByEngineerIds(param.getEngineeringList()).getData();
|
||||
if (CollectionUtil.isNotEmpty(dto)) {
|
||||
devList.addAll(dto.stream().map(DevDetailDTO::getEquipmentId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(param.getPortableDevList())) {
|
||||
devList.addAll(param.getPortableDevList());
|
||||
}
|
||||
//解绑用户和设备的关系
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
UserDevParam par = new UserDevParam();
|
||||
par.setUserId(param.getUserId());
|
||||
par.setList(devList);
|
||||
csDeviceUserFeignClient.channelDevByUserId(par);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user