jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
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
package com.ld.igds.file;
 
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.Expose;
import com.ld.igds.file.dto.FileData;
import com.ld.igds.models.FileInfo;
import com.ld.igds.util.Base64Util;
import com.ld.igds.util.ContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * 
 * @author: andy.jia
 * @description:
 * @version:
 * @data:2020年6月24日
 *
 */
@Component("sys.fileManager")
public class FileManager {
 
    @Autowired
    private CoreFileService fileService;
 
    /**
     * sys.fileManager#parseExcel
     * 
     * @param fileName
     * @return
     */
    @Expose
    public String parseExcel(String fileName) {
        return fileName;
    }
 
    /**
     * sys.fileManager#listFile 根据条件获取列表数据
     * 
     * @param bizId
     * @param bizId
     * @return
     */
    @DataProvider
    public List<FileData> listFile(String bizId) {
        if (null == bizId)
            return null;
        String companyId = ContextUtil.getCompanyId();
        return fileService.listFile(companyId, bizId);
    }
 
    /**
     * 
     * sys.fileManager#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.getCommonFilePath(file.getCreateTime());
 
        String imgData = Base64Util.getImageStr(basePath + file.getFileName());
 
        if (null == imgData) {
            result.put("code", "ERROR");
        }
        result.put("data", imgData);
        return result;
    }
 
}