czt
9 天以前 db67639449287bcec461916a7dca6003ee5dd03c
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
package com.fzzy.igds;
 
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.common.utils.Base64Util;
import com.fzzy.igds.domain.FileInfo;
import com.fzzy.igds.service.FileService;
import com.fzzy.igds.utils.ContextUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * @Description 文件上传
 * @Author CZT
 * @Date 2025/11/29 11:02
 */
@Slf4j
@Component
public class FilePR {
 
    @Resource
    private FileService fileService;
 
    /**
     * filePR#parseExcel
     *
     * @param fileName
     * @return
     */
    @Expose
    public String parseExcel(String fileName) {
        return fileName;
    }
 
    /**
     * filePR#listFile 根据条件获取列表数据
     *
     * @param bizId
     * @param bizId
     * @return
     */
    @DataProvider
    public List<FileInfo> listFile(String bizId) {
        if (null == bizId){
            return null;
        }
 
        return fileService.listFile(ContextUtil.getCompanyId(),ContextUtil.subDeptId(null), bizId, null);
    }
 
    /**
     *
     * filePR#getImg
     * 获取图片信息
     *
     * @param file
     * @return
     */
    @Expose
    public Map<String, String> getImg(FileInfo file) {
        Map<String, String> result = new HashMap<String, String>();
        result.put("code", "SUCCESS");
        String basePath = fileService.getFileSavePath("COMMON");
 
        String imgData = Base64Util.getImageStr(basePath + file.getFileName());
 
        if (null == imgData) {
            result.put("code", "ERROR");
        }
        result.put("data", imgData);
        return result;
    }
 
}