新能源场站高低电压穿越业务新增根据ID查询基本信息方法
This commit is contained in:
@@ -34,4 +34,7 @@ public class LineDTO {
|
||||
|
||||
@ApiModelProperty(name = "objType",value = "对象类型")
|
||||
private String objType;
|
||||
|
||||
@ApiModelProperty(name = "stationType",value = "新能源场站类型")
|
||||
private String stationType;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.device.pq.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.fallback.NewStationClientFallbackFactory;
|
||||
import com.njcn.device.pq.pojo.po.NewStation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 新能源场站高低电压穿越Feign客户端
|
||||
* @author guofeihu
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.DEVICE, path = "/newStation", fallbackFactory = NewStationClientFallbackFactory.class, contextId = "newStation")
|
||||
public interface NewStationClient {
|
||||
|
||||
/**
|
||||
* 根据ID获取新能源场站高低电压穿越表信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectById")
|
||||
HttpResult<NewStation> selectById(@RequestParam(name = "id") String id);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.device.pq.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.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.api.NewStationClient;
|
||||
import com.njcn.device.pq.pojo.po.NewStation;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 新能源场站高低电压穿越管理熔断降级
|
||||
* @author guofeihu
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NewStationClientFallbackFactory implements FallbackFactory<NewStationClient> {
|
||||
@Override
|
||||
public NewStationClient 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 NewStationClient() {
|
||||
@Override
|
||||
public HttpResult<NewStation> selectById(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取终获取告警策略列表", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,4 +121,7 @@ public class LineDetailDataVO {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(name = "新能源场站信息ID")
|
||||
private String newStationId;
|
||||
|
||||
}
|
||||
|
||||
@@ -76,5 +76,14 @@ public class NewStationController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, iNewStationService.selectDown(name), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||
@GetMapping("/selectById")
|
||||
@ApiOperation("根据ID获取新能源场站高低电压穿越表信息")
|
||||
public HttpResult<NewStation> selectById(@RequestParam(name = "id") String id) {
|
||||
String methodDescribe = getMethodDescribe("selectById");
|
||||
LogUtil.njcnDebug(log, "{},id值为:{}", methodDescribe, id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, iNewStationService.selectById(id), methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
select
|
||||
a.name lineName,
|
||||
c.Time_Interval,
|
||||
e.name scale
|
||||
e.name scale,
|
||||
c.New_Station_Id newStationId
|
||||
from pq_line a
|
||||
inner join pq_line b on a.pid = b.id
|
||||
inner join pq_line_detail c on a.id = c.id
|
||||
|
||||
@@ -1431,7 +1431,8 @@
|
||||
vg.Scale AS voltageLevel,
|
||||
pqd.Run_Flag as runFlag,
|
||||
detail.PT_Type AS ptType,
|
||||
detail.PT_Phase_Type AS ptPhaseType
|
||||
detail.PT_Phase_Type AS ptPhaseType,
|
||||
detail.New_Station_Id AS stationType
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
|
||||
@@ -45,4 +45,11 @@ public interface INewStationService extends IService<NewStation> {
|
||||
*/
|
||||
List<Map> selectDown(String name);
|
||||
|
||||
/***
|
||||
* 根据ID获取新能源场站高低电压穿越表信息
|
||||
* @param id
|
||||
* @return NewStation
|
||||
*/
|
||||
NewStation selectById(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -78,4 +78,9 @@ public class NewStationServiceImpl extends ServiceImpl<NewStationMapper, NewStat
|
||||
return this.baseMapper.selectDown(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NewStation selectById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user