yangys
2025-09-29 4c7296d45efe849dc70a3b2e2240c905481a91c9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.springblade.mdm.commons.service;
 
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
 
/**
 * 机床路径转换器,从Z盘这种目录转换为网络目录格式入:\\192.168.233.2\Workshop
 */
@Component
public class MachineDirTranslator {
    @Autowired
    private DirTransProperties transProperties;
 
    public String trans(String path){
        if(StringUtils.isBlank(transProperties.getTargetDirPrefix()) || !StringUtils.startsWithIgnoreCase(path,transProperties.getOriDirPrefix())){
            return path;
        }
 
        String finalDir = transProperties.getTargetDirPrefix()+StringUtils.removeStartIgnoreCase(path,transProperties.getOriDirPrefix());
        return finalDir;
    }
}