feat(ledger): 添加缺失台账信息的相关接口
This commit is contained in:
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -14,10 +15,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -94,11 +92,17 @@ public class CsCommTerminalController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点id集合,获取所有台账信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLedgerByLineId")
|
||||
@ApiOperation("根据监测点id集合获取所有台账信息")
|
||||
@ApiImplicitParam(name = "list", value = "实体", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getLedgerByLineId(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getLedgerByLineId");
|
||||
List<DevDetailDTO> result = commTerminalService.getLedgerByLineId(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,14 +90,14 @@ public class CsLedgerController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@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)
|
||||
// @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)
|
||||
@PostMapping("/add")
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
@@ -295,11 +296,11 @@ public class CslineController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询监测点")
|
||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getLineBySensitiveUser");
|
||||
List<CsLinePO> result = csLinePOService.getLineBySensitiveUser(list);
|
||||
@PostMapping("/getDevBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询装置")
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getDevBySensitiveUser");
|
||||
List<CsEquipmentDeliveryPO> result = csLinePOService.getDevBySensitiveUser(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,4 +15,6 @@ public interface CsCommTerminalService {
|
||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||
|
||||
List<String> commGetDevIds(String userId);
|
||||
|
||||
List<DevDetailDTO> getLedgerByLineId(List<String> id);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
@@ -86,7 +87,7 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
|
||||
List<CsLinePO> getSimpleLine();
|
||||
|
||||
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
||||
List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list);
|
||||
|
||||
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
||||
boolean uploadReport(MultipartFile file, String lineId);
|
||||
|
||||
@@ -80,7 +80,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getztProjectTree();
|
||||
|
||||
|
||||
List<CsLedgerVO> objTree();
|
||||
// List<CsLedgerVO> objTree();
|
||||
|
||||
/**
|
||||
* 根据设备集合获取项目和工程
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||
@@ -21,9 +22,7 @@ import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -70,12 +69,9 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
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());
|
||||
List<CsEquipmentDeliveryPO> po = csEquipmentDeliveryService.listByIds(devIds);
|
||||
if (CollUtil.isEmpty(po)) {
|
||||
result = po.stream().map(CsEquipmentDeliveryPO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -126,4 +122,91 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getLedgerByLineId(List<String> id) {
|
||||
List<DevDetailDTO> result = new ArrayList<>();
|
||||
List<CsLedger> lineLedgers = csLedgerService.listByIds(id);
|
||||
Set<String> equipmentIds = new HashSet<>();
|
||||
Set<String> projectIds = new HashSet<>();
|
||||
Set<String> engineeringIds = new HashSet<>();
|
||||
|
||||
if (CollUtil.isEmpty(lineLedgers)) {
|
||||
return result;
|
||||
}
|
||||
for (CsLedger item : lineLedgers) {
|
||||
String pids = item.getPids();
|
||||
if (pids == null) {
|
||||
continue;
|
||||
}
|
||||
String[] pidArr = pids.split(",");
|
||||
if (pidArr.length < 4) {
|
||||
continue;
|
||||
}
|
||||
engineeringIds.add(pidArr[1]);
|
||||
projectIds.add(pidArr[2]);
|
||||
equipmentIds.add(pidArr[3]);
|
||||
}
|
||||
|
||||
Map<String, CsLinePO> csLinePoMap = csLinePOMapper.selectBatchIds(id)
|
||||
.stream().collect(Collectors.toMap(CsLinePO::getLineId, item -> item));
|
||||
Map<String, CsLedger> equipmentLedgerMap = csLedgerService.listByIds(equipmentIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
Map<String, CsEquipmentDeliveryPO> equipmentDeliveryMap = csEquipmentDeliveryService.listByIds(equipmentIds)
|
||||
.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||
Map<String, CsLedger> projectLedgerMap = csLedgerService.listByIds(projectIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
Map<String, CsLedger> engineeringLedgerMap = csLedgerService.listByIds(engineeringIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
|
||||
for (CsLedger item : lineLedgers) {
|
||||
String pids = item.getPids();
|
||||
if (pids == null) {
|
||||
continue;
|
||||
}
|
||||
String[] pidArr = pids.split(",");
|
||||
if (pidArr.length < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String engineeringId = pidArr[1];
|
||||
String projectId = pidArr[2];
|
||||
String equipmentId = pidArr[3];
|
||||
|
||||
CsLedger engineeringLedger = engineeringLedgerMap.get(engineeringId);
|
||||
CsLedger projectLedger = projectLedgerMap.get(projectId);
|
||||
CsLedger equipmentLedger = equipmentLedgerMap.get(equipmentId);
|
||||
if (engineeringLedger == null || projectLedger == null || equipmentLedger == null) {
|
||||
continue;
|
||||
}
|
||||
DevDetailDTO dto = new DevDetailDTO();
|
||||
dto.setEngineeringid(engineeringId);
|
||||
dto.setEngineeringName(engineeringLedger.getName());
|
||||
dto.setProjectId(projectId);
|
||||
dto.setProjectName(projectLedger.getName());
|
||||
dto.setEquipmentId(equipmentId);
|
||||
dto.setEquipmentName(equipmentLedger.getName());
|
||||
dto.setLineId(item.getId());
|
||||
dto.setLineName(item.getName());
|
||||
|
||||
if (Objects.isNull(csLinePoMap.get(item.getId()).getRunStatus())) {
|
||||
CsEquipmentDeliveryPO delivery = equipmentDeliveryMap.get(equipmentId);
|
||||
if (delivery != null) {
|
||||
Integer runStatus = delivery.getRunStatus();
|
||||
if (runStatus == 1) {
|
||||
dto.setRunStatus(2);
|
||||
} else if (runStatus == 2) {
|
||||
dto.setRunStatus(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dto.setRunStatus(csLinePoMap.get(item.getId()).getRunStatus());
|
||||
}
|
||||
dto.setObjType(csLinePoMap.get(item.getId()).getMonitorObj());
|
||||
dto.setGovernType(equipmentDeliveryMap.get(equipmentId).getGovernType());
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1337,10 +1337,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
result.put("before", new ArrayList<>());
|
||||
result.put("after", new ArrayList<>());
|
||||
String sensitiveUserId = param.getSensitiveUserId();
|
||||
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
||||
if (CollUtil.isEmpty(linePOList)) {
|
||||
List<CsEquipmentDeliveryPO> devList = csLineFeignClient.getDevBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
||||
if (CollUtil.isEmpty(devList)) {
|
||||
return result;
|
||||
}
|
||||
List<String> devIds = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
List<CsLinePO> linePOList = csLineFeignClient.getLinesByDevList(devIds).getData();
|
||||
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
||||
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
||||
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
||||
|
||||
@@ -1057,88 +1057,88 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> objTree() {
|
||||
List<CsLedgerVO> result = new ArrayList<>();
|
||||
String userId = RequestUtil.getUserIndex();
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
devIds = 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();
|
||||
if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||
return result;
|
||||
}
|
||||
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
|
||||
// public List<CsLedgerVO> objTree() {
|
||||
// List<CsLedgerVO> result = new ArrayList<>();
|
||||
// String userId = RequestUtil.getUserIndex();
|
||||
// UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
// List<String> devIds;
|
||||
// if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
// devIds = 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();
|
||||
// if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||
// return result;
|
||||
// }
|
||||
// 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
|
||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||
|
||||
@@ -10,12 +10,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -76,6 +80,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
||||
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
||||
private final CsCommTerminalFeignClient csCommTerminal;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -220,9 +226,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.set(CsLinePO::getShortCircuitCapacity,param.getShortCircuitCapacity())
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getGovern,param.getGovern())
|
||||
.set(CsLinePO::getPosition,param.getPosition())
|
||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser())
|
||||
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
||||
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
@@ -322,11 +326,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineBySensitiveUser(List<String> list) {
|
||||
return this.lambdaQuery()
|
||||
.in(CsLinePO::getMonitorUser,list)
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.list();
|
||||
public List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(CsEquipmentDeliveryPO::getMonitorUser,list)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, DataStateEnum.DELETED.getCode());
|
||||
return csEquipmentDeliveryMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -339,10 +343,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
List<CsLinePO> poList = getSimpleLine();
|
||||
// 构建基础查询条件
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
// 关联敏感用户
|
||||
//.isNotNull(CsLinePO::getMonitorUser)
|
||||
.orderByAsc(CsLinePO::getMonitorUser);
|
||||
.eq(CsLinePO::getStatus, 1);
|
||||
// 只有当lineList不为空时才添加in条件
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
@@ -357,6 +358,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
return result;
|
||||
}
|
||||
List<String> devIds = records.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||
Map<String, CsEquipmentDeliveryPO> devMap = devList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||
|
||||
List<PqSensitiveUserLineVO> list = new ArrayList<>();
|
||||
List<String> sensitiveUserIds = list.stream().map(PqSensitiveUserLineVO::getSensitiveUser).distinct().collect(Collectors.toList());
|
||||
@@ -366,23 +370,32 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
if (CollUtil.isNotEmpty(pqSensitiveUserList)) {
|
||||
sensitiveUserNameMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
}
|
||||
// 最新数据时间
|
||||
List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||
Map<String,CsLineLatestData> lineLatestDataMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||
lineLatestDataMap = lineLatestDataList.stream().collect(Collectors.toMap(CsLineLatestData::getLineId, item -> item));
|
||||
}
|
||||
|
||||
PqSensitiveUserLineVO sensitiveUserLineVO;
|
||||
|
||||
List<String> lineIds = records.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(lineIds).getData();
|
||||
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||
|
||||
for (CsLinePO record : records) {
|
||||
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
||||
sensitiveUserLineVO.setEngineeringName(devDetailDTOMap.get(record.getLineId()).getEngineeringName());
|
||||
sensitiveUserLineVO.setProjectName(devDetailDTOMap.get(record.getLineId()).getProjectName());
|
||||
sensitiveUserLineVO.setDevName(devDetailDTOMap.get(record.getLineId()).getEquipmentName());
|
||||
// 治理对象
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(record.getMonitorUser(), null));
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(devMap.get(record.getDeviceId()).getMonitorUser(), null));
|
||||
// 测点名称
|
||||
sensitiveUserLineVO.setLineId(record.getLineId());
|
||||
sensitiveUserLineVO.setLineName(record.getName());
|
||||
// 是否治理
|
||||
if (ObjectUtil.isNotEmpty(record.getGovern())) {
|
||||
if (record.getGovern().equals(0)) {
|
||||
sensitiveUserLineVO.setGovern("未治理");
|
||||
}
|
||||
if (record.getGovern().equals(1)) {
|
||||
sensitiveUserLineVO.setGovern("已治理");
|
||||
}
|
||||
}
|
||||
String governMethod = devMap.get(record.getDeviceId()).getGovernMethod();
|
||||
sensitiveUserLineVO.setGovern(Objects.isNull(governMethod) ? "未治理" : governMethod);
|
||||
// 监测类型
|
||||
if (ObjectUtil.isNotNull(record.getPosition())) {
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
@@ -396,22 +409,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
}
|
||||
// 运行状态
|
||||
if (ObjectUtil.isNotNull(record.getRunStatus())) {
|
||||
//获取设备状态
|
||||
int devRunStatus = csEquipmentDeliveryMapper.selectById(record.getDeviceId()).getRunStatus();
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(devRunStatus));
|
||||
}
|
||||
sensitiveUserLineVO.setRunStatus(String.valueOf(devDetailDTOMap.get(record.getLineId()).getRunStatus()));
|
||||
// 报告文件
|
||||
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
||||
// 最新数据时间
|
||||
// List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||
// if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||
// sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
|
||||
// .filter(item -> item.getLineId().equals(record.getLineId()))
|
||||
// .map(CsLineLatestData::getTimeId)
|
||||
// .max(LocalDateTime::compareTo)
|
||||
// .orElse(null));
|
||||
// }
|
||||
//最新数据时间
|
||||
sensitiveUserLineVO.setLatestTime(Objects.isNull(lineLatestDataMap.get(record.getLineId()))? null : lineLatestDataMap.get(record.getLineId()).getTimeId());
|
||||
list.add(sensitiveUserLineVO);
|
||||
}
|
||||
result.setRecords(list);
|
||||
@@ -459,15 +461,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||
}
|
||||
lineDetailDataVO.setLineName(csLinePO.getName());
|
||||
//Device device = deviceMapper.selectById(devId);
|
||||
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
||||
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
||||
//lineDetailDataVO.setIp(device.getIp());
|
||||
//lineDetailDataVO.setLoginTime(device.getLoginTime());
|
||||
//lineDetailDataVO.setDevId(device.getId());
|
||||
//lineDetailDataVO.setBusinessType(dicDataFeignClient.getDicDataById(lineDetail.getBusinessType()).getData().getName());
|
||||
//lineDetailDataVO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName());
|
||||
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
||||
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + (Objects.isNull(csLinePO.getPt2Ratio())?1.0:csLinePO.getPt2Ratio()));
|
||||
|
||||
Reference in New Issue
Block a user