| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | 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.admin.manager.iot.rrpc.enums.LightErrorEnum; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.bo.C3ReportErrorBo; |
| | | import com.sandu.ximon.dao.bo.LightReportErrorBo; |
| | | import com.sandu.ximon.dao.domain.C3mReportError; |
| | | import com.sandu.ximon.dao.mapper.C3mReportErrorMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | |
| | | 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()); |
| | | c3MReportError.setErrorMsg(codeRespInnerFrame.getErrorMessage()); |
| | | save(c3MReportError); |
| | | } |
| | | |
| | | public List<C3ReportErrorBo> listReportError(BaseConditionVO baseConditionVO) { |
| | | List<C3ReportErrorBo> c3ReportErrorBos; |
| | | //为null的话是超管 |
| | | if (SecurityUtils.getClientId() == null) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | c3ReportErrorBos = baseMapper.listReportError(null); |
| | | } else { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | c3ReportErrorBos = baseMapper.listReportError(SecurityUtils.getUserId()); |
| | | } |
| | | |
| | | return c3ReportErrorBos; |
| | | } |
| | | } |