zbj//1.r_stat_event_d/m/q/m 调度 2.r_stat_event_org_d/m/q/y 调度
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
package com.njcn.executor.handler;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
|
import com.njcn.executor.utils.CommonExecutorUtils;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.HarmonicMetricFeignClient;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.RStatEventFeignClient;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 暂态指标统计
|
||||||
|
* @author zbj
|
||||||
|
* @date 2023/07/03
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RStatEventJob {
|
||||||
|
|
||||||
|
private final RStatEventFeignClient rStatEventFeignClient;
|
||||||
|
|
||||||
|
@XxlJob("rStartEventDHandler")
|
||||||
|
public void rStartEventDHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||||
|
rStatEventFeignClient.rStartEventHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XxlJob("rStartEventMHandler")
|
||||||
|
public void rStartEventMHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
|
rStatEventFeignClient.rStartEventHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XxlJob("rStartEventQHandler")
|
||||||
|
public void rStartEventQHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_QUARTER));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_QUARTER));
|
||||||
|
rStatEventFeignClient.rStartEventHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XxlJob("rStartEventYHandler")
|
||||||
|
public void rStartEventYHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_YEAR));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_YEAR));
|
||||||
|
rStatEventFeignClient.rStartEventHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.njcn.executor.handler;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
|
import com.njcn.executor.utils.CommonExecutorUtils;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.RStatEventFeignClient;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.RStatEventOrgFeignClient;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 单位暂态指标数据统计
|
||||||
|
* @author zbj
|
||||||
|
* @date 2023/07/04
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RStatEventOrgJob {
|
||||||
|
|
||||||
|
private final RStatEventOrgFeignClient rStatEventOrgFeignClient;
|
||||||
|
|
||||||
|
@XxlJob("rStartEventOrgDHandler")
|
||||||
|
public void rStartEventOrgDHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
|
||||||
|
rStatEventOrgFeignClient.rStartEventOrgHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XxlJob("rStartEventOrgMHandler")
|
||||||
|
public void rStartEventOrgMHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
|
rStatEventOrgFeignClient.rStartEventOrgHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XxlJob("rStartEventOrgQHandler")
|
||||||
|
public void rStartEventOrgQHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_QUARTER));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_QUARTER));
|
||||||
|
rStatEventOrgFeignClient.rStartEventOrgHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XxlJob("rStartEventOrgYHandler")
|
||||||
|
public void rStartEventOrgYHandler(){
|
||||||
|
OrgParam orgParam = new OrgParam();
|
||||||
|
orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_YEAR));
|
||||||
|
orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_YEAR));
|
||||||
|
rStatEventOrgFeignClient.rStartEventOrgHandler(orgParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.prepare.harmonic.api.line;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.fallback.RStatEventFeignClientFallbackFactory;
|
||||||
|
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 = "/rStartEvent",//对应controller请求类
|
||||||
|
fallbackFactory = RStatEventFeignClientFallbackFactory.class//服务降级处理类
|
||||||
|
)
|
||||||
|
public interface RStatEventFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/rStartEventHandler")
|
||||||
|
HttpResult<Boolean> rStartEventHandler(@RequestBody OrgParam orgParam);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.prepare.harmonic.api.line;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.fallback.RStatEventOrgFeignClientFallbackFactory;
|
||||||
|
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 = "/rStartEventOrg",//对应controller请求类
|
||||||
|
fallbackFactory = RStatEventOrgFeignClientFallbackFactory.class//服务降级处理类
|
||||||
|
)
|
||||||
|
public interface RStatEventOrgFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/rStartEventOrgHandler")
|
||||||
|
HttpResult<Boolean> rStartEventOrgHandler(@RequestBody OrgParam orgParam);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.njcn.prepare.harmonic.api.line.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.line.HarmOverLimitFeignClient;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.RStatEventFeignClient;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zbj
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class RStatEventFeignClientFallbackFactory implements FallbackFactory<RStatEventFeignClient> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RStatEventFeignClient 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 RStatEventFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> rStartEventHandler(OrgParam orgParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "暂态指标统计: ", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.njcn.prepare.harmonic.api.line.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.line.RStatEventFeignClient;
|
||||||
|
import com.njcn.prepare.harmonic.api.line.RStatEventOrgFeignClient;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zbj
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class RStatEventOrgFeignClientFallbackFactory implements FallbackFactory<RStatEventOrgFeignClient> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RStatEventOrgFeignClient 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 RStatEventOrgFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> rStartEventOrgHandler(OrgParam orgParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "暂态指标统计: ", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user