1.部分算法调度任务添加

2.算法调整
This commit is contained in:
2023-07-26 15:29:26 +08:00
parent c14db734fe
commit f4b5786236
23 changed files with 857 additions and 68 deletions

View File

@@ -0,0 +1,24 @@
package com.njcn.prepare.harmonic.api.newalgorithm;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.newalgorithm.fallback.RMpEventDetailFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(
value = ServerInfo.PREPARE_BOOT,//对应模块名
path = "/rmpeventdetail",//对应controller请求类
fallbackFactory = RMpEventDetailFeignClientFallbackFactory.class//服务降级处理类
)
public interface RMpEventDetailFeignClient {
@PostMapping("/eventdetailHandler")
@ApiOperation("监测点暂态指标处理")
HttpResult<String> eventdetailHandler(@RequestBody @Validated LineParam lineParam);
}

View File

@@ -0,0 +1,23 @@
package com.njcn.prepare.harmonic.api.newalgorithm;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.newalgorithm.fallback.RMpMonitorEvaluateFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
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;
@FeignClient(
value = ServerInfo.PREPARE_BOOT,//对应模块名
path = "/rmpmonitorevaluate",//对应controller请求类
fallbackFactory = RMpMonitorEvaluateFeignClientFallbackFactory.class//服务降级处理类
)
public interface RMpMonitorEvaluateFeignClient {
@ApiOperation("监测点评价_日统计(MySQL库)")
@PostMapping("handlerMonitorEvaluate")
HttpResult<Boolean> handlerMonitorEvaluate(@RequestBody LineParam jobParam );
}

View File

@@ -0,0 +1,24 @@
package com.njcn.prepare.harmonic.api.newalgorithm;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.newalgorithm.fallback.ROperatingMonitorFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(
value = ServerInfo.PREPARE_BOOT,//对应模块名
path = "/roperatingmonitor",//对应controller请求类
fallbackFactory = ROperatingMonitorFeignClientFallbackFactory.class//服务降级处理类
)
public interface ROperatingMonitorFeignClient {
@PostMapping("handlerMonitorOperatingD")
HttpResult<Boolean> handlerMonitorOperatingD(@RequestBody LineParam jobParam );
@PostMapping("handlerMonitorOperatingM")
HttpResult<Boolean> handlerMonitorOperatingM(@RequestBody LineParam jobParam );
}

View File

@@ -0,0 +1,23 @@
package com.njcn.prepare.harmonic.api.newalgorithm;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.newalgorithm.fallback.RStatAbnormalFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
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;
@FeignClient(
value = ServerInfo.PREPARE_BOOT,//对应模块名
path = "/rmstatabnormal",//对应controller请求类
fallbackFactory = RStatAbnormalFeignClientFallbackFactory.class//服务降级处理类
)
public interface RStatAbnormalFeignClient {
@ApiOperation("监测点异常_日统计(MySQL库)")
@PostMapping("handlerMonitorAbnormal")
HttpResult<Boolean> handlerMonitorAbnormal(@RequestBody LineParam jobParam );
}

View File

@@ -0,0 +1,21 @@
package com.njcn.prepare.harmonic.api.newalgorithm;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.newalgorithm.fallback.RStatHarmonicFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(
value = ServerInfo.PREPARE_BOOT,//对应模块名
path = "/rstatharmonic",//对应controller请求类
fallbackFactory = RStatHarmonicFeignClientFallbackFactory.class//服务降级处理类
)
public interface RStatHarmonicFeignClient {
@PostMapping("/Handler")
HttpResult<String> handler(@RequestBody OrgParam orgParam);
}

View File

@@ -0,0 +1,33 @@
package com.njcn.prepare.harmonic.api.newalgorithm.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.device.biz.utils.DeviceEnumUtil;
import com.njcn.prepare.harmonic.api.newalgorithm.RMpEventDetailFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RMpEventDetailFeignClientFallbackFactory implements FallbackFactory<RMpEventDetailFeignClient> {
@Override
public RMpEventDetailFeignClient create(Throwable throwable) {
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException)throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new RMpEventDetailFeignClient() {
@Override
public HttpResult<String> eventdetailHandler(LineParam lineParam) {
log.error("{}异常,降级处理,异常为:{}", "监测点暂态指标处理: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,33 @@
package com.njcn.prepare.harmonic.api.newalgorithm.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.device.biz.utils.DeviceEnumUtil;
import com.njcn.prepare.harmonic.api.newalgorithm.RMpMonitorEvaluateFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RMpMonitorEvaluateFeignClientFallbackFactory implements FallbackFactory<RMpMonitorEvaluateFeignClient> {
@Override
public RMpMonitorEvaluateFeignClient create(Throwable throwable) {
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException)throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new RMpMonitorEvaluateFeignClient() {
@Override
public HttpResult<Boolean> handlerMonitorEvaluate(LineParam jobParam) {
log.error("{}异常,降级处理,异常为:{}", "监测点评价_日统计: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,38 @@
package com.njcn.prepare.harmonic.api.newalgorithm.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.device.biz.utils.DeviceEnumUtil;
import com.njcn.prepare.harmonic.api.newalgorithm.ROperatingMonitorFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class ROperatingMonitorFeignClientFallbackFactory implements FallbackFactory<ROperatingMonitorFeignClient> {
@Override
public ROperatingMonitorFeignClient create(Throwable throwable) {
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException)throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new ROperatingMonitorFeignClient() {
@Override
public HttpResult<Boolean> handlerMonitorOperatingD(LineParam jobParam) {
log.error("{}异常,降级处理,异常为:{}", "监测点数据质量_日统计: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Boolean> handlerMonitorOperatingM(LineParam jobParam) {
log.error("{}异常,降级处理,异常为:{}", "监测点数据质量_月统计: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,33 @@
package com.njcn.prepare.harmonic.api.newalgorithm.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.device.biz.utils.DeviceEnumUtil;
import com.njcn.prepare.harmonic.api.newalgorithm.RStatAbnormalFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RStatAbnormalFeignClientFallbackFactory implements FallbackFactory<RStatAbnormalFeignClient> {
@Override
public RStatAbnormalFeignClient create(Throwable throwable) {
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException)throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new RStatAbnormalFeignClient() {
@Override
public HttpResult<Boolean> handlerMonitorAbnormal(LineParam jobParam) {
log.error("{}异常,降级处理,异常为:{}", "监测点异常_日统计: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,33 @@
package com.njcn.prepare.harmonic.api.newalgorithm.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.device.biz.utils.DeviceEnumUtil;
import com.njcn.prepare.harmonic.api.newalgorithm.RStatHarmonicFeignClient;
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RStatHarmonicFeignClientFallbackFactory implements FallbackFactory<RStatHarmonicFeignClient> {
@Override
public RStatHarmonicFeignClient create(Throwable throwable) {
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException)throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new RStatHarmonicFeignClient() {
@Override
public HttpResult<String> handler(OrgParam orgParam) {
log.error("{}异常,降级处理,异常为:{}", "单位监测点稳态指标统计: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}