太阳能供电数据echarts
This commit is contained in:
@ -76,7 +76,11 @@
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.73</version>
|
||||
</dependency>
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.fastbee.common.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DevParamsUtils {
|
||||
|
||||
public static Map<String, Object> getDevParams(String evParams) {
|
||||
Map<String, Object> devData = new HashMap<>();
|
||||
try{
|
||||
Object devParams = com.alibaba.fastjson.JSON.parse(evParams); //先转换成Object
|
||||
List<Map<String, Object>> Params = (List<Map<String, Object>>) devParams;
|
||||
if (Params != null) {
|
||||
for (Map<String, Object> param : Params) {
|
||||
devData.put(param.get("key").toString(), param.get("value").toString());
|
||||
}
|
||||
}
|
||||
}catch (Exception exception){
|
||||
}
|
||||
|
||||
return devData;
|
||||
}
|
||||
}
|
@ -88,7 +88,7 @@ public class DeviceDetailController extends BaseController {
|
||||
if (null == queryLogVo.getDeviceId() || queryLogVo.getDeviceId() == 0L) {
|
||||
return AjaxResult.error("请选择设备");
|
||||
}
|
||||
List<HashMap<String, Object>> list = deviceDetailService.gongdianChart(queryLogVo);
|
||||
List<Object> list = deviceDetailService.gongdianChart(queryLogVo);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
|
||||
import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
|
||||
import com.fastbee.xunjian.domain.XjInspectionRecords;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -23,7 +24,7 @@ public interface IDeviceDetailService {
|
||||
|
||||
List<Device> getBindDevices(String ids);
|
||||
|
||||
List<HashMap<String, Object>> gongdianChart(QueryLogVo queryLogVo);
|
||||
ArrayList<Object> gongdianChart(QueryLogVo queryLogVo);
|
||||
|
||||
List<XjInspectionRecords> xunjianRecord(QueryLogVo queryLogVo);
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
package com.fastbee.data.service.devicedetail.impl;
|
||||
|
||||
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
||||
import com.fastbee.common.utils.DevParamsUtils;
|
||||
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
||||
import com.fastbee.iot.domain.Device;
|
||||
import com.fastbee.iot.domain.ThingsModel;
|
||||
import com.fastbee.iot.mapper.DeviceMapper;
|
||||
import com.fastbee.iot.service.IDeviceService;
|
||||
import com.fastbee.iot.service.IThingsModelService;
|
||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||
import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
|
||||
import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
|
||||
import com.fastbee.xunjian.domain.XjInspectionRecords;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
@ -17,6 +22,10 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
||||
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
@Autowired
|
||||
public IDeviceService iDeviceService;
|
||||
@Autowired
|
||||
private IThingsModelService thingsModelService;
|
||||
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
|
||||
this.deviceMapper = deviceMapper;
|
||||
}
|
||||
@ -48,16 +57,41 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap<String, Object>> gongdianChart(QueryLogVo queryLogVo) {
|
||||
//todo
|
||||
return Collections.emptyList();
|
||||
public ArrayList<Object> gongdianChart(QueryLogVo queryLogVo) {
|
||||
Long deviceId = queryLogVo.getDeviceId();
|
||||
if (deviceId == null) {
|
||||
throw new RuntimeException("请上传devicerId");
|
||||
}
|
||||
Device device = iDeviceService.selectDeviceByDeviceId(deviceId);
|
||||
if (device == null) {
|
||||
throw new RuntimeException("未查到该设备");
|
||||
}
|
||||
Map<String, Object> devParams = DevParamsUtils.getDevParams(device.getDevParams());
|
||||
//太阳能设备
|
||||
String taiyangnengIds = devParams.get("taiyangnIds").toString();
|
||||
if (taiyangnengIds == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
ArrayList<Object> deviceLogAllCurves = iDeviceService.getDeviceLogAllCurves(Long.parseLong(taiyangnengIds), queryLogVo.getStartTime(), queryLogVo.getEndTime());
|
||||
return deviceLogAllCurves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XjInspectionRecords> xunjianRecord(QueryLogVo queryLogVo) {
|
||||
//todo
|
||||
Long deviceId = queryLogVo.getDeviceId();
|
||||
if (deviceId == null) {
|
||||
throw new RuntimeException("请上传devicerId");
|
||||
}
|
||||
Device device = iDeviceService.selectDeviceByDeviceId(deviceId);
|
||||
if (device == null) {
|
||||
throw new RuntimeException("未查到该设备");
|
||||
}
|
||||
List<XjInspectionRecords> xjInspectionRecords = new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
deviceListVo.setOnLineCount(onLineCount);
|
||||
return deviceListVo;
|
||||
}
|
||||
|
||||
//todo 需要修改安防版和水电双计设备实时数据
|
||||
@Override
|
||||
public Object getRealTimeDataByDevicerId(Long deviceId) {
|
||||
HashMap<String, Object> rMap = new HashMap<String, Object>() {};
|
||||
@ -121,7 +121,6 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
ThingsModel thingsModel1 = new ThingsModel();
|
||||
thingsModel1.setProductId(138L);
|
||||
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
|
||||
// HashMap<String, Object> taiyangnengMap = new HashMap<String, Object>() {};
|
||||
if (StringUtils.isNotEmpty(taiyangnengIds)) {
|
||||
Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
|
||||
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
||||
@ -248,25 +247,6 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
return rMap;
|
||||
}
|
||||
|
||||
// private List<AlertEntity> getAlertListForDevice(Long deviceId, Long productId) {
|
||||
// AlertEntity alert = new AlertEntity();
|
||||
// alert.setDeviceId(deviceId);
|
||||
// alert.setProductId(productId);
|
||||
// return iAlertService.selectAlertList(alert);
|
||||
// }
|
||||
|
||||
// private void parseAlert(AlertEntity alert, List<DeviceAlertDto> waterLevelAlert, List<DeviceAlertDto> rainfallAlert) {
|
||||
// JSONArray triggers = JSON.parseArray(alert.getTriggers());
|
||||
// for (Object obj : triggers) {
|
||||
// Map<String, Object> trigger = (Map<String, Object>) obj;
|
||||
// Float value = Float.valueOf(trigger.get("value").toString());
|
||||
// if (alert.getAlertType() == 1) {
|
||||
// waterLevelAlert.add(new DeviceAlertDto(alert.getAlertName(), "#FF0000", value));
|
||||
// } else if (alert.getAlertType() == 2) {
|
||||
// rainfallAlert.add(new DeviceAlertDto(alert.getAlertName(), "#FFFF00", value));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private HashMap<String, Object> getDataList(Device device, String identity) {
|
||||
HashMap<String, Object> dataListMap = new HashMap<>();
|
||||
|
@ -76,11 +76,7 @@
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.73</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--在线文档 -->
|
||||
<dependency>
|
||||
|
Reference in New Issue
Block a user