设备重启和进程重启

This commit is contained in:
hzj
2025-02-17 15:07:04 +08:00
parent 6fcd46efff
commit 92d540e497
9 changed files with 184 additions and 14 deletions

View File

@@ -1,11 +1,16 @@
package com.njcn.message.api;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.message.api.fallback.ProduceFeignClientFallbackFactory;
import com.njcn.message.message.DeviceRebootMessage;
import com.njcn.message.message.ProcessRebootMessage;
import com.njcn.message.message.RecallMessage;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -28,4 +33,9 @@ public interface ProduceFeignClient {
@PostMapping("/askRestartDevice")
public HttpResult<Boolean> askRestartDevice(@RequestBody DeviceRebootMessage message);
@PostMapping("/askRestartProcess")
public HttpResult<Boolean> askRestartProcess(@RequestBody ProcessRebootMessage message);
}

View File

@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.message.api.ProduceFeignClient;
import com.njcn.message.message.DeviceRebootMessage;
import com.njcn.message.message.ProcessRebootMessage;
import com.njcn.message.message.RecallMessage;
import com.njcn.message.utils.MessageEnumUtil;
import feign.hystrix.FallbackFactory;
@@ -43,7 +44,13 @@ public class ProduceFeignClientFallbackFactory implements FallbackFactory<Produc
@Override
public HttpResult<Boolean> askRestartDevice(DeviceRebootMessage message) {
log.error("{}异常,降级处理,异常为:{}", "消息数据解析", throwable.toString());
log.error("{}异常,降级处理,异常为:{}", "设备重启", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Boolean> askRestartProcess(ProcessRebootMessage message) {
log.error("{}异常,降级处理,异常为:{}", "进程重启", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};

View File

@@ -32,6 +32,8 @@ public interface BusinessTopic {
String CONTROL_TOPIC = "control_Topic";
String PROCESS_TOPIC = "process_Topic";
String ASK_REAL_DATA_TOPIC = "ask_real_data_topic";
String RECALL_TOPIC = "recall_Topic";

View File

@@ -0,0 +1,31 @@
package com.njcn.message.constant;
/**
* Description:
* Date: 2025/02/17 上午 10:09【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface DeviceRebootType {
/***
* 1. 新增终端台账
*/
String ADD_TERMINAL = "add_terminal";
/***
* 1. 删除终端台账
*/
String DELETE_TERMINAL = "delete_terminal";
/***
*修改终端 新增/删除/监测点台账
*/
String LEDGER_MODIFY = "ledger_modify";
/**
* Icd变更
*/
String ICD_CHANGE = "icd_change";
}

View File

@@ -13,21 +13,55 @@ import java.util.List;
*/
@Data
public class DeviceRebootMessage {
//set_process
private String code="set_process";
private String code;
private Integer index;
private List<RebootData> data;
private DeviceInfo data;
@Data
public static class RebootData {
//reset/add",重置或者添加进程
private String fun;
//重置启动多少个进程,或者添加第几个进程
private Integer processNum;
//"stat/recall/all"//重置的进程类型stat或者recall或者所有进程添加的进程类型stat或者recall或者stat和recall只有稳态和补招是多进程
private String frontType;
public static class DeviceInfo {
//终端索引
private String id;
//终端ip
private String ip;
//终端型号
private String devType;
//挂载单位
private String org_name;
//组织名称
private String port;
//终端端口
private String stationName;
//变电站名
private String name;
//终端序列号
private String updateTime;
//数据更新时间
private String manufacturer;
//终端厂商
private String status;
//终端状态
private String series;
//终端识别码
private String devKey;
//
private List<MonitorInfo> monitorData;
@Data
public static class MonitorInfo {
//监测点索引
private String id;
//名称
private String name;
//监测点逻辑号
private String lineNo;
//监测点电压等级
private String voltageLevel;
//监测点接线方式
private String ptType;
private String status;
}
}
}

View File

@@ -0,0 +1,35 @@
package com.njcn.message.message;
import lombok.Data;
import java.util.List;
/**
* Description:
* Date: 2024/12/13 10:15【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class ProcessRebootMessage {
//set_process
private String code="set_process";
private Integer index;
private List<ProcessRebootMessage.RebootData> data;
@Data
public static class RebootData {
//reset/add",重置或者添加进程
private String fun;
//重置启动多少个进程,或者添加第几个进程
private Integer processNum;
//"stat/recall/all"//重置的进程类型stat或者recall或者所有进程添加的进程类型stat或者recall或者stat和recall只有稳态和补招是多进程
private String frontType;
}
}

View File

@@ -20,6 +20,11 @@ public class RecallMessage {
public static class RecallDTO {
/**
* {
* "dataType":1,
* "monitorId":["1","2"],
* "timeInterval":: ["2024-01-01 12:52:51~2024-01-01 13:53:00","2024-01-02 12:52:51~2024-01-02 13:53:00"]
* }
* monitorId : ["id1","id2","id3"]
* dataType : 稳态
* timeInterval : ["2024-01-01 12:52:51~2024-01-01 13:53:00","2024-01-02 12:52:51~2024-01-02 13:53:00","2024-01-03 12:52:51~2024-01-03 13:53:00","2024-01-04 12:52:51~2024-01-04 13:53:00"]