1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| package com.nova.sankuai.domain.enums.alipayrefund;
|
| import com.fasterxml.jackson.annotation.JsonCreator;
| import com.fasterxml.jackson.annotation.JsonValue;
|
| import java.util.Arrays;
|
| public enum RefundStatus {
| CREATED(0, "已创建请求"),
| REFUNDED(1, "已退款"),
| CANCELED(2, "已取消");
|
| private final int code;
| private final String desc;
|
| RefundStatus(int code, String desc) {
| this.code = code;
| this.desc = desc;
| }
|
| @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
| public static RefundStatus fromCode(Integer code) {
| return Arrays.stream(values())
| .filter(it -> code != null && it.code == code)
| .findAny()
| .orElse(null);
| }
|
| public int getCode() {
| return code;
| }
|
| @JsonValue
| public String getDesc() {
| return desc;
| }
| }
|
|