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
63
64
65
66
67
package org.jeecg.modules.dnc.response;
 
import com.google.common.collect.ImmutableMap;
import io.swagger.annotations.ApiModelProperty;
import lombok.ToString;
 
/**
 * Created by admin on 2018/3/5.
 */
@ToString
public enum UcenterCode implements ResultCode {
    UCENTER_USERNAME_NONE(false,23001,"请输入账号!"),
    UCENTER_PASSWORD_NONE(false,23002,"请输入密码!"),
    UCENTER_VERIFY_CODE_NONE(false,23003,"请输入验证码!"),
    UCENTER_ACCOUNT_NOT_EXIST(false,23004,"账号不存在!"),
    UCENTER_CREDENTIAL_ERROR(false,23005,"账号或密码错误!"),
    UCENTER_LOGIN_ERROR(false,23006,"登陆过程出现异常请尝试重新操作!"),
    UCENTER_PASSWORD_ERROR(false, 23007, "原密码错误!"),
    UCENTER_USER_ID_NONE(false, 23008, "用户ID不能为空!"),
    UCENTER_USER_NOT_EXIST(false, 23009, "用户不存在!"),
    UCENTER_USER_EXIST(false, 23010, "用户已存在!"),
    UCENTER_ROLE_NONE(false, 23011, "指定的角色不合法!"),
    UCENTER_DEPART_NONE(false, 23012, "指定的部门不合法!"),
    UCENTER_ACT_EXIST(false, 23013, "用户有关联的流程审批人!"),
    UCENTER_PRODUCT_EXIST(false, 23014, "用户有关联的产品树权限!"),
    UCENTER_DEVICE_EXIST(false, 23015, "用户有关联的设备树权限!");
 
    //操作代码
    @ApiModelProperty(value = "操作是否成功", example = "true", required = true)
    boolean success;
 
    //操作代码
    @ApiModelProperty(value = "操作代码", example = "22001", required = true)
    int code;
    //提示信息
    @ApiModelProperty(value = "操作提示", example = "操作过于频繁!", required = true)
    String message;
    private UcenterCode(boolean success, int code, String message){
        this.success = success;
        this.code = code;
        this.message = message;
    }
    private static final ImmutableMap<Integer, UcenterCode> CACHE;
 
    static {
        final ImmutableMap.Builder<Integer, UcenterCode> builder = ImmutableMap.builder();
        for (UcenterCode commonCode : values()) {
            builder.put(commonCode.code(), commonCode);
        }
        CACHE = builder.build();
    }
 
    @Override
    public boolean success() {
        return success;
    }
 
    @Override
    public int code() {
        return code;
    }
 
    @Override
    public String message() {
        return message;
    }
}