1.部分算法调度任务添加
2.算法调整
This commit is contained in:
@@ -93,7 +93,7 @@ public class RMpPartHarmonicDetailD implements Serializable {
|
||||
/**
|
||||
* 谐波电压超标次数
|
||||
*/
|
||||
@TableField(value = "v_times", exist = false)
|
||||
@TableField(value = "v_times")
|
||||
private Integer vTimes;
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ public class RMpPartHarmonicDetailD implements Serializable {
|
||||
/**
|
||||
* 谐波电流超标次数
|
||||
*/
|
||||
@TableField(value = "i_times", exist = false)
|
||||
@TableField(value = "i_times")
|
||||
private Integer iTimes;
|
||||
|
||||
/**
|
||||
@@ -711,13 +711,13 @@ public class RMpPartHarmonicDetailD implements Serializable {
|
||||
/**
|
||||
* 三相电压不平衡度超标次数
|
||||
*/
|
||||
@TableField(value = "unbalance_times", exist = false)
|
||||
@TableField(value = "unbalance_times")
|
||||
private Integer unbalanceTimes;
|
||||
|
||||
/**
|
||||
* 负序电流超标次数
|
||||
*/
|
||||
@TableField(value = "i_neg_times", exist = false)
|
||||
@TableField(value = "i_neg_times")
|
||||
private Integer iNegTimes;
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@@ -51,7 +51,7 @@ public class RMpSurplusHarmonicDetailD implements Serializable {
|
||||
/**
|
||||
* 间谐波电压超标次数
|
||||
*/
|
||||
@TableField(value = "inuharm_times", exist = false)
|
||||
@TableField(value = "inuharm_times")
|
||||
private Integer inuharmTimes;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.executor.utils.CommonExecutorUtils;
|
||||
import com.njcn.prepare.harmonic.api.newalgorithm.RMpEventDetailFeignClient;
|
||||
import com.njcn.prepare.harmonic.api.newalgorithm.RMpMonitorEvaluateFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/7/26 9:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RMpEventDetailJob {
|
||||
|
||||
private final RMpEventDetailFeignClient rMpEventDetailFeignClient;
|
||||
|
||||
@XxlJob("rMpEventDetailDay")
|
||||
public void rMpEventDetailDay(){
|
||||
log.info(LocalDateTime.now()+"监测点暂态指标处理调度开始------------------------");
|
||||
LineParam lineParam = new LineParam();
|
||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataSource(2);
|
||||
rMpEventDetailFeignClient.eventdetailHandler(lineParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.executor.utils.CommonExecutorUtils;
|
||||
import com.njcn.prepare.harmonic.api.newalgorithm.RMpMonitorEvaluateFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/7/26 9:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RMpMonitorEvaluateJob {
|
||||
|
||||
private final RMpMonitorEvaluateFeignClient rMpMonitorEvaluateFeignClient;
|
||||
|
||||
@XxlJob("rMpMonitorEvaluate")
|
||||
public void rMpMonitorEvaluate(){
|
||||
log.info(LocalDateTime.now()+"监测点评价_日统计调度开始------------------------");
|
||||
LineParam lineParam = new LineParam();
|
||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataSource(2);
|
||||
rMpMonitorEvaluateFeignClient.handlerMonitorEvaluate(lineParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.executor.utils.CommonExecutorUtils;
|
||||
import com.njcn.prepare.harmonic.api.newalgorithm.ROperatingMonitorFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/7/25 11:05
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class ROperatingMonitorJob {
|
||||
|
||||
private final ROperatingMonitorFeignClient rOperatingMonitorFeignClient;
|
||||
|
||||
@XxlJob("rOperatingMonitorDay")
|
||||
public void rOperatingMonitorDay(){
|
||||
log.info(LocalDateTime.now()+"监测点数据质量_日统计调度开始------------------------");
|
||||
LineParam lineParam = new LineParam();
|
||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataSource(2);
|
||||
rOperatingMonitorFeignClient.handlerMonitorOperatingD(lineParam);
|
||||
}
|
||||
|
||||
@XxlJob("rOperatingMonitorMonth")
|
||||
public void rOperatingMonitorMonth(){
|
||||
log.info(LocalDateTime.now()+"监测点数据质量_月统计调度开始------------------------");
|
||||
LineParam lineParam = new LineParam();
|
||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||
lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||
lineParam.setDataSource(2);
|
||||
rOperatingMonitorFeignClient.handlerMonitorOperatingM(lineParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.executor.utils.CommonExecutorUtils;
|
||||
import com.njcn.prepare.harmonic.api.newalgorithm.ROperatingMonitorFeignClient;
|
||||
import com.njcn.prepare.harmonic.api.newalgorithm.RStatAbnormalFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/7/26 10:03
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RStatAbnormalJob {
|
||||
|
||||
private final RStatAbnormalFeignClient rStatAbnormalFeignClient;
|
||||
|
||||
@XxlJob("rStatAbnormalDay")
|
||||
public void rStatAbnormalDay(){
|
||||
log.info(LocalDateTime.now()+"监测点异常_日统计调度开始------------------------");
|
||||
LineParam lineParam = new LineParam();
|
||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataSource(2);
|
||||
rStatAbnormalFeignClient.handlerMonitorAbnormal(lineParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.executor.utils.CommonExecutorUtils;
|
||||
import com.njcn.prepare.harmonic.api.newalgorithm.RStatHarmonicFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/7/25 11:05
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RStatHarmonicJob {
|
||||
|
||||
private final RStatHarmonicFeignClient rStatHarmonicFeignClient;
|
||||
|
||||
@XxlJob("rStatHarmonicDay")
|
||||
public void rStatHarmonicDay(){
|
||||
log.info(LocalDateTime.now()+"单位监测点稳态指标日统计调度开始------------------------");
|
||||
OrgParam orgParam = new OrgParam();
|
||||
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||
rStatHarmonicFeignClient.handler(orgParam);
|
||||
}
|
||||
|
||||
@XxlJob("rStatHarmonicMonth")
|
||||
public void rStatHarmonicMonth(){
|
||||
log.info(LocalDateTime.now()+"单位监测点稳态指标月统计调度开始------------------------");
|
||||
OrgParam orgParam = new OrgParam();
|
||||
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||
System.out.println("orgParam==:" + orgParam);
|
||||
rStatHarmonicFeignClient.handler(orgParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,8 +45,8 @@ public class TargetWarnJob {
|
||||
@XxlJob("alarmMonthJob")
|
||||
public void alarmMonthJob(){
|
||||
LineParam lineParam = new LineParam();
|
||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||
lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||
lineParam.setDataSource(2);
|
||||
targetWarnFeignClient.alarmMonth(lineParam);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Calendar;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -23,10 +24,13 @@ public class CommonExecutorUtils {
|
||||
log.error(LocalDateTime.now()+"xxl调度任务参数未设置");
|
||||
return null;
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_MONTH,-1);
|
||||
if (Objects.equals(BizParamConstant.STAT_BIZ_DAY,command)){
|
||||
calendar.add(Calendar.DAY_OF_MONTH,-1);
|
||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH,command)){
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
log.info("job调度时间:"+sdf.format(calendar.getTime()));
|
||||
return sdf.format(calendar.getTime());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -87,26 +87,20 @@
|
||||
|
||||
<select id="getAvgDayData" resultType="com.njcn.prepare.harmonic.pojo.dto.AlarmDetailDayDTO">
|
||||
select
|
||||
Y.lineId,
|
||||
avg(Y.vUnbalance) vUnbalance,
|
||||
avg(Y.vHarmonic) vHarmonic,
|
||||
avg(Y.vlDev) vlDev,
|
||||
avg(Y.freqDev) freqDev,
|
||||
avg(Y.plt) plt,
|
||||
avg(Y.sagTimes) sagTimes,
|
||||
avg(Y.interruptTimes) interruptTimes
|
||||
from
|
||||
t0.lineId,
|
||||
coalesce(t0.vUnbalance, 0) vUnbalance,
|
||||
coalesce(t0.v, 0) vHarmonic,
|
||||
coalesce(t1.vlDev, 0) vlDev,
|
||||
coalesce(t1.freqDev, 0) freqDev,
|
||||
coalesce(t2.plt, 0) plt,
|
||||
coalesce(t3.sagTimes, 0) sagTimes,
|
||||
coalesce(t3.interruptTimes, 0) interruptTimes
|
||||
from
|
||||
(
|
||||
select
|
||||
A.time,
|
||||
A.lineId,
|
||||
coalesce(A.vUnbalance, 0) vUnbalance,
|
||||
coalesce(A.v, 0) vHarmonic,
|
||||
coalesce(B.vlDev, 0) vlDev,
|
||||
coalesce(B.freqDev, 0) freqDev,
|
||||
coalesce(C.plt, 0) plt,
|
||||
coalesce(D.sagTimes, 0) sagTimes,
|
||||
coalesce(D.interruptTimes, 0) interruptTimes
|
||||
avg(A.vUnbalance) vUnbalance,
|
||||
avg(A.v) v
|
||||
from
|
||||
(
|
||||
select
|
||||
@@ -115,27 +109,50 @@
|
||||
max(v_unbalance) vUnbalance,
|
||||
max(greatest(v_thd, v_1, v_2, v_3, v_4, v_5, v_6, v_7, v_8, v_9, v_10, v_11, v_12, v_13, v_14, v_15, v_16, v_17, v_18, v_19, v_20, v_21, v_22, v_23, v_24, v_25, v_26, v_27, v_28, v_29, v_30, v_31, v_32, v_33, v_34, v_35, v_36, v_37, v_38, v_39, v_40, v_41, v_42, v_43, v_44, v_45, v_46, v_47, v_48, v_49, v_50)) v
|
||||
from
|
||||
r_stat_data_v_d t0
|
||||
r_stat_data_v_d
|
||||
where
|
||||
`time` between #{startTime} and #{endTime} and value_type = 'CP95'
|
||||
group by `time`,line_id
|
||||
) A
|
||||
left join
|
||||
(
|
||||
`time` between #{startTime} and #{endTime}
|
||||
and value_type = 'CP95'
|
||||
group by
|
||||
`time`,
|
||||
line_id
|
||||
) A
|
||||
group by
|
||||
A.lineId
|
||||
) t0
|
||||
left join
|
||||
(
|
||||
select
|
||||
B.lineId,
|
||||
avg(B.vlDev) vlDev,
|
||||
avg(B.freqDev) freqDev
|
||||
from
|
||||
(
|
||||
select
|
||||
`time`,
|
||||
line_id lineId,
|
||||
max(abs(vl_dev)) vlDev,
|
||||
max(abs(freq_dev)) freqDev
|
||||
from
|
||||
r_stat_data_v_d t0
|
||||
r_stat_data_v_d
|
||||
where
|
||||
`time` between #{startTime} and #{endTime} and value_type = 'MAX'
|
||||
group by `time`,line_id
|
||||
) B
|
||||
on A.lineId = B.lineId
|
||||
left join
|
||||
(
|
||||
`time` between #{startTime} and #{endTime}
|
||||
and value_type = 'MAX'
|
||||
group by
|
||||
`time`,
|
||||
line_id
|
||||
) B
|
||||
group by
|
||||
B.lineId
|
||||
) t1
|
||||
on t0.lineId = t1.lineId
|
||||
left join
|
||||
(
|
||||
select
|
||||
C.lineId,
|
||||
avg(C.plt) plt
|
||||
from
|
||||
(
|
||||
select
|
||||
`time` ,
|
||||
line_id lineId,
|
||||
@@ -143,33 +160,38 @@
|
||||
from
|
||||
r_stat_data_plt_d
|
||||
where
|
||||
`time` between #{startTime} and #{endTime} and value_type = 'MAX'
|
||||
group by `time`,line_id
|
||||
) C
|
||||
on A.lineId = C.lineId
|
||||
left join
|
||||
(
|
||||
select
|
||||
measurement_point_id lineId,
|
||||
data_date dataDate,
|
||||
sag_times sagTimes,
|
||||
interrupt_times interruptTimes
|
||||
from
|
||||
r_mp_event_detail_d
|
||||
where
|
||||
data_date between #{startTime} and #{endTime}
|
||||
) D
|
||||
on A.lineId = D.lineId
|
||||
<where>
|
||||
<if test="list != null and list.size() > 0">
|
||||
A.lineId in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) Y
|
||||
group by Y.lineId
|
||||
`time` between #{startTime} and #{endTime}
|
||||
and value_type = 'MAX'
|
||||
group by
|
||||
`time`,
|
||||
line_id
|
||||
) C
|
||||
group by
|
||||
C.lineId
|
||||
) t2
|
||||
on t0.lineId = t2.lineId
|
||||
left join
|
||||
(
|
||||
select
|
||||
measurement_point_id lineId,
|
||||
avg(sag_times) sagTimes,
|
||||
avg(interrupt_times) interruptTimes
|
||||
from
|
||||
r_mp_event_detail_d
|
||||
where
|
||||
data_date between #{startTime} and #{endTime}
|
||||
group by
|
||||
measurement_point_id
|
||||
) t3
|
||||
on t0.lineId = t3.lineId
|
||||
<where>
|
||||
<if test="list != null and list.size() > 0">
|
||||
A.lineId in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getTargetWarnD" resultType="com.njcn.prepare.harmonic.pojo.dto.RMpTargetWarnDDTO">
|
||||
|
||||
@@ -382,7 +382,207 @@
|
||||
or t0.inuharm_16_overtime>0
|
||||
) then 1
|
||||
else 0
|
||||
end isInuharm
|
||||
end isInuharm,
|
||||
case
|
||||
when t0.uharm_2_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_3_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_4_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_5_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_6_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_7_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_8_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_9_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_10_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_11_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_12_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_13_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_14_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_15_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_16_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_17_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_18_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_19_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_20_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_21_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_22_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_23_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_24_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.uharm_25_overtime>0 then 1
|
||||
else 0
|
||||
end vTimes,
|
||||
case
|
||||
when t0.iharm_2_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_3_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_4_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_5_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_6_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_7_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_8_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_9_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_10_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_11_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_12_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_13_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_14_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_15_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_16_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_17_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_18_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_19_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_20_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_21_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_22_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_23_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_24_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.iharm_25_overtime>0 then 1
|
||||
else 0
|
||||
end iTimes,
|
||||
case
|
||||
when t0.ubalance_overtime>0 then 1
|
||||
else 0
|
||||
end unbalanceTimes,
|
||||
case
|
||||
when t0.i_neg_overtime>0 then 1
|
||||
else 0
|
||||
end iNegTimes
|
||||
from
|
||||
r_stat_limit_rate_d t0
|
||||
left join
|
||||
|
||||
@@ -126,7 +126,71 @@
|
||||
case
|
||||
when t0.inuharm_16_overtime>0 then 1
|
||||
else 0
|
||||
end isInuharm16
|
||||
end isInuharm16,
|
||||
case
|
||||
when t0.inuharm_1_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_2_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_3_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_4_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_5_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_6_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_7_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_8_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_9_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_10_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_11_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_12_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_13_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_14_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_15_overtime>0 then 1
|
||||
else 0
|
||||
end +
|
||||
case
|
||||
when t0.inuharm_16_overtime>0 then 1
|
||||
else 0
|
||||
end inuharmTimes
|
||||
from
|
||||
r_stat_limit_rate_d t0
|
||||
where
|
||||
|
||||
@@ -36,6 +36,8 @@ public class RMpPartHarmonicDetailDServiceImpl extends MppServiceImpl<RMpPartHar
|
||||
log.info(LocalDateTime.now()+"===>监测点稳态指标超标明细日表1开始执行");
|
||||
List<RMpPartHarmonicDetailD> result = new ArrayList<>();
|
||||
if (Objects.equals(lineParam.getType(),5)){
|
||||
System.out.println(lineParam.getDataDate());
|
||||
System.out.println(lineParam.getLineIds());
|
||||
result = getData(lineParam.getDataDate(),lineParam.getLineIds());
|
||||
} else if (Objects.equals(lineParam.getType(),3)){
|
||||
int year = Integer.parseInt(lineParam.getDataDate().split("-")[0]);
|
||||
|
||||
Reference in New Issue
Block a user