| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | * @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); |
| | | } |
| | | } |