优化预览
This commit is contained in:
parent
abfc92405c
commit
9bff9d672e
|
@ -1,7 +1,6 @@
|
|||
package org.dromara.system.controller.file;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -112,8 +111,8 @@ public class SysOssPersonController extends BaseController {
|
|||
*/
|
||||
@SaCheckPermission("file:person:download")
|
||||
@PostMapping("/download/{id}")
|
||||
public void download(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||
sysOssPersonService.download(id, response);
|
||||
public R<String> download(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
|
||||
return R.ok("操作成功",sysOssPersonService.download(id));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.dromara.system.controller.file;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -131,12 +130,13 @@ public class SysOssResourceController extends BaseController {
|
|||
*/
|
||||
@SaCheckPermission("file:resource:download")
|
||||
@PostMapping("/download/{id}")
|
||||
public void download(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||
sysOssResourceService.download(id, response);
|
||||
public R<String> download(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
|
||||
return R.ok("操作成功",sysOssResourceService.download(id));
|
||||
}
|
||||
|
||||
@SaCheckPermission("file:resource:preview")
|
||||
@PostMapping("/preview/{id}")
|
||||
public void preview(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||
sysOssResourceService.preview(id, response);
|
||||
public R<String> preview(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
|
||||
return R.ok("操作成功",sysOssResourceService.preview(id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.dromara.system.controller.file;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -133,13 +132,13 @@ public class SysOssTextbookController extends BaseController {
|
|||
*/
|
||||
@SaCheckPermission("file:textbook:download")
|
||||
@PostMapping("/download/{id}")
|
||||
public void download(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||
sysOssTextbookService.download(id, response);
|
||||
public R<String> download(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
|
||||
return R.ok("操作成功",sysOssTextbookService.download(id));
|
||||
}
|
||||
|
||||
@SaCheckPermission("file:textbook:preview")
|
||||
@PostMapping("/preview/{id}")
|
||||
public void preview(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||
sysOssTextbookService.preview(id, response);
|
||||
public R<String> preview(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
|
||||
return R.ok("操作成功",sysOssTextbookService.preview(id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
|
@ -159,8 +158,8 @@ public class PortalController extends BaseController {
|
|||
|
||||
@SaIgnore
|
||||
@PostMapping("/resource/preview/{id}")
|
||||
public void resourcePreview(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||
ossResourceService.preview(id, response);
|
||||
public R<String> resourcePreview(@PathVariable Long id) {
|
||||
return R.ok("操作成功",ossResourceService.preview(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,7 +206,7 @@ public class PortalController extends BaseController {
|
|||
|
||||
@SaIgnore
|
||||
@PostMapping("/textbook/preview/{id}")
|
||||
public void textbookPreview(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||
ossTextbookService.preview(id, response);
|
||||
public R<String> textbookPreview(@PathVariable Long id) {
|
||||
return R.ok("操作成功",ossTextbookService.preview(id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package org.dromara.system.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.bo.SysOssPersonBo;
|
||||
import org.dromara.system.domain.vo.SysOssPersonVo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -71,6 +69,6 @@ public interface ISysOssPersonService {
|
|||
Boolean copyByBo(SysOssPersonBo bo);
|
||||
Boolean moveByBo(SysOssPersonBo bo);
|
||||
|
||||
void download(Long id, HttpServletResponse response) throws IOException;
|
||||
String preview(Long id) throws Exception;
|
||||
String download(Long id);
|
||||
String preview(Long id);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package org.dromara.system.service;
|
||||
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.bo.SysOssResourceBo;
|
||||
import org.dromara.system.domain.vo.SysOssResourceVo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -84,8 +82,8 @@ public interface ISysOssResourceService {
|
|||
|
||||
Boolean moveByBo(SysOssResourceBo bo);
|
||||
|
||||
void download(Long id, HttpServletResponse response) throws IOException;
|
||||
String download(Long id);
|
||||
|
||||
void preview(Long id, HttpServletResponse response) throws Exception;
|
||||
String preview(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package org.dromara.system.service;
|
||||
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.bo.SysOssTextbookBo;
|
||||
import org.dromara.system.domain.vo.SysOssTextbookVo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -82,7 +80,7 @@ public interface ISysOssTextbookService {
|
|||
Boolean copyByBo(SysOssTextbookBo bo);
|
||||
Boolean moveByBo(SysOssTextbookBo bo);
|
||||
|
||||
void download(Long id, HttpServletResponse response) throws IOException;
|
||||
void preview(Long id, HttpServletResponse response) throws Exception;
|
||||
String download(Long id);
|
||||
String preview(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
|
@ -28,7 +27,6 @@ import org.dromara.system.service.ISysOssPersonService;
|
|||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -202,18 +200,18 @@ public class SysOssPersonServiceImpl implements ISysOssPersonService {
|
|||
date.setFileName(ossPerson.getFileName());
|
||||
date.setFileSuffix(ossPerson.getFileSuffix());
|
||||
date.setFilePath(path);
|
||||
date.setType(ossPerson.getType());
|
||||
return date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Long id, HttpServletResponse response) throws IOException {
|
||||
public String download(Long id) {
|
||||
SysOssPerson ossPerson = baseMapper.selectById(id);
|
||||
String fileName = ossPerson.getFileName();
|
||||
ossService.download(ossPerson.getOssId(), fileName, response);
|
||||
return ossService.getUrlById(ossPerson.getOssId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String preview(Long id) throws Exception {
|
||||
public String preview(Long id){
|
||||
SysOssPerson ossPerson = baseMapper.selectById(id);
|
||||
return ossService.getUrlById(ossPerson.getOssId());
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
|
@ -28,7 +27,6 @@ import org.dromara.system.service.ISysOssResourceService;
|
|||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -254,17 +252,16 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void download(Long id, HttpServletResponse response) throws IOException {
|
||||
public String download(Long id) {
|
||||
SysOssResource ossResource = baseMapper.selectById(id);
|
||||
String fileName = ossResource.getFileName();
|
||||
ossService.download(ossResource.getOssId(), fileName, response);
|
||||
baseMapper.addDownloadNum(id);
|
||||
return ossService.getUrlById(ossResource.getOssId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preview(Long id, HttpServletResponse response) throws Exception {
|
||||
public String preview(Long id) {
|
||||
SysOssResource ossResource = baseMapper.selectById(id);
|
||||
//ossService.preview(ossResource.getOssId(), response);
|
||||
baseMapper.addPreviewNum(id);
|
||||
return ossService.getUrlById(ossResource.getOssId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
|
@ -27,7 +26,6 @@ import org.dromara.system.service.ISysOssService;
|
|||
import org.dromara.system.service.ISysOssTextbookService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
@ -265,18 +263,17 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void download(Long id, HttpServletResponse response) throws IOException {
|
||||
public String download(Long id) {
|
||||
SysOssTextbook ossTextbook = baseMapper.selectById(id);
|
||||
String fileName = ossTextbook.getFileName();
|
||||
ossService.download(ossTextbook.getOssId(), fileName, response);
|
||||
baseMapper.addDownloadNum(id);
|
||||
return ossService.getUrlById(ossTextbook.getOssId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preview(Long id, HttpServletResponse response) throws Exception {
|
||||
public String preview(Long id){
|
||||
SysOssTextbook ossTextbook = baseMapper.selectById(id);
|
||||
//ossService.preview(ossTextbook.getOssId(), response);
|
||||
baseMapper.addPreviewNum(id);
|
||||
return ossService.getUrlById(ossTextbook.getOssId());
|
||||
}
|
||||
|
||||
private List<String> processFormatSuffixQuery(int format) {
|
||||
|
|
Loading…
Reference in New Issue