云前置功能调整

This commit is contained in:
xy
2025-11-04 14:08:59 +08:00
parent 43bdcbf623
commit b7574b2916
13 changed files with 136 additions and 36 deletions

View File

@@ -0,0 +1,22 @@
package com.njcn.csdevice.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author xy
*/
@Data
public class IcdNodeParam implements Serializable {
@ApiModelProperty("设备id")
private String id;
@ApiModelProperty("前置服务器id")
private String nodeId;
@ApiModelProperty("进程号")
private Integer processNo;
}

View File

@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.Min;
/** /**
* *
* Description: * Description:
@@ -53,21 +55,25 @@ public class CsLineParam extends BaseEntity {
/** /**
* PT一次变比 * PT一次变比
*/ */
@Min(value = 1, message = "PT一次变比必须大于等于1")
private Double ptRatio; private Double ptRatio;
/** /**
* PT二次变比 * PT二次变比
*/ */
@Min(value = 1, message = "PT二次变比必须大于等于1")
private Double pt2Ratio; private Double pt2Ratio;
/** /**
* CT一次变比 * CT一次变比
*/ */
@Min(value = 1, message = "CT一次变比必须大于等于1")
private Double ctRatio; private Double ctRatio;
/** /**
* CT二次变比 * CT二次变比
*/ */
@Min(value = 1, message = "CT二次变比必须大于等于1")
private Double ct2Ratio; private Double ct2Ratio;
/** /**

View File

@@ -2,6 +2,7 @@ package com.njcn.csdevice.controller.equipment;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
@@ -152,6 +153,9 @@ public class EquipmentDeliveryController extends BaseController {
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true) @ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
public HttpResult<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> ids){ public HttpResult<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> ids){
String methodDescribe = getMethodDescribe("queryEquipmentById"); String methodDescribe = getMethodDescribe("queryEquipmentById");
if (CollectionUtil.isEmpty(ids)) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(ids); List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(ids);
List<CsEquipmentDeliveryDTO> collect = csEquipmentDeliveryPOS.stream().map(temp -> { List<CsEquipmentDeliveryDTO> collect = csEquipmentDeliveryPOS.stream().map(temp -> {
CsEquipmentDeliveryDTO csEquipmentDeliveryDTO = new CsEquipmentDeliveryDTO(); CsEquipmentDeliveryDTO csEquipmentDeliveryDTO = new CsEquipmentDeliveryDTO();

View File

@@ -8,6 +8,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csdevice.param.IcdNodeParam;
import com.njcn.csdevice.pojo.param.NodeParam; import com.njcn.csdevice.pojo.param.NodeParam;
import com.njcn.csdevice.pojo.po.Node; import com.njcn.csdevice.pojo.po.Node;
import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo; import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo;
@@ -200,5 +201,15 @@ public class NodeController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateDevNode")
@ApiOperation("更新设备前置信息")
@ApiImplicitParam(name = "param", value = "参数", required = true)
public HttpResult<String> updateDevNode(@RequestBody IcdNodeParam param){
String methodDescribe = getMethodDescribe("updateDevNode");
String result = iNodeService.updateDevNode(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
} }

View File

@@ -3,6 +3,7 @@ package com.njcn.csdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csdevice.param.IcdNodeParam;
import com.njcn.csdevice.pojo.param.NodeParam; import com.njcn.csdevice.pojo.param.NodeParam;
import com.njcn.csdevice.pojo.po.Node; import com.njcn.csdevice.pojo.po.Node;
import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo; import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo;
@@ -84,4 +85,6 @@ public interface INodeService extends IService<Node> {
void restartProcess(String nodeId, Integer processNo); void restartProcess(String nodeId, Integer processNo);
String updateDevProcessNo(String id, Integer processNo); String updateDevProcessNo(String id, Integer processNo);
String updateDevNode(IcdNodeParam param);
} }

View File

@@ -833,17 +833,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Override @Override
public Boolean updateCldDev(CsEquipmentDeliveryAuditParm param) { public Boolean updateCldDev(CsEquipmentDeliveryAuditParm param) {
//云前置设备判断,修改云前置判断设备是否达到上限 // //云前置设备判断,修改云前置判断设备是否达到上限
if(ObjectUtil.isNotNull(param.getNodeId())){ // if(ObjectUtil.isNotNull(param.getNodeId())){
Node node = nodeService.getNodeById(param.getNodeId()); // Node node = nodeService.getNodeById(param.getNodeId());
List<CsEquipmentDeliveryPO> devList = getListByNodeId(param.getNodeId()); // List<CsEquipmentDeliveryPO> devList = getListByNodeId(param.getNodeId());
if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) { // if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) {
throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT); // throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT);
} // }
//自动分配进程号 // //自动分配进程号
int process = findLeastFrequentProcess(devList,node.getMaxProcessNum()); // int process = findLeastFrequentProcess(devList,node.getMaxProcessNum());
param.setNodeProcess(process); // param.setNodeProcess(process);
} // }
StringUtil.containsSpecialCharacters(param.getNdid()); StringUtil.containsSpecialCharacters(param.getNdid());
boolean result; boolean result;
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();

View File

@@ -7,11 +7,9 @@ import cn.hutool.core.util.IdUtil;
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.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.constant.DataParam; import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.LineBaseEnum; import com.njcn.csdevice.enums.LineBaseEnum;
import com.njcn.csdevice.mapper.*; import com.njcn.csdevice.mapper.*;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.dto.DevDetailDTO; import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO; import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.param.CsLedgerParam; import com.njcn.csdevice.pojo.param.CsLedgerParam;
@@ -54,7 +52,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
private final CsDevModelRelationService csDevModelRelationService; private final CsDevModelRelationService csDevModelRelationService;
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper; private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
private final ICsDataSetService csDataSetService; private final ICsDataSetService csDataSetService;
private final EquipmentFeignClient equipmentFeignClient;
private final DictTreeFeignClient dictTreeFeignClient; private final DictTreeFeignClient dictTreeFeignClient;
@Override @Override
@@ -82,14 +79,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
//区分治理装置和云前置装置 //区分治理装置和云前置装置
List<String> zhiLianDevice = new ArrayList<>(); List<String> zhiLianDevice = new ArrayList<>();
List<String> cldDevice = new ArrayList<>(); List<String> cldDevice = new ArrayList<>();
List<CsEquipmentDeliveryDTO> csEquipmentDeliveryPOS = equipmentFeignClient.queryDeviceById(device).getData(); if (CollectionUtil.isNotEmpty(device)) {
if (CollectionUtil.isNotEmpty(csEquipmentDeliveryPOS)) { List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectBatchIds(device);
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData(); DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
Optional.ofNullable(vo1) Optional.ofNullable(vo1)
.map(DictTreeVO::getId) .map(DictTreeVO::getId)
.ifPresent(id -> csEquipmentDeliveryPOS.stream() .ifPresent(id -> csEquipmentDeliveryPOS.stream()
.filter(item -> Objects.equals(item.getDevType(), id)) .filter(item -> Objects.equals(item.getDevType(), id))
.map(CsEquipmentDeliveryDTO::getId) .map(CsEquipmentDeliveryPO::getId)
.forEach(cldDevice::add) .forEach(cldDevice::add)
); );
DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData(); DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
@@ -97,11 +94,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
.map(DictTreeVO::getId) .map(DictTreeVO::getId)
.ifPresent(id -> csEquipmentDeliveryPOS.stream() .ifPresent(id -> csEquipmentDeliveryPOS.stream()
.filter(item -> Objects.equals(item.getDevType(), id)) .filter(item -> Objects.equals(item.getDevType(), id))
.map(CsEquipmentDeliveryDTO::getId) .map(CsEquipmentDeliveryPO::getId)
.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());
@@ -287,14 +283,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
List<String> zhiLianDevice = new ArrayList<>(); List<String> zhiLianDevice = new ArrayList<>();
List<String> cldDevice = new ArrayList<>(); List<String> cldDevice = new ArrayList<>();
List<CsEquipmentDeliveryDTO> csEquipmentDeliveryPOS = equipmentFeignClient.queryDeviceById(device).getData(); if (CollectionUtil.isNotEmpty(device)) {
if (CollectionUtil.isNotEmpty(csEquipmentDeliveryPOS)) { List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectBatchIds(device);
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData(); DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
Optional.ofNullable(vo1) Optional.ofNullable(vo1)
.map(DictTreeVO::getId) .map(DictTreeVO::getId)
.ifPresent(id -> csEquipmentDeliveryPOS.stream() .ifPresent(id -> csEquipmentDeliveryPOS.stream()
.filter(item -> Objects.equals(item.getDevType(), id)) .filter(item -> Objects.equals(item.getDevType(), id))
.map(CsEquipmentDeliveryDTO::getId) .map(CsEquipmentDeliveryPO::getId)
.forEach(cldDevice::add) .forEach(cldDevice::add)
); );
DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData(); DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
@@ -302,10 +298,11 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
.map(DictTreeVO::getId) .map(DictTreeVO::getId)
.ifPresent(id -> csEquipmentDeliveryPOS.stream() .ifPresent(id -> csEquipmentDeliveryPOS.stream()
.filter(item -> Objects.equals(item.getDevType(), id)) .filter(item -> Objects.equals(item.getDevType(), id))
.map(CsEquipmentDeliveryDTO::getId) .map(CsEquipmentDeliveryPO::getId)
.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());

View File

@@ -190,7 +190,7 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
} else { } else {
if (item.getReceivedCode() == 200) { if (item.getReceivedCode() == 200) {
cldLogsVo.setStatus("补召成功"); cldLogsVo.setStatus("补召成功");
cldLogsVo.setResult("补召成功"); cldLogsVo.setResult(item.getReceivedMsg());
} else { } else {
cldLogsVo.setStatus("补召失败"); cldLogsVo.setStatus("补召失败");
cldLogsVo.setResult(item.getReceivedMsg()); cldLogsVo.setResult(item.getReceivedMsg());

View File

@@ -183,11 +183,11 @@ class IcdServiceImpl implements IcdService {
} }
//获取设备信息 //获取设备信息
CsEquipmentDeliveryPO dev = csEquipmentDeliveryService.getDevByLineId(po.getLineId()); CsEquipmentDeliveryPO dev = csEquipmentDeliveryService.getDevByLineId(po.getLineId());
BZEventMessage.File file = new BZEventMessage.File(); BZEventMessage.Event file = new BZEventMessage.Event();
file.setGuid(po.getId()); file.setGuid(po.getId());
file.setTerminalId(po.getDeviceId()); file.setTerminalId(po.getDeviceId());
file.setMonitorId(po.getLineId()); file.setMonitorIdList(Collections.singletonList(po.getLineId()));
file.setTimeList(Collections.singletonList(po.getStartTime().format(microsecondFormatter))); file.setTimeInterval(Collections.singletonList(po.getStartTime().format(microsecondFormatter)));
file.setDataType(2); file.setDataType(2);
//记录发送日志 //记录发送日志
CsTerminalLogs csTerminalLogs = new CsTerminalLogs(); CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
@@ -211,7 +211,7 @@ class IcdServiceImpl implements IcdService {
csTerminalReply.setCode("oneFile"); csTerminalReply.setCode("oneFile");
csTerminalReplyService.saveOrUpdate(csTerminalReply); csTerminalReplyService.saveOrUpdate(csTerminalReply);
//发送消息 //发送消息
bzEventMessageTemplate.sendMember(file,dev.getNodeId()); bzEventMessageTemplate.sendMember(Collections.singletonList(file),dev.getNodeId());
} }
@Override @Override
@@ -421,7 +421,7 @@ class IcdServiceImpl implements IcdService {
.collect(Collectors.groupingBy(CsEventPO::getDeviceId)); .collect(Collectors.groupingBy(CsEventPO::getDeviceId));
nodeToDeviceMap.forEach((nodeId, deviceList) -> { nodeToDeviceMap.forEach((nodeId, deviceList) -> {
List<BZEventMessage.File> msgList = new ArrayList<>(); List<BZEventMessage.Event> msgList = new ArrayList<>();
List<CsTerminalLogs> logList = new ArrayList<>(); List<CsTerminalLogs> logList = new ArrayList<>();
List<CsTerminalReply> replyList = new ArrayList<>(); List<CsTerminalReply> replyList = new ArrayList<>();
@@ -434,11 +434,11 @@ class IcdServiceImpl implements IcdService {
.collect(Collectors.groupingBy(CsEventPO::getLineId)); .collect(Collectors.groupingBy(CsEventPO::getLineId));
lineToEventMap.forEach((lineId, eventGroup) -> { lineToEventMap.forEach((lineId, eventGroup) -> {
BZEventMessage.File event = new BZEventMessage.File(); BZEventMessage.Event event = new BZEventMessage.Event();
String guid = IdUtil.simpleUUID(); String guid = IdUtil.simpleUUID();
event.setGuid(guid); event.setGuid(guid);
event.setTerminalId(deviceId); event.setTerminalId(deviceId);
event.setMonitorId(lineId); event.setMonitorIdList(Collections.singletonList(lineId));
event.setDataType(2); event.setDataType(2);
List<String> timeList = eventGroup.stream() List<String> timeList = eventGroup.stream()
@@ -447,7 +447,7 @@ class IcdServiceImpl implements IcdService {
.map(dt -> dt.format(microsecondFormatter)) .map(dt -> dt.format(microsecondFormatter))
.collect(Collectors.toList()); .collect(Collectors.toList());
event.setTimeList(timeList); event.setTimeInterval(timeList);
msgList.add(event); msgList.add(event);
// 记录发送日志 // 记录发送日志

View File

@@ -14,6 +14,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.enums.AlgorithmResponseEnum; import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper; import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
import com.njcn.csdevice.mapper.NodeMapper; import com.njcn.csdevice.mapper.NodeMapper;
import com.njcn.csdevice.param.IcdNodeParam;
import com.njcn.csdevice.pojo.param.NodeParam; import com.njcn.csdevice.pojo.param.NodeParam;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO; import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.Node; import com.njcn.csdevice.pojo.po.Node;
@@ -31,6 +32,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -207,6 +209,46 @@ public class NodeServiceImpl extends ServiceImpl<NodeMapper, Node> implements IN
return result; return result;
} }
@Override
public String updateDevNode(IcdNodeParam param) {
String result;
LambdaQueryWrapper<CsEquipmentDeliveryPO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CsEquipmentDeliveryPO::getId,param.getId());
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectOne(wrapper);
if (Objects.equals(po.getNodeId(),param.getNodeId()) && Objects.equals(po.getNodeProcess(),param.getProcessNo())) {
return "前置机修改前后一致,暂不调整";
}
Node node = getNodeById(param.getNodeId());
List<CsEquipmentDeliveryPO> devList = getListByNodeId(param.getNodeId());
if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) {
throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT);
}
int oldProcessNo = po.getNodeProcess();
po.setNodeId(param.getNodeId());
po.setNodeProcess(param.getProcessNo());
int count = csEquipmentDeliveryMapper.updateById(po);
if (count > 0) {
result = "修改成功";
//重启前置机进程(两个)
//原来的
restartProcess(po.getNodeId(), oldProcessNo);
//修改后的
restartProcess(param.getNodeId(), param.getProcessNo());
} else {
result = "修改失败";
}
return result;
}
//根据前置机id获取装置数量
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
.in(CsEquipmentDeliveryPO::getRunStatus, Arrays.asList(1,2));
return csEquipmentDeliveryMapper.selectList(lambdaQueryWrapper);
}
/** /**
* 校验参数,检查是否存在相同编码的字典类型 * 校验参数,检查是否存在相同编码的字典类型
*/ */

View File

@@ -27,6 +27,9 @@ public class CsRtDataVO {
@ApiModelProperty("监测点id") @ApiModelProperty("监测点id")
private String lineId; private String lineId;
@ApiModelProperty("设备状态 1:离线 2:在线")
private Integer devStatus;
@ApiModelProperty("相别") @ApiModelProperty("相别")
private String phaseType; private String phaseType;

View File

@@ -5,8 +5,8 @@ import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.*; import com.njcn.csdevice.api.*;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.pojo.po.CsDataArray; import com.njcn.csdevice.pojo.po.CsDataArray;
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.pojo.vo.DataArrayTreeVO; import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
import com.njcn.csdevice.pojo.vo.LineTargetVO; import com.njcn.csdevice.pojo.vo.LineTargetVO;
@@ -22,7 +22,6 @@ import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.EpdFeignClient; import com.njcn.system.api.EpdFeignClient;
import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataEnum;
import dm.jdbc.util.StringUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@@ -74,6 +73,8 @@ public class LineTargetServiceImpl implements ILineTargetService {
private final InfluxDbParamUtil influxDbParamUtil; private final InfluxDbParamUtil influxDbParamUtil;
private final EquipmentFeignClient equipmentFeignClient;
@Override @Override
public List<DataArrayTreeVO> getLineTarget(String lineId) { public List<DataArrayTreeVO> getLineTarget(String lineId) {
List<String> setList = new ArrayList<>(); List<String> setList = new ArrayList<>();
@@ -125,7 +126,12 @@ public class LineTargetServiceImpl implements ILineTargetService {
String dataId = dataArray.getDataId(); String dataId = dataArray.getDataId();
String classId = epdFeignClient.selectById(dataId).getData().getClassId(); String classId = epdFeignClient.selectById(dataId).getData().getClassId();
String clDid = influxDbParamUtil.getClDidByLineId(item.getLineId()); String clDid = influxDbParamUtil.getClDidByLineId(item.getLineId());
result.add(getLineRtData(item.getId(),item.getLineId(),influxDbParamUtil.getTableNameByClassId(classId),targetTag,phasic,dataType,targetName,clDid)); //基础信息
CsRtDataVO vo = getLineRtData(item.getId(),item.getLineId(),influxDbParamUtil.getTableNameByClassId(classId),targetTag,phasic,dataType,targetName,clDid);
//设备状态信息
CsEquipmentDeliveryPO po = equipmentFeignClient.getDevByLineId(item.getLineId()).getData();
vo.setDevStatus(po.getRunStatus());
result.add(vo);
} }
}); });
return result; return result;

View File

@@ -9,6 +9,7 @@ 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.pojo.po.RStatIntegrityD; import com.njcn.csdevice.pojo.po.RStatIntegrityD;
import com.njcn.csdevice.pojo.po.RStatOnlineRateD; import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
import com.njcn.csharmonic.pojo.param.StatisticsDataParam; import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
import com.njcn.csharmonic.pojo.vo.DataVo; import com.njcn.csharmonic.pojo.vo.DataVo;
import com.njcn.csharmonic.pojo.vo.HalfMonthReportVO; import com.njcn.csharmonic.pojo.vo.HalfMonthReportVO;
@@ -91,6 +92,7 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
//获取装置 //获取装置
List<CsEquipmentDeliveryPO> equipmentDeliveryList = equipmentFeignClient.getAll().getData(); List<CsEquipmentDeliveryPO> equipmentDeliveryList = equipmentFeignClient.getAll().getData();
if (CollectionUtil.isNotEmpty(equipmentDeliveryList)) { if (CollectionUtil.isNotEmpty(equipmentDeliveryList)) {
Map<String, CsEquipmentDeliveryPO> map = equipmentDeliveryList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
List<CsEquipmentDeliveryPO> processList = Objects.isNull(param.getProcess()) List<CsEquipmentDeliveryPO> processList = Objects.isNull(param.getProcess())
? equipmentDeliveryList ? equipmentDeliveryList
: equipmentDeliveryList.stream() : equipmentDeliveryList.stream()
@@ -126,7 +128,11 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
vo.setMac(dev.getMac()); vo.setMac(dev.getMac());
vo.setOperationalTime(dev.getCreateTime()); vo.setOperationalTime(dev.getCreateTime());
vo.setOperationalStatus(dev.getUsageStatus() == 0 ? "停运" : "在运"); vo.setOperationalStatus(dev.getUsageStatus() == 0 ? "停运" : "在运");
if (Objects.equals(line.getName(),"治理监测点")) {
vo.setLineName(line.getName() + "(" + map.get(dev.getId()).getModuleNumber() + "模块)");
} else {
vo.setLineName(line.getName()); vo.setLineName(line.getName());
}
vo.setCommunicationStatus(dev.getRunStatus() == 1 ? "离线" : "在线"); vo.setCommunicationStatus(dev.getRunStatus() == 1 ? "离线" : "在线");
vo.setLatestTime(LocalDateTime.now()); vo.setLatestTime(LocalDateTime.now());
vo.setProcess(dev.getProcess()); vo.setProcess(dev.getProcess());