预处理模块:工单问题生成,主网有效监测时长计算,

过程监督模块:工单模块功能,其他模块的审核
This commit is contained in:
huangzj
2023-02-27 11:24:58 +08:00
parent 5915ed87ac
commit 338b659d94
58 changed files with 2932 additions and 57 deletions

View File

@@ -0,0 +1,25 @@
package com.njcn.process.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.pojo.dto.OverLimitFlagDTO;
import com.njcn.process.api.fallback.RStatWorkOrderFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/2/15 14:13【需求编号】
*
* @author clam
* @version V1.0.0
*/
@FeignClient(value = ServerInfo.PROCESS,path = "/rStatWorkOrder",fallbackFactory = RStatWorkOrderFallbackFactory.class)
public interface RStatWorkOrderFeignClient {
@PostMapping("/createProblem")
HttpResult<Boolean> createProblem(@RequestBody List<OverLimitFlagDTO> overLimitFlagDTOList);
}

View File

@@ -0,0 +1,45 @@
package com.njcn.process.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.prepare.harmonic.pojo.dto.OverLimitFlagDTO;
import com.njcn.process.api.RStatWorkOrderFeignClient;
import com.njcn.process.utils.ProcessEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/2/15 14:15【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Slf4j
@Component
public class RStatWorkOrderFallbackFactory implements FallbackFactory<RStatWorkOrderFeignClient> {
@Override
public RStatWorkOrderFeignClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = ProcessEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new RStatWorkOrderFeignClient() {
@Override
public HttpResult<Boolean> createProblem(List<OverLimitFlagDTO> overLimitFlagDTOList) {
log.error("{}异常,降级处理,异常为:{}", "问题单插入异常", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}