前置联调
This commit is contained in:
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.fallback.DeviceFeignClientFallbackFactory;
|
||||
import com.njcn.device.pq.api.fallback.LineFeignClientFallbackFactory;
|
||||
import com.njcn.device.pq.pojo.dto.DevComFlagDTO;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -41,4 +42,9 @@ public interface DeviceFeignClient {
|
||||
@ApiOperation("修改装置通讯状态及时间")
|
||||
HttpResult<Boolean> updateDevComFlag(@RequestBody DevComFlagDTO devComFlagDTO);
|
||||
|
||||
|
||||
@PostMapping("/getDeviceInfo")
|
||||
@ApiOperation("查询设备详情")
|
||||
HttpResult<DeviceDTO> getDeviceInfo(@RequestParam("devId") String devId);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.api.DeviceFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.DevComFlagDTO;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceDTO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -38,6 +39,12 @@ public class DeviceFeignClientFallbackFactory implements FallbackFactory<DeviceF
|
||||
log.error("{}异常,降级处理,异常为:{}", "修改设备状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<DeviceDTO> getDeviceInfo(String devId) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "查询设备详情", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.njcn.device.pq.pojo.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
@Data
|
||||
public class DeviceDTO implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 装置序号
|
||||
*/
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 装置模型(0:虚拟设备;1:实际设备;2:离线设备;)默认是实际设备
|
||||
*/
|
||||
private Integer devModel;
|
||||
|
||||
/**
|
||||
* 数据类型(0:暂态系统;1:稳态系统;2:两个系统)
|
||||
*/
|
||||
private Integer devDataType;
|
||||
|
||||
/**
|
||||
* 终端运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)
|
||||
*/
|
||||
private Integer runFlag;
|
||||
|
||||
/**
|
||||
* 通讯状态(0:中断;1:正常)
|
||||
*/
|
||||
private Integer comFlag;
|
||||
|
||||
/**
|
||||
* 设备制造商,字典表
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 定检状态(0:未检 1:已检)
|
||||
*/
|
||||
private Integer checkFlag;
|
||||
|
||||
/**
|
||||
* 前置类型(MMS、CLD)字典表
|
||||
*/
|
||||
private String frontType;
|
||||
|
||||
/**
|
||||
* 终端型号(570、580……)字典表
|
||||
*/
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 网络参数
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 召唤标志(0:周期触发;1:变为触发)
|
||||
*/
|
||||
private Integer callFlag;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 装置识别码(3ds加密)
|
||||
*/
|
||||
private String series;
|
||||
|
||||
/**
|
||||
* 装置秘钥(3ds加密)
|
||||
*/
|
||||
private String devKey;
|
||||
|
||||
/**
|
||||
* 前置序号Id,前置表
|
||||
*/
|
||||
private String nodeId;
|
||||
|
||||
/**
|
||||
* 投运时间
|
||||
*/
|
||||
private LocalDate loginTime;
|
||||
|
||||
/**
|
||||
* 数据更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 本次定检时间,默认等于投运时间
|
||||
*/
|
||||
private LocalDate thisTimeCheck;
|
||||
|
||||
/**
|
||||
* 下次定检时间,默认为投运时间后推3年,假如时间小于3个月则为待检
|
||||
*/
|
||||
private LocalDate nextTimeCheck;
|
||||
|
||||
/**
|
||||
* 电度功能 0 关闭 1开启
|
||||
*/
|
||||
private Integer electroplate;
|
||||
|
||||
/**
|
||||
* 对时功能 0 关闭, 1开启
|
||||
*/
|
||||
private Integer onTime;
|
||||
|
||||
/**
|
||||
* 合同号
|
||||
*/
|
||||
private String contract;
|
||||
|
||||
/**
|
||||
* 设备sim卡号
|
||||
*/
|
||||
private String sim;
|
||||
|
||||
|
||||
/**
|
||||
* 装置系列
|
||||
*/
|
||||
private String devSeries;
|
||||
|
||||
|
||||
/**
|
||||
* 监测装置安装位置
|
||||
*/
|
||||
private String devLocation;
|
||||
|
||||
|
||||
/**
|
||||
* 监测厂家设备编号
|
||||
*/
|
||||
private String devNo;
|
||||
|
||||
|
||||
/**
|
||||
* 告警功能 0:关闭 null、1:开启
|
||||
*/
|
||||
private Integer isAlarm;
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class NodeProcessDeviceTree {
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public static class ProcessDevice {
|
||||
private Integer processNo;
|
||||
private Integer processState;
|
||||
private String processState;
|
||||
private List<DeviceInfo> deviceInfoList;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,18 @@ public class PqsTerminalPushLogDTO implements Serializable {
|
||||
|
||||
private String nodeId;
|
||||
|
||||
private String nodeName;
|
||||
|
||||
private Integer processNum;
|
||||
|
||||
|
||||
private String devId;
|
||||
|
||||
private String devName;
|
||||
//设备是否进程号是否修改
|
||||
|
||||
private Boolean processUpdateFlag;
|
||||
|
||||
/**
|
||||
* 新增,修改,删除
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.pq.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/05/07 上午 11:38【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class PreCommandDTO {
|
||||
private String guid;
|
||||
private String command;
|
||||
private String result;
|
||||
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.dto.DevComFlagDTO;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceDTO;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.ConstantValueParam;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
@@ -27,6 +28,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -34,8 +36,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -200,6 +200,17 @@ public class DeviceController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, update, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getDeviceInfo")
|
||||
@ApiOperation("查询设备详情")
|
||||
public HttpResult<DeviceDTO> getDeviceInfo(@RequestParam("devId") String devId) {
|
||||
String methodDescribe = getMethodDescribe("getDeviceInfo");
|
||||
Device one = iDeviceService.lambdaQuery().eq(Device::getId, devId).one();
|
||||
DeviceDTO dto = new DeviceDTO();
|
||||
BeanUtils.copyProperties(one,dto);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dto, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("台账状态统计")
|
||||
@PostMapping(value = "statisticDevNum")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
|
||||
@@ -73,7 +73,7 @@ public class NodeDeviceController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
@PostMapping("updateDeviceProcess")
|
||||
public HttpResult<Boolean> updateDeviceProcess(@RequestBody DeviceProcess deviceProcess){
|
||||
String methodDescribe = getMethodDescribe("nodeDeviceTree");
|
||||
String methodDescribe = getMethodDescribe("updateDeviceProcess");
|
||||
Boolean flag = nodeDeviceService.updateDeviceProcess(deviceProcess);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PreCommandDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
@@ -428,39 +429,48 @@ 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 = "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")List<String> devIds,@RequestParam("deviceRebootType")String deviceRebootType,@RequestParam("processNo")Integer processNo) {
|
||||
String methodDescribe = getMethodDescribe("askRestartDevice");
|
||||
terminalBaseService.askRestartDevice(devIds,deviceRebootType,processNo);
|
||||
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")List<String> devIds,@RequestParam("deviceRebootType")String deviceRebootType,@RequestParam("processNo")Integer processNo) {
|
||||
// String methodDescribe = getMethodDescribe("askRestartDevice");
|
||||
// terminalBaseService.askRestartDevice(devIds,deviceRebootType,processNo);
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
// }
|
||||
|
||||
@ApiOperation("台账变更推送")
|
||||
@PostMapping(value = "ledgerChangePush")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
public HttpResult<Object> ledgerChangePush() {
|
||||
public HttpResult<List<PreCommandDTO>> ledgerChangePush() {
|
||||
String methodDescribe = getMethodDescribe("ledgerChangePush");
|
||||
terminalBaseService.ledgerChangePush();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
List<PreCommandDTO> preCommandDTOList = terminalBaseService.ledgerChangePush();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, preCommandDTOList, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("查询前置推送结果")
|
||||
@PostMapping(value = "getPushResult")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
public HttpResult<String> getPushResult(@RequestParam("guid")String guid) {
|
||||
String methodDescribe = getMethodDescribe("getPushResult");
|
||||
String result = terminalBaseService.getPushResult(guid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pq.pojo.dto.PreCommandDTO;
|
||||
import com.njcn.device.pq.pojo.param.AddTerminalParam;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.SyncTerminalParam;
|
||||
@@ -286,11 +287,13 @@ public interface TerminalBaseService {
|
||||
Boolean terminalSyncDeleteFly(String lineId);
|
||||
|
||||
//通知前置重启设备
|
||||
void askRestartProcess(Integer processNo,String processType,String deviceRebootType);
|
||||
// void askRestartProcess(Integer processNo,String processType,String deviceRebootType);
|
||||
|
||||
void askRestartDevice(List<String> devId, String deviceRebootType,Integer processNo);
|
||||
// void askRestartDevice(List<String> devId, String deviceRebootType,Integer processNo);
|
||||
|
||||
void ledgerChangePush();
|
||||
List<PreCommandDTO> ledgerChangePush();
|
||||
|
||||
String getPushResult(String guid);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,33 +1,41 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
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.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceInfo;
|
||||
import com.njcn.device.pq.pojo.dto.MonitorInfo;
|
||||
import com.njcn.device.pq.pojo.dto.NodeProcessDeviceTree;
|
||||
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.pojo.po.*;
|
||||
import com.njcn.device.pq.service.DeviceProcessService;
|
||||
import com.njcn.device.pq.service.IDeviceService;
|
||||
import com.njcn.device.pq.service.NodeDeviceService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.device.pq.enums.LineBaseEnum.SUB_LEVEL;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/11/5 8:52【需求编号】
|
||||
@@ -42,6 +50,8 @@ public class NodeDeviceServiceImpl implements NodeDeviceService {
|
||||
private final LineMapper lineMapper;
|
||||
private final IDeviceService iDeviceService;
|
||||
private final DeviceProcessService deviceProcessService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final PqsTerminalLogsMapper pqsTerminalLogsMapper;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
@Override
|
||||
@@ -106,7 +116,14 @@ public class NodeDeviceServiceImpl implements NodeDeviceService {
|
||||
List<DeviceInfo> collect = list.stream().filter(deviceInfo -> Objects.equals(deviceInfo.getProcessNo(), finalI)).collect(Collectors.toList());
|
||||
processDevice.setDeviceInfoList(collect);
|
||||
processDeviceLis.add(processDevice);
|
||||
// redisUtil.getObjectByKey()
|
||||
//h获取redis里心跳
|
||||
|
||||
String heartByKey = redisUtil.getStringByKey(nodeId.concat(":").concat(i + ""));
|
||||
if(StringUtils.isNoneBlank(heartByKey)){
|
||||
processDevice.setProcessState(heartByKey);
|
||||
}else {
|
||||
processDevice.setProcessState("0");
|
||||
}
|
||||
}
|
||||
nodeProcessDeviceTree.setProcessDeviceList(processDeviceLis);
|
||||
|
||||
@@ -117,6 +134,28 @@ public class NodeDeviceServiceImpl implements NodeDeviceService {
|
||||
|
||||
@Override
|
||||
public Boolean updateDeviceProcess(DeviceProcess deviceProcess) {
|
||||
return deviceProcessService.updateById(deviceProcess);
|
||||
DeviceProcess byId = deviceProcessService.getById(deviceProcess.getId());
|
||||
deviceProcessService.updateById(deviceProcess);
|
||||
//记录日志
|
||||
DictData dataDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.PROCESS_PARMETER.getCode(), DicDataTypeEnum.DEV_OPS.getCode()).getData();
|
||||
String name = RequestUtil.getUserNickname();
|
||||
PqsTerminalLogs pqsTerminalLogs = new PqsTerminalLogs();
|
||||
pqsTerminalLogs.setLogsType(dataDic.getId());
|
||||
//终端为4
|
||||
pqsTerminalLogs.setTerminalType(4);
|
||||
|
||||
List<Line> subList = lineMapper.selectList(null);
|
||||
Map<String,Line> subMap = subList.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
|
||||
Line dev = subMap.get(deviceProcess.getId());
|
||||
String subName = subMap.get(dev.getPids().split(StrUtil.COMMA)[SUB_LEVEL.getCode()]).getName();
|
||||
String temLos = "%s进行更新终端进程操作;终端名称 :%s,由进程%s修改成进程%s";
|
||||
String tem = String.format(temLos,name,subName+"_"+dev.getName(),byId.getProcessNo(),deviceProcess.getProcessNo());
|
||||
pqsTerminalLogs.setTerminalDescribe(tem);
|
||||
pqsTerminalLogs.setState(DataStateEnum.ENABLE.getCode());
|
||||
pqsTerminalLogs.setIsPush(0);
|
||||
pqsTerminalLogs.setOperateType(Param.UPDATE);
|
||||
pqsTerminalLogs.setObjIndex(deviceProcess.getId());
|
||||
pqsTerminalLogsMapper.insert(pqsTerminalLogs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ 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.dto.PqsTerminalPushLogDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PreCommandDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.param.oracle.*;
|
||||
import com.njcn.device.pq.pojo.po.*;
|
||||
@@ -50,6 +51,7 @@ 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.constant.RedisKeyPrefix;
|
||||
import com.njcn.message.message.DeviceRebootMessage;
|
||||
import com.njcn.message.message.ProcessRebootMessage;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
@@ -88,6 +90,8 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -319,10 +323,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
// .stream()
|
||||
// .min(Comparator.comparingInt(e -> e.getValue()))
|
||||
// .map(Map.Entry::getKey);
|
||||
// DeviceProcess deviceProcess = new DeviceProcess();
|
||||
// deviceProcess.setId(device.getId());
|
||||
// deviceProcess.setProcessNo(deviceParam.getProcessNum());
|
||||
// deviceProcessService.saveOrUpdate(deviceProcess);
|
||||
DeviceProcess deviceProcess = new DeviceProcess();
|
||||
deviceProcess.setId(device.getId());
|
||||
deviceProcess.setProcessNo(1);
|
||||
deviceProcessService.saveOrUpdate(deviceProcess);
|
||||
//装置功能
|
||||
List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData();
|
||||
if (CollectionUtil.isEmpty(funList)) {
|
||||
@@ -1640,7 +1644,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
@Override
|
||||
public List<Line> getLineById(List<String> lineIds) {
|
||||
return this.lambdaQuery()
|
||||
.in(Line::getId, lineIds)
|
||||
.in(!CollectionUtils.isEmpty(lineIds),Line::getId, lineIds)
|
||||
.eq(Line::getLevel, 6)
|
||||
.eq(Line::getState, DataStateEnum.ENABLE.getCode())
|
||||
.list();
|
||||
@@ -3644,32 +3648,34 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void askRestartProcess(Integer processNum,String processType, String processRebootType) {
|
||||
// @Override
|
||||
public void askRestartProcess(String guid,String nodeId,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);
|
||||
procesRebootMessage.setFun(processType);
|
||||
procesRebootMessage.setProcessNum(processNum);
|
||||
procesRebootMessage.setFrontType(processRebootType);
|
||||
procesRebootMessage.setNodeId(nodeId);
|
||||
procesRebootMessage.setProcessNo(processNum);
|
||||
procesRebootMessage.setGuid(guid);
|
||||
produceFeignClient.askRestartProcess(procesRebootMessage);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
// @Override
|
||||
// @Async
|
||||
public void askRestartDevice(List<String> devId, String deviceRebootType,Integer processNum) {
|
||||
public void askRestartDevice(String guid,String nodeId,List<String> devId, String deviceRebootType,Integer processNum) {
|
||||
|
||||
|
||||
DeviceRebootMessage deviceRebootMessage = new DeviceRebootMessage();
|
||||
deviceRebootMessage.setCode(deviceRebootType);
|
||||
deviceRebootMessage.setGuid(guid);
|
||||
deviceRebootMessage.setNodeId(nodeId);
|
||||
deviceRebootMessage.setProcessNo(processNum);
|
||||
if(Objects.equals(deviceRebootType, DeviceRebootType.DELETE_TERMINAL)){
|
||||
List<DeviceRebootMessage.DeviceInfo> list = new ArrayList<>();
|
||||
|
||||
@@ -3714,79 +3720,247 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void ledgerChangePush() {
|
||||
public List<PreCommandDTO> ledgerChangePush() {
|
||||
List<PreCommandDTO> preCommandDTOList = new ArrayList<>();
|
||||
DictData dataDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.PROCESS_PARMETER.getCode(), DicDataTypeEnum.DEV_OPS.getCode()).getData();
|
||||
|
||||
QueryWrapper<PqsTerminalLogs> queryWrapper= new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(PqsTerminalLogs::getState, 1).eq(PqsTerminalLogs::getIsPush, 0).in(PqsTerminalLogs::getTerminalType,Stream.of(4,6).collect(Collectors.toList()));
|
||||
|
||||
|
||||
//涉及进程修改的直接重启进程
|
||||
List<DeviceProcess> deviceProcesses = deviceProcessService.lambdaQuery().list();
|
||||
Map<String, Integer> deviceProcesseMap = deviceProcesses.stream().collect(Collectors.toMap(DeviceProcess::getId, DeviceProcess::getProcessNo));
|
||||
List<PqsTerminalLogs> list = pqsTerminalLogsMapper.selectList(queryWrapper);
|
||||
//获取所有监测点
|
||||
List<Line> lineById = this.lineMapper.selectList(null);
|
||||
Map<String, Line> lineMap = lineById.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
|
||||
|
||||
// list.forEach(temp->{
|
||||
// PqsTerminalPushLogDTO pqsTerminalPushLogDTO = new PqsTerminalPushLogDTO();
|
||||
// if(Objects.equals(temp.getTerminalType(),6)){
|
||||
// pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
// pqsTerminalPushLogDTO.setNodeId();
|
||||
// pqsTerminalPushLogDTO.setProcessNum();
|
||||
// pqsTerminalPushLogDTO.setDevId();
|
||||
// pqsTerminalPushLogDTO.setOperateType(DeviceRebootType.LEDGER_MODIFY);
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// });
|
||||
|
||||
//监测点终端集合
|
||||
Map<String, String> lineDeviceMap = lineById.stream().filter(temp->Objects.equals(temp.getLevel(),6)).collect(Collectors.toMap(Line::getId, item -> item.getPids().split(",")[4]));
|
||||
List<Device> devices = deviceMapper.selectList(null);
|
||||
Map<String, Device> deviceMap = devices.stream().collect(Collectors.toMap(Device::getId, Function.identity()));
|
||||
List<Node> nodes = nodeService.nodeAllList();
|
||||
Map<String, Node> nodeMap = nodes.stream().collect(Collectors.toMap(Node::getId, Function.identity()));
|
||||
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
|
||||
//一个是删除操作,其余都算终端设备更新操作
|
||||
List<PqsTerminalLogs> delDevice = list.stream().filter(temp -> Objects.equals(temp.getOperateType(), Param.DEL) && Objects.equals(temp.getTerminalType(), 4)).distinct().collect(Collectors.toList());
|
||||
List<String> delDevIds = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(delDevice)){
|
||||
List<String> collect = delDevice.stream().map(PqsTerminalLogs::getObjIndex).collect(Collectors.toList());
|
||||
delDevIds.addAll(collect);
|
||||
List<DeviceProcess> deviceProcessList = deviceProcessService.lambdaQuery().in(DeviceProcess::getId, collect).list();
|
||||
//根据进程号分组,每个进程发送一条信息给前置,如果该进程修改的设备数超过10台则直接重启该进程;
|
||||
Map<Integer, List<DeviceProcess>> collect1 = deviceProcessList.stream().collect(Collectors.groupingBy(DeviceProcess::getProcessNo));
|
||||
//根据进程号
|
||||
collect1.forEach((k,v)->{
|
||||
// this.askRestartDevice(temp.getObjIndex(), DeviceRebootType.DELETE_TERMINAL);
|
||||
if(v.size()>=10){
|
||||
// this.askRestartProcess(k,);
|
||||
list.forEach(temp->{
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = new PqsTerminalPushLogDTO();
|
||||
if(Objects.equals(temp.getTerminalType(),6)){
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId = lineDeviceMap.get(temp.getObjIndex());
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(false);
|
||||
if(deviceProcesseMap.containsKey(deviceId)){
|
||||
pqsTerminalPushLogDTO.setProcessNum(deviceProcesseMap.get(deviceId));
|
||||
}else {
|
||||
// this.askRestartDevice();
|
||||
throw new BusinessException("存在终端未设置进程号,请在前置管理页面设置进程号在进行此操作");
|
||||
}
|
||||
pqsTerminalPushLogDTO.setOperateType(DeviceRebootType.LEDGER_MODIFY);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
|
||||
}else if(Objects.equals(temp.getTerminalType(),4)){
|
||||
//如果是修改进程操作记录2个进程日志;
|
||||
if(temp.getLogsType().equals(dataDic.getId())){
|
||||
String temLos = "%s进行更新终端进程操作;终端名称 :%s,由进程%s修改成进程%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String num1 = strings.get(2); // 第一个进程
|
||||
String num2 = strings.get(3); // 第二个进程
|
||||
int processId1 = Integer.parseInt(num1);
|
||||
int processId2 = Integer.parseInt(num2);
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId = temp.getObjIndex();
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO.setProcessNum(processId1);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO1 = new PqsTerminalPushLogDTO();
|
||||
|
||||
pqsTerminalPushLogDTO1.setId(temp.getId());
|
||||
pqsTerminalPushLogDTO1.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO1.setDevName(lineMap.get(deviceId).getName());
|
||||
pqsTerminalPushLogDTO1.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO1.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO1.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO1.setProcessNum(processId2);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
|
||||
}else {
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId = temp.getObjIndex();
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
//设备删除找不到设备名称
|
||||
pqsTerminalPushLogDTO.setDevName("设备id:"+deviceId);
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(false);
|
||||
if(deviceProcesseMap.containsKey(deviceId)){
|
||||
pqsTerminalPushLogDTO.setProcessNum(deviceProcesseMap.get(deviceId));
|
||||
}else {
|
||||
throw new BusinessException("存在终端未设置进程号,请在前置管理页面设置进程号在进行此操作");
|
||||
}
|
||||
//区分删除操作,新增和其他操作
|
||||
String operate= DeviceRebootType.LEDGER_MODIFY;
|
||||
if(Objects.equals(temp.getOperateType(), Param.DEL)){
|
||||
operate = DeviceRebootType.DELETE_TERMINAL;
|
||||
} else if (Objects.equals(temp.getOperateType(), Param.ADD)) {
|
||||
operate = DeviceRebootType.ADD_TERMINAL;
|
||||
}
|
||||
pqsTerminalPushLogDTO.setOperateType(operate);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, Map<Integer, List<PqsTerminalPushLogDTO>>> collect2 = pqsTerminalPushLogDTOList.stream().collect(Collectors.groupingBy(PqsTerminalPushLogDTO::getNodeId, Collectors.groupingBy(PqsTerminalPushLogDTO::getProcessNum)));
|
||||
collect2.forEach((nodeId,pqsTerminalPushLogDTOMap)->{
|
||||
pqsTerminalPushLogDTOMap.forEach((processId,tempPqsTerminalPushLogDTOList)->{
|
||||
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = tempPqsTerminalPushLogDTOList.get(0);
|
||||
//如果存在终端变更进程的记录直接重启进程
|
||||
boolean processUpdateFlag = tempPqsTerminalPushLogDTOList.stream().map(PqsTerminalPushLogDTO::getProcessUpdateFlag).anyMatch(b -> b != null && b);
|
||||
if(processUpdateFlag){
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "重启前置机:"+pqsTerminalPushLogDTO.getNodeName()+"下进程:"+processId;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
//调用重启进程接口
|
||||
this.askRestartProcess(guid,pqsTerminalPushLogDTO.getNodeId(),processId,"delete","all");
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}else {
|
||||
List<String> deviceIds = tempPqsTerminalPushLogDTOList.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
//如果一个进程上涉及10个以上的设备修改,直接重启进程,否则重启设备
|
||||
if(CollectionUtil.isNotEmpty(deviceIds)&&deviceIds.size()>10){
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "重启前置机:"+pqsTerminalPushLogDTO.getNodeName()+"下进程:"+processId;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
//调用重启进程接口
|
||||
this.askRestartProcess(guid,pqsTerminalPushLogDTO.getNodeId(),processId,"delete","all");
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
|
||||
}else {
|
||||
//调用重启设备接口先删除设备,在重启设备
|
||||
List<String> deleteDevIds = new ArrayList<>();
|
||||
Map<String, List<PqsTerminalPushLogDTO>> collect = tempPqsTerminalPushLogDTOList.stream().collect(Collectors.groupingBy(PqsTerminalPushLogDTO::getOperateType));
|
||||
if(collect.containsKey(DeviceRebootType.DELETE_TERMINAL)){
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.DELETE_TERMINAL);
|
||||
deleteDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
String devNameString = deleteDevIds.stream().map(temp->{return lineMap.get(temp).getName();}).collect(Collectors.joining(","));
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
|
||||
String command = "删除前置机:"+pqsTerminalPushLogDTO.getNodeName()+"下进程:"+processId+"下终端"+devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
//调用重启进程接口
|
||||
this.askRestartDevice(guid,pqsTerminalPushLogDTO.getNodeId(),deleteDevIds,DeviceRebootType.DELETE_TERMINAL,processId);
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
|
||||
}
|
||||
List<String> updateDevIds = new ArrayList<>();
|
||||
List<String> lineIds = list.stream().filter(temp -> Objects.equals(temp.getTerminalType(), 6)).map(PqsTerminalLogs::getObjIndex).distinct().collect(Collectors.toList());
|
||||
List<String> devIds = list.stream().filter(temp -> Objects.equals(temp.getTerminalType(), 4)).map(PqsTerminalLogs::getObjIndex).distinct().collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(lineIds)){
|
||||
//更新的终端
|
||||
List<Line> lineById = this.getLineById(lineIds);
|
||||
List<String> devIdList = lineById.stream().map(temp -> {
|
||||
return temp.getPids().split(",")[4];
|
||||
}).distinct().collect(Collectors.toList());
|
||||
updateDevIds.addAll(devIdList);
|
||||
if(collect.containsKey(DeviceRebootType.LEDGER_MODIFY)){
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.LEDGER_MODIFY);
|
||||
deleteDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
String devNameString = deleteDevIds.stream().map(temp->{return lineMap.get(temp).getName();}).collect(Collectors.joining(","));
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "修改前置机:"+pqsTerminalPushLogDTO.getNodeName()+"下进程:"+processId+"下终端"+devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
//调用重启进程接口
|
||||
this.askRestartDevice(guid,pqsTerminalPushLogDTO.getNodeId(),deleteDevIds,DeviceRebootType.LEDGER_MODIFY,processId);
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
if(collect.containsKey(DeviceRebootType.ADD_TERMINAL)){
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.ADD_TERMINAL);
|
||||
deleteDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
String devNameString = deleteDevIds.stream().map(temp->{return lineMap.get(temp).getName();}).collect(Collectors.joining(","));
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "新增前置机:"+pqsTerminalPushLogDTO.getNodeName()+"下进程:"+processId+"下终端"+devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
//调用重启进程接口
|
||||
this.askRestartDevice(guid,pqsTerminalPushLogDTO.getNodeId(),deleteDevIds,DeviceRebootType.ADD_TERMINAL,processId);
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
updateDevIds.addAll(devIds);
|
||||
if(!CollectionUtils.isEmpty(delDevIds)){
|
||||
updateDevIds.removeAll(delDevIds);
|
||||
}
|
||||
updateDevIds.stream().distinct().forEach(temp->{
|
||||
// this.askRestartDevice(temp, DeviceRebootType.LEDGER_MODIFY);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
list.forEach(temp->{
|
||||
temp.setIsPush(1);
|
||||
|
||||
pqsTerminalLogsMapper.updateById(temp);
|
||||
});
|
||||
|
||||
}else {
|
||||
throw new BusinessException("暂无变动的装置测点推送");
|
||||
}
|
||||
return preCommandDTOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPushResult(String guid) {
|
||||
String stringByKey = redisUtil.getStringByKey(RedisKeyPrefix.TOPIC_REPLY.concat(guid));
|
||||
return stringByKey;
|
||||
}
|
||||
|
||||
//反解析日志
|
||||
public List<String> parseTemplateValues(String template, String actualString) {
|
||||
List<String> values = new ArrayList<>();
|
||||
|
||||
// 分割模板字符串,以%s为分隔符
|
||||
String[] templateParts = template.split("%s", -1); // -1保留末尾空字符串
|
||||
|
||||
int currentPos = 0;
|
||||
for (int i = 0; i < templateParts.length - 1; i++) {
|
||||
String part = templateParts[i];
|
||||
|
||||
// 在原始字符串中找到当前模板部分的位置
|
||||
int partIndex = actualString.indexOf(part, currentPos);
|
||||
if (partIndex == -1) {
|
||||
throw new IllegalArgumentException("字符串不匹配模板");
|
||||
}
|
||||
|
||||
// 计算值开始位置
|
||||
int valueStart = partIndex + part.length();
|
||||
|
||||
// 找到下一个模板部分的位置来确定值结束位置
|
||||
String nextPart = templateParts[i + 1];
|
||||
int nextPartIndex;
|
||||
if (nextPart.isEmpty()) {
|
||||
// 如果下一个部分是空字符串,则值到字符串末尾
|
||||
nextPartIndex = actualString.length();
|
||||
} else {
|
||||
nextPartIndex = actualString.indexOf(nextPart, valueStart);
|
||||
if (nextPartIndex == -1) {
|
||||
throw new IllegalArgumentException("字符串不匹配模板");
|
||||
}
|
||||
}
|
||||
|
||||
// 提取值
|
||||
String value = actualString.substring(valueStart, nextPartIndex);
|
||||
values.add(value);
|
||||
|
||||
currentPos = nextPartIndex;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -370,6 +370,8 @@ public enum DicDataEnum {
|
||||
DEV_PARAMETER("设备日志", "Dev_Parameter"),
|
||||
WEB_ADD("web新增用户", "Web_Add"),
|
||||
DATA_PLAN("流量套餐修改", "Data_Plan"),
|
||||
PROCESS_PARMETER("终端进程操作", "Process_Parmeter"),
|
||||
|
||||
|
||||
/**
|
||||
* 接线方式
|
||||
|
||||
Reference in New Issue
Block a user