bug修复

This commit is contained in:
zy 2025-12-01 11:32:38 +08:00
parent 4a9fe0e4f6
commit 21e2d2d788
3 changed files with 44 additions and 5 deletions

View File

@ -22,6 +22,7 @@ import org.jeecg.common.iot.common.VOWaterSurvIntegrateParam;
import org.jeecg.common.util.R; import org.jeecg.common.util.R;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.common.vo.*; import org.jeecg.common.vo.*;
import org.jeecg.common.vo.inner.TransZhiBiaoVo;
import org.jeecg.common.vo.statistic.ScreenIndexSummaryDetailVo; import org.jeecg.common.vo.statistic.ScreenIndexSummaryDetailVo;
import org.jeecg.common.vo.statistic.ScreenSummaryVo; import org.jeecg.common.vo.statistic.ScreenSummaryVo;
import org.jeecg.modules.appmana.service.*; import org.jeecg.modules.appmana.service.*;
@ -816,7 +817,9 @@ public class BigScreenController {
SurvStationInfo survStationInfo = stationList.get(0); SurvStationInfo survStationInfo = stationList.get(0);
List<String> deviceList = new ArrayList<>(); List<String> deviceList = new ArrayList<>();
List<String> deployList = new ArrayList<>(); List<String> deployList = new ArrayList<>();
survStationInfo.setDeviceCount(survStationInfo.getDeviceList().size()); Map<String, List<ScEquZhibiao>> zhibiaoMap = new HashMap<>();
List<String> orientIds = new ArrayList<>();
if(survStationInfo.getDeviceList()!=null&&survStationInfo.getDeviceList().size()>0){ if(survStationInfo.getDeviceList()!=null&&survStationInfo.getDeviceList().size()>0){
//补充设备数量 //补充设备数量
survStationInfo.setDeviceCount(survStationInfo.getDeviceList().size()); survStationInfo.setDeviceCount(survStationInfo.getDeviceList().size());
@ -849,12 +852,14 @@ public class BigScreenController {
} }
else if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())) {//面源 else if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())) {//面源
SurvTransdataOrientwaterVo transdataOrientwaterVo=transdataOrientwaterService.getNewestData(survDeviceDeploy.getDeployCode()); SurvTransdataOrientwaterVo transdataOrientwaterVo=transdataOrientwaterService.getNewestData(survDeviceDeploy.getDeployCode());
orientIds.add(survDeviceDeploy.getId());
if(transdataOrientwaterVo!=null) { if(transdataOrientwaterVo!=null) {
List<CommonDataTrans> orientData = commonP3Service.constructOrient(transdataOrientwaterVo,survStationInfo,survDeviceDeploy); List<CommonDataTrans> orientData = commonP3Service.constructOrient(transdataOrientwaterVo,survStationInfo,survDeviceDeploy);
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(orientData)); returnArrs = JSONArray.parseArray(JSONObject.toJSONString(orientData));
} }
}else if(PollutionConstants.WATER_LIVE.equals(survDeviceDeploy.getDeployType())) {//畜禽 }else if(PollutionConstants.WATER_LIVE.equals(survDeviceDeploy.getDeployType())) {//畜禽
SurvTransdataLivestockwaterVo transdataLivestockwaterVo=transdataLivestockwaterService.getNewestData(survDeviceDeploy.getDeployCode()); SurvTransdataLivestockwaterVo transdataLivestockwaterVo=transdataLivestockwaterService.getNewestData(survDeviceDeploy.getDeployCode());
orientIds.add(survDeviceDeploy.getId());
if(transdataLivestockwaterVo!=null) { if(transdataLivestockwaterVo!=null) {
List<CommonDataTrans> liveData = commonP3Service.constructLive(transdataLivestockwaterVo,survStationInfo,survDeviceDeploy); List<CommonDataTrans> liveData = commonP3Service.constructLive(transdataLivestockwaterVo,survStationInfo,survDeviceDeploy);
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(liveData)); returnArrs = JSONArray.parseArray(JSONObject.toJSONString(liveData));
@ -868,7 +873,25 @@ public class BigScreenController {
survStationInfo.getDeviceList().retainAll(remainList); survStationInfo.getDeviceList().retainAll(remainList);
//补充在线状态 //补充在线状态
survStationInfo.setDeviceList(iotutils.addOnlineStatus(survStationInfo.getDeviceList())); survStationInfo.setDeviceList(iotutils.addOnlineStatus(survStationInfo.getDeviceList()));
List<ScEquZhibiao> equList = zhibiaoService.getAllChemical(deployList);
if(equList.size()>0){
zhibiaoMap = equList.stream().collect(Collectors.groupingBy(ScEquZhibiao::getEquId));
}
} }
//重新计算设备数
int counts = survStationInfo.getDeviceList().size();
if(!orientIds.isEmpty()){
//已配置的设备用指标数未配置用1
for (String id : orientIds) {
List<ScEquZhibiao> zhibiaos = zhibiaoMap.get(id);
if(zhibiaos!=null){
counts = counts + zhibiaos.size() -1;
}
}
}
survStationInfo.setDeviceCount(survStationInfo.getDeviceList().size());
survStationInfo.setLatestData(returnArrs); survStationInfo.setLatestData(returnArrs);
survStationInfo.setLatestSoilData(returnSoilArrs); survStationInfo.setLatestSoilData(returnSoilArrs);
survStationInfo.setLatestAirData(returnAirArrs); survStationInfo.setLatestAirData(returnAirArrs);

View File

@ -301,8 +301,7 @@ public class IotCommonP3ServiceImpl {
} }
tempEnt.setSurvItem(pollutionEnum.getCode()); tempEnt.setSurvItem(pollutionEnum.getCode());
String vals = EntityFieldUtil.getFieldValue(transdataOrientwaterVo,zhibiao.getEntityField(),String.class); String vals = EntityFieldUtil.getFieldValue(transdataOrientwaterVo,zhibiao.getEntityField(),String.class);
log.warn(zhibiao.getEntityField()+"=============wtch==============="+vals); tempEnt.setValue(vals);
EntityFieldUtil.setFieldValue(tempEnt,zhibiao.getEntityField(),vals);
tempEnt.setDeployId(deploy.getId()); tempEnt.setDeployId(deploy.getId());
listFinal.add(tempEnt); listFinal.add(tempEnt);
} }
@ -426,7 +425,7 @@ public class IotCommonP3ServiceImpl {
tempEnt.setDataDateTime(transdataLivestockwaterVo.getDataDateTime()); tempEnt.setDataDateTime(transdataLivestockwaterVo.getDataDateTime());
tempEnt.setSurvItem(pollutionEnum.getCode()); tempEnt.setSurvItem(pollutionEnum.getCode());
String vals = EntityFieldUtil.getFieldValue(transdataLivestockwaterVo,zhibiao.getEntityField(),String.class); String vals = EntityFieldUtil.getFieldValue(transdataLivestockwaterVo,zhibiao.getEntityField(),String.class);
EntityFieldUtil.setFieldValue(tempEnt,zhibiao.getEntityField(),vals); tempEnt.setValue(vals);
tempEnt.setDeployId(deploy.getId()); tempEnt.setDeployId(deploy.getId());
listFinal.add(tempEnt); listFinal.add(tempEnt);
} }

View File

@ -211,6 +211,8 @@ public class SurvStationInfoController {
List<String> liveList = new ArrayList<>(); List<String> liveList = new ArrayList<>();
List<String> stinkList = new ArrayList<>(); List<String> stinkList = new ArrayList<>();
List<String> waterList = new ArrayList<>(); List<String> waterList = new ArrayList<>();
List<String> orientIds = new ArrayList<>();
Map<String, List<ScEquZhibiao>> zhibiaoMap = new HashMap<>();
if(curStation.getDeviceList()!=null&&curStation.getDeviceList().size()>0){ if(curStation.getDeviceList()!=null&&curStation.getDeviceList().size()>0){
for (SurvDeviceDeploy survDeviceDeploy : curStation.getDeviceList()) { for (SurvDeviceDeploy survDeviceDeploy : curStation.getDeviceList()) {
deployList.add(survDeviceDeploy.getId()); deployList.add(survDeviceDeploy.getId());
@ -222,8 +224,10 @@ public class SurvStationInfoController {
waterList.add(survDeviceDeploy.getDeployCode()); waterList.add(survDeviceDeploy.getDeployCode());
}else if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())) {//面源 }else if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())) {//面源
orientList.add(survDeviceDeploy.getDeployCode()); orientList.add(survDeviceDeploy.getDeployCode());
orientIds.add(survDeviceDeploy.getId());
}else if(PollutionConstants.WATER_LIVE.equals(survDeviceDeploy.getDeployType())) {//畜禽 }else if(PollutionConstants.WATER_LIVE.equals(survDeviceDeploy.getDeployType())) {//畜禽
liveList.add(survDeviceDeploy.getDeployCode()); liveList.add(survDeviceDeploy.getDeployCode());
orientIds.add(survDeviceDeploy.getId());
}else if(PollutionConstants.STINK.equals(survDeviceDeploy.getDeployType())) {//恶臭 }else if(PollutionConstants.STINK.equals(survDeviceDeploy.getDeployType())) {//恶臭
stinkList.add(survDeviceDeploy.getDeployCode()); stinkList.add(survDeviceDeploy.getDeployCode());
}else if(PollutionConstants.CAMERA.equals(survDeviceDeploy.getDeployType())) {//摄像头 }else if(PollutionConstants.CAMERA.equals(survDeviceDeploy.getDeployType())) {//摄像头
@ -231,6 +235,7 @@ public class SurvStationInfoController {
} }
List<ScEquZhibiao> equList = zhibiaoService.getShowedChemical(deployList); List<ScEquZhibiao> equList = zhibiaoService.getShowedChemical(deployList);
if(equList.size()>0){ if(equList.size()>0){
zhibiaoMap = equList.stream().collect(Collectors.groupingBy(ScEquZhibiao::getEquId));
TransZhiBiaoVo transZhiBiaoVo = new TransZhiBiaoVo(); TransZhiBiaoVo transZhiBiaoVo = new TransZhiBiaoVo();
transZhiBiaoVo.setZhibiaos(equList); transZhiBiaoVo.setZhibiaos(equList);
allSurv = zhAdminFeignClient.translatePollution(transZhiBiaoVo); allSurv = zhAdminFeignClient.translatePollution(transZhiBiaoVo);
@ -295,7 +300,18 @@ public class SurvStationInfoController {
} }
//获取数据量 //获取数据量
curStation.setSurvDataCount(finalDataCounts); curStation.setSurvDataCount(finalDataCounts);
curStation.setDeviceCount(curStation.getDeviceList().size()); //重新计算设备数
int counts = curStation.getDeviceList().size();
if(!orientIds.isEmpty()){
//已配置的设备用指标数未配置用1
for (String id : orientIds) {
List<ScEquZhibiao> zhibiaos = zhibiaoMap.get(id);
if(zhibiaos!=null){
counts = counts + zhibiaos.size() -1;
}
}
}
curStation.setDeviceCount(counts);
// curStation.setSurvItemCount(allSurv.size()); // curStation.setSurvItemCount(allSurv.size());
curStation.setSurvItemCount(curStation.getSurvObj().length); curStation.setSurvItemCount(curStation.getSurvObj().length);
List<PollutionSetVo> survList = new ArrayList<>(); List<PollutionSetVo> survList = new ArrayList<>();
@ -305,6 +321,7 @@ public class SurvStationInfoController {
survList = zhAdminFeignClient.translateArrPollution(transSurvObjVo); survList = zhAdminFeignClient.translateArrPollution(transSurvObjVo);
} }
curStation.setSurvColorItems(survList); curStation.setSurvColorItems(survList);
jsonObject.put("stationInfo",curStation); jsonObject.put("stationInfo",curStation);
//TODO 实时监测数据 //TODO 实时监测数据
jsonObject.put("liveSurvData",jsonArray); jsonObject.put("liveSurvData",jsonArray);