Sfoglia il codice sorgente

报错类型修改

gaodm 5 anni fa
parent
commit
6b04b98b80

+ 40 - 0
prec-service/src/main/java/com/diagbot/exception/ServiceErrorCode.java

@@ -0,0 +1,40 @@
+package com.diagbot.exception;
+
+/**
+ * @Description: 本服务错误码
+ * 系统码(3位) + 等级码(1位) + 4位顺序号
+ * 系统码 通用码 000;用户中心 100; 管理中心 200;
+ * @author: gaodm
+ * @time: 2018/9/10 11:11
+ */
+public enum ServiceErrorCode implements ErrorCode {
+    IDCARD_LOGIN("17020000", "请使用身份证号码登录"),
+    IQC_NOT_FOUND("17020001", "就诊号不存在");
+
+    private String code;
+    private String msg;
+
+
+    ServiceErrorCode(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public static ServiceErrorCode codeOf(String code) {
+        for (ServiceErrorCode state : values()) {
+            if (state.getCode() == code) {
+                return state;
+            }
+        }
+        return null;
+    }
+}