|
@@ -222,9 +222,15 @@ public class SysController {
|
|
|
@RequestMapping(value = "/file/preview/app", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
|
|
|
public Result filePreview(@ApiParam(value = "小程序签名key", required = true) @RequestParam String key) throws Exception {
|
|
|
- BasicAttachment basicAttachment = basicAttachmentService.filePreviewApp(key);
|
|
|
- Optional.ofNullable(basicAttachment).orElseThrow(() -> ExceptionResultEnum.ATTACHMENT_NO_DATA.exception());
|
|
|
- return ResultUtil.ok(new EditResult(basicAttachment.getId(), basicAttachmentService.filePreview(basicAttachment.getPath())), key);
|
|
|
+ List<BasicAttachment> basicAttachmentList = basicAttachmentService.filePreviewApp(key);
|
|
|
+ if (CollectionUtils.isEmpty(basicAttachmentList)) {
|
|
|
+ throw ExceptionResultEnum.ATTACHMENT_NO_DATA.exception();
|
|
|
+ }
|
|
|
+ List<EditResult> editResultList = new ArrayList<>(basicAttachmentList.size());
|
|
|
+ for (BasicAttachment b : basicAttachmentList) {
|
|
|
+ editResultList.add(new EditResult(b.getId(), basicAttachmentService.filePreview(b.getPath()), key));
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(editResultList);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "文件预览接口")
|