|
|
@ -11,9 +11,11 @@ package com.epmet.controller; |
|
|
|
import com.epmet.cloud.CloudStorageConfig; |
|
|
|
import com.epmet.cloud.OssFactory; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
@ -33,6 +35,7 @@ import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.io.FilenameUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.http.entity.ContentType; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.MediaType; |
|
|
@ -246,6 +249,14 @@ public class OssController { |
|
|
|
, EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
Result<UploadImgResultDTO> result = ossService.uploadImg(file, null); |
|
|
|
if (result != null && result.success() ){ |
|
|
|
UploadImgResultDTO data = result.getData(); |
|
|
|
if ( data!= null && StringUtils.isNotBlank(data.getUrl())){ |
|
|
|
String path = data.getUrl().replace(data.getUrl(), StrConstant.EPMETY_STR); |
|
|
|
redisUtils.set(RedisKeys.getOssFileKey(path),path,RedisUtils.MINUTE_THIRTY_EXPIRE); |
|
|
|
} |
|
|
|
} |
|
|
|
return ossService.uploadImg(file, null); |
|
|
|
} |
|
|
|
|
|
|
|