wangting
2024-09-27 a3e87f78ee262ca9bb7d9b0c997639d5f3295890
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
package com.vci.client.fm;
 
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
 
import com.vci.client.fm.util.RandomUtil;
import com.vci.client.fm.util.TransformUtil;
import com.vci.corba.common.VCIError;
/**
 * 文件存储路径相关业务类
 * @author liwei
 *
 */
public class FileCabinetPath {
    
    /**
     * 获取服务器端文件存储路径
     * @return
     */
    public static String getRandomServerSaveFilePath() throws VCIError{
        try {
            List<String> serverFileSaveCabinetPaths = null;
            serverFileSaveCabinetPaths = getFileSavePath();
            return serverFileSaveCabinetPaths.get(0);
        } catch (VCIError e) {
            throw new VCIError(String.valueOf(e.code), e.messages);
        }
    }
    
    
    public static List<String> getFileSavePath() throws VCIError{
        List<String> rs = null;
        rs = new ArrayList<String>();
        String firstPath = null;
        String secondPath = null;
        String te = null;
        String ys2s = null;
        Set<Integer> hs = RandomUtil.getRandom(25600, 1);
        Iterator<Integer> it = hs.iterator();
        while (it.hasNext()) {
            int randomNum = it.next();
            int ys = randomNum % 255;
            String ys16 = TransformUtil.sl(16, ys);
            if (ys16.length() <= 1) {
                te = "0" + ys16;
            } else {
                te = ys16;
            }
            firstPath = te;
            int ys2 = randomNum % 100;
            if (ys2 <= 9) {
                ys2s = "0" + ys2;
            } else {
                ys2s = ys2 + "";
            }
            secondPath = ys2s;
            String mzPath = "/" + firstPath + "/" + secondPath;
            rs.add(mzPath);
        }
 
        return rs;
 
    }
 
}