From b95c910f14377d4f15cc4c05fa0b7bf8df759e91 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期四, 07 四月 2022 17:57:24 +0800
Subject: [PATCH] ip音柱文件上传

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java |   38 ++++++++++++++++++++++++++++++++------
 1 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
index 8053284..e2a44a3 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
@@ -2,10 +2,11 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.PageHelper;
 import com.sandu.common.execption.BusinessException;
+import com.sandu.common.object.BaseConditionVO;
 import com.sandu.common.service.impl.BaseServiceImpl;
 import com.sandu.ximon.admin.param.IpVolumeFileParam;
-import com.sandu.ximon.admin.param.ReceiveParam;
 import com.sandu.ximon.admin.security.SecurityUtils;
 import com.sandu.ximon.dao.domain.IpVolumeFile;
 import com.sandu.ximon.dao.mapper.IpVolumeFileMapper;
@@ -26,17 +27,21 @@
 
     public boolean addFile(IpVolumeFileParam fileParam) {
         IpVolumeFile file = new IpVolumeFile();
-        file.setUserId(SecurityUtils.getClientId());
+//        if(SecurityUtils.getClientId()!=null){
+//            file.setUserName(SecurityUtils.getUsername());
+//        }
+//
         if(SecurityUtils.getClientId()!=null){
             file.setUserName(SecurityUtils.getUsername());
+            file.setUserId(SecurityUtils.getClientId());
         }
 
         if(clientService.getClientId()!=null){
             file.setClientId(clientService.getClientId());
         }
         file.setFileName(fileParam.getFileName());
-        file.setFileSize(fileParam.getFileSize());
         file.setFileUrl(fileParam.getFileUrl());
+        file.setOriginSize(fileParam.getOriginSize());
         return save(file);
     }
 
@@ -48,13 +53,34 @@
         return removeById(fileId);
     }
 
-    public LambdaQueryWrapper<IpVolumeFile> listFile(ReceiveParam receiveParam) {
+    public LambdaQueryWrapper<IpVolumeFile> listFile(BaseConditionVO baseConditionVO, String keyword) {
+        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
         LambdaQueryWrapper<IpVolumeFile> wrapper = Wrappers.lambdaQuery(IpVolumeFile.class).eq(IpVolumeFile::getClientId, clientService.getClientId());
-        if (receiveParam.getKeyWord() == null) {
+        if (keyword.isEmpty()) {
             return wrapper;
         } else {
-          return   wrapper.like(IpVolumeFile::getFileName,receiveParam.getKeyWord());
+          return   wrapper.like(IpVolumeFile::getFileName,keyword);
         }
     }
 
+    public boolean upload(IpVolumeFileParam fileParam) {
+        IpVolumeFile file = new IpVolumeFile();
+//        if(SecurityUtils.getClientId()!=null){
+//            file.setUserName(SecurityUtils.getUsername());
+//        }
+//
+        if(SecurityUtils.getClientId()!=null){
+            file.setUserName(SecurityUtils.getUsername());
+            file.setUserId(SecurityUtils.getClientId());
+        }
+
+        if(clientService.getClientId()!=null){
+            file.setClientId(clientService.getClientId());
+        }
+        file.setFileName(fileParam.getFileName());
+        file.setFileUrl(fileParam.getFileUrl());
+        file.setOriginSize(fileParam.getOriginSize());
+        return save(file);
+    }
+
 }

--
Gitblit v1.9.3