首页-风机实时数据查询
This commit is contained in:
parent
64e10cd200
commit
6abc588e4d
@ -0,0 +1,36 @@
|
|||||||
|
package com.das.modules.page.controller;
|
||||||
|
|
||||||
|
import com.das.common.result.R;
|
||||||
|
import com.das.modules.page.domian.HomeWindRealTimeVo;
|
||||||
|
import com.das.modules.page.service.HomeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页相关Controller
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/api/home")
|
||||||
|
@RestController
|
||||||
|
public class HomeController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HomeService homeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*风机实时数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/windRealTimeData")
|
||||||
|
public R<List<HomeWindRealTimeVo>> windRealTimeData() {
|
||||||
|
return R.success(homeService.queryWindRealTimeData());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.das.modules.page.domian;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HomeWindRealTimeVo {
|
||||||
|
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long irn;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long modelId;
|
||||||
|
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
private String belongLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为标杆机组
|
||||||
|
*/
|
||||||
|
private Integer standard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额定容量
|
||||||
|
*/
|
||||||
|
private Double nominalCapacity;
|
||||||
|
|
||||||
|
private Map<String,Object> attributeMap;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.das.modules.page.service;
|
||||||
|
|
||||||
|
import com.das.modules.page.domian.HomeWindRealTimeVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface HomeService {
|
||||||
|
|
||||||
|
List<HomeWindRealTimeVo> queryWindRealTimeData();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.das.modules.page.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.das.modules.data.domain.SnapshotValueQueryParam;
|
||||||
|
import com.das.modules.data.service.DataService;
|
||||||
|
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||||
|
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||||
|
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||||
|
import com.das.modules.page.domian.HomeWindRealTimeVo;
|
||||||
|
import com.das.modules.page.service.HomeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class HomeServiceImpl implements HomeService {
|
||||||
|
|
||||||
|
private static final Integer OBJECT_TYPE = 10002;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysEquipmentMapper sysEquipmentMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataService dataService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 首页-风机实时数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<HomeWindRealTimeVo> queryWindRealTimeData() {
|
||||||
|
SysEquipmentDto sysEquipmentDto = new SysEquipmentDto();
|
||||||
|
sysEquipmentDto.setObjectType(OBJECT_TYPE);
|
||||||
|
//获取所有风机设备
|
||||||
|
List<SysEquipmentVo> sysEquipmentVos = sysEquipmentMapper.querySysEquipmentList(sysEquipmentDto);
|
||||||
|
//风机返回数据列表
|
||||||
|
List<HomeWindRealTimeVo> homeWindRealTimeVoList = new ArrayList<>();
|
||||||
|
List<SnapshotValueQueryParam> paramList = new ArrayList<>();
|
||||||
|
//构建需要查询的物模型属 性
|
||||||
|
List<String> attributesList = new ArrayList<>();
|
||||||
|
//风速
|
||||||
|
attributesList.add("iwindspeed");
|
||||||
|
//风机状态
|
||||||
|
attributesList.add("iturbineoperationmode");
|
||||||
|
//有功功率(MW)
|
||||||
|
attributesList.add("igenpower");
|
||||||
|
//当天可利用率
|
||||||
|
attributesList.add("iavailabillitytoday");
|
||||||
|
//日发电量(kwh)
|
||||||
|
attributesList.add("ikwhthisday");
|
||||||
|
//总发电量(万kwh)
|
||||||
|
attributesList.add("ikwhoverall");
|
||||||
|
for (SysEquipmentVo item : sysEquipmentVos) {
|
||||||
|
//构建查询属性参数
|
||||||
|
SnapshotValueQueryParam snapshotValueQueryParam = new SnapshotValueQueryParam();
|
||||||
|
snapshotValueQueryParam.setAttributes(attributesList);
|
||||||
|
snapshotValueQueryParam.setDeviceId(item.getId().toString());
|
||||||
|
paramList.add(snapshotValueQueryParam);
|
||||||
|
//构建风机数据返回
|
||||||
|
HomeWindRealTimeVo homeWindRealTimeVoResult = new HomeWindRealTimeVo();
|
||||||
|
homeWindRealTimeVoResult.setIrn(item.getId());
|
||||||
|
homeWindRealTimeVoResult.setName(item.getName());
|
||||||
|
homeWindRealTimeVoResult.setModel(item.getModel());
|
||||||
|
homeWindRealTimeVoResult.setModelId(item.getIotModelId());
|
||||||
|
homeWindRealTimeVoResult.setBelongLine(item.getBelongLine());
|
||||||
|
homeWindRealTimeVoResult.setStandard(item.getStandard());
|
||||||
|
homeWindRealTimeVoResult.setNominalCapacity(item.getNominalCapacity());
|
||||||
|
homeWindRealTimeVoList.add(homeWindRealTimeVoResult);
|
||||||
|
}
|
||||||
|
//获取设备测点数据
|
||||||
|
Map<String, Map<String, Object>> map = dataService.querySnapshotValues(paramList);
|
||||||
|
for (HomeWindRealTimeVo item : homeWindRealTimeVoList) {
|
||||||
|
item.setAttributeMap(map.get(item.getIrn().toString()));
|
||||||
|
}
|
||||||
|
return homeWindRealTimeVoList;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user