czt
2025-06-03 4901f0cf60ecc6484d149ca5e9a0083e4b21db21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.fzzy.igds.sys.pr;
 
import com.bstek.dorado.uploader.UploadFile;
import com.bstek.dorado.uploader.annotation.FileResolver;
import com.fzzy.igds.file.FileService;
import com.fzzy.igds.util.ContextUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.util.Map;
 
/**
 * @Description Dorado7 附件上传公共管理层
 * @Author CZT
 * @Date 2024/12/28 10:05
 */
@Slf4j
@Component
public class FileUploadManage {
 
    @Resource
    private FileService fileService;
 
 
    /**
     * 上传库区简介视频
     * fileUploadManage#videoFile
     *
     * @param file
     * @param parameter
     * @return
     */
    @FileResolver
    public String videoFile(UploadFile file, Map<String, Object> parameter) {
 
        String fileId = null;
        try {
 
            String basePath = fileService.getDeptFilePath(null);
            fileId = "aerial-" + ContextUtil.subDeptId(null)
                    + file.getFileName().substring(
                    file.getFileName().lastIndexOf("."));
 
            file.transferTo(new File(basePath + fileId));
 
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
        return fileId;
    }
 
    /**
     * 上传库区鸟瞰图
     * fileUploadManage#imgFile
     *
     * @param file
     * @param parameter
     * @return
     */
    @FileResolver
    public String imgFile(UploadFile file, Map<String, Object> parameter) {
 
        String fileId = null;
        try {
 
            String basePath = fileService.getDeptFilePath(null);
 
            fileId = "aerial-" + ContextUtil.subDeptId(null)
                    + file.getFileName().substring(
                    file.getFileName().lastIndexOf("."));
 
            file.transferTo(new File(basePath + fileId));
 
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
        return fileId;
    }
 
}