|
@@ -12,8 +12,10 @@ import java.io.*;
|
|
|
@ConditionalOnExpression("${useOss}==false")
|
|
|
public class NginxFileService implements FileService {
|
|
|
|
|
|
- @Value("${filePath}")
|
|
|
- private String filePath;
|
|
|
+ @Value("${save.path}")
|
|
|
+ private String savePath;
|
|
|
+ @Value("${save.json}")
|
|
|
+ private String jsonPath;
|
|
|
@Value("${baseUrl.urlPath}")
|
|
|
private String urlPath;
|
|
|
|
|
@@ -25,7 +27,7 @@ public class NginxFileService implements FileService {
|
|
|
@Override
|
|
|
public String uploadFile(MultipartFile file) {
|
|
|
String fileName = System.currentTimeMillis()+ file.getOriginalFilename();
|
|
|
- File saveFile = new File(filePath + fileName);
|
|
|
+ File saveFile = new File(savePath + jsonPath + fileName);
|
|
|
//判断文件父目录是否存在
|
|
|
// System.out.println(saveFile.getParentFile());
|
|
|
if (!saveFile.getParentFile().exists()) {
|
|
@@ -43,7 +45,7 @@ public class NginxFileService implements FileService {
|
|
|
@Override
|
|
|
public String uploadJson(String content,long taskId) {
|
|
|
String fileName = taskId+".json";
|
|
|
- File saveFile = new File(filePath + fileName);
|
|
|
+ File saveFile = new File(savePath + jsonPath + fileName);
|
|
|
//判断文件父目录是否存在
|
|
|
// System.out.println(saveFile.getParentFile());
|
|
|
if (!saveFile.getParentFile().exists()) {
|
|
@@ -54,8 +56,8 @@ public class NginxFileService implements FileService {
|
|
|
write.write(content);
|
|
|
write.flush();
|
|
|
write.close();
|
|
|
- System.out.println("上传三级菜单的json " + filePath + fileName);
|
|
|
- return filePath + fileName;
|
|
|
+ System.out.println("上传三级菜单的json " + savePath + jsonPath + fileName);
|
|
|
+ return savePath + jsonPath + fileName;
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
return null;
|