Commit fe0efd26ea7a501a50597fb773d5614047154b34

Authored by 云中非
1 parent 367cf61e

refactor: RPC状态返回中文名称

1 1 package org.thingsboard.server.common.data.yunteng.dto;
2 2
3   -import com.fasterxml.jackson.annotation.JsonFormat;
4 3 import com.fasterxml.jackson.databind.JsonNode;
5   -import com.fasterxml.jackson.databind.annotation.JsonSerialize;
6   -import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
7 4 import io.swagger.annotations.ApiModelProperty;
8 5 import lombok.Data;
9   -import lombok.EqualsAndHashCode;
10   -import org.thingsboard.server.common.data.TenantProfile;
11   -import org.thingsboard.server.common.data.rpc.RpcStatus;
12 6 import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum;
13   -import org.thingsboard.server.common.data.yunteng.enums.LoginMethodEnum;
14   -import org.thingsboard.server.common.data.yunteng.enums.ThirdPlatformEnum;
15   -
16   -import javax.validation.constraints.NotEmpty;
17   -import java.time.LocalDateTime;
  7 +import org.thingsboard.server.common.data.yunteng.enums.YtRpcStatus;
18 8
19 9 /**
20 10 * @author Administrator
... ... @@ -54,9 +44,12 @@ public class YtRpcRecordDTO {
54 44 @ApiModelProperty(value = "RPC扩展信息")
55 45 private JsonNode additionalInfo;
56 46 @ApiModelProperty(value = "RPC状态")
57   - private RpcStatus status;
58   -
  47 + private YtRpcStatus status;
59 48
60 49
  50 + private String statusName;
61 51
  52 + public String getStatusName() {
  53 + return YtRpcStatus.getLabel(status.name());
  54 + }
62 55 }
... ...
  1 +/**
  2 + * Copyright © 2016-2021 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.server.common.data.yunteng.enums;
  17 +
  18 +public enum YtRpcStatus {
  19 + QUEUED("队列中"), SENT("已发送"), DELIVERED("处理中"), SUCCESSFUL("成功"), TIMEOUT("超时"), EXPIRED("过期"), FAILED("失败");
  20 +
  21 + String label;
  22 + YtRpcStatus(String label){
  23 + this.label= label;
  24 + }
  25 + public static String getLabel(String name){
  26 + for(YtRpcStatus type:values()){
  27 + if(type.name().equals(name)){
  28 + return type.label;
  29 + }
  30 + }
  31 + return null;
  32 + }
  33 +}
... ...