|
|
@ -29,6 +29,7 @@ import com.epmet.utils.ModuleConstant; |
|
|
|
import com.google.gson.Gson; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.io.FilenameUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.MediaType; |
|
|
@ -37,7 +38,6 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
|
import springfox.documentation.annotations.ApiIgnore; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
@ -48,6 +48,7 @@ import java.util.Map; |
|
|
|
@RestController |
|
|
|
@RequestMapping("file") |
|
|
|
@Api(tags="文件上传") |
|
|
|
@Slf4j |
|
|
|
public class OssController { |
|
|
|
@Autowired |
|
|
|
private OssService ossService; |
|
|
@ -191,6 +192,7 @@ public class OssController { |
|
|
|
|
|
|
|
// 校验文件类型
|
|
|
|
if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType()) && !MediaType.IMAGE_JPEG_VALUE.equals(file.getContentType())) { |
|
|
|
log.error("uploadArticleImg file type:{} is not support 2 upload",file.getContentType() == null? null:file.getContentType()); |
|
|
|
throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getCode() |
|
|
|
, EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg()); |
|
|
|
} |
|
|
|