|
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
import com.ruoyi.data.domain.*;
|
|
import com.ruoyi.data.domain.*;
|
|
|
import com.ruoyi.data.domain.bo.*;
|
|
import com.ruoyi.data.domain.bo.*;
|
|
|
import com.ruoyi.data.domain.vo.*;
|
|
import com.ruoyi.data.domain.vo.*;
|
|
@@ -75,36 +77,36 @@ public class TblDataController extends BaseController {
|
|
|
|
|
|
|
|
private List<SensorPoint> getSensorPointList(){
|
|
private List<SensorPoint> getSensorPointList(){
|
|
|
List<SensorPoint> list = new ArrayList<>();
|
|
List<SensorPoint> list = new ArrayList<>();
|
|
|
- List<PointUnit> pointUnitlist = new ArrayList<>();
|
|
|
|
|
|
|
+ List<PointData> pointUnitlist = new ArrayList<>();
|
|
|
TblSensorBo sensorBo = new TblSensorBo();
|
|
TblSensorBo sensorBo = new TblSensorBo();
|
|
|
List<TblSensorVo> tblSeneorVoList = iTblSensorService.queryList(sensorBo);
|
|
List<TblSensorVo> tblSeneorVoList = iTblSensorService.queryList(sensorBo);
|
|
|
TblDatapointBo tblDatapointBo = new TblDatapointBo();
|
|
TblDatapointBo tblDatapointBo = new TblDatapointBo();
|
|
|
List<TblDatapointVo> tblDatapointVoList = iTblDatapointService.queryList(tblDatapointBo);
|
|
List<TblDatapointVo> tblDatapointVoList = iTblDatapointService.queryList(tblDatapointBo);
|
|
|
TblUnitBo tblUnitBo = new TblUnitBo();
|
|
TblUnitBo tblUnitBo = new TblUnitBo();
|
|
|
- List<TblUnitVo> tblUnitVoList = iTblUnitService.queryList(tblUnitBo);
|
|
|
|
|
- for(TblDatapointVo tblDatapointVo:tblDatapointVoList){
|
|
|
|
|
- PointUnit pointUnit= new PointUnit();
|
|
|
|
|
- pointUnit.setPointInfo(tblDatapointVo);
|
|
|
|
|
- for(TblUnitVo tblUnitVo:tblUnitVoList){
|
|
|
|
|
- if(tblDatapointVo.getDataType() == tblUnitVo.getId()){
|
|
|
|
|
- pointUnit.setUnitName(tblUnitVo.getUnitName());
|
|
|
|
|
- pointUnit.setUnitType(tblUnitVo.getUnitType());
|
|
|
|
|
- pointUnit.setUnitSymbol(tblUnitVo.getUnitSymbol());
|
|
|
|
|
- pointUnit.setName(tblDatapointVo.getValueType());
|
|
|
|
|
- pointUnitlist.add(pointUnit);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
for(TblSensorVo tblSensorVo:tblSeneorVoList){
|
|
for(TblSensorVo tblSensorVo:tblSeneorVoList){
|
|
|
SensorPoint sensorPoint = new SensorPoint();
|
|
SensorPoint sensorPoint = new SensorPoint();
|
|
|
sensorPoint.setTblSensorVo(tblSensorVo);
|
|
sensorPoint.setTblSensorVo(tblSensorVo);
|
|
|
- List<PointUnit> pointUnits = new ArrayList<PointUnit>();
|
|
|
|
|
- for(PointUnit pointUnit:pointUnitlist){
|
|
|
|
|
- if(tblSensorVo.getId() == pointUnit.getPointInfo().getSensorId()){
|
|
|
|
|
- pointUnits.add(pointUnit);
|
|
|
|
|
|
|
+ List<PointData> pointDatas = new ArrayList<PointData>();
|
|
|
|
|
+ JSONArray pointArry = new JSONArray(tblSensorVo.getDatapoints());
|
|
|
|
|
+ for(Object pointObject:pointArry){
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject(pointObject);
|
|
|
|
|
+ Long pointId = Long.valueOf((String) jsonObject.get("dataPointId"));
|
|
|
|
|
+ System.out.println(pointId);
|
|
|
|
|
+ for(TblDatapointVo tblDatapointVo:tblDatapointVoList){
|
|
|
|
|
+ System.out.println(tblDatapointVo.getId());
|
|
|
|
|
+ if(pointId == tblDatapointVo.getId()) {
|
|
|
|
|
+ PointData pointData = new PointData();
|
|
|
|
|
+ pointData.setName((String) jsonObject.get("name"));
|
|
|
|
|
+ pointData.setLabel((String) jsonObject.get("label"));
|
|
|
|
|
+ pointData.setUnit((String) jsonObject.get("unit"));
|
|
|
|
|
+ pointData.setUnitType((String) jsonObject.get("unitType"));
|
|
|
|
|
+ pointData.setDataPointInfo(tblDatapointVo);
|
|
|
|
|
+ pointDatas.add(pointData);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- sensorPoint.setDataPoints(pointUnits);
|
|
|
|
|
|
|
+ sensorPoint.setDataPoints(pointDatas);
|
|
|
list.add(sensorPoint);
|
|
list.add(sensorPoint);
|
|
|
}
|
|
}
|
|
|
return list;
|
|
return list;
|