skyline 2 yıl önce
ebeveyn
işleme
bce30f4187

+ 7 - 0
entity/src/main/java/com/kym/entity/miniapp/Attachment.java

@@ -1,5 +1,6 @@
 package com.kym.entity.miniapp;
 package com.kym.entity.miniapp;
 
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.kym.entity.BaseEntity;
 import com.kym.entity.BaseEntity;
 import lombok.Getter;
 import lombok.Getter;
@@ -33,6 +34,12 @@ public class Attachment extends BaseEntity implements Serializable {
      */
      */
     private String name;
     private String name;
 
 
+    /**
+     * 链接
+     */
+    @TableField(exist = false)
+    private String url;
+
     /**
     /**
      * 文件大小
      * 文件大小
      */
      */

+ 2 - 1
miniapp/src/main/java/com/kym/miniapp/aspect/AppLogAspect.java

@@ -74,8 +74,9 @@ public class AppLogAspect {
         appLog.setMethod(className + "." + methodName + "()");
         appLog.setMethod(className + "." + methodName + "()");
         //请求的参数
         //请求的参数
         Object[] args = joinPoint.getArgs();
         Object[] args = joinPoint.getArgs();
-        String params = new Gson().toJson(args);
+
         if (!apiLog.ignoreParams()) {
         if (!apiLog.ignoreParams()) {
+            String params = new Gson().toJson(args);
             appLog.setRequestParam(params);
             appLog.setRequestParam(params);
         }
         }
         //获取request
         //获取request

+ 1 - 0
miniapp/src/main/resources/application.yml

@@ -131,6 +131,7 @@ upload:
   file:
   file:
    storage: file_storage  #文件存放地址
    storage: file_storage  #文件存放地址
    size: 20  #最大上传Mb
    size: 20  #最大上传Mb
+   url: https://static.kuaiyuman.cn/
 
 
 oss:
 oss:
   endpoint: oss-cn-shenzhen.aliyuncs.com
   endpoint: oss-cn-shenzhen.aliyuncs.com

+ 5 - 0
service/src/main/java/com/kym/service/miniapp/impl/AttachmentServiceImpl.java

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