Copyright: Copyright(c) 2025+ *
Company : 紫光汇智信息技术有限公司+ * Modification History: + * Date Author Version Discription + * -------------------------------------------------------------------------- + * 2025/08/21 ch 1.0 Why & What is modified: <修改原因描述> * + */ +@Configuration +public class ThreadConfig { + /** + * 创建用于gRPC连接监听的线程池 + * 用于处理客户端连接/断开连接等事件 + */ + @Bean("grpcConnectionListenerExecutor") + public ExecutorService grpcConnectionListenerExecutor() { + // 获取系统可用处理器核心数 + int corePoolSize =1; + int maximumPoolSize = corePoolSize * 2; + + // 设置线程空闲时间 + long keepAliveTime = 60L; + + // 设置队列大小 + int queueCapacity = 1000; + + // 创建线程池 + return new ThreadPoolExecutor( + // 核心线程数 + corePoolSize, + // 最大线程数 + maximumPoolSize, + // 空闲线程存活时间 + keepAliveTime, + // 时间单位 + TimeUnit.SECONDS, + // 任务队列 + new LinkedBlockingQueue<>(queueCapacity), + new ThreadFactory() { + private final AtomicInteger threadNumber = new AtomicInteger(1); + + @Override + public Thread newThread(Runnable runable) { + Thread thread = new Thread(runable, "grpc-connection-listener-" + threadNumber.getAndIncrement()); + thread.setDaemon(false); // 设置为非守护线程 + return thread; + } + }, + // 拒绝策略:由调用线程执行任务 + new ThreadPoolExecutor.CallerRunsPolicy() + ); + } +} diff --git a/nex-be/src/main/java/com/unisinsight/project/controller/DeviceController.java b/nex-be/src/main/java/com/unisinsight/project/controller/DeviceController.java index 64a56f3..746cf19 100644 --- a/nex-be/src/main/java/com/unisinsight/project/controller/DeviceController.java +++ b/nex-be/src/main/java/com/unisinsight/project/controller/DeviceController.java @@ -7,10 +7,12 @@ import com.unisinsight.project.entity.res.DeviceRes; import com.unisinsight.project.entity.res.PageResult; import com.unisinsight.project.exception.BaseErrorCode; import com.unisinsight.project.exception.Result; +import com.unisinsight.project.service.ClientOperateService; import com.unisinsight.project.service.DeviceService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -33,6 +35,8 @@ public class DeviceController { @Resource private DeviceService deviceService; + @Autowired + private ClientOperateService clientOperateService; @ApiOperation(value = "终端新增") @PostMapping("/add") public Result> insertUser(@RequestBody DeviceReq deviceReq) { @@ -82,4 +86,25 @@ public class DeviceController { return deviceService.selectPageUser(deviceReq); } + @ApiOperation(value = "开机") + @PostMapping("/terminal/start") + public Result> terminalStart(@RequestBody DeviceReq deviceReq) { + if (Objects.isNull(deviceReq)) { + return Result.errorResult(BaseErrorCode.PARAMS_CHK_ERROR); + } + log.info("终端开机请求参数为:{}", JSONUtil.toJsonStr(deviceReq)); + return clientOperateService.terminalStart(deviceReq); + } + + @ApiOperation(value = "关机") + @PostMapping("/terminal/end") + public Result> terminalEnd(@RequestBody DeviceReq deviceReq) { + if (Objects.isNull(deviceReq)) { + return Result.errorResult(BaseErrorCode.PARAMS_CHK_ERROR); + } + log.info("终端关机请求参数为:{}", JSONUtil.toJsonStr(deviceReq)); + return clientOperateService.terminalEnd(deviceReq); + } + + } diff --git a/nex-be/src/main/java/com/unisinsight/project/entity/dao/Device.java b/nex-be/src/main/java/com/unisinsight/project/entity/dao/Device.java index 1029cf9..8216b99 100644 --- a/nex-be/src/main/java/com/unisinsight/project/entity/dao/Device.java +++ b/nex-be/src/main/java/com/unisinsight/project/entity/dao/Device.java @@ -102,6 +102,11 @@ public class Device implements Serializable { */ @TableField(value = "description") private String description; + /** + * 设备状态 0:离线 1:在线 + */ + @TableField(value = "device_status") + private Integer deviceStatus; @TableField(exist = false) private static final long serialVersionUID = 1L; diff --git a/nex-be/src/main/java/com/unisinsight/project/entity/req/DeviceReq.java b/nex-be/src/main/java/com/unisinsight/project/entity/req/DeviceReq.java index d4da562..4ad56a7 100644 --- a/nex-be/src/main/java/com/unisinsight/project/entity/req/DeviceReq.java +++ b/nex-be/src/main/java/com/unisinsight/project/entity/req/DeviceReq.java @@ -84,6 +84,12 @@ public class DeviceReq implements Serializable { @ApiModelProperty("描述") @JsonProperty("description") private String description; + /** + * 设备状态 0:离线 1:在线 + */ + @ApiModelProperty("设备状态") + @JsonProperty("device_status") + private String deviceStatus; /** * 查询页 diff --git a/nex-be/src/main/java/com/unisinsight/project/grpc/generate/MsgResponse.java b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/MsgResponse.java new file mode 100644 index 0000000..b3b4ddc --- /dev/null +++ b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/MsgResponse.java @@ -0,0 +1,622 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: message.proto + +package com.unisinsight.project.grpc.generate; + +/** + * Protobuf type {@code MsgResponse} + */ +public final class MsgResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:MsgResponse) + MsgResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use MsgResponse.newBuilder() to construct. + private MsgResponse(com.google.protobuf.GeneratedMessageV3.Builder> builder) { + super(builder); + } + private MsgResponse() { + message_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new MsgResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MsgResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + success_ = input.readBool(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + message_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.unisinsight.project.grpc.generate.NotificationProto.internal_static_MsgResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.unisinsight.project.grpc.generate.NotificationProto.internal_static_MsgResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.unisinsight.project.grpc.generate.MsgResponse.class, com.unisinsight.project.grpc.generate.MsgResponse.Builder.class); + } + + public static final int SUCCESS_FIELD_NUMBER = 1; + private boolean success_; + /** + *
bool success = 1;
+ * @return The success.
+ */
+ @java.lang.Override
+ public boolean getSuccess() {
+ return success_;
+ }
+
+ public static final int MESSAGE_FIELD_NUMBER = 2;
+ private volatile java.lang.Object message_;
+ /**
+ * string message = 2;
+ * @return The message.
+ */
+ @java.lang.Override
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ }
+ }
+ /**
+ * string message = 2;
+ * @return The bytes for message.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (success_ != false) {
+ output.writeBool(1, success_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (success_ != false) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(1, success_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof com.unisinsight.project.grpc.generate.MsgResponse)) {
+ return super.equals(obj);
+ }
+ com.unisinsight.project.grpc.generate.MsgResponse other = (com.unisinsight.project.grpc.generate.MsgResponse) obj;
+
+ if (getSuccess()
+ != other.getSuccess()) return false;
+ if (!getMessage()
+ .equals(other.getMessage())) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + SUCCESS_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
+ getSuccess());
+ hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
+ hash = (53 * hash) + getMessage().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.MsgResponse parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(com.unisinsight.project.grpc.generate.MsgResponse prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code MsgResponse}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builderbool success = 1;
+ * @return The success.
+ */
+ @java.lang.Override
+ public boolean getSuccess() {
+ return success_;
+ }
+ /**
+ * bool success = 1;
+ * @param value The success to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSuccess(boolean value) {
+
+ success_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * bool success = 1;
+ * @return This builder for chaining.
+ */
+ public Builder clearSuccess() {
+
+ success_ = false;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object message_ = "";
+ /**
+ * string message = 2;
+ * @return The message.
+ */
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string message = 2;
+ * @return The bytes for message.
+ */
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string message = 2;
+ * @param value The message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessage(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string message = 2;
+ * @return This builder for chaining.
+ */
+ public Builder clearMessage() {
+
+ message_ = getDefaultInstance().getMessage();
+ onChanged();
+ return this;
+ }
+ /**
+ * string message = 2;
+ * @param value The bytes for message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessageBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:MsgResponse)
+ }
+
+ // @@protoc_insertion_point(class_scope:MsgResponse)
+ private static final com.unisinsight.project.grpc.generate.MsgResponse DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new com.unisinsight.project.grpc.generate.MsgResponse();
+ }
+
+ public static com.unisinsight.project.grpc.generate.MsgResponse getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parserbool success = 1;
+ * @return The success.
+ */
+ boolean getSuccess();
+
+ /**
+ * string message = 2;
+ * @return The message.
+ */
+ java.lang.String getMessage();
+ /**
+ * string message = 2;
+ * @return The bytes for message.
+ */
+ com.google.protobuf.ByteString
+ getMessageBytes();
+}
diff --git a/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationMessage.java b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationMessage.java
new file mode 100644
index 0000000..299c044
--- /dev/null
+++ b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationMessage.java
@@ -0,0 +1,962 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: message.proto
+
+package com.unisinsight.project.grpc.generate;
+
+/**
+ * Protobuf type {@code NotificationMessage}
+ */
+public final class NotificationMessage extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:NotificationMessage)
+ NotificationMessageOrBuilder {
+private static final long serialVersionUID = 0L;
+ // Use NotificationMessage.newBuilder() to construct.
+ private NotificationMessage(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private NotificationMessage() {
+ type_ = "";
+ content_ = "";
+ msg_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new NotificationMessage();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private NotificationMessage(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ type_ = s;
+ break;
+ }
+ case 18: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ content_ = s;
+ break;
+ }
+ case 24: {
+
+ timestamp_ = input.readInt64();
+ break;
+ }
+ case 32: {
+
+ code_ = input.readInt32();
+ break;
+ }
+ case 42: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ msg_ = s;
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return com.unisinsight.project.grpc.generate.NotificationProto.internal_static_NotificationMessage_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return com.unisinsight.project.grpc.generate.NotificationProto.internal_static_NotificationMessage_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ com.unisinsight.project.grpc.generate.NotificationMessage.class, com.unisinsight.project.grpc.generate.NotificationMessage.Builder.class);
+ }
+
+ public static final int TYPE_FIELD_NUMBER = 1;
+ private volatile java.lang.Object type_;
+ /**
+ * string type = 1;
+ * @return The type.
+ */
+ @java.lang.Override
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ type_ = s;
+ return s;
+ }
+ }
+ /**
+ * string type = 1;
+ * @return The bytes for type.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int CONTENT_FIELD_NUMBER = 2;
+ private volatile java.lang.Object content_;
+ /**
+ * string content = 2;
+ * @return The content.
+ */
+ @java.lang.Override
+ public java.lang.String getContent() {
+ java.lang.Object ref = content_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ content_ = s;
+ return s;
+ }
+ }
+ /**
+ * string content = 2;
+ * @return The bytes for content.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getContentBytes() {
+ java.lang.Object ref = content_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ content_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int TIMESTAMP_FIELD_NUMBER = 3;
+ private long timestamp_;
+ /**
+ * int64 timestamp = 3;
+ * @return The timestamp.
+ */
+ @java.lang.Override
+ public long getTimestamp() {
+ return timestamp_;
+ }
+
+ public static final int CODE_FIELD_NUMBER = 4;
+ private int code_;
+ /**
+ * int32 code = 4;
+ * @return The code.
+ */
+ @java.lang.Override
+ public int getCode() {
+ return code_;
+ }
+
+ public static final int MSG_FIELD_NUMBER = 5;
+ private volatile java.lang.Object msg_;
+ /**
+ * string msg = 5;
+ * @return The msg.
+ */
+ @java.lang.Override
+ public java.lang.String getMsg() {
+ java.lang.Object ref = msg_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ msg_ = s;
+ return s;
+ }
+ }
+ /**
+ * string msg = 5;
+ * @return The bytes for msg.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getMsgBytes() {
+ java.lang.Object ref = msg_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ msg_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, type_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(content_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, content_);
+ }
+ if (timestamp_ != 0L) {
+ output.writeInt64(3, timestamp_);
+ }
+ if (code_ != 0) {
+ output.writeInt32(4, code_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(msg_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 5, msg_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, type_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(content_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, content_);
+ }
+ if (timestamp_ != 0L) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(3, timestamp_);
+ }
+ if (code_ != 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(4, code_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(msg_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, msg_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof com.unisinsight.project.grpc.generate.NotificationMessage)) {
+ return super.equals(obj);
+ }
+ com.unisinsight.project.grpc.generate.NotificationMessage other = (com.unisinsight.project.grpc.generate.NotificationMessage) obj;
+
+ if (!getType()
+ .equals(other.getType())) return false;
+ if (!getContent()
+ .equals(other.getContent())) return false;
+ if (getTimestamp()
+ != other.getTimestamp()) return false;
+ if (getCode()
+ != other.getCode()) return false;
+ if (!getMsg()
+ .equals(other.getMsg())) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + TYPE_FIELD_NUMBER;
+ hash = (53 * hash) + getType().hashCode();
+ hash = (37 * hash) + CONTENT_FIELD_NUMBER;
+ hash = (53 * hash) + getContent().hashCode();
+ hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getTimestamp());
+ hash = (37 * hash) + CODE_FIELD_NUMBER;
+ hash = (53 * hash) + getCode();
+ hash = (37 * hash) + MSG_FIELD_NUMBER;
+ hash = (53 * hash) + getMsg().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.NotificationMessage parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(com.unisinsight.project.grpc.generate.NotificationMessage prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code NotificationMessage}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builderstring type = 1;
+ * @return The type.
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ type_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string type = 1;
+ * @return The bytes for type.
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string type = 1;
+ * @param value The type to set.
+ * @return This builder for chaining.
+ */
+ public Builder setType(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ type_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string type = 1;
+ * @return This builder for chaining.
+ */
+ public Builder clearType() {
+
+ type_ = getDefaultInstance().getType();
+ onChanged();
+ return this;
+ }
+ /**
+ * string type = 1;
+ * @param value The bytes for type to set.
+ * @return This builder for chaining.
+ */
+ public Builder setTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object content_ = "";
+ /**
+ * string content = 2;
+ * @return The content.
+ */
+ public java.lang.String getContent() {
+ java.lang.Object ref = content_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ content_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string content = 2;
+ * @return The bytes for content.
+ */
+ public com.google.protobuf.ByteString
+ getContentBytes() {
+ java.lang.Object ref = content_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ content_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string content = 2;
+ * @param value The content to set.
+ * @return This builder for chaining.
+ */
+ public Builder setContent(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ content_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string content = 2;
+ * @return This builder for chaining.
+ */
+ public Builder clearContent() {
+
+ content_ = getDefaultInstance().getContent();
+ onChanged();
+ return this;
+ }
+ /**
+ * string content = 2;
+ * @param value The bytes for content to set.
+ * @return This builder for chaining.
+ */
+ public Builder setContentBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ content_ = value;
+ onChanged();
+ return this;
+ }
+
+ private long timestamp_ ;
+ /**
+ * int64 timestamp = 3;
+ * @return The timestamp.
+ */
+ @java.lang.Override
+ public long getTimestamp() {
+ return timestamp_;
+ }
+ /**
+ * int64 timestamp = 3;
+ * @param value The timestamp to set.
+ * @return This builder for chaining.
+ */
+ public Builder setTimestamp(long value) {
+
+ timestamp_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * int64 timestamp = 3;
+ * @return This builder for chaining.
+ */
+ public Builder clearTimestamp() {
+
+ timestamp_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ private int code_ ;
+ /**
+ * int32 code = 4;
+ * @return The code.
+ */
+ @java.lang.Override
+ public int getCode() {
+ return code_;
+ }
+ /**
+ * int32 code = 4;
+ * @param value The code to set.
+ * @return This builder for chaining.
+ */
+ public Builder setCode(int value) {
+
+ code_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * int32 code = 4;
+ * @return This builder for chaining.
+ */
+ public Builder clearCode() {
+
+ code_ = 0;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object msg_ = "";
+ /**
+ * string msg = 5;
+ * @return The msg.
+ */
+ public java.lang.String getMsg() {
+ java.lang.Object ref = msg_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ msg_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string msg = 5;
+ * @return The bytes for msg.
+ */
+ public com.google.protobuf.ByteString
+ getMsgBytes() {
+ java.lang.Object ref = msg_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ msg_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string msg = 5;
+ * @param value The msg to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMsg(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ msg_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string msg = 5;
+ * @return This builder for chaining.
+ */
+ public Builder clearMsg() {
+
+ msg_ = getDefaultInstance().getMsg();
+ onChanged();
+ return this;
+ }
+ /**
+ * string msg = 5;
+ * @param value The bytes for msg to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMsgBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ msg_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:NotificationMessage)
+ }
+
+ // @@protoc_insertion_point(class_scope:NotificationMessage)
+ private static final com.unisinsight.project.grpc.generate.NotificationMessage DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new com.unisinsight.project.grpc.generate.NotificationMessage();
+ }
+
+ public static com.unisinsight.project.grpc.generate.NotificationMessage getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parserstring type = 1;
+ * @return The type.
+ */
+ java.lang.String getType();
+ /**
+ * string type = 1;
+ * @return The bytes for type.
+ */
+ com.google.protobuf.ByteString
+ getTypeBytes();
+
+ /**
+ * string content = 2;
+ * @return The content.
+ */
+ java.lang.String getContent();
+ /**
+ * string content = 2;
+ * @return The bytes for content.
+ */
+ com.google.protobuf.ByteString
+ getContentBytes();
+
+ /**
+ * int64 timestamp = 3;
+ * @return The timestamp.
+ */
+ long getTimestamp();
+
+ /**
+ * int32 code = 4;
+ * @return The code.
+ */
+ int getCode();
+
+ /**
+ * string msg = 5;
+ * @return The msg.
+ */
+ java.lang.String getMsg();
+ /**
+ * string msg = 5;
+ * @return The bytes for msg.
+ */
+ com.google.protobuf.ByteString
+ getMsgBytes();
+}
diff --git a/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationProto.java b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationProto.java
new file mode 100644
index 0000000..5e3f656
--- /dev/null
+++ b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationProto.java
@@ -0,0 +1,78 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: message.proto
+
+package com.unisinsight.project.grpc.generate;
+
+public final class NotificationProto {
+ private NotificationProto() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_RegisterRequest_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_RegisterRequest_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_NotificationMessage_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_NotificationMessage_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_MsgResponse_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_MsgResponse_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\rmessage.proto\"8\n\017RegisterRequest\022\021\n\tcl" +
+ "ient_sn\030\001 \001(\t\022\022\n\nclient_mac\030\002 \001(\t\"b\n\023Not" +
+ "ificationMessage\022\014\n\004type\030\001 \001(\t\022\017\n\007conten" +
+ "t\030\002 \001(\t\022\021\n\ttimestamp\030\003 \001(\003\022\014\n\004code\030\004 \001(\005" +
+ "\022\013\n\003msg\030\005 \001(\t\"/\n\013MsgResponse\022\017\n\007success\030" +
+ "\001 \001(\010\022\017\n\007message\030\002 \001(\t2\213\001\n\023NotificationS" +
+ "ervice\022:\n\016RegisterStream\022\020.RegisterReque" +
+ "st\032\024.NotificationMessage0\001\0228\n\016shutdownCl" +
+ "ient\022\020.RegisterRequest\032\024.NotificationMes" +
+ "sageB<\n%com.unisinsight.project.grpc.gen" +
+ "erateB\021NotificationProtoP\001b\006proto3"
+ };
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ });
+ internal_static_RegisterRequest_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_RegisterRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_RegisterRequest_descriptor,
+ new java.lang.String[] { "ClientSn", "ClientMac", });
+ internal_static_NotificationMessage_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_NotificationMessage_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_NotificationMessage_descriptor,
+ new java.lang.String[] { "Type", "Content", "Timestamp", "Code", "Msg", });
+ internal_static_MsgResponse_descriptor =
+ getDescriptor().getMessageTypes().get(2);
+ internal_static_MsgResponse_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_MsgResponse_descriptor,
+ new java.lang.String[] { "Success", "Message", });
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationServiceGrpc.java b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationServiceGrpc.java
new file mode 100644
index 0000000..22b08d5
--- /dev/null
+++ b/nex-be/src/main/java/com/unisinsight/project/grpc/generate/NotificationServiceGrpc.java
@@ -0,0 +1,364 @@
+package com.unisinsight.project.grpc.generate;
+
+import static io.grpc.MethodDescriptor.generateFullMethodName;
+
+/**
+ */
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler (version 1.50.0)",
+ comments = "Source: message.proto")
+@io.grpc.stub.annotations.GrpcGenerated
+public final class NotificationServiceGrpc {
+
+ private NotificationServiceGrpc() {}
+
+ public static final String SERVICE_NAME = "NotificationService";
+
+ // Static method descriptors that strictly reflect the proto.
+ private static volatile io.grpc.MethodDescriptor+ * 客户端注册长连接 + *+ */ + public void registerStream(com.unisinsight.project.grpc.generate.RegisterRequest request, + io.grpc.stub.StreamObserver
+ * 客户端关闭连接 + *+ */ + public void shutdownClient(com.unisinsight.project.grpc.generate.RegisterRequest request, + io.grpc.stub.StreamObserver
+ * 客户端注册长连接 + *+ */ + public void registerStream(com.unisinsight.project.grpc.generate.RegisterRequest request, + io.grpc.stub.StreamObserver
+ * 客户端关闭连接 + *+ */ + public void shutdownClient(com.unisinsight.project.grpc.generate.RegisterRequest request, + io.grpc.stub.StreamObserver
+ * 客户端注册长连接 + *+ */ + public java.util.Iterator
+ * 客户端关闭连接 + *+ */ + public com.unisinsight.project.grpc.generate.NotificationMessage shutdownClient(com.unisinsight.project.grpc.generate.RegisterRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getShutdownClientMethod(), getCallOptions(), request); + } + } + + /** + */ + public static final class NotificationServiceFutureStub extends io.grpc.stub.AbstractFutureStub
+ * 客户端关闭连接 + *+ */ + public com.google.common.util.concurrent.ListenableFuture
string client_sn = 1;
+ * @return The clientSn.
+ */
+ @java.lang.Override
+ public java.lang.String getClientSn() {
+ java.lang.Object ref = clientSn_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ clientSn_ = s;
+ return s;
+ }
+ }
+ /**
+ * string client_sn = 1;
+ * @return The bytes for clientSn.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getClientSnBytes() {
+ java.lang.Object ref = clientSn_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ clientSn_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int CLIENT_MAC_FIELD_NUMBER = 2;
+ private volatile java.lang.Object clientMac_;
+ /**
+ * string client_mac = 2;
+ * @return The clientMac.
+ */
+ @java.lang.Override
+ public java.lang.String getClientMac() {
+ java.lang.Object ref = clientMac_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ clientMac_ = s;
+ return s;
+ }
+ }
+ /**
+ * string client_mac = 2;
+ * @return The bytes for clientMac.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getClientMacBytes() {
+ java.lang.Object ref = clientMac_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ clientMac_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(clientSn_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, clientSn_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(clientMac_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, clientMac_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(clientSn_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, clientSn_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(clientMac_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, clientMac_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof com.unisinsight.project.grpc.generate.RegisterRequest)) {
+ return super.equals(obj);
+ }
+ com.unisinsight.project.grpc.generate.RegisterRequest other = (com.unisinsight.project.grpc.generate.RegisterRequest) obj;
+
+ if (!getClientSn()
+ .equals(other.getClientSn())) return false;
+ if (!getClientMac()
+ .equals(other.getClientMac())) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + CLIENT_SN_FIELD_NUMBER;
+ hash = (53 * hash) + getClientSn().hashCode();
+ hash = (37 * hash) + CLIENT_MAC_FIELD_NUMBER;
+ hash = (53 * hash) + getClientMac().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static com.unisinsight.project.grpc.generate.RegisterRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(com.unisinsight.project.grpc.generate.RegisterRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code RegisterRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builderstring client_sn = 1;
+ * @return The clientSn.
+ */
+ public java.lang.String getClientSn() {
+ java.lang.Object ref = clientSn_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ clientSn_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string client_sn = 1;
+ * @return The bytes for clientSn.
+ */
+ public com.google.protobuf.ByteString
+ getClientSnBytes() {
+ java.lang.Object ref = clientSn_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ clientSn_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string client_sn = 1;
+ * @param value The clientSn to set.
+ * @return This builder for chaining.
+ */
+ public Builder setClientSn(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ clientSn_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string client_sn = 1;
+ * @return This builder for chaining.
+ */
+ public Builder clearClientSn() {
+
+ clientSn_ = getDefaultInstance().getClientSn();
+ onChanged();
+ return this;
+ }
+ /**
+ * string client_sn = 1;
+ * @param value The bytes for clientSn to set.
+ * @return This builder for chaining.
+ */
+ public Builder setClientSnBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ clientSn_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object clientMac_ = "";
+ /**
+ * string client_mac = 2;
+ * @return The clientMac.
+ */
+ public java.lang.String getClientMac() {
+ java.lang.Object ref = clientMac_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ clientMac_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string client_mac = 2;
+ * @return The bytes for clientMac.
+ */
+ public com.google.protobuf.ByteString
+ getClientMacBytes() {
+ java.lang.Object ref = clientMac_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ clientMac_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string client_mac = 2;
+ * @param value The clientMac to set.
+ * @return This builder for chaining.
+ */
+ public Builder setClientMac(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ clientMac_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string client_mac = 2;
+ * @return This builder for chaining.
+ */
+ public Builder clearClientMac() {
+
+ clientMac_ = getDefaultInstance().getClientMac();
+ onChanged();
+ return this;
+ }
+ /**
+ * string client_mac = 2;
+ * @param value The bytes for clientMac to set.
+ * @return This builder for chaining.
+ */
+ public Builder setClientMacBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ clientMac_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:RegisterRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:RegisterRequest)
+ private static final com.unisinsight.project.grpc.generate.RegisterRequest DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new com.unisinsight.project.grpc.generate.RegisterRequest();
+ }
+
+ public static com.unisinsight.project.grpc.generate.RegisterRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parserstring client_sn = 1;
+ * @return The clientSn.
+ */
+ java.lang.String getClientSn();
+ /**
+ * string client_sn = 1;
+ * @return The bytes for clientSn.
+ */
+ com.google.protobuf.ByteString
+ getClientSnBytes();
+
+ /**
+ * string client_mac = 2;
+ * @return The clientMac.
+ */
+ java.lang.String getClientMac();
+ /**
+ * string client_mac = 2;
+ * @return The bytes for clientMac.
+ */
+ com.google.protobuf.ByteString
+ getClientMacBytes();
+}
diff --git a/nex-be/src/main/java/com/unisinsight/project/grpc/proto/message.proto b/nex-be/src/main/java/com/unisinsight/project/grpc/proto/message.proto
new file mode 100644
index 0000000..016e612
--- /dev/null
+++ b/nex-be/src/main/java/com/unisinsight/project/grpc/proto/message.proto
@@ -0,0 +1,31 @@
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "com.unisinsight.project.grpc.generate";
+option java_outer_classname = "NotificationProto";
+
+service NotificationService {
+ // 客户端注册长连接
+ rpc RegisterStream (RegisterRequest) returns (stream NotificationMessage);
+ // 客户端关闭连接
+ rpc shutdownClient (RegisterRequest) returns (NotificationMessage);
+}
+
+message RegisterRequest {
+ string client_sn = 1;
+ string client_mac = 2;
+}
+
+message NotificationMessage {
+
+ string type = 1;
+ string content = 2;
+ int64 timestamp = 3;
+ int32 code=4;
+ string msg=5;
+}
+
+message MsgResponse {
+ bool success = 1;
+ string message = 2;
+}
\ No newline at end of file
diff --git a/nex-be/src/main/java/com/unisinsight/project/grpc/service/ClientNotificationServiceImpl.java b/nex-be/src/main/java/com/unisinsight/project/grpc/service/ClientNotificationServiceImpl.java
new file mode 100644
index 0000000..b12d811
--- /dev/null
+++ b/nex-be/src/main/java/com/unisinsight/project/grpc/service/ClientNotificationServiceImpl.java
@@ -0,0 +1,213 @@
+
+package com.unisinsight.project.grpc.service;
+
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.unisinsight.project.entity.dao.Device;
+import com.unisinsight.project.exception.BaseErrorCode;
+import com.unisinsight.project.exception.Result;
+import com.unisinsight.project.grpc.generate.NotificationMessage;
+import com.unisinsight.project.grpc.generate.NotificationServiceGrpc;
+import com.unisinsight.project.grpc.generate.RegisterRequest;
+import com.unisinsight.project.service.DeviceService;
+import com.unisinsight.project.util.StringUtil;
+import io.grpc.stub.StreamObserver;
+import lombok.extern.slf4j.Slf4j;
+import net.devh.boot.grpc.server.service.GrpcService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.http.HttpStatus;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * @author : ch
+ * @version : 1.0
+ * @ClassName : ClientNotificationServiceImpl
+ * @Description :
+ * @DATE : Created in 9:17 2025/8/21
+ * Copyright: Copyright(c) 2025+ *
Company : 紫光汇智信息技术有限公司+ * Modification History: + * Date Author Version Discription + * -------------------------------------------------------------------------- + * 2025/08/21 ch 1.0 Why & What is modified: <修改原因描述> * + */ +@GrpcService +@Slf4j +public class ClientNotificationServiceImpl extends NotificationServiceGrpc.NotificationServiceImplBase implements SendNotificationService { + // 保存客户端连接的映射表 + private final ConcurrentHashMap
Copyright: Copyright(c) 2025+ *
Company : 紫光汇智信息技术有限公司+ * Modification History: + * Date Author Version Discription + * -------------------------------------------------------------------------- + * 2025/08/21 ch 1.0 Why & What is modified: <修改原因描述> * + */ +public interface SendNotificationService { + Result> sendNotification(String clientId, NotificationMessage notification); +} diff --git a/nex-be/src/main/java/com/unisinsight/project/service/ClientOperateService.java b/nex-be/src/main/java/com/unisinsight/project/service/ClientOperateService.java new file mode 100644 index 0000000..6bcf794 --- /dev/null +++ b/nex-be/src/main/java/com/unisinsight/project/service/ClientOperateService.java @@ -0,0 +1,25 @@ +package com.unisinsight.project.service; + + +import com.unisinsight.project.entity.req.DeviceReq; +import com.unisinsight.project.exception.Result; + +/** + * @author : ch + * @version : 1.0 + * @ClassName : ClientOperateService + * @Description : + * @DATE : Created in 17:06 2025/8/21 + *
Copyright: Copyright(c) 2025+ *
Company : 紫光汇智信息技术有限公司+ * Modification History: + * Date Author Version Discription + * -------------------------------------------------------------------------- + * 2025/08/21 ch 1.0 Why & What is modified: <修改原因描述> * + */ +public interface ClientOperateService { + + Result> terminalStart(DeviceReq deviceReq); + + Result> terminalEnd(DeviceReq deviceReq); +} diff --git a/nex-be/src/main/java/com/unisinsight/project/service/impl/ClientOperateServiceImpl.java b/nex-be/src/main/java/com/unisinsight/project/service/impl/ClientOperateServiceImpl.java new file mode 100644 index 0000000..b4defb5 --- /dev/null +++ b/nex-be/src/main/java/com/unisinsight/project/service/impl/ClientOperateServiceImpl.java @@ -0,0 +1,41 @@ +package com.unisinsight.project.service.impl; + + +import com.unisinsight.project.entity.req.DeviceReq; +import com.unisinsight.project.exception.Result; +import com.unisinsight.project.grpc.generate.NotificationMessage; +import com.unisinsight.project.grpc.service.SendNotificationService; +import com.unisinsight.project.service.ClientOperateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author : ch + * @version : 1.0 + * @ClassName : ClientOperateServiceImpl + * @Description : + * @DATE : Created in 17:07 2025/8/21 + *
Copyright: Copyright(c) 2025+ *
Company : 紫光汇智信息技术有限公司+ * Modification History: + * Date Author Version Discription + * -------------------------------------------------------------------------- + * 2025/08/21 ch 1.0 Why & What is modified: <修改原因描述> * + */ +@Service +public class ClientOperateServiceImpl implements ClientOperateService { + + @Autowired + private SendNotificationService notificationService; + @Override + public Result> terminalStart(DeviceReq deviceReq) { + //todo 待客户端确认消息内容后完善 + return notificationService.sendNotification(deviceReq.getDeviceId(), NotificationMessage.newBuilder().setContent("终端开机").build()); + } + + @Override + public Result> terminalEnd(DeviceReq deviceReq) { + //todo 待客户端确认消息内容后完善 + return notificationService.sendNotification(deviceReq.getDeviceId(), NotificationMessage.newBuilder().setContent("终端关机").build()); + } +} diff --git a/nex-be/src/main/java/com/unisinsight/project/service/impl/DeviceServiceImpl.java b/nex-be/src/main/java/com/unisinsight/project/service/impl/DeviceServiceImpl.java index b92bc78..4440733 100644 --- a/nex-be/src/main/java/com/unisinsight/project/service/impl/DeviceServiceImpl.java +++ b/nex-be/src/main/java/com/unisinsight/project/service/impl/DeviceServiceImpl.java @@ -99,6 +99,7 @@ public class DeviceServiceImpl extends ServiceImpl