From 7ec3683c8e41460f4bb0bd3a6677198742313e2b Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 02 六月 2026 14:34:57 +0800
Subject: [PATCH] 新增智能电表、空调管理
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwElectricalWarningServiceImpl.java | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwElectricalWarningServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwElectricalWarningServiceImpl.java
index 8a06b32..1f12943 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwElectricalWarningServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwElectricalWarningServiceImpl.java
@@ -22,6 +22,7 @@
import com.doumee.dao.business.model.YwElectricalRoom;
import com.doumee.dao.business.model.YwElectricalWarning;
import com.doumee.dao.business.model.YwRoom;
+import com.doumee.dao.business.vo.WarningTypeStatVO;
import com.doumee.service.business.YwElectricalWarningService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
@@ -159,6 +160,38 @@
return list;
}
+ @Override
+ public List<WarningTypeStatVO> warningTypeStats() {
+ QueryWrapper<YwElectricalWarning> wrapper = new QueryWrapper<>();
+ wrapper.select("warning_def_id", "count(1) as cnt")
+ .eq("isdeleted", Constants.ZERO)
+ .eq("device_type", ELECTRICAL_DEVICE_TYPE)
+ .isNotNull("warning_def_id")
+ .groupBy("warning_def_id")
+ .orderByDesc("cnt");
+ List<Map<String, Object>> rows = ywElectricalWarningMapper.selectMaps(wrapper);
+ List<WarningTypeStatVO> list = new ArrayList<>();
+ if (CollectionUtils.isEmpty(rows)) {
+ return list;
+ }
+ for (Map<String, Object> row : rows) {
+ Object defIdObj = row.get("warning_def_id");
+ if (defIdObj == null) {
+ continue;
+ }
+ Integer warningDefId = Integer.parseInt(String.valueOf(defIdObj));
+ Object cntObj = row.get("cnt");
+ long count = cntObj == null ? 0L : Long.parseLong(String.valueOf(cntObj));
+ WarningTypeStatVO stat = new WarningTypeStatVO();
+ stat.setWarningDefId(warningDefId);
+ stat.setCount(count);
+ ElectronicConstant.warningDefId def = ElectronicConstant.warningDefId.getByKey(warningDefId);
+ stat.setWarningName(def != null ? def.getName() : "鏈煡鎶ヨ");
+ list.add(stat);
+ }
+ return list;
+ }
+
private MPJLambdaWrapper<YwElectricalWarning> buildPageQuery(PageWrap<YwElectricalWarning> pageWrap) {
MPJLambdaWrapper<YwElectricalWarning> queryWrapper = new MPJLambdaWrapper<>();
YwElectricalWarning model = pageWrap.getModel() == null ? new YwElectricalWarning() : pageWrap.getModel();
--
Gitblit v1.9.3