| | |
| | | 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; |
| | |
| | | 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; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | // if (!b) { |
| | | // throw new BusinessException("服务器删除失败"); |
| | | // } |
| | | |
| | | /** |
| | | * 音柱文件删除 日志记录开始 |
| | | */ |
| | | String content = "删除文件id:"+fileId+"音柱文件名称:" + byId.getFileName() + ",文件大小:" + byId.getOriginSize() + ",文件路径:" + byId.getFileUrl(); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "音柱文件删除", content); |
| | | /** |
| | | * 音柱文件删除 日志记录结束 |
| | | */ |
| | | |
| | | return removeById(fileId); |
| | | } |
| | |
| | | } |
| | | return wrapper; |
| | | } |
| | | |
| | | public List<IpVolumeFile> listFiles() { |
| | | LambdaQueryWrapper<IpVolumeFile> wrapper = Wrappers.lambdaQuery(IpVolumeFile.class); |
| | | |
| | | //不是超管 |
| | | if (SecurityUtils.getClientId() != null) { |
| | | wrapper = wrapper.eq(IpVolumeFile::getClientId, SecurityUtils.getUserId()) |
| | | .or(file -> { |
| | | file.eq(IpVolumeFile::getUserId, SecurityUtils.getUserId()); |
| | | }); |
| | | } |
| | | return list(wrapper); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | fileUploadDto.setFileSize(file.getSize()); |
| | | fileUploadDto.setFileName(file.getOriginalFilename()); |
| | | fileUploadDto.setFileType(file.getContentType()); |
| | | |
| | | /** |
| | | * 音柱文件上传 日志记录开始 |
| | | */ |
| | | String content = "文件内容:"+ JSON.toJSONString(fileUploadDto); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "音柱文件上传", content); |
| | | /** |
| | | * 音柱文件上传 日志记录结束 |
| | | */ |
| | | |
| | | return fileUploadDto; |
| | | } |
| | | |