辽宁前置代码
This commit is contained in:
@@ -45,6 +45,15 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -49,6 +49,14 @@ public class NodeDeviceController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("一键分配装置所属进程号")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
@PostMapping("oneKeyDistribution")
|
||||
public HttpResult<Boolean> oneKeyDistribution(@RequestParam("nodeId") String nodeId){
|
||||
String methodDescribe = getMethodDescribe("oneKeyDistribution");
|
||||
nodeDeviceService.oneKeyDistribution(nodeId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,11 +17,14 @@ import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineWiringDiagramVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalVO;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.device.pq.service.TerminalBaseService;
|
||||
import com.njcn.device.pq.service.impl.GeneralDeviceService;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.*;
|
||||
@@ -56,7 +59,7 @@ public class TerminalBaseController extends BaseController {
|
||||
|
||||
private final TerminalBaseService terminalBaseService;
|
||||
private final GeneralDeviceService generalDeviceService;
|
||||
|
||||
private final LineService lineService;
|
||||
|
||||
/**
|
||||
* 终端新增操作
|
||||
@@ -117,6 +120,15 @@ public class TerminalBaseController extends BaseController {
|
||||
}
|
||||
}
|
||||
terminalBaseService.addTerminal(addTerminalParam);
|
||||
//新增终端后发送消息给前置重启设备
|
||||
if (Objects.nonNull(addTerminalParam.getDeviceParam())) {
|
||||
addTerminalParam.getDeviceParam().forEach(temp->{
|
||||
Line line = terminalBaseService.queryTerminalByName(temp.getName());
|
||||
terminalBaseService.askRestartDevice(line.getId(), DeviceRebootType.ADD_TERMINAL);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -145,7 +157,14 @@ public class TerminalBaseController extends BaseController {
|
||||
@GetMapping("/terminalSyncDeleteFly")
|
||||
public HttpResult<Boolean> terminalSyncDeleteFly(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("terminalSyncDeleteFly");
|
||||
//获取设备id
|
||||
LineDetailDataVO lineDetailData = lineService.getLineDetailData(lineId);
|
||||
String devId =lineDetailData.getDevId();
|
||||
|
||||
Boolean b = terminalBaseService.terminalSyncDeleteFly(lineId);
|
||||
//删除监测点即修改终端通知前置重启
|
||||
terminalBaseService.askRestartDevice(devId,DeviceRebootType.LEDGER_MODIFY);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -192,6 +211,9 @@ public class TerminalBaseController extends BaseController {
|
||||
public HttpResult<Object> delTerminal(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("delTerminal");
|
||||
terminalBaseService.delTerminal(id);
|
||||
// 删除终端通知前置重启
|
||||
terminalBaseService.askRestartDevice(id,DeviceRebootType.DELETE_TERMINAL);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -412,4 +434,31 @@ public class TerminalBaseController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("请求前置重启进程")
|
||||
@PostMapping(value = "askRestartProcess")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "processNo", value = "进程号", required = true),
|
||||
@ApiImplicitParam(name = "deviceRebootType", value = "重启类型", required = true)
|
||||
})
|
||||
public HttpResult<Object> askRestartProcess(@RequestParam("processNo")Integer processNo,@RequestParam("processType")String processType,@RequestParam("deviceRebootType")String deviceRebootType) {
|
||||
String methodDescribe = getMethodDescribe("askRestartProcess");
|
||||
terminalBaseService.askRestartProcess(processNo,processType,deviceRebootType);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("请求前置设备进程")
|
||||
@PostMapping(value = "askRestartDevice")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||
@ApiImplicitParam(name = "deviceRebootType", value = "重启类型", required = true)
|
||||
})
|
||||
public HttpResult<Object> askRestartDevice(@RequestParam("devId")String devId,@RequestParam("deviceRebootType")String deviceRebootType) {
|
||||
String methodDescribe = getMethodDescribe("askRestartDevice");
|
||||
terminalBaseService.askRestartDevice(devId,deviceRebootType);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO;
|
||||
import com.njcn.device.pq.pojo.vo.RunManageVO;
|
||||
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
public interface DeviceProcessMapper extends BaseMapper<DeviceProcess> {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.DeviceProcessMapper">
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -14,17 +14,22 @@
|
||||
s2.Name manufacturer,
|
||||
pq_device.Com_Flag status,
|
||||
pq_device.Series series,
|
||||
pq_device_process.process_no processNo,
|
||||
pq_device.Dev_Key devKey
|
||||
FROM
|
||||
pq_node
|
||||
LEFT JOIN pq_device ON pq_node.Id = pq_device.Node_Id
|
||||
LEFT JOIN pq_line on pq_device.id = pq_line.id
|
||||
LEFT JOIN pq_device_process on pq_device_process.id = pq_device.id
|
||||
LEFT JOIN sys_dict_data s1 ON pq_device.Dev_Type = s1.id
|
||||
LEFT JOIN sys_dict_data s2 ON pq_device.Manufacturer = s2.id
|
||||
<where>
|
||||
<if test="nodeDeviceParam.ip!=null and nodeDeviceParam.ip != ''">
|
||||
pq_node.ip=#{nodeDeviceParam.ip}
|
||||
</if>
|
||||
<if test="nodeDeviceParam.devId!=null and nodeDeviceParam.devId != ''">
|
||||
pq_device.id=#{nodeDeviceParam.devId}
|
||||
</if>
|
||||
<if test="nodeDeviceParam.runFlag!=null and nodeDeviceParam.runFlag.size()!=0">
|
||||
AND pq_device.Run_Flag in
|
||||
<foreach collection="nodeDeviceParam.runFlag" open="(" close=")" item="item" separator=",">
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.biz.pojo.po.DeviceBak;
|
||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||
|
||||
/**
|
||||
* 监测点类
|
||||
* @author denghuajun
|
||||
* @date 2022/2/23
|
||||
*
|
||||
*/
|
||||
public interface DeviceProcessService extends IService<DeviceProcess> {
|
||||
|
||||
}
|
||||
@@ -16,4 +16,6 @@ import java.util.List;
|
||||
|
||||
public interface NodeDeviceService {
|
||||
List<DeviceInfo> nodeDeviceList(NodeDeviceParam nodeDeviceParam);
|
||||
|
||||
void oneKeyDistribution(String nodeId);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,14 @@ public interface TerminalBaseService {
|
||||
*/
|
||||
TerminalVO queryTerminal(String id);
|
||||
|
||||
/**
|
||||
* 终端查询操作
|
||||
* @param devName 设备名称
|
||||
* @author cdf
|
||||
* @date 2021/7/19
|
||||
*/
|
||||
Line queryTerminalByName(String devName);
|
||||
|
||||
/**
|
||||
* 终端删除操作
|
||||
* @param id 设备id
|
||||
@@ -275,4 +283,9 @@ public interface TerminalBaseService {
|
||||
* @return
|
||||
*/
|
||||
Boolean terminalSyncDeleteFly(String lineId);
|
||||
|
||||
//通知前置重启设备
|
||||
void askRestartProcess(Integer processNo,String processType,String deviceRebootType);
|
||||
|
||||
void askRestartDevice(String devId, String deviceRebootType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.biz.pojo.po.DeviceBak;
|
||||
import com.njcn.device.pq.mapper.DeviceBakMapper;
|
||||
import com.njcn.device.pq.mapper.DeviceProcessMapper;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||
import com.njcn.device.pq.service.DeviceProcessService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/01/22 下午 1:59【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DeviceProcessServiceImpl extends ServiceImpl<DeviceProcessMapper, DeviceProcess> implements DeviceProcessService {
|
||||
}
|
||||
@@ -1,15 +1,28 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
|
||||
import com.njcn.device.pq.mapper.DeviceMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.NodeMapper;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceInfo;
|
||||
import com.njcn.device.pq.pojo.dto.MonitorInfo;
|
||||
import com.njcn.device.pq.pojo.param.NodeDeviceParam;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||
import com.njcn.device.pq.pojo.po.Node;
|
||||
import com.njcn.device.pq.service.DeviceProcessService;
|
||||
import com.njcn.device.pq.service.IDeviceService;
|
||||
import com.njcn.device.pq.service.NodeDeviceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -23,6 +36,8 @@ import java.util.List;
|
||||
public class NodeDeviceServiceImpl implements NodeDeviceService {
|
||||
private final NodeMapper nodeMapper;
|
||||
private final LineMapper lineMapper;
|
||||
private final IDeviceService iDeviceService;
|
||||
private final DeviceProcessService deviceProcessService;
|
||||
@Override
|
||||
public List<DeviceInfo> nodeDeviceList(NodeDeviceParam nodeDeviceParam) {
|
||||
|
||||
@@ -34,4 +49,37 @@ public class NodeDeviceServiceImpl implements NodeDeviceService {
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void oneKeyDistribution(String nodeId) {
|
||||
Node node = nodeMapper.selectById(nodeId);
|
||||
Integer nodeDevNum = node.getNodeDevNum();
|
||||
Integer maxProcessNum = node.getMaxProcessNum();
|
||||
List<Device> list = iDeviceService.lambdaQuery().eq(Device::getNodeId, nodeId).list();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(PvDeviceResponseEnum.NO_DEVICE);
|
||||
|
||||
}
|
||||
List<String> deviceIdList = list.stream().map(Device::getId).collect(Collectors.toList());
|
||||
List<DeviceProcess> deviceProcessList = deviceProcessService.lambdaQuery().in(DeviceProcess::getId, deviceIdList).list();
|
||||
Integer devNum = list.size();
|
||||
if(nodeDevNum<devNum){
|
||||
throw new BusinessException(PvDeviceResponseEnum.OVER_LIMIT);
|
||||
}
|
||||
//单个进程支持最大装置数
|
||||
int maxDevNum = nodeDevNum / maxProcessNum;
|
||||
|
||||
List<List<DeviceProcess>> partition = ListUtils.partition(deviceProcessList, maxProcessNum);
|
||||
for (int i = 0; i < partition.size(); i++) {
|
||||
int processNo = i+1;
|
||||
partition.get(i).forEach(temp->{
|
||||
temp.setProcessNo(processNo);
|
||||
});
|
||||
}
|
||||
List<DeviceProcess> collect = partition.stream().flatMap(List::stream).collect(Collectors.toList());
|
||||
|
||||
//更新进程号
|
||||
deviceProcessService.updateBatchById(collect);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.njcn.device.pq.pojo.bo.excel.NodeExcel;
|
||||
import com.njcn.device.pq.pojo.bo.excel.OracleTerminalExcel;
|
||||
import com.njcn.device.pq.pojo.bo.excel.OverLimitExcel;
|
||||
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceInfo;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.param.oracle.*;
|
||||
@@ -45,6 +46,10 @@ import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.*;
|
||||
import com.njcn.device.pq.utils.DeviceUtil;
|
||||
import com.njcn.device.pq.utils.ExcelStyleUtil;
|
||||
import com.njcn.message.api.ProduceFeignClient;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
import com.njcn.message.message.DeviceRebootMessage;
|
||||
import com.njcn.message.message.ProcessRebootMessage;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
@@ -107,7 +112,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
||||
private final NodeDeviceService nodeDeviceService;
|
||||
private final DeviceProcessService deviceProcessService;
|
||||
private final ProduceFeignClient produceFeignClient;
|
||||
@Value("${oracle.isSync}")
|
||||
private Boolean isSync;
|
||||
|
||||
@@ -274,8 +281,39 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
deviceDetail.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
//处理装置识别码秘钥
|
||||
coderM3d(deviceDetail,false);
|
||||
coderM3d(deviceDetail, false);
|
||||
deviceMapper.insert(deviceDetail);
|
||||
//添加装置进程号
|
||||
Node nodeById = nodeService.getNodeById(deviceDetail.getNodeId());
|
||||
List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>().lambda().eq(Device::getNodeId, deviceDetail.getNodeId()));
|
||||
Integer maxNodeDevNum = nodeById.getNodeDevNum();
|
||||
Integer maxProcessNum = nodeById.getMaxProcessNum();
|
||||
if (devices.size() >= maxNodeDevNum) {
|
||||
throw new BusinessException(PvDeviceResponseEnum.OVER_LIMIT);
|
||||
}
|
||||
List<String> deviceIdList = devices.stream().map(Device::getId).collect(Collectors.toList());
|
||||
List<DeviceProcess> deviceProcessList = deviceProcessService.lambdaQuery().in(DeviceProcess::getId, deviceIdList).list();
|
||||
Map<Integer, Integer> processCountMap = null;
|
||||
if (Objects.nonNull(maxProcessNum)) {
|
||||
processCountMap = new HashMap<>();
|
||||
for (int i = 0; i < maxProcessNum; i++) {
|
||||
Integer processNum = i + 1;
|
||||
long count = deviceProcessList.stream().filter(temp -> Objects.equals(temp.getProcessNo(), processNum)).count();
|
||||
Integer processCount = Math.toIntExact(count);
|
||||
processCountMap.put(processNum, processCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//获取数量最少的线程号
|
||||
Optional<Integer> minKey = processCountMap.entrySet()
|
||||
.stream()
|
||||
.min(Comparator.comparingInt(e -> e.getValue()))
|
||||
.map(Map.Entry::getKey);
|
||||
DeviceProcess deviceProcess = new DeviceProcess();
|
||||
deviceProcess.setId(device.getId());
|
||||
deviceProcess.setProcessNo(minKey.orElse(1));
|
||||
deviceProcessService.saveOrUpdate(deviceProcess);
|
||||
//装置功能
|
||||
List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData();
|
||||
if (CollectionUtil.isEmpty(funList)) {
|
||||
@@ -1192,6 +1230,12 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Line queryTerminalByName(String devName) {
|
||||
Line one = this.lambdaQuery().eq(Line::getName, devName).one();
|
||||
return one;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delTerminal(String id) {
|
||||
@@ -3515,5 +3559,68 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
throw new BusinessException("字典转换异常");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void askRestartProcess(Integer processNum,String processType, String processRebootType) {
|
||||
|
||||
ProcessRebootMessage procesRebootMessage = new ProcessRebootMessage();
|
||||
procesRebootMessage.setIndex(processNum);
|
||||
List<ProcessRebootMessage.RebootData> list = new ArrayList<>();
|
||||
ProcessRebootMessage.RebootData rebootData = new ProcessRebootMessage.RebootData();
|
||||
|
||||
rebootData.setFun(processType);
|
||||
rebootData.setProcessNum(processNum);
|
||||
rebootData.setFrontType(processRebootType);
|
||||
list.add(rebootData);
|
||||
procesRebootMessage.setData(list);
|
||||
produceFeignClient.askRestartProcess(procesRebootMessage);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void askRestartDevice(String devId, String deviceRebootType) {
|
||||
DeviceProcess one = deviceProcessService.lambdaQuery().eq(DeviceProcess::getId, devId).one();
|
||||
|
||||
DeviceRebootMessage deviceRebootMessage = new DeviceRebootMessage();
|
||||
deviceRebootMessage.setCode(deviceRebootType);
|
||||
if(Objects.equals(deviceRebootType, DeviceRebootType.DELETE_TERMINAL)){
|
||||
DeviceRebootMessage.DeviceInfo deviceInfo = new DeviceRebootMessage.DeviceInfo();
|
||||
deviceInfo.setId(devId);
|
||||
List<DeviceRebootMessage.DeviceInfo> list = new ArrayList<>();
|
||||
list.add(deviceInfo);
|
||||
deviceRebootMessage.setData(list);
|
||||
deviceRebootMessage.setIndex(one.getProcessNo());
|
||||
produceFeignClient.askRestartDevice(deviceRebootMessage);
|
||||
//删除设备进程关系
|
||||
deviceProcessService.removeById(devId);
|
||||
|
||||
}else {
|
||||
NodeDeviceParam nodeDeviceParam = new NodeDeviceParam();
|
||||
nodeDeviceParam.setDevId(devId);
|
||||
List<DeviceInfo> deviceInfos = nodeDeviceService.nodeDeviceList(nodeDeviceParam);
|
||||
if (CollectionUtil.isNotEmpty(deviceInfos)){
|
||||
deviceRebootMessage.setIndex(one.getProcessNo());
|
||||
DeviceInfo deviceInfo = deviceInfos.get(0);
|
||||
DeviceRebootMessage.DeviceInfo deviceInfo1 = new DeviceRebootMessage.DeviceInfo();
|
||||
BeanUtils.copyProperties(deviceInfo,deviceInfo1);
|
||||
List<DeviceRebootMessage.DeviceInfo.MonitorInfo> monitorInfoList=deviceInfo.getMonitorData().stream().map(tempMonitorInfo->{
|
||||
DeviceRebootMessage.DeviceInfo.MonitorInfo m = new DeviceRebootMessage.DeviceInfo.MonitorInfo();
|
||||
BeanUtils.copyProperties(tempMonitorInfo,m);
|
||||
return m;
|
||||
}).collect(Collectors.toList());
|
||||
deviceInfo1.setMonitorData(monitorInfoList);
|
||||
List<DeviceRebootMessage.DeviceInfo> list = new ArrayList<>();
|
||||
list.add(deviceInfo1);
|
||||
deviceRebootMessage.setData(list);
|
||||
produceFeignClient.askRestartDevice(deviceRebootMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user