历史温度暂时提交
parent
34808ab31f
commit
1d6d86b9d2
|
|
@ -1,30 +0,0 @@
|
||||||
package com.agri.system.domain.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class LiveDataView {
|
|
||||||
|
|
||||||
private List<String> timeList;
|
|
||||||
|
|
||||||
private List<BigDecimal> temp1List;
|
|
||||||
|
|
||||||
private List<BigDecimal> temp2List;
|
|
||||||
|
|
||||||
private List<BigDecimal> temp3List;
|
|
||||||
|
|
||||||
private List<BigDecimal> temp4List;
|
|
||||||
|
|
||||||
private List<BigDecimal> humi1List;
|
|
||||||
|
|
||||||
private List<BigDecimal> humi2List;
|
|
||||||
|
|
||||||
private List<BigDecimal> humi3List;
|
|
||||||
|
|
||||||
private List<BigDecimal> humi4List;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -17,14 +17,16 @@ public class UChartsDataView {
|
||||||
// 内部类:单条系列数据
|
// 内部类:单条系列数据
|
||||||
public static class UChartsSeries {
|
public static class UChartsSeries {
|
||||||
private String name; // 系列名称(如"温度1")
|
private String name; // 系列名称(如"温度1")
|
||||||
|
private Boolean show; // 系列名称(如"温度1")
|
||||||
private BigDecimal index;
|
private BigDecimal index;
|
||||||
private List<BigDecimal> data; // 系列数值
|
private List<BigDecimal> data; // 系列数值
|
||||||
|
|
||||||
public UChartsSeries() {
|
public UChartsSeries() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UChartsSeries(String name, BigDecimal index, List<BigDecimal> data) {
|
public UChartsSeries(String name, Boolean show, BigDecimal index, List<BigDecimal> data) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.show = show;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
package com.agri.system.service;
|
package com.agri.system.service;
|
||||||
|
|
||||||
import com.agri.system.domain.SysDtuData;
|
import com.agri.system.domain.SysDtuData;
|
||||||
import com.agri.system.domain.vo.LiveDataView;
|
import com.agri.system.domain.vo.UChartsDataView;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -74,7 +73,7 @@ public interface ISysDtuDataService extends IService<SysDtuData>
|
||||||
|
|
||||||
List<Map<String, Object>> getLastDtuDataByImeiList(List<String> imeiList);
|
List<Map<String, Object>> getLastDtuDataByImeiList(List<String> imeiList);
|
||||||
|
|
||||||
LiveDataView getHistoryData(String imei, LocalDateTime startTime, LocalDateTime endTime);
|
UChartsDataView getHistoryData(String imei, LocalDateTime startTime, LocalDateTime endTime);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.agri.system.service.impl;
|
||||||
|
|
||||||
import com.agri.common.utils.DateUtils;
|
import com.agri.common.utils.DateUtils;
|
||||||
import com.agri.system.domain.SysDtuData;
|
import com.agri.system.domain.SysDtuData;
|
||||||
import com.agri.system.domain.vo.LiveDataView;
|
|
||||||
import com.agri.system.domain.vo.UChartsDataView;
|
import com.agri.system.domain.vo.UChartsDataView;
|
||||||
import com.agri.system.mapper.SysDtuDataMapper;
|
import com.agri.system.mapper.SysDtuDataMapper;
|
||||||
import com.agri.system.service.ISysDtuDataService;
|
import com.agri.system.service.ISysDtuDataService;
|
||||||
|
|
@ -134,7 +133,7 @@ public class SysDtuDataServiceImpl extends ServiceImpl<SysDtuDataMapper, SysDtuD
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LiveDataView getHistoryData(String imei, LocalDateTime startTime, LocalDateTime endTime) {
|
public UChartsDataView getHistoryData(String imei, LocalDateTime startTime, LocalDateTime endTime) {
|
||||||
// 非空校验
|
// 非空校验
|
||||||
Assert.hasText(imei, "设备IMEI不能为空");
|
Assert.hasText(imei, "设备IMEI不能为空");
|
||||||
|
|
||||||
|
|
@ -149,7 +148,6 @@ public class SysDtuDataServiceImpl extends ServiceImpl<SysDtuDataMapper, SysDtuD
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
List<SysDtuData> historyData = baseMapper.getHistoryData(imei, finalStartTime, finalEndTime);
|
List<SysDtuData> historyData = baseMapper.getHistoryData(imei, finalStartTime, finalEndTime);
|
||||||
LiveDataView liveDataView = new LiveDataView();
|
|
||||||
List<String> categories = new ArrayList<>();
|
List<String> categories = new ArrayList<>();
|
||||||
List<BigDecimal> temp1List = new ArrayList<>();
|
List<BigDecimal> temp1List = new ArrayList<>();
|
||||||
List<BigDecimal> temp2List = new ArrayList<>();
|
List<BigDecimal> temp2List = new ArrayList<>();
|
||||||
|
|
@ -179,27 +177,18 @@ public class SysDtuDataServiceImpl extends ServiceImpl<SysDtuDataMapper, SysDtuD
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置返回数据
|
// 设置返回数据
|
||||||
liveDataView.setTimeList(categories);
|
UChartsDataView uChartsData = new UChartsDataView();
|
||||||
liveDataView.setTemp1List(temp1List);
|
uChartsData.setCategories(categories);
|
||||||
liveDataView.setTemp2List(temp2List);
|
uChartsData.setSeries(Arrays.asList(
|
||||||
liveDataView.setTemp3List(temp3List);
|
new UChartsDataView.UChartsSeries("温度1", true,BigDecimal.ZERO, temp1List),
|
||||||
liveDataView.setTemp4List(temp4List);
|
new UChartsDataView.UChartsSeries("温度2", true,BigDecimal.ZERO, temp2List),
|
||||||
liveDataView.setHumi1List(humi1List);
|
new UChartsDataView.UChartsSeries("温度3", true,BigDecimal.ZERO, temp3List),
|
||||||
liveDataView.setHumi2List(humi2List);
|
new UChartsDataView.UChartsSeries("温度4", true,BigDecimal.ZERO, temp4List),
|
||||||
liveDataView.setHumi3List(humi3List);
|
new UChartsDataView.UChartsSeries("湿度1", false, BigDecimal.ONE, humi1List),
|
||||||
liveDataView.setHumi4List(humi4List);
|
new UChartsDataView.UChartsSeries("湿度2", false, BigDecimal.ONE, humi2List),
|
||||||
// UChartsDataView uChartsData = new UChartsDataView();
|
new UChartsDataView.UChartsSeries("湿度3", false, BigDecimal.ONE, humi3List),
|
||||||
// uChartsData.setCategories(categories);
|
new UChartsDataView.UChartsSeries("湿度4", false, BigDecimal.ONE, humi4List)
|
||||||
// uChartsData.setSeries(Arrays.asList(
|
));
|
||||||
// new UChartsDataView.UChartsSeries("温度1", BigDecimal.ZERO, temp1List),
|
return uChartsData;
|
||||||
// new UChartsDataView.UChartsSeries("温度2", BigDecimal.ZERO, temp2List),
|
|
||||||
// new UChartsDataView.UChartsSeries("温度3", BigDecimal.ZERO, temp3List),
|
|
||||||
// new UChartsDataView.UChartsSeries("温度4", BigDecimal.ZERO, temp4List),
|
|
||||||
// new UChartsDataView.UChartsSeries("湿度1", BigDecimal.ONE, humi1List),
|
|
||||||
// new UChartsDataView.UChartsSeries("湿度2", BigDecimal.ONE, humi2List),
|
|
||||||
// new UChartsDataView.UChartsSeries("湿度3", BigDecimal.ONE, humi3List),
|
|
||||||
// new UChartsDataView.UChartsSeries("湿度4", BigDecimal.ONE, humi4List)
|
|
||||||
// ));
|
|
||||||
return liveDataView;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue