完善文件服务器传输

This commit is contained in:
liuchengqian 2022-03-01 19:24:15 +08:00
parent 62703e1fe4
commit 2a362c3264
5 changed files with 11 additions and 11 deletions

View File

@ -54,6 +54,6 @@ public class PictureController {
if (pictureEntities.isEmpty()) { if (pictureEntities.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale);
} }
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities.get(0), locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities, locale);
} }
} }

View File

@ -48,7 +48,7 @@ public class SpecController {
if (specEntities.isEmpty()) { if (specEntities.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale);
} }
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities.get(0), locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities, locale);
} }
} }

View File

@ -50,13 +50,13 @@ public class FileEntity {
/** /**
* 上传模板的路径 * 上传模板的路径
*/ */
@Column(length = 1024, columnDefinition = "varchar(1024)") @Column(length = 2048, columnDefinition = "varchar(2048)")
private String fileUploadPath; private String fileUploadPath;
/** /**
* 下载路径 * 下载路径
*/ */
@Column(length = 1024, columnDefinition = "varchar(1024)") @Column(length = 2048, columnDefinition = "varchar(2048)")
private String fileDownloadPath; private String fileDownloadPath;
public FileEntity() { public FileEntity() {

View File

@ -46,7 +46,7 @@ public class PictureEntity {
/** /**
* 图片路径 * 图片路径
*/ */
@Column(length = 85, columnDefinition = "varchar(85)") @Column(length = 2048, columnDefinition = "varchar(2048)")
private String picturePath; private String picturePath;
public PictureEntity() { public PictureEntity() {

View File

@ -29,7 +29,7 @@ public class ExcelUploadUtil {
* @throws IOException * @throws IOException
*/ */
public static String memoryFile(MultipartFile fileInput, int subDirType) throws IOException { public static String memoryFile(MultipartFile fileInput, int subDirType) throws IOException {
String subDir = subDirType == 1 ? "excel/" : "picture/"; String subDir = subDirType == 1 ? "/excel/" : "/picture/";
//String uploadPath = "http://139.199.98.175:2088/wfTaskImage/"; //String uploadPath = "http://139.199.98.175:2088/wfTaskImage/";
// String uploadPath = "http://192.168.2.9:2088/"; // String uploadPath = "http://192.168.2.9:2088/";
String uploadPath = "http://118.24.27.47:4096/"; String uploadPath = "http://118.24.27.47:4096/";
@ -44,17 +44,17 @@ public class ExcelUploadUtil {
String newName = UUID.randomUUID().toString() + suffix; String newName = UUID.randomUUID().toString() + suffix;
//将图片保存到本地/usr/etc/images/Folder //将图片保存到本地/usr/etc/images/Folder
File file = new File("/Users/liuchengqian/Desktop/DaJiang/"); // File file = new File("/Users/liuchengqian/Desktop/DaJiang/");
// File file = new File("/home/sxy/server/industrial_measurement/" + subDir); File file = new File("/home/sxy/server/industrial_measurement" + subDir);
if (!file.exists()) { if (!file.exists()) {
file.mkdirs(); file.mkdirs();
} }
String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName; // String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName;
// String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; String path = "/home/sxy/server/industrial_measurement" + subDir + newName;
String uploadsImage = uploadPath + newName; String uploadsImage = uploadPath + newName;
//实现上传 //实现上传
fileInput.transferTo(new File(path)); fileInput.transferTo(new File(path));
return path; return subDir + newName;
} }
return null; return null;
} }