Commit ad8e7b93 authored by chenzhao's avatar chenzhao

健康划分 片区TD接口

parent 844adc48
......@@ -11,9 +11,15 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariabl
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IAlarmInfoDetailService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -22,7 +28,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author system_generator
......@@ -41,6 +49,11 @@ public class AnalyseController extends BaseController {
@Autowired
IAlarmInfoDetailService iAlarmInfoDetailService;
@Autowired
FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
PvHealthIndexMapper pvHealthIndexMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "工况测点区间划分-风机", notes = "工况测点区间划分-风机")
@GetMapping(value = "/getFanConditionVariablesByTime")
......@@ -252,15 +265,35 @@ public class AnalyseController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "预警详情信息-光伏", notes = "预警详情信息-光伏")
@GetMapping(value = "/queryIndexByArae")
public ResponseModel<Map<String, Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE, String startTimeTop, String endTimeTop) {
List<Map<String, Object>> maps = idxBizFanHealthIndexMapper.queryIndexByArae(ARAE, ANALYSISTYPE, startTimeTop, endTimeTop);
List<String> axisData = new ArrayList<>();
List<String> seriesData = new ArrayList<>();
public ResponseModel<Map<String, Object>> queryIndexByArae(String area, String analysisType, String startTimeTop, String endTimeTop) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop);
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop);
for (PvHealthIndex pvHealthIndex : pvHealthIndices) {
FanHealthIndex fanHealthIndex = new FanHealthIndex();
BeanUtils.copyProperties(pvHealthIndex,fanHealthIndex);
fanHealthIndices.add(fanHealthIndex);
}
Map<String, Object> map = new HashMap<>();
for (Map<String, Object> obj : maps) {
axisData.add(obj.get("HEALTHINDEX").toString());
seriesData.add(obj.get("ANALYSISTIME").toString());
List<Object> axisData = new ArrayList<>();
List<Object> seriesData = new ArrayList<>();
Map<String, List<FanHealthIndex>> mapList = fanHealthIndices.stream().collect(Collectors.groupingBy(FanHealthIndex::getAnalysisTime));
for (String s : mapList.keySet()) {
List<FanHealthIndex> fanHealthIndices1 = mapList.get(s);
Double healtnIndex = fanHealthIndices1.stream().collect(Collectors.averagingDouble(FanHealthIndex::getHealthIndex));
seriesData.add(healtnIndex.intValue());
axisData.add(s);
}
map.put("axisData", axisData);
map.put("seriesData", seriesData);
return ResponseHelper.buildResponse(map);
......
......@@ -23,7 +23,7 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<FanHealthIndex> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
......
......@@ -27,7 +27,7 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<PvHealthIndex> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
......
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