From adb93a02d29d87797eb3f18388da6e160c027f3e Mon Sep 17 00:00:00 2001 From: zy <82248909@qq.com> Date: Mon, 1 Dec 2025 12:27:35 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SurvStationInfoController.java | 22 +++++++++++++++++++ .../mapper/xml/SurvStationInfoMapper.xml | 1 - 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java index 68a6be9..fee0f45 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java @@ -114,24 +114,36 @@ public class SurvStationInfoController { IPage pageList = survStationInfoService.pages(page, survStationInfo); if(!pageList.getRecords().isEmpty()) { for (SurvStationInfo record : pageList.getRecords()) { + //重新计算设备数 + int counts = record.getDeviceList().size(); + Map> zhibiaoMap = new HashMap<>(); List airList = new ArrayList<>(); List soilList = new ArrayList<>(); List orientList = new ArrayList<>(); List liveList = new ArrayList<>(); + List orientIds = new ArrayList<>(); if(record.getDeviceList()!=null&&record.getDeviceList().size()>0){ + List deployList = new ArrayList<>(); for (SurvDeviceDeploy survDeviceDeploy : record.getDeviceList()) { + deployList.add(survDeviceDeploy.getId()); if(PollutionConstants.SOIL_SURV.equals(survDeviceDeploy.getDeployType())){//土壤设备 soilList.add(survDeviceDeploy.getDeployCode()); }else if(PollutionConstants.AIR_SURV.equals(survDeviceDeploy.getDeployType())){//气象设备 airList.add(survDeviceDeploy.getDeployCode()); }else if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())) {//面源 orientList.add(survDeviceDeploy.getDeployCode()); + orientIds.add(survDeviceDeploy.getId()); }else if(PollutionConstants.WATER_LIVE.equals(survDeviceDeploy.getDeployType())) {//畜禽 liveList.add(survDeviceDeploy.getDeployCode()); + orientIds.add(survDeviceDeploy.getId()); }else if(PollutionConstants.CAMERA.equals(survDeviceDeploy.getDeployType())) {//摄像头 } } + List equList = zhibiaoService.getShowedChemical(deployList); + if(!equList.isEmpty()){ + zhibiaoMap.putAll(equList.stream().collect(Collectors.groupingBy(ScEquZhibiao::getEquId))); + } } @@ -166,6 +178,16 @@ public class SurvStationInfoController { if(record.getDeviceList()!=null && !record.getDeviceList().isEmpty()){ List deploys = iotutils.addOnlineStatus(record.getDeviceList()); record.setDeviceList(deploys); + } + //设备数量 + if(!orientIds.isEmpty()){ + //已配置的设备用指标数,未配置用1; + for (String id : orientIds) { + List zhibiaos = zhibiaoMap.get(id); + if(zhibiaos!=null){ + counts = counts + zhibiaos.size() -1; + } + } } } } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml index 63f5b7c..3a41815 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml @@ -39,7 +39,6 @@ -