czt
10 天以前 52ea5fd92596267379be7924deb27de6cb10632b
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
package com.fzzy.igds.service;
 
import com.ruoyi.common.config.FrameworkConfig;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
 
import java.io.File;
import java.util.Date;
 
/**
 * @Description
 * @Author CZT
 * @Date 2025/12/4 17:36
 */
@Service
public class FileService {
 
    /**
     * 获取出入库文件路径
     * @param date
     * @return
     */
    public String getInoutFilePath(Date date) {
        if (null == date) date = new Date();
        String basePath = FrameworkConfig.getProfile() + "INOUT/" + DateFormatUtils.format(date, "yyyyMM") + "/";
        File file = new File(basePath);
        if (!file.exists()) {
            file.mkdirs();
        }
        return basePath;
    }
 
    /**
     * 获取库区路径下文件
     * @param companyId
     * @return
     */
    public String getDeptFilePath(String companyId) {
        if (StringUtils.isEmpty(companyId)){
            companyId = FrameworkConfig.getCompanyId();
        }
 
        String basePath = FrameworkConfig.getProfile() + "IMG/"+ companyId + "/SECURITY/";
 
        File file = new File(basePath);
        if (!file.exists()) {
            file.mkdirs();
        }
        return basePath;
    }
}