liurunyu
2025-01-14 706f722adc849eba0296f1dbd64166e1e0bde4c5
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/webCtrls/WebFileCtrl.java
@@ -1,7 +1,5 @@
package com.dy.pipIrrGlobal.webCtrls;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.dyFile.FileConstant;
@@ -18,7 +16,6 @@
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
/**
 * web文件上传
 */
@@ -40,13 +37,15 @@
    @Value("${dy.webFile.supportedFileTypes}")
    private String supportedFileTypes ;
    //视频的缩略图的扩展名
    private static final String VideoZipPicFileType = "jpg";
    /**
     * 上传照片图片文件 (当前只对png jpg格式图片支持缩略图)
     * @param file web端上传文件的post对象
     * @return 返回结果
     */
    @PostMapping("/upPhoto")
    @SsoAop()
    //参考:https://blog.zhengru.top/posts/33486.html#%E5%8D%95%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0
    public BaseResponse<?> upPhoto(MultipartFile file) {
        try {
@@ -67,8 +66,9 @@
                                frVo.fileNameHash,
                                fileNameGrp[0],
                                fileNameGrp[1],
                                frVo.getFileWebPath(),
                                (frVo.getFileWebUrl() + frVo.getFileWebPath()),
                                fileOp.getImgFileZipPath(frVo.getFileWebUrl() + frVo.getFileWebPath()),
                                fileOp.getFileZipPath(frVo.getFileWebUrl() + frVo.getFileWebPath()),
                                frVo.fileWebDownloadPath + id) ;
                        return  BaseResponseUtils.buildSuccess(fvo) ;
                    }else {
@@ -92,7 +92,6 @@
     * @return 返回结果
     */
    @PostMapping("/upPhone")
    @SsoAop()
    public BaseResponse<?> upPhone(MultipartFile file) {
        try {
            if (file != null) {
@@ -112,6 +111,7 @@
                                frVo.fileNameHash,
                                fileNameGrp[0],
                                fileNameGrp[1],
                                frVo.getFileWebPath(),
                                frVo.getFileWebUrl() + frVo.getFileWebPath(),
                                null,
                                frVo.fileWebDownloadPath + id) ;
@@ -138,7 +138,6 @@
     * @return 返回结果
     */
    @PostMapping("/upVideo")
    @SsoAop()
    public BaseResponse<?> upVideo(MultipartFile file) {
        try {
            if (file != null) {
@@ -158,8 +157,9 @@
                                frVo.fileNameHash,
                                fileNameGrp[0],
                                fileNameGrp[1],
                                frVo.getFileWebPath(),
                                frVo.getFileWebUrl() + frVo.getFileWebPath(),
                                null,
                                fileOp.getFileZipPath(frVo.getFileWebUrl() + frVo.getFileWebPath(), VideoZipPicFileType),
                                frVo.fileWebDownloadPath + id) ;
                        return  BaseResponseUtils.buildSuccess(fvo) ;
                    }else {
@@ -184,7 +184,6 @@
     * @return 返回结果
     */
    @PostMapping("/upDocument")
    @SsoAop()
    public BaseResponse<?> upDocument(MultipartFile file) {
        try {
            if (file != null) {
@@ -206,7 +205,9 @@
                        Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath);
                        FileVo fvo = new FileVo(id,
                                frVo.fileNameHash,
                                fileNameGrp[0], fileNameGrp[1],
                                fileNameGrp[0],
                                fileNameGrp[1],
                                frVo.getFileWebPath(),
                                frVo.getFileWebUrl() + frVo.getFileWebPath(),
                                null,
                                frVo.fileWebDownloadPath + id) ;