|
|
@@ -10,6 +10,7 @@ import com.kym.common.utils.OssUtil;
|
|
|
import com.kym.entity.miniapp.Attachment;
|
|
|
import com.kym.mapper.miniapp.AttachmentMapper;
|
|
|
import com.kym.service.miniapp.AttachmentService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@@ -33,6 +34,9 @@ public class AttachmentServiceImpl extends ServiceImpl<AttachmentMapper, Attachm
|
|
|
@Value("${upload.file.storage}")
|
|
|
private String fileStoragePath;
|
|
|
|
|
|
+ @Value("${upload.file.url}")
|
|
|
+ private String url;
|
|
|
+
|
|
|
@Value("${upload.file.size}")
|
|
|
private int fileSize;
|
|
|
|
|
|
@@ -49,6 +53,7 @@ public class AttachmentServiceImpl extends ServiceImpl<AttachmentMapper, Attachm
|
|
|
attachment.setName(fileName);
|
|
|
attachment.setSize(file.getSize());
|
|
|
attachment.setUuid(UUID.fastUUID().toString(true) + "." + FileUtil.getSuffix(fileName));
|
|
|
+ attachment.setUrl(url.concat(attachment.getUuid()));
|
|
|
attachment.setUploadBy(userId);
|
|
|
// attachment.setUploadName("admin");
|
|
|
attachment.setUploadName(CommUtil.null2String(StpUtil.getSession().get("username")));
|