From dda268997ca8f8a364f7c19b45d7a43a50a98efe Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 25 十月 2022 18:00:11 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportErrorService.java | 48 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportErrorService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportErrorService.java
index 5e5556a..4f1fdb2 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportErrorService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportErrorService.java
@@ -1,22 +1,34 @@
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.A5Frame;
import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightErrorCodeReportInnerFrame;
+import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightOperationReportInnerFrame;
+import com.sandu.ximon.admin.manager.iot.frame.inner.request.A5LightCleanErrorCodeInnerFrame;
+import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame;
+import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum;
import com.sandu.ximon.admin.manager.iot.rrpc.enums.LightErrorEnum;
+import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService;
import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.ListPagingUtils;
+import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils;
import com.sandu.ximon.dao.bo.LightReportErrorBo;
import com.sandu.ximon.dao.domain.LightReportError;
import com.sandu.ximon.dao.mapper.LightReportErrorMapper;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
+import java.util.stream.Collectors;
/**
* @author chenjiantian
* @date 2021/12/17 17:47
*/
+@Slf4j
@Service
public class LightReportErrorService extends BaseServiceImpl<LightReportErrorMapper, LightReportError> {
@@ -24,6 +36,7 @@
LightReportError lightReportError = new LightReportError();
lightReportError.setDeviceCode(deviceName);
lightReportError.setErrorCode(codeRespInnerFrame.getErrorCode());
+ lightReportError.setLightAddress(codeRespInnerFrame.getDestinationAddress());
save(lightReportError);
}
@@ -43,7 +56,7 @@
LightErrorEnum[] values = LightErrorEnum.values();
for (LightErrorEnum value : values) {
if ((value.getCode() & errorCode) > 0) {
- sb.append(value.getMessage());
+ sb.append(value.getMessage() + ";");
}
}
lightReportErrorBo.setErrorMsg(sb.toString());
@@ -56,11 +69,12 @@
*
* @return
*/
- public List<LightReportErrorBo> queryErrorCode(BaseConditionVO baseConditionVO) {
-
- PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+ public CommonPage queryErrorCode(BaseConditionVO baseConditionVO) {
List<LightReportErrorBo> lightReportErrorBos = baseMapper.listError(SecurityUtils.getClientId());
- for (LightReportErrorBo lightReportErrorBo : lightReportErrorBos) {
+ lightReportErrorBos = lightReportErrorBos.stream().filter(bean -> bean.getErrorCode() != 0).collect(Collectors.toList());
+ CommonPage commonPage = ListPagingUtils.pages(lightReportErrorBos, baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+
+ for (LightReportErrorBo lightReportErrorBo : (List<LightReportErrorBo>) commonPage.getList()) {
Integer errorCode = lightReportErrorBo.getErrorCode();
StringBuilder sb = new StringBuilder();
LightErrorEnum[] values = LightErrorEnum.values();
@@ -71,7 +85,29 @@
}
lightReportErrorBo.setErrorMsg(sb.toString());
}
- return lightReportErrorBos;
+ return commonPage;
}
+ /**
+ * 娓呴櫎鏁呴殰鐮�
+ *
+ * @param deviceName
+ * @param address
+ */
+ public void cleanErrorCode(String deviceName, String address) {
+ A5LightCleanErrorCodeInnerFrame a5LightCleanErrorCodeInnerFram = new A5LightCleanErrorCodeInnerFrame(address);
+
+ A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_LIGHT_DATA.getCode(), a5LightCleanErrorCodeInnerFram);
+ System.out.println(a5Frame + " -----a5Frame");
+
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(deviceName, "鍗曠伅甯�-鍗曠伅鏁呴殰娓呴櫎", a5Frame, commonFrame);
+
+ System.out.println(commonFrame + " -----commonFrame");
+ A5LightOperationReportInnerFrame operationReportInnerFrame = new A5LightOperationReportInnerFrame().transformFrame(commonFrame.getPayload());
+ if (operationReportInnerFrame.isValidate()) {
+ log.error("娓呴櫎鏁呴殰鐮佹垚鍔燂紝code锛�" + deviceName + "锛岀伅澶村湴鍧�锛�" + address);
+ }
+ }
}
+
--
Gitblit v1.9.3