适配更新自动填充
This commit is contained in:
parent
6c569dbccf
commit
82acc597e6
|
|
@ -111,24 +111,23 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
|
||||
UserLoginInfo user = Optional.of(UserThreadLocal.getUser()).orElse(new UserLoginInfo());
|
||||
|
||||
UserAccessLog userAccessLog = UserAccessLog.builder()
|
||||
.id(IdWorker.getSnowFlakeIdString())
|
||||
.userId(user.getUserId())
|
||||
.accessStartTime(DateUtil.date(accessStartTime))
|
||||
.accessEndTime(DateUtil.date(accessEndTime))
|
||||
.accessDuration(accessEndTime - accessStartTime)
|
||||
.action(userOperation.value())
|
||||
.requestUrl(request.getRequestURL().toString())
|
||||
.requestIp(parseIpFromUrl(request.getRequestURL().toString()))
|
||||
.reqArgs(reqArgs)
|
||||
.remoteAddr(getRealIp(request))
|
||||
.accessSuccess(true)
|
||||
.createTime(new Date())
|
||||
.operationModule(userOperation.modelName().key)
|
||||
.operationMsg(UserThreadLocal.getUser().getSuccessMsg())
|
||||
.dataId(user.getDataId())
|
||||
.parentId(user.getParentId())
|
||||
.build();
|
||||
UserAccessLog userAccessLog = new UserAccessLog()
|
||||
.setId(IdWorker.getSnowFlakeIdString())
|
||||
.setUserId(user.getUserId())
|
||||
.setAccessStartTime(DateUtil.date(accessStartTime))
|
||||
.setAccessEndTime(DateUtil.date(accessEndTime))
|
||||
.setAccessDuration(accessEndTime - accessStartTime)
|
||||
.setAction(userOperation.value())
|
||||
.setRequestUrl(request.getRequestURL().toString())
|
||||
.setRequestIp(parseIpFromUrl(request.getRequestURL().toString()))
|
||||
.setReqArgs(reqArgs)
|
||||
.setRemoteAddr(getRealIp(request))
|
||||
.setAccessSuccess(true)
|
||||
.setCreateTime(new Date())
|
||||
.setOperationModule(userOperation.modelName().key)
|
||||
.setOperationMsg(UserThreadLocal.getUser().getSuccessMsg())
|
||||
.setDataId(user.getDataId())
|
||||
.setParentId(user.getParentId());
|
||||
|
||||
ElectromagneticResult<?> result = user.getResult();
|
||||
if (result != null) {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ package com.electromagnetic.industry.software.manage.pojo.models;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@TableName("user_access_log")
|
||||
public class UserAccessLog {
|
||||
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ public class CommonService {
|
|||
return ElectromagneticResultUtil.fail("-1", info);
|
||||
} else {
|
||||
// 先设置dataStatus状态为删除状态
|
||||
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
||||
edFileInfoMapper.update(new EdFileInfo(), Wrappers.<EdFileInfo>lambdaUpdate()
|
||||
.like(EdFileInfo::getFilePath, id)
|
||||
.set(EdFileInfo::getSort, -1)
|
||||
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code));
|
||||
|
|
@ -306,7 +306,7 @@ public class CommonService {
|
|||
|
||||
for (int i = 0; i < edFileInfos1.size(); i++) {
|
||||
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)
|
||||
.eq(EdFileInfo::getId, tmp));
|
||||
}
|
||||
|
|
@ -322,7 +322,7 @@ public class CommonService {
|
|||
return ElectromagneticResultUtil.fail("-1", info);
|
||||
} else {
|
||||
// 逻辑删除文件夹
|
||||
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
||||
edFileInfoMapper.update(new EdFileInfo(), Wrappers.<EdFileInfo>lambdaUpdate()
|
||||
.eq(EdFileInfo::getId, id)
|
||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
|
||||
fileSystemService.renameFile(srcFilePath, srcPrjName + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG);
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), id, "作废目录 {} 成功", fileInfo.getFileName());
|
||||
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::getAllDeleted, true)
|
||||
.eq(EdFileInfo::getFileId, fileInfo.getFileId()));
|
||||
|
|
@ -314,7 +314,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
}
|
||||
|
||||
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())
|
||||
.set(EdFileInfo::getFileName, updateFileInfoDTO.getFileName())
|
||||
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
||||
|
|
@ -341,10 +341,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
public ElectromagneticResult<?> versionBack(String fileId, int targetVersion) {
|
||||
EdFileInfo fileInfo = this.baseMapper.selectList(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getFileId, fileId).last("limit 1")).get(0);
|
||||
try {
|
||||
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||
this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getFileId, fileId)
|
||||
.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)
|
||||
.eq(EdFileInfo::getFileId, fileId)
|
||||
.eq(EdFileInfo::getFileVersion, targetVersion));
|
||||
|
|
@ -921,7 +921,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
String destFilePath = commonService.getFileSysPath(destSaveFileInfo.getFilePath(), dataOwnCode);
|
||||
fileSystemService.copyFile(srcFilePath, destFilePath);
|
||||
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)
|
||||
.eq(EdFileInfo::getId, fileInfoTmp.getId()));
|
||||
return destSaveFileInfo;
|
||||
|
|
@ -1084,7 +1084,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
.setPreVersion(maxFileVersion)
|
||||
.setEffectFlag(EffectFlagEnum.EFFECT.code)
|
||||
.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::getFileType, srcFileInfo.getFileType()).set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
|
||||
this.baseMapper.insert(destSaveFileInfo);
|
||||
|
|
@ -1137,7 +1137,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
String timeStr = EleCommonUtil.getNowTimeStr();
|
||||
String fileCode = commonService.createFileCode(codePathByDbPath, suffix, FILE_START_VERSION, timeStr);
|
||||
// 将原有效的版本置为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)
|
||||
.eq(EdFileInfo::getId, effectFileInfo.getId()));
|
||||
// 新增文件
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
String tmpPath = newPrjName + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG;
|
||||
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)
|
||||
.set(EdFileInfo::getFileName, 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<String> ids = edFileInfos.stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||
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);
|
||||
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)
|
||||
.set(EdFileInfo::getSort, folderResortDTO.getSort())
|
||||
.eq(EdFileInfo::getId, folderResortDTO.getId());
|
||||
this.update(updateWrapper);
|
||||
this.update(new EdFileInfo(), updateWrapper);
|
||||
}
|
||||
UserThreadLocal.setSuccessInfo("", "", "子集重排序成功");
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
|
|
@ -291,7 +291,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
fileSysPaths.add(fileSysPath);
|
||||
});
|
||||
|
||||
this.update(Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||
this.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||
.likeRight(EdFileInfo::getFilePath, prjId));
|
||||
|
|
@ -300,7 +300,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||
.likeRight(EdFileInfo::getFilePath, prjId);
|
||||
this.update(updateWrapper);
|
||||
this.update(new EdFileInfo(), updateWrapper);
|
||||
commonService.deletePrjSysDir(fileSysPaths);
|
||||
UserThreadLocal.setSuccessInfo("", prjId, "项目 {} 发布成功", fileInfo.getFileName());
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
|
|
@ -433,7 +433,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
EdFileInfo fileInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getId, id));
|
||||
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)
|
||||
.set(EdFileInfo::getFileName, newFolderName));
|
||||
fileSystemService.renameFile(sysFilePath, newFolderName);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFor
|
|||
|
||||
// 有可能是被废除了,现在恢复
|
||||
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));
|
||||
} else {
|
||||
FileFormat fileFormat = new FileFormat();
|
||||
fileFormat.setSuffixName(suffixName);
|
||||
|
|
@ -63,7 +63,7 @@ public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFor
|
|||
*/
|
||||
@Override
|
||||
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));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
|||
}
|
||||
|
||||
// 更新MySQL数据库
|
||||
this.edFileInfoMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||
this.edFileInfoMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getFileId, fileId)
|
||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||
.set(EdFileInfo::getPermanentDeleted, true)
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@ public class UserAccessLogServiceImpl extends ServiceImpl<UserAccessLogMapper, U
|
|||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询操作记录(审计)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -135,25 +135,24 @@ public class BackupTask {
|
|||
List<File> files = FileUtil.loopFiles(elePropertyConfig.getTmpDir(), filter);
|
||||
for (File file : files) {
|
||||
fileSystemService.deleteFile(file.getAbsolutePath());
|
||||
UserAccessLog userAccessLog = UserAccessLog.builder()
|
||||
.id(IdWorker.getSnowFlakeIdString())
|
||||
.userId("")
|
||||
.accessStartTime(new Date())
|
||||
.accessEndTime(new Date())
|
||||
.accessDuration(0L)
|
||||
.action("删除")
|
||||
.requestUrl("")
|
||||
.requestIp("")
|
||||
.reqArgs("")
|
||||
.remoteAddr("")
|
||||
.accessSuccess(true)
|
||||
.operationMsg("从系统中物理删除了文件" + file.getName())
|
||||
.createTime(new Date())
|
||||
.operationModule(UserOperationModuleEnum.TMP.key)
|
||||
.dataId("")
|
||||
.parentId("")
|
||||
.response("")
|
||||
.build();
|
||||
UserAccessLog userAccessLog = new UserAccessLog()
|
||||
.setId(IdWorker.getSnowFlakeIdString())
|
||||
.setUserId("")
|
||||
.setAccessStartTime(new Date())
|
||||
.setAccessEndTime(new Date())
|
||||
.setAccessDuration(0L)
|
||||
.setAction("删除")
|
||||
.setRequestUrl("")
|
||||
.setRequestIp("")
|
||||
.setReqArgs("")
|
||||
.setRemoteAddr("")
|
||||
.setAccessSuccess(true)
|
||||
.setOperationMsg("从系统中物理删除了文件" + file.getName())
|
||||
.setCreateTime(new Date())
|
||||
.setOperationModule(UserOperationModuleEnum.TMP.key)
|
||||
.setDataId("")
|
||||
.setParentId("")
|
||||
.setResponse("");
|
||||
userAccessLogMapper.insert(userAccessLog);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue