办学质量监测教学评价系统
ageer
2024-02-27 a079ef44e53acd9e8df51dbb31cf5aea4f9be5bd
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.xmzs.midjourney.result;
 
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
 
import java.util.HashMap;
import java.util.Map;
 
@Data
@ApiModel("提交结果")
public class SubmitResultVO {
 
    @ApiModelProperty(value = "状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误)", required = true, example = "1")
    private int code;
 
    @ApiModelProperty(value = "描述", required = true, example = "提交成功")
    private String description;
 
    @ApiModelProperty(value = "任务ID", example = "1320098173412546")
    private String result;
 
    @ApiModelProperty(value = "扩展字段")
    private Map<String, Object> properties = new HashMap<>();
 
    public SubmitResultVO setProperty(String name, Object value) {
        this.properties.put(name, value);
        return this;
    }
 
    public SubmitResultVO removeProperty(String name) {
        this.properties.remove(name);
        return this;
    }
 
    public Object getProperty(String name) {
        return this.properties.get(name);
    }
 
    @SuppressWarnings("unchecked")
    public <T> T getPropertyGeneric(String name) {
        return (T) getProperty(name);
    }
 
    public <T> T getProperty(String name, Class<T> clz) {
        return clz.cast(getProperty(name));
    }
 
    public static SubmitResultVO of(int code, String description, String result) {
        return new SubmitResultVO(code, description, result);
    }
 
    public static SubmitResultVO fail(int code, String description) {
        return new SubmitResultVO(code, description, null);
    }
 
    private SubmitResultVO(int code, String description, String result) {
        this.code = code;
        this.description = description;
        this.result = result;
    }
}