Compare commits
2 Commits
cbbdc5627e
...
a22a369afa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a22a369afa | ||
|
|
da1bdafbb2 |
@@ -0,0 +1,13 @@
|
||||
package cn.nopj.chaos_api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileUploadResponse {
|
||||
private String fileName;
|
||||
private String fileDownloadUri;
|
||||
private String ossBucket;
|
||||
private String fileOSSUri;
|
||||
private String fileType;
|
||||
private long size;
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
<artifactId>chaos_api_domain</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.nopj.chaos_api.service;
|
||||
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public interface ImageService {
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
* @param fileName 文件名
|
||||
* @param content 文件内容
|
||||
* @return 文件路径
|
||||
*/
|
||||
String uploadImage(String fileName, InputStream content);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.nopj.chaos_api.service.impl;
|
||||
|
||||
import cn.nopj.chaos_api.service.ImageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ImageServiceImpl implements ImageService {
|
||||
@Override
|
||||
public String uploadImage(String fileName, InputStream content) {
|
||||
//todo 完成上传图片功能
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.nopj.chaos_api.controller;
|
||||
|
||||
import cn.nopj.chaos_api.model.ApiResult;
|
||||
import cn.nopj.chaos_api.service.ImageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/image")
|
||||
public class ImageController {
|
||||
@Autowired
|
||||
private ImageService imageService;
|
||||
|
||||
@RequestMapping("/upload")
|
||||
ApiResult<String> uploadImage(@RequestParam("file") MultipartFile file) {
|
||||
log.info("上传图片");
|
||||
return ApiResult.success("上传成功");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user