Merge remote-tracking branch 'origin/master'
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,102 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||||
|
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.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 CsLinePOMapper csLinePOMapper;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.select(CsLinePO::getLineId).in(CsLinePO::getDeviceId, devIds)
|
||||||
|
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||||
|
List<CsLinePO> poList = csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
||||||
|
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||||
|
List<CsLinePO> poList =csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ import java.util.Optional;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Date: 2023/9/27 10:29【需求编号】
|
* Date: 2023/9/27 10:29【需求编号】
|
||||||
*
|
*
|
||||||
@@ -50,12 +50,12 @@ public class CsDevCapacityPOServiceImpl extends ServiceImpl<CsDevCapacityPOMappe
|
|||||||
public Double getDevCapacity(String id) {
|
public Double getDevCapacity(String id) {
|
||||||
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
||||||
|
|
||||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
//String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||||
|
|
||||||
Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
//Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||||
List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
//List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||||
/*治理侧监测点*/
|
/*治理侧监测点*/
|
||||||
CsLinePO csLinePO = collect1.get(0);
|
CsLinePO csLinePO = csLinePOS.get(0);
|
||||||
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, csLinePO.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
|
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, csLinePO.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
|
||||||
// Optional.ofNullable(one).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DATA_MISSING));
|
// Optional.ofNullable(one).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DATA_MISSING));
|
||||||
if(Objects.isNull(one)){
|
if(Objects.isNull(one)){
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -57,8 +64,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
private final EngineeringController engineeringController;
|
|
||||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||||
|
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||||
|
private final UserFeignClient userFeignClient;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLedgerVO> getLedgerTree() {
|
public List<CsLedgerVO> getLedgerTree() {
|
||||||
@@ -104,7 +113,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
.forEach(zhiLianDevice::add)
|
.forEach(zhiLianDevice::add)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
|
||||||
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||||
@@ -148,14 +157,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
.peek(
|
.peek(
|
||||||
item -> {
|
item -> {
|
||||||
item.setType("line");
|
item.setType("line");
|
||||||
String index = item.getId().substring(item.getId().length()-1);
|
String index = item.getId().substring(item.getId().length() - 1);
|
||||||
if (Objects.equals(index,"0")) {
|
if (Objects.equals(index, "0")) {
|
||||||
item.setLineType(0);
|
item.setLineType(0);
|
||||||
} else {
|
} else {
|
||||||
item.setLineType(1);
|
item.setLineType(1);
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(CsLinePO::getLineId,item.getId()).eq(CsLinePO::getStatus,1);
|
queryWrapper.eq(CsLinePO::getLineId, item.getId()).eq(CsLinePO::getStatus, 1);
|
||||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||||
item.setConType(po.getConType());
|
item.setConType(po.getConType());
|
||||||
}
|
}
|
||||||
@@ -201,16 +210,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<CsLedgerVO> ledger;
|
List<CsLedgerVO> ledger;
|
||||||
String role = RequestUtil.getUserRole();
|
String role = RequestUtil.getUserRole();
|
||||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
if (roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())) {
|
||||||
ledger = allList.stream()
|
ledger = allList.stream()
|
||||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
if (CollectionUtil.isNotEmpty(list1)){
|
if (CollectionUtil.isNotEmpty(list1)) {
|
||||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
//针对未启用的装置判断
|
//针对未启用的装置判断
|
||||||
@@ -269,6 +278,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();
|
||||||
@@ -328,7 +338,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
|
||||||
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||||
@@ -404,16 +414,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<CsLedgerVO> ledger;
|
List<CsLedgerVO> ledger;
|
||||||
String role = RequestUtil.getUserRole();
|
String role = RequestUtil.getUserRole();
|
||||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
if (roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())) {
|
||||||
ledger = allList.stream()
|
ledger = allList.stream()
|
||||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
if (CollectionUtil.isNotEmpty(list1)){
|
if (CollectionUtil.isNotEmpty(list1)) {
|
||||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
//针对未启用的装置判断
|
//针对未启用的装置判断
|
||||||
@@ -475,11 +485,11 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
||||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).one();
|
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId, csLedgerParam.getPid()).one();
|
||||||
CsLedger csLedger = new CsLedger();
|
CsLedger csLedger = new CsLedger();
|
||||||
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
BeanUtils.copyProperties(csLedgerParam, csLedger);
|
||||||
csLedger.setState(1);
|
csLedger.setState(1);
|
||||||
if (Objects.equals(csLedgerParam.getPid(),"9999999")){
|
if (Objects.equals(csLedgerParam.getPid(), "9999999")) {
|
||||||
csLedger.setPid("0");
|
csLedger.setPid("0");
|
||||||
csLedger.setPids("0");
|
csLedger.setPids("0");
|
||||||
} else {
|
} else {
|
||||||
@@ -491,7 +501,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteLedgerTree(String id) {
|
public void deleteLedgerTree(String id) {
|
||||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId,id).one();
|
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId, id).one();
|
||||||
csLedger.setState(0);
|
csLedger.setState(0);
|
||||||
this.updateById(csLedger);
|
this.updateById(csLedger);
|
||||||
}
|
}
|
||||||
@@ -506,8 +516,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
@Override
|
@Override
|
||||||
public String findDevByLineId(String lineId) {
|
public String findDevByLineId(String lineId) {
|
||||||
String deviceId = null;
|
String deviceId = null;
|
||||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId,lineId).eq(CsLedger::getState,1).one();
|
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId, lineId).eq(CsLedger::getState, 1).one();
|
||||||
if (!Objects.isNull(csLedger)){
|
if (!Objects.isNull(csLedger)) {
|
||||||
deviceId = csLedger.getPid();
|
deviceId = csLedger.getPid();
|
||||||
}
|
}
|
||||||
return deviceId;
|
return deviceId;
|
||||||
@@ -515,7 +525,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CsLedger findDataById(String id) {
|
public CsLedger findDataById(String id) {
|
||||||
return this.lambdaQuery().eq(CsLedger::getId,id).eq(CsLedger::getState,1).one();
|
return this.lambdaQuery().eq(CsLedger::getId, id).eq(CsLedger::getState, 1).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -523,12 +533,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
QueryWrapper<AppTopologyDiagramPO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<AppTopologyDiagramPO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("status","1");
|
queryWrapper.eq("status", "1");
|
||||||
List<AppTopologyDiagramPO> appTopologyDiagramPOS = appTopologyDiagramMapper.selectList(queryWrapper);
|
List<AppTopologyDiagramPO> appTopologyDiagramPOS = appTopologyDiagramMapper.selectList(queryWrapper);
|
||||||
projectList.forEach(temp->{
|
projectList.forEach(temp -> {
|
||||||
AppProjectPO appProjectPO = appProjectMapper.selectById(temp.getId());
|
AppProjectPO appProjectPO = appProjectMapper.selectById(temp.getId());
|
||||||
temp.setArea(appProjectPO.getArea());
|
temp.setArea(appProjectPO.getArea());
|
||||||
temp.setRemark(appProjectPO.getDescription());
|
temp.setRemark(appProjectPO.getDescription());
|
||||||
@@ -544,13 +554,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
temp.setChildren(collect);
|
temp.setChildren(collect);
|
||||||
});
|
});
|
||||||
engineeringList.forEach(eng -> {
|
engineeringList.forEach(eng -> {
|
||||||
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||||
eng.setArea(this.getAreaById(csEngineeringPO.getProvince())+this.getAreaById(csEngineeringPO.getCity()));
|
eng.setArea(this.getAreaById(csEngineeringPO.getProvince()) + this.getAreaById(csEngineeringPO.getCity()));
|
||||||
eng.setProvinceId(csEngineeringPO.getProvince());
|
eng.setProvinceId(csEngineeringPO.getProvince());
|
||||||
eng.setCityId(csEngineeringPO.getCity());
|
eng.setCityId(csEngineeringPO.getCity());
|
||||||
eng.setRemark(csEngineeringPO.getDescription());
|
eng.setRemark(csEngineeringPO.getDescription());
|
||||||
eng.setChildren(getChildren(eng, projectList));
|
eng.setChildren(getChildren(eng, projectList));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return engineeringList;
|
return engineeringList;
|
||||||
@@ -566,14 +576,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
DevDetailDTO device = new DevDetailDTO();
|
DevDetailDTO device = new DevDetailDTO();
|
||||||
CsLedger dev = this.findDataById(devId);
|
CsLedger dev = this.findDataById(devId);
|
||||||
//如果是便携式设备,pid为0,项目,工程都设置为/
|
//如果是便携式设备,pid为0,项目,工程都设置为/
|
||||||
if(Objects.equals(dev.getPid(),"0")){
|
if (Objects.equals(dev.getPid(), "0")) {
|
||||||
device.setEquipmentName(dev.getName());
|
device.setEquipmentName(dev.getName());
|
||||||
device.setEquipmentId(devId);
|
device.setEquipmentId(devId);
|
||||||
device.setProjectId("/");
|
device.setProjectId("/");
|
||||||
device.setProjectName("/");
|
device.setProjectName("/");
|
||||||
device.setEngineeringid("/");
|
device.setEngineeringid("/");
|
||||||
device.setEngineeringName("/");
|
device.setEngineeringName("/");
|
||||||
}else {
|
} else {
|
||||||
device.setEquipmentName(dev.getName());
|
device.setEquipmentName(dev.getName());
|
||||||
device.setEquipmentId(devId);
|
device.setEquipmentId(devId);
|
||||||
CsLedger project = this.findDataById(dev.getPid());
|
CsLedger project = this.findDataById(dev.getPid());
|
||||||
@@ -595,12 +605,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
/*获取用户工程,设备信息过滤*/
|
/*获取用户工程,设备信息过滤*/
|
||||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> device = roleEngineerDevService.getDevice();
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
|
||||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0")).
|
||||||
peek(
|
peek(
|
||||||
temp->{
|
temp -> {
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||||
temp.setComFlag(po.getRunStatus());
|
temp.setComFlag(po.getRunStatus());
|
||||||
temp.setNDId(po.getNdid());
|
temp.setNDId(po.getNdid());
|
||||||
@@ -626,9 +636,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
project.setPid("0");
|
project.setPid("0");
|
||||||
project.setId(DataParam.WIRELESS_PROJECT_ID);
|
project.setId(DataParam.WIRELESS_PROJECT_ID);
|
||||||
|
|
||||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
List<CsLedgerVO> portables = allList.stream().filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0")).collect(Collectors.toList());
|
||||||
checkDevSetData(portables);
|
checkDevSetData(portables);
|
||||||
for(CsLedgerVO c : portables){
|
for (CsLedgerVO c : portables) {
|
||||||
c.setPid(project.getId());
|
c.setPid(project.getId());
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
@@ -643,9 +653,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);
|
||||||
@@ -659,29 +666,109 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(deviceList)) {
|
if (CollUtil.isNotEmpty(deviceList)) {
|
||||||
tree.add(government);
|
tree.add(government);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLedgerVO> objTree() {
|
||||||
|
List<CsLedgerVO> result = new ArrayList<>();
|
||||||
|
String userId = "fa37b93cc90d4c1784ca8f6debddee1a";
|
||||||
|
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||||
|
List<String> devIds;
|
||||||
|
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||||
|
devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||||
|
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||||
|
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||||
|
List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||||
|
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(devIds)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||||
|
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).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()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||||
|
|
||||||
|
List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().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());
|
||||||
|
csLedgerVO.setName(pro.getName());
|
||||||
|
|
||||||
|
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());
|
||||||
|
if(CollUtil.isNotEmpty(objTemIds)){
|
||||||
|
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(CsLedger::getPid).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());
|
||||||
|
csLedgerVO.setName(gc.getName());
|
||||||
|
|
||||||
|
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<>();
|
||||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||||
Set<String> idSet = new HashSet<>(id);
|
Set<String> idSet = new HashSet<>(id);
|
||||||
if (CollectionUtil.isNotEmpty(id)) {
|
if (CollectionUtil.isNotEmpty(id)) {
|
||||||
id.forEach(item->{
|
id.forEach(item -> {
|
||||||
allList.forEach(item2->{
|
allList.forEach(item2 -> {
|
||||||
if (Objects.equals(item2.getId(),item)) {
|
if (Objects.equals(item2.getId(), item)) {
|
||||||
idSet.addAll(Arrays.asList(item2.getPids().split( ",")));
|
idSet.addAll(Arrays.asList(item2.getPids().split(",")));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(idSet)) {
|
if (CollectionUtil.isNotEmpty(idSet)) {
|
||||||
idSet.forEach(item->{
|
idSet.forEach(item -> {
|
||||||
allList.forEach(item2->{
|
allList.forEach(item2 -> {
|
||||||
if (Objects.equals(item2.getId(),item)) {
|
if (Objects.equals(item2.getId(), item)) {
|
||||||
result.add(item2);
|
result.add(item2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -718,7 +805,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||||
|
|
||||||
//list1是 cld设备
|
//list1是 cld设备
|
||||||
devs.forEach(item->{
|
devs.forEach(item -> {
|
||||||
if (item.getDevType().equals(vo1.getId())) {
|
if (item.getDevType().equals(vo1.getId())) {
|
||||||
list1.add(item.getId());
|
list1.add(item.getId());
|
||||||
}
|
}
|
||||||
@@ -759,19 +846,19 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(deviceTree)) {
|
if (CollectionUtil.isNotEmpty(deviceTree)) {
|
||||||
List<CsLedgerVO> finalLineTree = lineTree;
|
List<CsLedgerVO> finalLineTree = lineTree;
|
||||||
deviceTree.forEach(item->{
|
deviceTree.forEach(item -> {
|
||||||
item.setChildren(getChildren(item, finalLineTree));
|
item.setChildren(getChildren(item, finalLineTree));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(projectTree)) {
|
if (CollectionUtil.isNotEmpty(projectTree)) {
|
||||||
List<CsLedgerVO> finalDeviceTree = deviceTree;
|
List<CsLedgerVO> finalDeviceTree = deviceTree;
|
||||||
projectTree.forEach(item->{
|
projectTree.forEach(item -> {
|
||||||
item.setChildren(getChildren(item, finalDeviceTree));
|
item.setChildren(getChildren(item, finalDeviceTree));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(engineerTree)) {
|
if (CollectionUtil.isNotEmpty(engineerTree)) {
|
||||||
List<CsLedgerVO> finalProjectTree = projectTree;
|
List<CsLedgerVO> finalProjectTree = projectTree;
|
||||||
engineerTree.forEach(item->{
|
engineerTree.forEach(item -> {
|
||||||
item.setChildren(getChildren(item, finalProjectTree));
|
item.setChildren(getChildren(item, finalProjectTree));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -791,9 +878,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<DevDetailDTO> details = new ArrayList<>();
|
List<DevDetailDTO> details = new ArrayList<>();
|
||||||
List<CsLedger> ledgers = this.listByIds(list);
|
List<CsLedger> ledgers = this.listByIds(list);
|
||||||
Set<String> enginingeringIds = new HashSet<>();
|
Set<String> enginingeringIds = new HashSet<>();
|
||||||
ledgers.forEach(item->{
|
ledgers.forEach(item -> {
|
||||||
DevDetailDTO device = new DevDetailDTO();
|
DevDetailDTO device = new DevDetailDTO();
|
||||||
if(Objects.equals(item.getPid(),"0")){
|
if (Objects.equals(item.getPid(), "0")) {
|
||||||
device.setEquipmentName(item.getName());
|
device.setEquipmentName(item.getName());
|
||||||
device.setEquipmentId(item.getId());
|
device.setEquipmentId(item.getId());
|
||||||
device.setProjectId("/");
|
device.setProjectId("/");
|
||||||
@@ -807,7 +894,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
});
|
});
|
||||||
if (CollectionUtil.isNotEmpty(enginingeringIds)) {
|
if (CollectionUtil.isNotEmpty(enginingeringIds)) {
|
||||||
List<CsLedger> engineer = this.listByIds(enginingeringIds);
|
List<CsLedger> engineer = this.listByIds(enginingeringIds);
|
||||||
engineer.forEach(item->{
|
engineer.forEach(item -> {
|
||||||
DevDetailDTO detail = new DevDetailDTO();
|
DevDetailDTO detail = new DevDetailDTO();
|
||||||
detail.setEngineeringid(item.getId());
|
detail.setEngineeringid(item.getId());
|
||||||
detail.setEngineeringName(item.getName());
|
detail.setEngineeringName(item.getName());
|
||||||
@@ -828,7 +915,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||||
List<CsLedger> dev = this.list(queryWrapper2);
|
List<CsLedger> dev = this.list(queryWrapper2);
|
||||||
dev.forEach(item->{
|
dev.forEach(item -> {
|
||||||
DevDetailDTO detail = new DevDetailDTO();
|
DevDetailDTO detail = new DevDetailDTO();
|
||||||
detail.setEquipmentName(item.getName());
|
detail.setEquipmentName(item.getName());
|
||||||
detail.setEquipmentId(item.getId());
|
detail.setEquipmentId(item.getId());
|
||||||
@@ -840,7 +927,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
@Override
|
@Override
|
||||||
public List<DevDetailDTO> getEngineeringHaveDevs(List<String> list) {
|
public List<DevDetailDTO> getEngineeringHaveDevs(List<String> list) {
|
||||||
List<DevDetailDTO> result = new ArrayList<>();
|
List<DevDetailDTO> result = new ArrayList<>();
|
||||||
list.forEach(item->{
|
list.forEach(item -> {
|
||||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(CsLedger::getPid, item);
|
queryWrapper.eq(CsLedger::getPid, item);
|
||||||
List<CsLedger> project = this.list(queryWrapper);
|
List<CsLedger> project = this.list(queryWrapper);
|
||||||
@@ -873,12 +960,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAreaById(String id){
|
public String getAreaById(String id) {
|
||||||
String areaName =redisUtil.getStringByKey (id);
|
String areaName = redisUtil.getStringByKey(id);
|
||||||
areaName = Optional.ofNullable (areaName).orElseGet (() ->{
|
areaName = Optional.ofNullable(areaName).orElseGet(() -> {
|
||||||
Area data = areaFeignClient.selectIdArea (id).getData ( );
|
Area data = areaFeignClient.selectIdArea(id).getData();
|
||||||
redisUtil.saveByKey (id,data.getName ());
|
redisUtil.saveByKey(id, data.getName());
|
||||||
return data.getName ();
|
return data.getName();
|
||||||
});
|
});
|
||||||
return areaName;
|
return areaName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.njcn.access.pojo.po.CsLineLatestData;
|
|||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
import com.njcn.csdevice.mapper.*;
|
import com.njcn.csdevice.mapper.*;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
@@ -399,9 +400,15 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
return new LineDetailDataVO();
|
return new LineDetailDataVO();
|
||||||
} else {
|
} else {
|
||||||
CsLinePO csLinePO = this.baseMapper.selectOne(new LambdaQueryWrapper<CsLinePO>().eq(CsLinePO::getLineId,id));
|
CsLinePO csLinePO = this.baseMapper.selectOne(new LambdaQueryWrapper<CsLinePO>().eq(CsLinePO::getLineId,id));
|
||||||
|
|
||||||
|
CsLedger csLedger = csLedgerMapper.selectById(csLinePO.getLineId());
|
||||||
|
|
||||||
LineDetailDataVO lineDetailDataVO = new LineDetailDataVO();
|
LineDetailDataVO lineDetailDataVO = new LineDetailDataVO();
|
||||||
|
|
||||||
//lineDetailDataVO.setScale(dicDataFeignClient.getDicDataById(voltageMapper.selectById(voId).getScale()).getData().getName());
|
lineDetailDataVO.setScale(csLinePO.getVolGrade()+"kV");
|
||||||
|
lineDetailDataVO.setAreaName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.ENGINEERING_LEVEL.getCode()+1]).getName());
|
||||||
|
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||||
|
|
||||||
//Device device = deviceMapper.selectById(devId);
|
//Device device = deviceMapper.selectById(devId);
|
||||||
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
||||||
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
||||||
@@ -413,8 +420,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
||||||
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
||||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||||
//lineDetailDataVO.setPt(lineDetail.getPt1() + "/" + lineDetail.getPt2());
|
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + csLinePO.getPt2Ratio());
|
||||||
//lineDetailDataVO.setCt(lineDetail.getCt1() + "/" + lineDetail.getCt2());
|
lineDetailDataVO.setCt(csLinePO.getCtRatio() + "/" + csLinePO.getCt2Ratio());
|
||||||
lineDetailDataVO.setDealCapacity(csLinePO.getProtocolCapacity().floatValue());
|
lineDetailDataVO.setDealCapacity(csLinePO.getProtocolCapacity().floatValue());
|
||||||
lineDetailDataVO.setDevCapacity(csLinePO.getDevCapacity().floatValue());
|
lineDetailDataVO.setDevCapacity(csLinePO.getDevCapacity().floatValue());
|
||||||
lineDetailDataVO.setShortCapacity(csLinePO.getShortCircuitCapacity().floatValue());
|
lineDetailDataVO.setShortCapacity(csLinePO.getShortCircuitCapacity().floatValue());
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ public class CsConfigurationParm {
|
|||||||
private String id;
|
private String id;
|
||||||
@ApiModelProperty(value = "当前用户ID")
|
@ApiModelProperty(value = "当前用户ID")
|
||||||
private String currentUserId;
|
private String currentUserId;
|
||||||
|
@ApiModelProperty(value = "当前用户角色")
|
||||||
|
private String roleCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public class CsConfigurationVO extends BaseEntity {
|
|||||||
|
|
||||||
private Integer orderBy;
|
private Integer orderBy;
|
||||||
|
|
||||||
|
private Integer scope;
|
||||||
|
|
||||||
|
|
||||||
private List<String> projectIds;
|
private List<String> projectIds;
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,15 @@
|
|||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
<result column="status" jdbcType="INTEGER" property="status" />
|
<result column="status" jdbcType="INTEGER" property="status" />
|
||||||
|
<result column="scope" jdbcType="INTEGER" property="scope" />
|
||||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, `name`, `status`, create_by, create_time, update_by, update_time
|
id, `name`, `status`, `scope`,create_by, create_time, update_by, update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="queryPage" resultMap="BaseResultMap">
|
<select id="queryPage" resultMap="BaseResultMap">
|
||||||
@@ -24,7 +25,14 @@
|
|||||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND (a.scope = 1 OR (a.scope = 0 AND a.create_by = #{userId}))
|
<choose>
|
||||||
|
<when test="userId != null and userId != ''">
|
||||||
|
AND (a.scope = 1 OR (a.scope = 0 AND a.create_by = #{userId}))
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
AND (a.scope = 1 OR a.scope = 0)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
||||||
AND a.name like concat(concat("%",#{temp.searchValue}),"%")
|
AND a.name like concat(concat("%",#{temp.searchValue}),"%")
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Date: 2023/5/31 10:53【需求编号】
|
* Date: 2023/5/31 10:53【需求编号】
|
||||||
*
|
*
|
||||||
@@ -42,7 +42,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMapper, CsConfigurationPO> implements CsConfigurationService{
|
public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMapper, CsConfigurationPO> implements CsConfigurationService {
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final UserFeignClient userFeignClient;
|
private final UserFeignClient userFeignClient;
|
||||||
@@ -53,17 +53,16 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
public boolean add(CsConfigurationParm csConfigurationParm) {
|
public boolean add(CsConfigurationParm csConfigurationParm) {
|
||||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||||
|
|
||||||
BeanUtils.copyProperties(csConfigurationParm,csConfigurationPO);
|
BeanUtils.copyProperties(csConfigurationParm, csConfigurationPO);
|
||||||
|
|
||||||
List<String> projectIds = csConfigurationParm.getProjectIds();
|
List<String> projectIds = csConfigurationParm.getProjectIds();
|
||||||
if(CollectionUtils.isEmpty(projectIds)){
|
String projects = "";
|
||||||
throw new BusinessException("请选择项目");
|
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||||
|
projects = String.join(",", projectIds);
|
||||||
}
|
}
|
||||||
String projects = String.join(",", projectIds);
|
|
||||||
|
|
||||||
csConfigurationPO.setProjectIds(projects);
|
csConfigurationPO.setProjectIds(projects);
|
||||||
//排序不填给个100往后排
|
//排序不填给个100往后排
|
||||||
csConfigurationPO.setOrderBy(Objects.isNull(csConfigurationParm.getOrderBy())?100:csConfigurationParm.getOrderBy());
|
csConfigurationPO.setOrderBy(Objects.isNull(csConfigurationParm.getOrderBy()) ? 100 : csConfigurationParm.getOrderBy());
|
||||||
csConfigurationPO.setImagePath(csConfigurationParm.getFileContent());
|
csConfigurationPO.setImagePath(csConfigurationParm.getFileContent());
|
||||||
|
|
||||||
csConfigurationPO.setStatus("1");
|
csConfigurationPO.setStatus("1");
|
||||||
@@ -71,7 +70,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
|
|
||||||
String name = csConfigurationPO.getName();
|
String name = csConfigurationPO.getName();
|
||||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, name).eq(CsConfigurationPO::getStatus, "1").count();
|
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, name).eq(CsConfigurationPO::getStatus, "1").count();
|
||||||
if(count>1){
|
if (count > 1) {
|
||||||
throw new BusinessException("存在相同的组态项目名称在其他工程项目中,无法新建");
|
throw new BusinessException("存在相同的组态项目名称在其他工程项目中,无法新建");
|
||||||
}
|
}
|
||||||
return save;
|
return save;
|
||||||
@@ -80,30 +79,30 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
@Override
|
@Override
|
||||||
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
||||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||||
if(Objects.equals(auditParm.getStatus(),"0")){
|
if (Objects.equals(auditParm.getStatus(), "0")) {
|
||||||
csConfigurationPO.setId(auditParm.getId());
|
csConfigurationPO.setId(auditParm.getId());
|
||||||
csConfigurationPO.setStatus("0");
|
csConfigurationPO.setStatus("0");
|
||||||
boolean b = this.updateById(csConfigurationPO);
|
boolean b = this.updateById(csConfigurationPO);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, auditParm.getName()).ne(CsConfigurationPO::getId,auditParm.getId()).eq(CsConfigurationPO::getStatus, "1").count();
|
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, auditParm.getName()).ne(CsConfigurationPO::getId, auditParm.getId()).eq(CsConfigurationPO::getStatus, "1").count();
|
||||||
if(count>0){
|
if (count > 0) {
|
||||||
throw new BusinessException("修改名称失败,存在相同的组态项目");
|
throw new BusinessException("修改名称失败,存在相同的组态项目");
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(auditParm,csConfigurationPO);
|
BeanUtils.copyProperties(auditParm, csConfigurationPO);
|
||||||
|
|
||||||
List<String> projectIds = auditParm.getProjectIds();
|
List<String> projectIds = auditParm.getProjectIds();
|
||||||
if(!CollectionUtils.isEmpty(projectIds)){
|
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||||
String projects = String.join(",", projectIds);
|
String projects = String.join(",", projectIds);
|
||||||
csConfigurationPO.setProjectIds(projects);
|
csConfigurationPO.setProjectIds(projects);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!Objects.isNull(auditParm.getOrderBy())){
|
if (!Objects.isNull(auditParm.getOrderBy())) {
|
||||||
csConfigurationPO.setOrderBy(auditParm.getOrderBy()==0?100:auditParm.getOrderBy());
|
csConfigurationPO.setOrderBy(auditParm.getOrderBy() == 0 ? 100 : auditParm.getOrderBy());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Objects.isNull(auditParm.getFileContent())){
|
if (!Objects.isNull(auditParm.getFileContent())) {
|
||||||
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(auditParm.getFileContent()), HarmonicConstant.CONFIGURATIONPATH, HarmonicConstant.CONFIGURATIONNAME);
|
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(auditParm.getFileContent()), HarmonicConstant.CONFIGURATIONPATH, HarmonicConstant.CONFIGURATIONNAME);
|
||||||
csConfigurationPO.setImagePath(s);
|
csConfigurationPO.setImagePath(s);
|
||||||
}
|
}
|
||||||
@@ -115,19 +114,21 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<CsConfigurationVO> queryPage(CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam) {
|
public IPage<CsConfigurationVO> queryPage(CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam) {
|
||||||
Page<CsConfigurationVO> returnpage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
Page<CsConfigurationVO> returnpage = new Page<>(csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize());
|
||||||
Page<CsConfigurationPO> temppage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
Page<CsConfigurationPO> temppage = new Page<>(csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize());
|
||||||
|
|
||||||
List<String> data1 = roleEngineerDevFeignClient.getRoleProject().getData();
|
List<String> data1 = roleEngineerDevFeignClient.getRoleProject().getData();
|
||||||
if(CollectionUtils.isEmpty(data1)){
|
// if (CollectionUtils.isEmpty(data1)) {
|
||||||
return returnpage;
|
// return returnpage;
|
||||||
}
|
// }
|
||||||
//+无线项目id
|
//+无线项目id
|
||||||
data1.add(DataParam.WIRELESS_PROJECT_ID);
|
data1.add(DataParam.WIRELESS_PROJECT_ID);
|
||||||
|
String userId = csConfigurationQueryParam.getCurrentUserId();
|
||||||
|
String roleCode = csConfigurationQueryParam.getRoleCode();
|
||||||
|
if (roleCode.contains("operation_manager")) {
|
||||||
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage,csConfigurationQueryParam,data1,csConfigurationQueryParam.getCurrentUserId());
|
userId = null;
|
||||||
|
}
|
||||||
|
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage, csConfigurationQueryParam, data1, userId);
|
||||||
// QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
// QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
||||||
// query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
// query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
||||||
// le (StringUtils.isNotBlank (csConfigurationQueryParam.getSearchEndTime()), CsConfigurationPO.COL_CREATE_TIME, csConfigurationQueryParam.getSearchEndTime ( )).
|
// le (StringUtils.isNotBlank (csConfigurationQueryParam.getSearchEndTime()), CsConfigurationPO.COL_CREATE_TIME, csConfigurationQueryParam.getSearchEndTime ( )).
|
||||||
@@ -136,7 +137,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
// Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().selectPage(temppage, query);
|
// Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().selectPage(temppage, query);
|
||||||
List<String> collect1 = csConfigurationPOPage.getRecords().stream().map(CsConfigurationPO::getCreateBy).collect(Collectors.toList());
|
List<String> collect1 = csConfigurationPOPage.getRecords().stream().map(CsConfigurationPO::getCreateBy).collect(Collectors.toList());
|
||||||
Map<String, String> collect2;
|
Map<String, String> collect2;
|
||||||
if(!CollectionUtils.isEmpty(collect1)){
|
if (!CollectionUtils.isEmpty(collect1)) {
|
||||||
List<User> data = userFeignClient.appuserByIdList(collect1).getData();
|
List<User> data = userFeignClient.appuserByIdList(collect1).getData();
|
||||||
collect2 = data.stream().collect(Collectors.toMap(User::getId, User::getName, (e1, e2) -> e1 + "," + e2));
|
collect2 = data.stream().collect(Collectors.toMap(User::getId, User::getName, (e1, e2) -> e1 + "," + e2));
|
||||||
|
|
||||||
@@ -148,16 +149,16 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
CsConfigurationVO csDevModelPageVO = new CsConfigurationVO();
|
CsConfigurationVO csDevModelPageVO = new CsConfigurationVO();
|
||||||
BeanUtils.copyProperties(page, csDevModelPageVO);
|
BeanUtils.copyProperties(page, csDevModelPageVO);
|
||||||
|
|
||||||
if(StringUtils.isEmpty(page.getProjectIds())){
|
if (StringUtils.isEmpty(page.getProjectIds())) {
|
||||||
csDevModelPageVO.setProjectIds(new ArrayList<>());
|
csDevModelPageVO.setProjectIds(new ArrayList<>());
|
||||||
}else {
|
} else {
|
||||||
csDevModelPageVO.setProjectIds( Arrays.asList(page.getProjectIds().split(",")));
|
csDevModelPageVO.setProjectIds(Arrays.asList(page.getProjectIds().split(",")));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(Objects.isNull(page.getImagePath())){
|
if (Objects.isNull(page.getImagePath())) {
|
||||||
csDevModelPageVO.setFileContent(null);
|
csDevModelPageVO.setFileContent(null);
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
InputStream fileStream = fileStorageUtil.getFileStream(page.getImagePath());
|
InputStream fileStream = fileStorageUtil.getFileStream(page.getImagePath());
|
||||||
String text = new BufferedReader(
|
String text = new BufferedReader(
|
||||||
new InputStreamReader(fileStream, StandardCharsets.UTF_8))
|
new InputStreamReader(fileStream, StandardCharsets.UTF_8))
|
||||||
@@ -174,13 +175,12 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
returnpage.setTotal(csConfigurationPOPage.getTotal());
|
returnpage.setTotal(csConfigurationPOPage.getTotal());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String uploadImage(MultipartFile issuesFile) {
|
public String uploadImage(MultipartFile issuesFile) {
|
||||||
return fileStorageUtil.getFileUrl( fileStorageUtil.uploadMultipart(issuesFile, HarmonicConstant.CONFIGURATIONPATH));
|
return fileStorageUtil.getFileUrl(fileStorageUtil.uploadMultipart(issuesFile, HarmonicConstant.CONFIGURATIONPATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*将strin写入Json文件,返回一个InputStream*/
|
/*将strin写入Json文件,返回一个InputStream*/
|
||||||
|
|||||||
@@ -1126,6 +1126,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
Map<String, List<ReportTemplateDTO>> classMap = reportTemplateDTOList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getResourceId));
|
Map<String, List<ReportTemplateDTO>> classMap = reportTemplateDTOList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getResourceId));
|
||||||
//定义存放越限指标的map
|
//定义存放越限指标的map
|
||||||
Map<String, ReportTemplateDTO> assNoPassMap = new HashMap<>();
|
Map<String, ReportTemplateDTO> assNoPassMap = new HashMap<>();
|
||||||
|
|
||||||
classMap.forEach((classKey, templateValue) -> {
|
classMap.forEach((classKey, templateValue) -> {
|
||||||
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
||||||
//每张表开启一个独立线程查询
|
//每张表开启一个独立线程查询
|
||||||
@@ -1133,23 +1134,27 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
// 子线程中手动指定数据源(关键)
|
// 子线程中手动指定数据源(关键)
|
||||||
DynamicDataSourceContextHolder.push("sjzx");
|
DynamicDataSourceContextHolder.push("sjzx");
|
||||||
//avg.max,min,cp95
|
//avg.max,min,cp95
|
||||||
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
try {
|
||||||
//相别分组
|
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
||||||
Map<String, List<ReportTemplateDTO>> phaseMap = valueTypeVal.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getPhase));
|
//相别分组
|
||||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
Map<String, List<ReportTemplateDTO>> phaseMap = valueTypeVal.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getPhase));
|
||||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||||
}
|
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}finally {
|
||||||
|
DynamicDataSourceContextHolder.poll();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
return value.stream().filter(x -> x.getValueType().equals(name)).map(temp -> {
|
return value.stream().filter(x -> x.getValueType().equals(name)).map(temp -> {
|
||||||
BigDecimal o = null;
|
BigDecimal o = null;
|
||||||
try {
|
try {
|
||||||
o = (BigDecimal) finalField.get(temp);
|
o = BigDecimal.valueOf((Double) finalField.get(temp));
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user