1.国网上送代码调整

This commit is contained in:
wr
2023-12-25 10:17:58 +08:00
parent c83b89c318
commit f9ac0a5c45
10 changed files with 268 additions and 30 deletions

View File

@@ -0,0 +1,41 @@
package com.njcn.device.pms.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.response.HttpResult;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pms.api.fallback.MonitorClientFallbackFactory;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.MonitorParam;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO;
import io.swagger.annotations.ApiImplicitParam;
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;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author yzh
* @date 2022/10/18
*/
@FeignClient(
value = ServerInfo.DEVICE,
path = "/monitorSend",
contextId = "monitorSend",
fallbackFactory = MonitorClientFallbackFactory.class)
public interface MonitorSendClient {
@PostMapping("/sendType")
HttpResult<String> windSend(@RequestBody @Validated MonitorParam.Info param);
}

View File

@@ -0,0 +1,42 @@
package com.njcn.device.pms.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.device.pms.api.MonitorSendClient;
import com.njcn.device.pms.pojo.param.MonitorParam;
import com.njcn.device.pms.utils.PmsDeviceEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author wr
* @description
* @date 2023/12/25 9:17
*/
@Slf4j
@Component
public class MonitorSendClientFallbackFactory implements FallbackFactory<MonitorSendClient> {
@Override
public MonitorSendClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = PmsDeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new MonitorSendClient()
{
@Override
public HttpResult<String> windSend(MonitorParam.Info param) {
log.error("{}异常,降级处理,异常为:{}", "国网五类台账上送接口", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -66,6 +66,8 @@ public class TractionStationDTO extends Unit {
/*监测点编号 是否必填:否*/
@ExcelProperty(value = "监测点编号")
private String monitorNumber;
@ExcelProperty(value = "监测点名称")
private String monitorName;
/*第二个监测点编号 是否必填:否*/
@ExcelProperty(value = "第二个监测点编号")
private String monitorNumberTwo;