添加畸变率算法
This commit is contained in:
@@ -59,6 +59,12 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>algorithm-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.dataProcess.api;
|
||||
|
||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.dataProcess.api.fallback.RMpVThdFeignClientFallbackFactory;
|
||||
import com.njcn.dataProcess.api.fallback.SpThroughFeignClientFallbackFactory;
|
||||
import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto;
|
||||
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||
import com.njcn.dataProcess.pojo.dto.SpThroughDto;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年01月05日 15:11
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/rmpvthd", fallbackFactory = RMpVThdFeignClientFallbackFactory.class, contextId = "rmpvthd")
|
||||
public interface RmpVThdFeignClient {
|
||||
|
||||
@PostMapping("/batchInsertionThd")
|
||||
HttpResult<String> batchInsertionThd(@RequestBody List<RMpVThd> result);
|
||||
|
||||
@PostMapping("/batchInsertionPower")
|
||||
HttpResult<List<RMpVThd>> queryThd(@RequestBody CalculatedParam calculatedParam);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.njcn.dataProcess.api.fallback;
|
||||
|
||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||
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.dataProcess.api.RmpVThdFeignClient;
|
||||
import com.njcn.dataProcess.api.SpThroughFeignClient;
|
||||
import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto;
|
||||
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||
import com.njcn.dataProcess.pojo.dto.SpThroughDto;
|
||||
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年01月05日 15:08
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RMpVThdFeignClientFallbackFactory implements FallbackFactory<RmpVThdFeignClient> {
|
||||
|
||||
|
||||
/**
|
||||
* 输出远程请求接口异常日志
|
||||
* @param cause RPC请求异常
|
||||
*/
|
||||
@Override
|
||||
public RmpVThdFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if(cause.getCause() instanceof BusinessException){
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
exceptionEnum = DataProcessingEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new RmpVThdFeignClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<String> batchInsertionThd(List<RMpVThd> result) {
|
||||
log.error("{}异常,降级处理,异常为:{}","畸变率插入",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<RMpVThd>> queryThd(CalculatedParam calculatedParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}","畸变率查询",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.dataProcess.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/10/10 19:59【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* 谐波畸变率排名
|
||||
*/
|
||||
@ApiModel(value="com-njcn-harmonic-pojo-po-RMpVThd")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "r_mp_v_thd")
|
||||
public class RMpVThd implements Serializable {
|
||||
/**
|
||||
* 监测点ID
|
||||
*/
|
||||
@TableField(value = "measurement_point_id")
|
||||
@MppMultiId
|
||||
private String measurementPointId;
|
||||
|
||||
/**
|
||||
* 排名类型,字典表(1年 2季度 3月份 4周 5日)
|
||||
*/
|
||||
@TableField(value = "data_type")
|
||||
@MppMultiId
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@TableField(value = "data_date")
|
||||
@MppMultiId
|
||||
private LocalDate dataDate;
|
||||
|
||||
/**
|
||||
* 谐波畸变率
|
||||
*/
|
||||
@TableField(value = "v_thd")
|
||||
private Double vThd;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
Reference in New Issue
Block a user