1.influxDB引入包调整
2.波形图片对外接口
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.csharmonic.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csharmonic.api.fallback.WavePicClientFallbackFactory;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/event", fallbackFactory = WavePicClientFallbackFactory.class,contextId = "event")
|
||||||
|
|
||||||
|
public interface WavePicFeignClient {
|
||||||
|
|
||||||
|
@GetMapping("/getWavePics")
|
||||||
|
HttpResult<CsEventVO> getWavePics(@RequestParam("eventId") String eventId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.njcn.csharmonic.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csharmonic.api.WavePicFeignClient;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class WavePicClientFallbackFactory implements FallbackFactory<WavePicFeignClient> {
|
||||||
|
@Override
|
||||||
|
public WavePicFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new WavePicFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsEventVO> getWavePics(String eventId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","获取事件波形图",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,4 +91,10 @@ public class CsEventPO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "level")
|
@TableField(value = "level")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发生位置 grid:电网侧,load:负载侧
|
||||||
|
*/
|
||||||
|
@TableField(value = "location")
|
||||||
|
private String location;
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
|
|||||||
import com.njcn.csharmonic.param.ThdDataQueryParm;
|
import com.njcn.csharmonic.param.ThdDataQueryParm;
|
||||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||||
import com.njcn.csharmonic.service.StableDataService;
|
import com.njcn.csharmonic.service.StableDataService;
|
||||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
import com.njcn.influx.pojo.po.HarmonicRatioData;
|
import com.njcn.influx.pojo.po.HarmonicRatioData;
|
||||||
import com.njcn.influx.pojo.po.PowerQualityData;
|
import com.njcn.influx.pojo.po.PowerQualityData;
|
||||||
@@ -30,7 +30,6 @@ import org.influxdb.dto.QueryResult;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -374,7 +373,7 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
stringBuilder1.append("last("+data.getName()).append("_"+i).append(") AS "+data.getName()).append("_"+i).append(",");
|
stringBuilder1.append("last("+data.getName()).append("_"+i).append(") AS "+data.getName()).append("_"+i).append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stringBuilder2.append ("line_id='").append (csLinePO.getLineId()).append("' and value_type = 'avg' group by phasic_type ").append(InfluxDBPublicParam.TIME_ZONE);
|
stringBuilder2.append ("line_id='").append (csLinePO.getLineId()).append("' and value_type = 'avg' group by phasic_type ").append(InfluxDbSqlConstant.TZ);
|
||||||
String sql1 = "select "+stringBuilder1+" from "+"apf_data"+" where "+stringBuilder2;
|
String sql1 = "select "+stringBuilder1+" from "+"apf_data"+" where "+stringBuilder2;
|
||||||
|
|
||||||
QueryResult sqlData = influxDbUtils.query(sql1);
|
QueryResult sqlData = influxDbUtils.query(sql1);
|
||||||
|
|||||||
Reference in New Issue
Block a user