Commit eae12f78 authored by tangwei's avatar tangwei

测点运行曲线

parent 988aaede
......@@ -139,6 +139,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "测点运行趋势图", notes = "测点运行趋势图")
@GetMapping(value = "/getqyt")
public ResponseModel<Object> getqyt(
int type,
String address,
String statioName,
String equipmentName,
......@@ -147,6 +148,6 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "endTime", required = false) String endTime
) {
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( address,statioName,equipmentName,arae,startTime,endTime));
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( type,address,statioName,equipmentName,arae,startTime,endTime));
}
}
......@@ -5,10 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizUxfv;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizUxfvMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizFanHealthIndexService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
......@@ -31,7 +31,10 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
@Autowired
IdxBizUxfvMapper idxBizUxfvMapper;
IdxBizPvPointProcessVariableClassificationMapper idxBizPvPointProcessVariableClassificationMapper;
@Autowired
IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
......@@ -63,18 +66,31 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
public Object getqyt(String address,String statioName,String equipmentName, String arae,String startTime,String endTime){
public Object getqyt(int type,String address,String statioName,String equipmentName, String arae,String startTime,String endTime){
Map<String, Object> map = new HashMap<>();
try {
//获取场站网关
IdxBizUxfv idxBizUxfv= idxBizUxfvMapper.selectOne(
new QueryWrapper<IdxBizUxfv>()
String tdid=null;
if(type==1){
IdxBizPvPointProcessVariableClassification idxBizPvPointProcessVariableClassification= idxBizPvPointProcessVariableClassificationMapper.selectOne(
new QueryWrapper<IdxBizPvPointProcessVariableClassification>()
.eq("INDEX_ADDRESS", address)
.eq("STATION", statioName)
.eq("EQUIPMENT_NAME", equipmentName)
.eq("ARAE", arae)
);
String tdid=address+"_"+idxBizUxfv.getGatewayId();
tdid=address+"_"+idxBizPvPointProcessVariableClassification.getGatewayId();
}else{
IdxBizFanPointProcessVariableClassification idxBizFanPointProcessVariableClassification= idxBizFanPointProcessVariableClassificationMapper.selectOne(
new QueryWrapper<IdxBizFanPointProcessVariableClassification>()
.eq("INDEX_ADDRESS", address)
.eq("STATION", statioName)
.eq("EQUIPMENT_NAME", equipmentName)
.eq("ARAE", arae)
);
tdid=address+"_"+idxBizFanPointProcessVariableClassification.getGatewayId();
}
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
......@@ -87,8 +103,8 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
startTime = sdf.format(currentDayStartTime);
endTime= sdf.format(currentDayEndTime);
}else{
Date currentDayStartTime =new Date(startTime);
Date currentDayEndTime = new Date(endTime);
Date currentDayStartTime =dateFormat.parse(startTime);
Date currentDayEndTime = dateFormat.parse(endTime);
startTime = sdf.format(currentDayStartTime);
endTime= sdf.format(currentDayEndTime);
}
......@@ -100,13 +116,17 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
activePowers.add(indicatorDataListActivePowers.get(i).getValue());
axisData.add(DateUtil.format(indicatorDataListActivePowers.get(i).getCreatedTime(), "HH:mm"));
}
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map2.put("data", activePowers);
seriesData.add(map2);
map.put("seriesData", seriesData);
// List<Map<String, Object>> seriesData = new ArrayList<>();
// Map<String, Object> map2 = new HashMap<>();
// map2.put("data", activePowers);
// seriesData.add(map2);
map.put("seriesData", activePowers);
map.put("axisData", axisData);
}catch (Exception e){
e.printStackTrace();
throw new RuntimeException();
}
return map;
}
......
......@@ -41,7 +41,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
List<IndicatorData> selectByIndexNameAndDate(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId, @Param("date") String date, @Param("limitNum") Integer limitNum);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ")
@Select("select `value`, created_time from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("id") String id, @Param("startTime") String startTime, @Param("endTime") String endTime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment