添加电能质量全过程月报

功能及其批处理任务
This commit is contained in:
hzj
2024-10-29 14:26:10 +08:00
parent 3132b0a134
commit 3c820b1645
6 changed files with 221 additions and 86 deletions

View File

@@ -0,0 +1,33 @@
package com.njcn.harmonic.api;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.api.fallback.PmsTemProcessReportFallbackFactory;
import com.njcn.harmonic.api.fallback.UploadGwDataFallbackFactory;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.pojo.param.UploadParam;
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;
/**
* @author xuyang
*/
@FeignClient(
value = ServerInfo.HARMONIC,
path = "/process/pmsTemProcessReport",
fallbackFactory = PmsTemProcessReportFallbackFactory.class,
contextId = "pmsTemProcessReport")
public interface PmsTemProcessReportFeignClient {
@PostMapping("/dayCalReport")
HttpResult<Boolean> dayCalReport() ;
}

View File

@@ -0,0 +1,43 @@
package com.njcn.harmonic.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.harmonic.api.PmsTemProcessReportFeignClient;
import com.njcn.harmonic.api.UploadGwDataFeignClient;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.pojo.param.UploadParam;
import com.njcn.harmonic.utils.HarmonicEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author xuyang
* @version 1.0.0
* @date 2023年12月15日 13:50
*/
@Slf4j
@Component
public class PmsTemProcessReportFallbackFactory implements FallbackFactory<PmsTemProcessReportFeignClient> {
@Override
public PmsTemProcessReportFeignClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = HarmonicEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new PmsTemProcessReportFeignClient() {
@Override
public HttpResult<Boolean> dayCalReport() {
log.error("{}异常,降级处理,异常为:{}", "电能质量全过程月报", throwable.toString());
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
}
};
}
}

View File

@@ -25,6 +25,7 @@ public class PmsTemProcessReport{
/**
* uuid
*/
@TableId(value = "obj_id", type = IdType.ASSIGN_UUID)
private String objId;
/**