更新参数类型
This commit is contained in:
parent
b0afd5f4aa
commit
266c46fe16
@ -59,7 +59,7 @@ public class FileController {
|
|||||||
@Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String file = ExcelUploadUtil.memoryFile(fileExcel);
|
String file = ExcelUploadUtil.memoryFile(fileExcel,1);
|
||||||
fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file);
|
fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import org.springframework.data.jpa.repository.Modifying;
|
|||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +54,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
if (fileExcel == null) {
|
if (fileExcel == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale);
|
||||||
}
|
}
|
||||||
String file = ExcelUploadUtil.memoryFile(fileExcel);
|
String file = ExcelUploadUtil.memoryFile(fileExcel,1);
|
||||||
FileEntity fileEntity1 = new FileEntity();
|
FileEntity fileEntity1 = new FileEntity();
|
||||||
fileEntity1.setLotNo(fileQo.getLotNo());
|
fileEntity1.setLotNo(fileQo.getLotNo());
|
||||||
fileEntity1.setMachineNo(fileQo.getMachineNo());
|
fileEntity1.setMachineNo(fileQo.getMachineNo());
|
||||||
|
@ -35,7 +35,7 @@ public class PictureServiceImpl implements PictureService {
|
|||||||
if (pictureEntity2.isPresent()) {
|
if (pictureEntity2.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale);
|
||||||
}
|
}
|
||||||
String file = ExcelUploadUtil.memoryFile(pictureFile);
|
String file = ExcelUploadUtil.memoryFile(pictureFile, 2);
|
||||||
PictureEntity pictureEntity1 = new PictureEntity();
|
PictureEntity pictureEntity1 = new PictureEntity();
|
||||||
pictureEntity1.setLotNo(lotNo);
|
pictureEntity1.setLotNo(lotNo);
|
||||||
pictureEntity1.setMachineNo(machineNo);
|
pictureEntity1.setMachineNo(machineNo);
|
||||||
|
@ -23,16 +23,18 @@ public class ExcelUploadUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传单张图片
|
* 上传单张图片
|
||||||
* @param fileExcel
|
*
|
||||||
|
* @param fileInput
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static String memoryFile(MultipartFile fileExcel) throws IOException {
|
public static String memoryFile(MultipartFile fileInput, int subDirType) throws IOException {
|
||||||
|
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/";
|
||||||
//获取原始文件名
|
//获取原始文件名
|
||||||
String originalFilename = fileExcel.getOriginalFilename();
|
String originalFilename = fileInput.getOriginalFilename();
|
||||||
if (originalFilename != null && !"".equals(originalFilename)) {
|
if (originalFilename != null && !"".equals(originalFilename)) {
|
||||||
//找到 . 的位置
|
//找到 . 的位置
|
||||||
int index = originalFilename.lastIndexOf(".");
|
int index = originalFilename.lastIndexOf(".");
|
||||||
@ -42,16 +44,16 @@ 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("E:/shoptest/");
|
// File file = new File("/Users/liuchengqian/Desktop/DaJiang/");
|
||||||
File file = new File("/home/sxy/server/industrial_measurement/excel/");
|
File file = new File("/home/sxy/server/industrial_measurement/" + subDir);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.mkdirs();
|
file.mkdirs();
|
||||||
}
|
}
|
||||||
//String path = "E:/shoptest/" + newName;
|
// String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName;
|
||||||
String path = "/home/sxy/server/industrial_measurement/excel/" + newName;
|
String path = "/home/sxy/server/industrial_measurement/" + subDir + newName;
|
||||||
String uploadsImage = uploadPath + newName;
|
String uploadsImage = uploadPath + newName;
|
||||||
//实现上传
|
//实现上传
|
||||||
fileExcel.transferTo(new File(path));
|
fileInput.transferTo(new File(path));
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -99,9 +101,9 @@ public class ExcelUploadUtil {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除本地或服务器储存的图片
|
* 删除本地或服务器储存的图片
|
||||||
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -127,6 +129,7 @@ public class ExcelUploadUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过图片路径解析 ,上传保存
|
* 通过图片路径解析 ,上传保存
|
||||||
|
*
|
||||||
* @param listImgSrc
|
* @param listImgSrc
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -171,6 +174,7 @@ public class ExcelUploadUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除本地文件夹图片
|
* 删除本地文件夹图片
|
||||||
|
*
|
||||||
* @param url
|
* @param url
|
||||||
*/
|
*/
|
||||||
public static void deleteImage(String url) {
|
public static void deleteImage(String url) {
|
||||||
|
Loading…
Reference in New Issue
Block a user