bug修复

This commit is contained in:
zy 2025-12-01 12:27:35 +08:00
parent 7669048a8f
commit adb93a02d2
2 changed files with 22 additions and 1 deletions

View File

@ -114,24 +114,36 @@ public class SurvStationInfoController {
IPage<SurvStationInfo> pageList = survStationInfoService.pages(page, survStationInfo);
if(!pageList.getRecords().isEmpty()) {
for (SurvStationInfo record : pageList.getRecords()) {
//重新计算设备数
int counts = record.getDeviceList().size();
Map<String, List<ScEquZhibiao>> zhibiaoMap = new HashMap<>();
List<String> airList = new ArrayList<>();
List<String> soilList = new ArrayList<>();
List<String> orientList = new ArrayList<>();
List<String> liveList = new ArrayList<>();
List<String> orientIds = new ArrayList<>();
if(record.getDeviceList()!=null&&record.getDeviceList().size()>0){
List<String> 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<ScEquZhibiao> 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<SurvDeviceDeploy> deploys = iotutils.addOnlineStatus(record.getDeviceList());
record.setDeviceList(deploys);
}
//设备数量
if(!orientIds.isEmpty()){
//已配置的设备用指标数未配置用1
for (String id : orientIds) {
List<ScEquZhibiao> zhibiaos = zhibiaoMap.get(id);
if(zhibiaos!=null){
counts = counts + zhibiaos.size() -1;
}
}
}
}
}

View File

@ -39,7 +39,6 @@
</resultMap>
<resultMap id="countMap" type="org.jeecg.common.entity.SurvStationInfo" extends="baseResultMap">
<association property="deviceCount" javaType="java.lang.Integer" select="getDeviceCount" column="STATION_CODE" />
<association property="survItemCount" javaType="java.lang.Integer" select="getZhiBiaoCount" column="STATION_CODE" />
<collection property="deviceList" select="getSimpleDeviceList" column="{STATION_CODE = STATION_CODE}" />
</resultMap>