Compare commits

..

No commits in common. "2a1c41ae983df25d11e4d163ea5a16cc4c8a4c03" and "85592627d621c4102610d9faeced9f7b3830b411" have entirely different histories.

View File

@ -41,8 +41,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
@ -51,7 +49,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URLDecoder; import java.net.URLDecoder;
@ -67,7 +64,6 @@ import java.util.stream.Stream;
@Slf4j @Slf4j
@RequestMapping("/file") @RequestMapping("/file")
public class FileController { public class FileController {
private static final Logger LOGGER = LoggerFactory.getLogger(FileController.class);
@Resource @Resource
IFileService fileService; IFileService fileService;
@ -121,12 +117,9 @@ public class FileController {
} else if ("drawio".equals(extendName)) { } else if ("drawio".equals(extendName)) {
templateFilePath = "template/Drawio.drawio"; templateFilePath = "template/Drawio.drawio";
} }
// String url2 = ClassUtils.getDefaultClassLoader().getResource("static/" + templateFilePath).getPath(); String url2 = ClassUtils.getDefaultClassLoader().getResource("static/" + templateFilePath).getPath();
// System.out.println("ClassUtils.getDefaultClassLoader() = " + ClassUtils.getDefaultClassLoader().getResource("st")); System.out.println("ClassUtils.getDefaultClassLoader() = " + ClassUtils.getDefaultClassLoader().getResource("st"));
// System.out.println("ClassUtils.getDefaultClassLoader().getResource(\"static\") = " + ClassUtils.getDefaultClassLoader().getResource("static")); System.out.println("ClassUtils.getDefaultClassLoader().getResource(\"static\") = " + ClassUtils.getDefaultClassLoader().getResource("static"));
String separatorInfo = File.separator;
String url2 = getMubanFile("static" + separatorInfo + templateFilePath.replace("/", separatorInfo));
LOGGER.info("--->>模板文件所在的路径是:{}", url2);
System.out.println("url2 = " + url2); System.out.println("url2 = " + url2);
url2 = URLDecoder.decode(url2, "UTF-8"); url2 = URLDecoder.decode(url2, "UTF-8");
FileInputStream fileInputStream = new FileInputStream(url2); FileInputStream fileInputStream = new FileInputStream(url2);
@ -167,18 +160,6 @@ public class FileController {
} }
} }
/**
* user.dir默认会定位到你的工程根目录但是web项目不行如果是web项目会定位到tomcat的bin目录
*
* @param fileName
*/
public String getMubanFile(String fileName) {
String rootPath = System.getProperty("user.dir");
String fenge = File.separator;
//找寻这个路径下边的 /src/main/resources/ Windows跟Linux环境分割符号不同
return rootPath + fenge + "src" + fenge + "main" + fenge + "resources" + fenge + fileName;
}
@Operation(summary = "创建文件夹", description = "目录(文件夹)的创建", tags = {"file"}) @Operation(summary = "创建文件夹", description = "目录(文件夹)的创建", tags = {"file"})
@RequestMapping(value = "/createFold", method = RequestMethod.POST) @RequestMapping(value = "/createFold", method = RequestMethod.POST)
@MyLog(operation = "创建文件夹", module = CURRENT_MODULE) @MyLog(operation = "创建文件夹", module = CURRENT_MODULE)