This commit is contained in:
s2042968 2025-03-05 15:42:22 +08:00
commit a148bc463a
15 changed files with 70 additions and 71 deletions

View File

@ -29,7 +29,7 @@ public class FileController {
private BackupPro backupPro; private BackupPro backupPro;
@RequestMapping("/upload") @RequestMapping("/upload")
public ElectromagneticResult<?> upload(@RequestParam("file") MultipartFile file, @RequestParam("path") String path) { public ElectromagneticResult<?> upload(@RequestParam("file") MultipartFile file) {
BackupFileResLog backupFileResLog = BackupFileResLog.builder().backupStartTime(new Date()).fileName(file.getOriginalFilename()).backupSuccess(true).build(); BackupFileResLog backupFileResLog = BackupFileResLog.builder().backupStartTime(new Date()).fileName(file.getOriginalFilename()).backupSuccess(true).build();
try { try {
fileService.upload(file); fileService.upload(file);

View File

@ -10,3 +10,6 @@ spring:
multipart: multipart:
max-file-size: 500MB max-file-size: 500MB
max-request-size: 500MB max-request-size: 500MB
server:
port: 12491

View File

@ -20,7 +20,7 @@ public class EdMetaObjectHandler implements MetaObjectHandler {
this.strictInsertFill(metaObject, "createdAt", Date.class, new Date()); this.strictInsertFill(metaObject, "createdAt", Date.class, new Date());
} }
if (metaObject.hasGetter("createdTime")) { if (metaObject.hasGetter("createdTime")) {
this.strictInsertFill(metaObject, "createdTime", Date.class, new Date()); this.setFieldValByName("createdTime", new Date(), metaObject);
} }
if (metaObject.hasGetter("gmtModified")) { if (metaObject.hasGetter("gmtModified")) {
this.strictInsertFill(metaObject, "gmtModified", Date.class, new Date()); this.strictInsertFill(metaObject, "gmtModified", Date.class, new Date());
@ -29,7 +29,7 @@ public class EdMetaObjectHandler implements MetaObjectHandler {
this.strictInsertFill(metaObject, "updatedAt", Date.class, new Date()); this.strictInsertFill(metaObject, "updatedAt", Date.class, new Date());
} }
if (metaObject.hasGetter("createdBy")) { if (metaObject.hasGetter("createdBy")) {
this.strictUpdateFill(metaObject, "createdBy", String.class, Optional.of(UserThreadLocal.getUserId()).orElse("")); this.setFieldValByName("createdBy", Optional.of(UserThreadLocal.getUserId()).orElse(""), metaObject);
} }
} }
@ -42,10 +42,10 @@ public class EdMetaObjectHandler implements MetaObjectHandler {
this.strictUpdateFill(metaObject, "updatedAt", Date.class, new Date()); this.strictUpdateFill(metaObject, "updatedAt", Date.class, new Date());
} }
if (metaObject.hasGetter("updatedTime")) { if (metaObject.hasGetter("updatedTime")) {
this.strictUpdateFill(metaObject, "updatedTime", Date.class, new Date()); this.setFieldValByName("updatedTime", new Date(), metaObject);
} }
if (metaObject.hasGetter("updatedBy")) { if (metaObject.hasGetter("updatedBy")) {
this.strictUpdateFill(metaObject, "updatedTime", String.class, Optional.of(UserThreadLocal.getUserId()).orElse("")); this.setFieldValByName("updatedBy", Optional.of(UserThreadLocal.getUserId()).orElse(""), metaObject);
} }
} }
} }

View File

@ -111,24 +111,23 @@ public class LoginInterceptor implements HandlerInterceptor {
UserLoginInfo user = Optional.of(UserThreadLocal.getUser()).orElse(new UserLoginInfo()); UserLoginInfo user = Optional.of(UserThreadLocal.getUser()).orElse(new UserLoginInfo());
UserAccessLog userAccessLog = UserAccessLog.builder() UserAccessLog userAccessLog = new UserAccessLog()
.id(IdWorker.getSnowFlakeIdString()) .setId(IdWorker.getSnowFlakeIdString())
.userId(user.getUserId()) .setUserId(user.getUserId())
.accessStartTime(DateUtil.date(accessStartTime)) .setAccessStartTime(DateUtil.date(accessStartTime))
.accessEndTime(DateUtil.date(accessEndTime)) .setAccessEndTime(DateUtil.date(accessEndTime))
.accessDuration(accessEndTime - accessStartTime) .setAccessDuration(accessEndTime - accessStartTime)
.action(userOperation.value()) .setAction(userOperation.value())
.requestUrl(request.getRequestURL().toString()) .setRequestUrl(request.getRequestURL().toString())
.requestIp(parseIpFromUrl(request.getRequestURL().toString())) .setRequestIp(parseIpFromUrl(request.getRequestURL().toString()))
.reqArgs(reqArgs) .setReqArgs(reqArgs)
.remoteAddr(getRealIp(request)) .setRemoteAddr(getRealIp(request))
.accessSuccess(true) .setAccessSuccess(true)
.createTime(new Date()) .setCreateTime(new Date())
.operationModule(userOperation.modelName().key) .setOperationModule(userOperation.modelName().key)
.operationMsg(UserThreadLocal.getUser().getSuccessMsg()) .setOperationMsg(UserThreadLocal.getUser().getSuccessMsg())
.dataId(user.getDataId()) .setDataId(user.getDataId())
.parentId(user.getParentId()) .setParentId(user.getParentId());
.build();
ElectromagneticResult<?> result = user.getResult(); ElectromagneticResult<?> result = user.getResult();
if (result != null) { if (result != null) {

View File

@ -16,7 +16,7 @@ public class FileFormatController {
@Resource @Resource
private FileFormatService fileFormatService; private FileFormatService fileFormatService;
@PostMapping("/add") @GetMapping("/add")
@UserOperation(value = "新增文件格式", modelName = UserOperationModuleEnum.DATABASE) @UserOperation(value = "新增文件格式", modelName = UserOperationModuleEnum.DATABASE)
public ElectromagneticResult<?> addFileFormat(@RequestParam String suffixName) { public ElectromagneticResult<?> addFileFormat(@RequestParam String suffixName) {
return ElectromagneticResultUtil.success(fileFormatService.addFileFormat(suffixName)); return ElectromagneticResultUtil.success(fileFormatService.addFileFormat(suffixName));

View File

@ -26,7 +26,7 @@ public class FileRecycleController {
} }
@RequestMapping("remove") @RequestMapping("remove")
@UserOperation(value = "物理删除", modelName = UserOperationModuleEnum.DATABASE) @UserOperation(value = "彻底清除文件", modelName = UserOperationModuleEnum.DATABASE)
public ElectromagneticResult<?> remove(@RequestParam String fileId) { public ElectromagneticResult<?> remove(@RequestParam String fileId) {
return fileRecycleService.remove(fileId); return fileRecycleService.remove(fileId);
} }

View File

@ -3,11 +3,12 @@ package com.electromagnetic.industry.software.manage.pojo.models;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date; import java.util.Date;
@Data @Data
@Builder @Accessors(chain = true)
@TableName("user_access_log") @TableName("user_access_log")
public class UserAccessLog { public class UserAccessLog {

View File

@ -17,7 +17,7 @@ public class FileRecycleQueryVO {
private String fileVersion; private String fileVersion;
private Date updateTime; private Date updatedTime;
private String fileNote; private String fileNote;

View File

@ -292,7 +292,7 @@ public class CommonService {
return ElectromagneticResultUtil.fail("-1", info); return ElectromagneticResultUtil.fail("-1", info);
} else { } else {
// 先设置dataStatus状态为删除状态 // 先设置dataStatus状态为删除状态
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate() edFileInfoMapper.update(new EdFileInfo(), Wrappers.<EdFileInfo>lambdaUpdate()
.like(EdFileInfo::getFilePath, id) .like(EdFileInfo::getFilePath, id)
.set(EdFileInfo::getSort, -1) .set(EdFileInfo::getSort, -1)
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)); .set(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code));
@ -306,7 +306,7 @@ public class CommonService {
for (int i = 0; i < edFileInfos1.size(); i++) { for (int i = 0; i < edFileInfos1.size(); i++) {
String tmp = edFileInfos1.get(i).getId(); String tmp = edFileInfos1.get(i).getId();
edFileInfoMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) edFileInfoMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.set(EdFileInfo::getSort, i + 1) .set(EdFileInfo::getSort, i + 1)
.eq(EdFileInfo::getId, tmp)); .eq(EdFileInfo::getId, tmp));
} }
@ -322,7 +322,7 @@ public class CommonService {
return ElectromagneticResultUtil.fail("-1", info); return ElectromagneticResultUtil.fail("-1", info);
} else { } else {
// 逻辑删除文件夹 // 逻辑删除文件夹
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate() edFileInfoMapper.update(new EdFileInfo(), Wrappers.<EdFileInfo>lambdaUpdate()
.eq(EdFileInfo::getId, id) .eq(EdFileInfo::getId, id)
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)); .set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
fileSystemService.renameFile(srcFilePath, srcPrjName + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG); fileSystemService.renameFile(srcFilePath, srcPrjName + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG);

View File

@ -227,7 +227,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), id, "作废目录 {} 成功", fileInfo.getFileName()); UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), id, "作废目录 {} 成功", fileInfo.getFileName());
return res; return res;
} }
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.set(EdFileInfo::getEffectFlag, false) .set(EdFileInfo::getEffectFlag, false)
.set(EdFileInfo::getAllDeleted, true) .set(EdFileInfo::getAllDeleted, true)
.eq(EdFileInfo::getFileId, fileInfo.getFileId())); .eq(EdFileInfo::getFileId, fileInfo.getFileId()));
@ -315,7 +315,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
} }
String srcFilePath = commonService.getFileSysPath(fileInfo.getFilePath(), dataOwnCode); String srcFilePath = commonService.getFileSysPath(fileInfo.getFilePath(), dataOwnCode);
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.eq(EdFileInfo::getId, updateFileInfoDTO.getId()) .eq(EdFileInfo::getId, updateFileInfoDTO.getId())
.set(EdFileInfo::getFileName, updateFileInfoDTO.getFileName()) .set(EdFileInfo::getFileName, updateFileInfoDTO.getFileName())
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote())); .set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
@ -342,10 +342,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
public ElectromagneticResult<?> versionBack(String fileId, int targetVersion) { public ElectromagneticResult<?> versionBack(String fileId, int targetVersion) {
EdFileInfo fileInfo = this.baseMapper.selectList(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getFileId, fileId).last("limit 1")).get(0); EdFileInfo fileInfo = this.baseMapper.selectList(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getFileId, fileId).last("limit 1")).get(0);
try { try {
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.eq(EdFileInfo::getFileId, fileId) .eq(EdFileInfo::getFileId, fileId)
.set(EdFileInfo::getEffectFlag, false)); .set(EdFileInfo::getEffectFlag, false));
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.set(EdFileInfo::getEffectFlag, true) .set(EdFileInfo::getEffectFlag, true)
.eq(EdFileInfo::getFileId, fileId) .eq(EdFileInfo::getFileId, fileId)
.eq(EdFileInfo::getFileVersion, targetVersion)); .eq(EdFileInfo::getFileVersion, targetVersion));
@ -922,7 +922,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
String destFilePath = commonService.getFileSysPath(destSaveFileInfo.getFilePath(), dataOwnCode); String destFilePath = commonService.getFileSysPath(destSaveFileInfo.getFilePath(), dataOwnCode);
fileSystemService.copyFile(srcFilePath, destFilePath); fileSystemService.copyFile(srcFilePath, destFilePath);
this.baseMapper.deleteById(srcFileInfo.getId()); this.baseMapper.deleteById(srcFileInfo.getId());
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code) .set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
.eq(EdFileInfo::getId, fileInfoTmp.getId())); .eq(EdFileInfo::getId, fileInfoTmp.getId()));
return destSaveFileInfo; return destSaveFileInfo;
@ -1085,7 +1085,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
.setPreVersion(maxFileVersion) .setPreVersion(maxFileVersion)
.setEffectFlag(EffectFlagEnum.EFFECT.code) .setEffectFlag(EffectFlagEnum.EFFECT.code)
.setFileCode(fileCode); .setFileCode(fileCode);
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class).eq(EdFileInfo::getParentId, targetFolderId) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class).eq(EdFileInfo::getParentId, targetFolderId)
.eq(EdFileInfo::getFileName, srcFileInfo.getFileName()) .eq(EdFileInfo::getFileName, srcFileInfo.getFileName())
.eq(EdFileInfo::getFileType, srcFileInfo.getFileType()).set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)); .eq(EdFileInfo::getFileType, srcFileInfo.getFileType()).set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
this.baseMapper.insert(destSaveFileInfo); this.baseMapper.insert(destSaveFileInfo);
@ -1138,7 +1138,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
String timeStr = EleCommonUtil.getNowTimeStr(); String timeStr = EleCommonUtil.getNowTimeStr();
String fileCode = commonService.createFileCode(codePathByDbPath, suffix, FILE_START_VERSION, timeStr); String fileCode = commonService.createFileCode(codePathByDbPath, suffix, FILE_START_VERSION, timeStr);
// 将原有效的版本置为false // 将原有效的版本置为false
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code) .set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
.eq(EdFileInfo::getId, effectFileInfo.getId())); .eq(EdFileInfo::getId, effectFileInfo.getId()));
// 新增文件 // 新增文件

View File

@ -143,7 +143,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
String tmpPath = newPrjName + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG; String tmpPath = newPrjName + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG;
fileSystemService.renameFile(newPath, tmpPath); fileSystemService.renameFile(newPath, tmpPath);
} }
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.eq(EdFileInfo::getId, prjId) .eq(EdFileInfo::getId, prjId)
.set(EdFileInfo::getFileName, newPrjName)); .set(EdFileInfo::getFileName, newPrjName));
fileSystemService.renameFile(commonService.getEleDataPath(dataOwnCode), oldPrjName, newPrjName); fileSystemService.renameFile(commonService.getEleDataPath(dataOwnCode), oldPrjName, newPrjName);
@ -184,7 +184,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(queryWrapper); List<EdFileInfo> edFileInfos = this.baseMapper.selectList(queryWrapper);
List<String> ids = edFileInfos.stream().map(EdFileInfo::getId).collect(Collectors.toList()); List<String> ids = edFileInfos.stream().map(EdFileInfo::getId).collect(Collectors.toList());
ids.add(prjId); ids.add(prjId);
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class).set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code).in(EdFileInfo::getId, ids)); this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class).set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code).in(EdFileInfo::getId, ids));
// 对原文件进行处理 // 对原文件进行处理
EdFileInfo prjFile = this.getById(prjId); EdFileInfo prjFile = this.getById(prjId);
fileSystemService.renameFile(commonService.getFileSysPath(prjId, dataOwnCode), prjFile + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG); fileSystemService.renameFile(commonService.getFileSysPath(prjId, dataOwnCode), prjFile + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG);
@ -257,7 +257,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class) LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
.set(EdFileInfo::getSort, folderResortDTO.getSort()) .set(EdFileInfo::getSort, folderResortDTO.getSort())
.eq(EdFileInfo::getId, folderResortDTO.getId()); .eq(EdFileInfo::getId, folderResortDTO.getId());
this.update(updateWrapper); this.update(new EdFileInfo(), updateWrapper);
} }
UserThreadLocal.setSuccessInfo("", "", "子集重排序成功"); UserThreadLocal.setSuccessInfo("", "", "子集重排序成功");
return ElectromagneticResultUtil.success(true); return ElectromagneticResultUtil.success(true);
@ -291,7 +291,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
fileSysPaths.add(fileSysPath); fileSysPaths.add(fileSysPath);
}); });
this.update(Wrappers.lambdaUpdate(EdFileInfo.class) this.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code) .eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code) .set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
.likeRight(EdFileInfo::getFilePath, prjId)); .likeRight(EdFileInfo::getFilePath, prjId));
@ -300,7 +300,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code) .set(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code) .eq(EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
.likeRight(EdFileInfo::getFilePath, prjId); .likeRight(EdFileInfo::getFilePath, prjId);
this.update(updateWrapper); this.update(new EdFileInfo(), updateWrapper);
commonService.deletePrjSysDir(fileSysPaths); commonService.deletePrjSysDir(fileSysPaths);
UserThreadLocal.setSuccessInfo("", prjId, "项目 {} 发布成功", fileInfo.getFileName()); UserThreadLocal.setSuccessInfo("", prjId, "项目 {} 发布成功", fileInfo.getFileName());
return ElectromagneticResultUtil.success(true); return ElectromagneticResultUtil.success(true);
@ -433,7 +433,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
EdFileInfo fileInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class) EdFileInfo fileInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
.eq(EdFileInfo::getId, id)); .eq(EdFileInfo::getId, id));
String sysFilePath = commonService.getFileSysPath(fileInfo.getFilePath(), dataOwnCode); String sysFilePath = commonService.getFileSysPath(fileInfo.getFilePath(), dataOwnCode);
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.eq(EdFileInfo::getId, id) .eq(EdFileInfo::getId, id)
.set(EdFileInfo::getFileName, newFolderName)); .set(EdFileInfo::getFileName, newFolderName));
fileSystemService.renameFile(sysFilePath, newFolderName); fileSystemService.renameFile(sysFilePath, newFolderName);

View File

@ -13,6 +13,7 @@ import com.electromagnetic.industry.software.manage.pojo.models.FileFormat;
import com.electromagnetic.industry.software.manage.pojo.resp.FileFormatVO; import com.electromagnetic.industry.software.manage.pojo.resp.FileFormatVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -33,7 +34,7 @@ public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFor
// 有可能是被废除了现在恢复 // 有可能是被废除了现在恢复
if (names.contains(suffixName)) { if (names.contains(suffixName)) {
this.baseMapper.update(null, Wrappers.<FileFormat>lambdaUpdate().set(FileFormat::getEffectFlag, EffectFlagEnum.EFFECT.code)); this.baseMapper.update(new FileFormat(), Wrappers.<FileFormat>lambdaUpdate().set(FileFormat::getEffectFlag, EffectFlagEnum.EFFECT.code).eq(FileFormat::getSuffixName, suffixName));
} else { } else {
FileFormat fileFormat = new FileFormat(); FileFormat fileFormat = new FileFormat();
fileFormat.setSuffixName(suffixName); fileFormat.setSuffixName(suffixName);
@ -62,7 +63,7 @@ public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFor
*/ */
@Override @Override
public boolean deleteFileFormat(String id) { public boolean deleteFileFormat(String id) {
this.baseMapper.update(null, Wrappers.<FileFormat>lambdaUpdate().eq(FileFormat::getId, id).set(FileFormat::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)); this.baseMapper.update(new FileFormat(), Wrappers.<FileFormat>lambdaUpdate().eq(FileFormat::getId, id).set(FileFormat::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
UserThreadLocal.setSuccessInfo("","", StrFormatter.format("废除了文件格式id {} ", id)); UserThreadLocal.setSuccessInfo("","", StrFormatter.format("废除了文件格式id {} ", id));
return true; return true;
} }
@ -73,7 +74,7 @@ public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFor
*/ */
@Override @Override
public List<FileFormatVO> getList() { public List<FileFormatVO> getList() {
List<FileFormat> fileFormats = this.baseMapper.selectList(Wrappers.<FileFormat>lambdaQuery().eq(FileFormat::getEffectFlag, EffectFlagEnum.EFFECT.code)); List<FileFormat> fileFormats = this.baseMapper.selectList(Wrappers.<FileFormat>lambdaQuery().eq(FileFormat::getEffectFlag, EffectFlagEnum.EFFECT.code).orderByDesc(FileFormat::getCreatedTime));
List<FileFormatVO> fileFormatVOS = BeanUtil.copyToList(fileFormats, FileFormatVO.class); List<FileFormatVO> fileFormatVOS = BeanUtil.copyToList(fileFormats, FileFormatVO.class);
UserThreadLocal.setSuccessInfo("","", "查询了文件格式列表"); UserThreadLocal.setSuccessInfo("","", "查询了文件格式列表");
return fileFormatVOS; return fileFormatVOS;

View File

@ -194,7 +194,7 @@ public class FileRecycleServiceImpl implements FileRecycleService {
} }
// 更新MySQL数据库 // 更新MySQL数据库
this.edFileInfoMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class) this.edFileInfoMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
.eq(EdFileInfo::getFileId, fileId) .eq(EdFileInfo::getFileId, fileId)
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code) .set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
.set(EdFileInfo::getPermanentDeleted, true) .set(EdFileInfo::getPermanentDeleted, true)

View File

@ -32,10 +32,6 @@ public class UserAccessLogServiceImpl extends ServiceImpl<UserAccessLogMapper, U
@Resource @Resource
private UserMapper userMapper; private UserMapper userMapper;
@Resource
private PermissionService permissionService;
/** /**
* 分页查询操作记录审计 * 分页查询操作记录审计
* *

View File

@ -135,25 +135,24 @@ public class BackupTask {
List<File> files = FileUtil.loopFiles(elePropertyConfig.getTmpDir(), filter); List<File> files = FileUtil.loopFiles(elePropertyConfig.getTmpDir(), filter);
for (File file : files) { for (File file : files) {
fileSystemService.deleteFile(file.getAbsolutePath()); fileSystemService.deleteFile(file.getAbsolutePath());
UserAccessLog userAccessLog = UserAccessLog.builder() UserAccessLog userAccessLog = new UserAccessLog()
.id(IdWorker.getSnowFlakeIdString()) .setId(IdWorker.getSnowFlakeIdString())
.userId("") .setUserId("")
.accessStartTime(new Date()) .setAccessStartTime(new Date())
.accessEndTime(new Date()) .setAccessEndTime(new Date())
.accessDuration(0L) .setAccessDuration(0L)
.action("删除") .setAction("删除")
.requestUrl("") .setRequestUrl("")
.requestIp("") .setRequestIp("")
.reqArgs("") .setReqArgs("")
.remoteAddr("") .setRemoteAddr("")
.accessSuccess(true) .setAccessSuccess(true)
.operationMsg("从系统中物理删除了文件" + file.getName()) .setOperationMsg("从系统中物理删除了文件" + file.getName())
.createTime(new Date()) .setCreateTime(new Date())
.operationModule(UserOperationModuleEnum.TMP.key) .setOperationModule(UserOperationModuleEnum.TMP.key)
.dataId("") .setDataId("")
.parentId("") .setParentId("")
.response("") .setResponse("");
.build();
userAccessLogMapper.insert(userAccessLog); userAccessLogMapper.insert(userAccessLog);
} }
} }