feat(EleEpdPqd): 添加根据告警码获取数据功能
- 在控制器中新增 findListByCode 方法实现告警码查询 - 在 Feign 客户端接口中添加对应的远程调用方法 - 在降级工厂中实现相应的异常处理逻辑 - 添加了参数验证注解支持 - 集成了 Swagger 文档注解便于接口文档生成
This commit is contained in:
@@ -8,6 +8,7 @@ import com.njcn.system.pojo.param.EleEpdPqdParam;
|
|||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
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.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -64,4 +65,7 @@ public interface EpdFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/selectAll")
|
@PostMapping("/selectAll")
|
||||||
HttpResult<List<EleEpdPqdListVO>> selectAll();
|
HttpResult<List<EleEpdPqdListVO>> selectAll();
|
||||||
|
|
||||||
|
@PostMapping("/findListByCode")
|
||||||
|
HttpResult<List<EleEpdPqd>> findListByCode(@RequestParam("code") @Validated String code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,6 +119,12 @@ public class EpdFeignClientFallbackFactory implements FallbackFactory<EpdFeignCl
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据数据分类查询字典信息集合",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据数据分类查询字典信息集合",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<EleEpdPqd>> findListByCode(String code) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据告警码获取数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,5 +234,15 @@ public class EleEpdPqdController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user