|
@@ -161,10 +161,11 @@ public class SysController {
|
|
|
@Transactional
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = AttachmentResult.class)})
|
|
|
public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
|
|
|
- @ApiParam(value = "上传文件类型", required = true) @RequestParam UploadFileEnum type) throws Exception {
|
|
|
+ @ApiParam(value = "上传文件类型", required = true) @RequestParam UploadFileEnum type,
|
|
|
+ @ApiParam(value = "小程序签名key") @RequestParam(required = false) String key) throws Exception {
|
|
|
BasicAttachment basicAttachment = null;
|
|
|
try {
|
|
|
- basicAttachment = basicAttachmentService.saveAttachment(file, type);
|
|
|
+ basicAttachment = basicAttachmentService.saveAttachment(file, type, key);
|
|
|
} catch (Exception e) {
|
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
|
basicAttachmentService.deleteAttachment(basicAttachment);
|
|
@@ -176,7 +177,7 @@ public class SysController {
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
|
String filePath = (String) jsonObject.get(SystemConstant.PATH);
|
|
|
- return ResultUtil.ok(new AttachmentResult(basicAttachment.getId(), basicAttachmentService.filePreview(basicAttachment.getPath()), filePath));
|
|
|
+ return ResultUtil.ok(new AttachmentResult(basicAttachment.getId(), basicAttachmentService.filePreview(basicAttachment.getPath()), filePath, key));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "下载导入模板")
|
|
@@ -217,6 +218,15 @@ public class SysController {
|
|
|
return ResultUtil.ok(new EditResult(basicAttachmentService.filePreview(path)));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "小程序签名预览接口")
|
|
|
+ @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);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "文件预览接口")
|
|
|
@RequestMapping(value = "/file/preview", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
|