1.被调用的服务接口返回的数据类型
@PostMapping(value = "/getPaymentById") public CommonResult<String> getPaymentById(@RequestBody Payment payment){ Payment res = paymentService.getPaymentById(payment.getId()); if(res != null){ return new CommonResult(200,"查询成功,serverPort:"+serverPort,res); }else{ return new CommonResult(500,"查询失败",null); } }
2.openFeign接口如果还是用
public CommonResult<String> getPaymentById(@RequestBody Payment payment);
接收的话会报Object转String异常,所以得用
@PostMapping(value = "/getPaymentById") public CommonResult<Object> getPaymentById(@RequestBody Payment payment);
Object的泛型接收