From 8dcbf0608171abce431df0356f11efbbc6c2de40 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期三, 27 七月 2022 15:45:52 +0800
Subject: [PATCH] 充电桩故障存储

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3mReportErrorService.java |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3mReportErrorService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3mReportErrorService.java
index fd40653..419af4e 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3mReportErrorService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3mReportErrorService.java
@@ -1,8 +1,11 @@
 package com.sandu.ximon.admin.service;
 
 import com.sandu.common.service.impl.BaseServiceImpl;
+import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3ErrorCodeReportInnerFrame;
+import com.sandu.ximon.admin.manager.iot.rrpc.enums.C3ErrorEnum;
 import com.sandu.ximon.dao.domain.C3mReportError;
 import com.sandu.ximon.dao.mapper.C3mReportErrorMapper;
+import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
 /**
@@ -10,7 +13,28 @@
  * @date 2022/7/27
  */
 @Service
+@AllArgsConstructor
 public class C3mReportErrorService extends BaseServiceImpl<C3mReportErrorMapper, C3mReportError> {
 
+    /**
+     * 淇濆瓨鍏呯數妗╂晠闅滀俊鎭�
+     *
+     * @param codeRespInnerFrame
+     */
+    public void saveReportError(A5C3ErrorCodeReportInnerFrame codeRespInnerFrame) {
+        C3mReportError c3MReportError = new C3mReportError();
+        c3MReportError.setC3Mac(codeRespInnerFrame.getDestinationAddress());
+        c3MReportError.setErrorCode(codeRespInnerFrame.getErrorCode());
 
+        StringBuilder sb = new StringBuilder();
+        Integer errorCode = codeRespInnerFrame.getErrorCode();
+        C3ErrorEnum[] values = C3ErrorEnum.values();
+        for (C3ErrorEnum value : values) {
+            if ((value.getCode() & errorCode) > 0) {
+                sb.append(value.getMessage());
+            }
+        }
+        c3MReportError.setErrorMsg(sb.toString());
+        save(c3MReportError);
+    }
 }

--
Gitblit v1.9.3