统一设备数量计算
This commit is contained in:
parent
2d6dab4a1b
commit
b31c07e7df
|
|
@ -261,11 +261,20 @@ public class BigScreenController {
|
||||||
if(stationList!=null&&stationList.size()>0){
|
if(stationList!=null&&stationList.size()>0){
|
||||||
Integer count = 0;
|
Integer count = 0;
|
||||||
for (SurvStationInfo survStationInfo : stationList) {
|
for (SurvStationInfo survStationInfo : stationList) {
|
||||||
|
//设备数量
|
||||||
|
int counts = survStationInfo.getDeviceList()!=null?survStationInfo.getDeviceList().size():0;
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
survStationInfo.setName(count.toString());
|
survStationInfo.setName(count.toString());
|
||||||
List<String> deployList = new ArrayList<>();
|
List<String> deployList = new ArrayList<>();
|
||||||
survStationInfo.setDeviceCount(survStationInfo.getDeviceList().size());
|
List<String> orientIds = new ArrayList<>();
|
||||||
|
Map<String, List<ScEquZhibiao>> zhibiaoMap = new HashMap<>();
|
||||||
if(survStationInfo.getDeviceList()!=null&&survStationInfo.getDeviceList().size()>0){
|
if(survStationInfo.getDeviceList()!=null&&survStationInfo.getDeviceList().size()>0){
|
||||||
|
List<String> listIds = survStationInfo.getDeviceList().stream().map(SurvDeviceDeploy::getId).collect(Collectors.toList());
|
||||||
|
List<ScEquZhibiao> equList = zhibiaoService.getAllChemical(listIds);
|
||||||
|
if(!equList.isEmpty()){
|
||||||
|
zhibiaoMap.putAll(equList.stream().collect(Collectors.groupingBy(ScEquZhibiao::getEquId)));
|
||||||
|
}
|
||||||
|
|
||||||
List<SurvDeviceDeploy> remainList = new ArrayList<>();
|
List<SurvDeviceDeploy> remainList = new ArrayList<>();
|
||||||
for (SurvDeviceDeploy survDeviceDeploy : survStationInfo.getDeviceList()) {
|
for (SurvDeviceDeploy survDeviceDeploy : survStationInfo.getDeviceList()) {
|
||||||
deployList.add(survDeviceDeploy.getId());
|
deployList.add(survDeviceDeploy.getId());
|
||||||
|
|
@ -311,6 +320,7 @@ public class BigScreenController {
|
||||||
//只保留摄像头的数据
|
//只保留摄像头的数据
|
||||||
remainList.add(survDeviceDeploy);
|
remainList.add(survDeviceDeploy);
|
||||||
}else if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())) {//面源
|
}else if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())) {//面源
|
||||||
|
orientIds.add(survDeviceDeploy.getId());
|
||||||
SurvTransdataOrientwaterVo transdataVo= transdataOrientwaterService.getNewestData(survDeviceDeploy.getDeployCode());
|
SurvTransdataOrientwaterVo transdataVo= transdataOrientwaterService.getNewestData(survDeviceDeploy.getDeployCode());
|
||||||
if(transdataVo!=null) {
|
if(transdataVo!=null) {
|
||||||
jsonObject.putAll(JSONObject.parseObject(JSON.toJSONString(transdataVo)));
|
jsonObject.putAll(JSONObject.parseObject(JSON.toJSONString(transdataVo)));
|
||||||
|
|
@ -323,6 +333,7 @@ public class BigScreenController {
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(PollutionConstants.WATER_LIVE.equals(survDeviceDeploy.getDeployType())) {//畜禽
|
}else if(PollutionConstants.WATER_LIVE.equals(survDeviceDeploy.getDeployType())) {//畜禽
|
||||||
|
orientIds.add(survDeviceDeploy.getId());
|
||||||
SurvTransdataLivestockwaterVo transdataAir= transdataLivestockwaterService.getNewestData(survDeviceDeploy.getDeployCode());
|
SurvTransdataLivestockwaterVo transdataAir= transdataLivestockwaterService.getNewestData(survDeviceDeploy.getDeployCode());
|
||||||
if(transdataAir!=null) {
|
if(transdataAir!=null) {
|
||||||
jsonObject.putAll(JSONObject.parseObject(JSON.toJSONString(transdataAir)));
|
jsonObject.putAll(JSONObject.parseObject(JSON.toJSONString(transdataAir)));
|
||||||
|
|
@ -358,6 +369,18 @@ public class BigScreenController {
|
||||||
}
|
}
|
||||||
survStationInfo.setSurvColorItems(survList);
|
survStationInfo.setSurvColorItems(survList);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
//补充设备数量
|
||||||
|
if(!orientIds.isEmpty()){
|
||||||
|
//已配置的设备用指标数,未配置用1;
|
||||||
|
for (String id : orientIds) {
|
||||||
|
List<ScEquZhibiao> zhibiaos = zhibiaoMap.get(id);
|
||||||
|
if(zhibiaos!=null){
|
||||||
|
counts = counts + zhibiaos.size() -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
survStationInfo.setDeviceCount(counts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue