|
@@ -0,0 +1,91 @@
|
|
|
+package com.qmth.themis.exam.enums;
|
|
|
+
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+
|
|
|
+ * @Description: webSocket消息类型 enum
|
|
|
+ * @Param:
|
|
|
+ * @return:
|
|
|
+ * @Author: wangliang
|
|
|
+ * @Date: 2020/7/22
|
|
|
+ */
|
|
|
+public enum WebsocketTypeEnum {
|
|
|
+
|
|
|
+ client_paper_download(0, "客户端已下载试卷"),
|
|
|
+
|
|
|
+ sync_status(1, "状态同步"),
|
|
|
+
|
|
|
+ sync_ack(2, "同步确认"),
|
|
|
+
|
|
|
+ invigilate_liveness_verify(3, "监考强制活体验证"),
|
|
|
+
|
|
|
+ invigilate_notice(4, "监考消息"),
|
|
|
+
|
|
|
+ invigilate_notice_ack(5, "监考消息确认"),
|
|
|
+
|
|
|
+ invigilate_stop_exam(6, "监考强制收卷");
|
|
|
+
|
|
|
+ private int id;
|
|
|
+ private String code;
|
|
|
+
|
|
|
+ private WebsocketTypeEnum(int id, String code) {
|
|
|
+ this.id = id;
|
|
|
+ this.code = code;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 状态转换 toId
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String convertToCode(String value) {
|
|
|
+ if (Objects.equals(value.trim(), client_paper_download.name())) {
|
|
|
+ return client_paper_download.getCode();
|
|
|
+ } else if (Objects.equals(value.trim(), sync_status.name())) {
|
|
|
+ return sync_status.getCode();
|
|
|
+ } else if (Objects.equals(value.trim(), sync_ack.name())) {
|
|
|
+ return sync_ack.getCode();
|
|
|
+ } else if (Objects.equals(value.trim(), invigilate_liveness_verify.name())) {
|
|
|
+ return invigilate_liveness_verify.getCode();
|
|
|
+ } else if (Objects.equals(value.trim(), invigilate_notice.name())) {
|
|
|
+ return invigilate_notice.getCode();
|
|
|
+ } else if (Objects.equals(value.trim(), invigilate_notice_ack.name())) {
|
|
|
+ return invigilate_notice_ack.getCode();
|
|
|
+ } else {
|
|
|
+ return invigilate_stop_exam.getCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 状态转换 toName
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String convertToName(String value) {
|
|
|
+ if (Objects.equals(value.trim(), client_paper_download.getCode())) {
|
|
|
+ return client_paper_download.name();
|
|
|
+ } else if (Objects.equals(value.trim(), sync_status.getCode())) {
|
|
|
+ return sync_status.name();
|
|
|
+ } else if (Objects.equals(value.trim(), sync_ack.getCode())) {
|
|
|
+ return sync_ack.name();
|
|
|
+ } else if (Objects.equals(value.trim(), invigilate_liveness_verify.getCode())) {
|
|
|
+ return invigilate_liveness_verify.name();
|
|
|
+ } else if (Objects.equals(value.trim(), invigilate_notice.getCode())) {
|
|
|
+ return invigilate_notice.name();
|
|
|
+ } else if (Objects.equals(value.trim(), invigilate_notice_ack.getCode())) {
|
|
|
+ return invigilate_notice_ack.name();
|
|
|
+ } else {
|
|
|
+ return invigilate_stop_exam.name();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getId() {
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getCode() {
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+}
|