From 51eb63d31f771dd71b34d22e23c94ab2ee27f5c4 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 20 五月 2022 13:40:40 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java | 57 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 39 insertions(+), 18 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 537f359..eed7f5a 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
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.service;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
@@ -13,6 +14,7 @@
import com.sandu.ximon.admin.minio.utils.MinIoUtil;
import com.sandu.ximon.admin.param.IpVolumeFileParam;
import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils;
import com.sandu.ximon.dao.domain.IpVolumeFile;
import com.sandu.ximon.dao.mapper.IpVolumeFileMapper;
import lombok.AllArgsConstructor;
@@ -48,6 +50,15 @@
file.setFileName(fileParam.getFileName());
file.setFileUrl(fileParam.getFileUrl());
file.setOriginSize(fileParam.getOriginSize());
+
+ /**
+ * 闊虫煴鏂囦欢鏂板 鏃ュ織璁板綍寮�濮�
+ */
+ String content = "闊虫煴鏂囦欢鍚嶇О锛�" + fileParam.getFileName() + "锛屾枃浠跺ぇ灏忥細" + fileParam.getOriginSize() + "锛屾枃浠惰矾寰勶細" + fileParam.getFileUrl();
+ StoreOperationRecordsUtils.storeOperationData(null, null, "闊虫煴鏂囦欢鏂板", content);
+ /**
+ * 闊虫煴鏂囦欢鏂板 鏃ュ織璁板綍缁撴潫
+ */
return save(file);
}
@@ -66,34 +77,34 @@
// if (!b) {
// throw new BusinessException("鏈嶅姟鍣ㄥ垹闄ゅけ璐�");
// }
-
+ /**
+ * 闊虫煴鏂囦欢鍒犻櫎 鏃ュ織璁板綍寮�濮�
+ */
+ String content = "鍒犻櫎鏂囦欢id:"+fileId+"闊虫煴鏂囦欢鍚嶇О锛�" + byId.getFileName() + "锛屾枃浠跺ぇ灏忥細" + byId.getOriginSize() + "锛屾枃浠惰矾寰勶細" + byId.getFileUrl();
+ StoreOperationRecordsUtils.storeOperationData(null, null, "闊虫煴鏂囦欢鍒犻櫎", content);
+ /**
+ * 闊虫煴鏂囦欢鍒犻櫎 鏃ュ織璁板綍缁撴潫
+ */
return removeById(fileId);
}
public LambdaQueryWrapper<IpVolumeFile> listFile(BaseConditionVO baseConditionVO, String keyword) {
PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
- LambdaQueryWrapper<IpVolumeFile> wrapper;
+ LambdaQueryWrapper<IpVolumeFile> wrapper = Wrappers.lambdaQuery(IpVolumeFile.class);
- if (SecurityUtils.getClientId() == null) {
- wrapper = Wrappers.lambdaQuery(IpVolumeFile.class);
- } else {
- if (clientService.findClientId()) {
- wrapper = Wrappers.lambdaQuery(IpVolumeFile.class).eq(IpVolumeFile::getUserId, SecurityUtils.getUserId());
- } else {
- wrapper = Wrappers.lambdaQuery(IpVolumeFile.class).eq(IpVolumeFile::getClientId, clientService.getClientId())
- .or(file -> {
- file.eq(IpVolumeFile::getClientId, SecurityUtils.getUserId());
- });
- }
+ //涓嶆槸瓒呯
+ if (SecurityUtils.getClientId() != null) {
+ wrapper = wrapper.eq(IpVolumeFile::getClientId, SecurityUtils.getUserId())
+ .or(file -> {
+ file.eq(IpVolumeFile::getUserId, SecurityUtils.getUserId());
+ });
}
-
- if (keyword.isEmpty()) {
- return wrapper;
- } else {
- return wrapper.like(IpVolumeFile::getFileName, keyword);
+ if (keyword != null && !keyword.isEmpty()) {
+ wrapper.like(IpVolumeFile::getFileName, keyword);
}
+ return wrapper;
}
@@ -135,6 +146,16 @@
fileUploadDto.setFileSize(file.getSize());
fileUploadDto.setFileName(file.getOriginalFilename());
fileUploadDto.setFileType(file.getContentType());
+
+ /**
+ * 闊虫煴鏂囦欢涓婁紶 鏃ュ織璁板綍寮�濮�
+ */
+ String content = "鏂囦欢鍐呭:"+ JSON.toJSONString(fileUploadDto);
+ StoreOperationRecordsUtils.storeOperationData(null, null, "闊虫煴鏂囦欢涓婁紶", content);
+ /**
+ * 闊虫煴鏂囦欢涓婁紶 鏃ュ織璁板綍缁撴潫
+ */
+
return fileUploadDto;
}
--
Gitblit v1.9.3