feat(EleEpdPqd): 添加根据告警码获取数据功能

- 在控制器中新增 findListByCode 方法实现告警码查询
- 在 Feign 客户端接口中添加对应的远程调用方法
- 在降级工厂中实现相应的异常处理逻辑
- 添加了参数验证注解支持
- 集成了 Swagger 文档注解便于接口文档生成
This commit is contained in:
xy
2026-07-07 20:29:40 +08:00
parent 2b0c5e82fa
commit 29ca1e4a5f
3 changed files with 20 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import com.njcn.system.pojo.param.EleEpdPqdParam;
import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
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;
@@ -64,4 +65,7 @@ public interface EpdFeignClient {
@PostMapping("/selectAll")
HttpResult<List<EleEpdPqdListVO>> selectAll();
@PostMapping("/findListByCode")
HttpResult<List<EleEpdPqd>> findListByCode(@RequestParam("code") @Validated String code);
}

View File

@@ -119,6 +119,12 @@ public class EpdFeignClientFallbackFactory implements FallbackFactory<EpdFeignCl
log.error("{}异常,降级处理,异常为:{}","根据数据分类查询字典信息集合",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<EleEpdPqd>> findListByCode(String code) {
log.error("{}异常,降级处理,异常为:{}","根据告警码获取数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -234,5 +234,15 @@ public class EleEpdPqdController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
}
@PostMapping("/findListByCode")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据告警码获取数据")
@ApiImplicitParam(name = "code", value = "告警码", required = true)
public HttpResult<List<EleEpdPqd>> findListByCode(@RequestParam("code") @Validated String code){
String methodDescribe = getMethodDescribe("findListByCode");
List<EleEpdPqd> po = eleEpdPqdService.lambdaQuery().like(EleEpdPqd::getDefaultValue,code).list();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
}
}