|
@@ -31,7 +31,6 @@ public class UploadController {
|
|
|
|
|
|
@Value("${minio.bucketName}")
|
|
|
private String bucketName;
|
|
|
-
|
|
|
@Resource
|
|
|
MinioUtils minioUtils;
|
|
|
@Autowired
|
|
@@ -39,7 +38,6 @@ public class UploadController {
|
|
|
@Autowired
|
|
|
BaseRailwayManagementService baseRailwayManagementService;
|
|
|
|
|
|
-
|
|
|
@PostMapping("/upLoadImage")
|
|
|
public AjaxResult upLoadImage(@RequestParam("file") MultipartFile image,
|
|
|
@RequestParam(value = "cameraCode", required = false) String cameraCode,
|
|
@@ -78,4 +76,34 @@ public class UploadController {
|
|
|
}
|
|
|
return AjaxResult.success(uploadFile);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 相机版本文件上传
|
|
|
+ * @param image
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @PostMapping("/upLoadCameraVersion")
|
|
|
+ public AjaxResult upLoadCameraVersion(@RequestParam("file") MultipartFile image) throws Exception {
|
|
|
+ if (image.isEmpty()) {
|
|
|
+ return AjaxResult.error("不能上传空文件哦");
|
|
|
+ }
|
|
|
+ //图片保存路径
|
|
|
+ String uploadFile = null;
|
|
|
+ if (image != null || !image.isEmpty()) {
|
|
|
+ String imageName = image.getOriginalFilename();
|
|
|
+ if (StringUtils.isNotBlank(imageName)) {
|
|
|
+ // String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
|
|
+ String filename = IdUtils.fastSimpleUUID() + image.getOriginalFilename().substring(image.getOriginalFilename().lastIndexOf("."));
|
|
|
+ SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format1 = dateFormat1.format(new Date());
|
|
|
+ String imgName = "cameraVersion" + format1 + "/" + filename;
|
|
|
+ minioUtils.minIoClientUpload(image.getInputStream(), imgName);
|
|
|
+ uploadFile = "/cameraVersion/" + format1 + "/" + filename;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error("上传功能出错");
|
|
|
+ }
|
|
|
+ return AjaxResult.success(uploadFile);
|
|
|
+ }
|
|
|
}
|