报错feign.codec.EncodeException: class java.util.ArrayList is not a type supported by this encoder
需要调用的接口
@org.springframework.web.bind.annotation.PostMapping({"/file/getFileDetailBatch"})
@io.swagger.annotations.ApiOperation("批量获取文件详情")
com.hvisions.common.vo.ResultVO<java.util.List<com.hvisions.filemanagement.dto.FileDTO>> getFileDetailBatch(@org.springframework.web.bind.annotation.RequestBody java.util.List<java.lang.Integer> fileIds);
我的代码
controller
@PostMapping("/findImageInfoByIdList")
@ApiOperation(value = "批量获取图片详情")
public Result findImageInfoByIdList(@RequestBody List<Integer> idList) {
return overhaulOrderService.findImageInfoByIdList(idList);
}
impl
@Override
public Result findImageInfoByIdList(List<Integer> idList) {
ResultVO<List<FileDTO>> fileDetailBatch = fileClient.getFileDetailBatch(idList);
if (!fileDetailBatch.getCode().equals(CommonConstant.SUCCESS)) {
return Result.create().error(fileDetailBatch.getMessage());
}
for (FileDTO fileDTO : fileDetailBatch.getData()) {
String filePath = fileDTO.getFilePath();
for (int i = 0; i < 3; i++) {
filePath = filePath.substring(filePath.indexOf("/") + 1);
}
fileDTO.setFilePath(filePath);
}
return Result.create().success(fileDetailBatch.getData());
}
默认场景是支持list的,除非你们是自己注入了一些bean
```java
@RequestBody List idList
``` 前端传来时格式不是list?