解决合并冲突
This commit is contained in:
commit
344666b50b
|
|
@ -26,8 +26,7 @@ public class AopUtil {
|
||||||
} else if (value instanceof ServletResponse) {
|
} else if (value instanceof ServletResponse) {
|
||||||
log.info("参数中有response");
|
log.info("参数中有response");
|
||||||
map.put(name, "response");
|
map.put(name, "response");
|
||||||
} else if (value instanceof MultipartFile) {
|
} else if (value instanceof MultipartFile file) {
|
||||||
MultipartFile file = (MultipartFile) value;
|
|
||||||
Map<String, Object> pars = new HashMap<>();
|
Map<String, Object> pars = new HashMap<>();
|
||||||
pars.put("fileName", file.getOriginalFilename());
|
pars.put("fileName", file.getOriginalFilename());
|
||||||
pars.put("fileSize", file.getSize());
|
pars.put("fileSize", file.getSize());
|
||||||
|
|
|
||||||
|
|
@ -70,74 +70,77 @@ public class ElePropertyConfig {
|
||||||
@Value("${prj.folder.max.length}")
|
@Value("${prj.folder.max.length}")
|
||||||
private Integer prjFolderMaxLength;
|
private Integer prjFolderMaxLength;
|
||||||
|
|
||||||
|
@Value("${prjRootPath}")
|
||||||
|
private String prjRootPath;
|
||||||
|
|
||||||
public String getEleTmpPath() {
|
public String getEleTmpPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + eleTmpPath;
|
return winPrefix + prjRootPath + eleTmpPath;
|
||||||
}
|
}
|
||||||
return eleTmpPath;
|
return prjRootPath + eleTmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSysPrjPath() {
|
public String getSysPrjPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + sysPrjPath;
|
return winPrefix + prjRootPath + sysPrjPath;
|
||||||
}
|
}
|
||||||
return sysPrjPath;
|
return prjRootPath + sysPrjPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSysUploadPath() {
|
public String getSysUploadPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + sysUploadPath;
|
return winPrefix + prjRootPath + sysUploadPath;
|
||||||
}
|
}
|
||||||
return sysUploadPath;
|
return prjRootPath + sysUploadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSysDownloadPath() {
|
public String getSysDownloadPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + sysDownloadPath;
|
return winPrefix + prjRootPath + sysDownloadPath;
|
||||||
}
|
}
|
||||||
return sysDownloadPath;
|
return prjRootPath + sysDownloadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserPrjPath() {
|
public String getUserPrjPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + userPrjPath;
|
return winPrefix + prjRootPath + userPrjPath;
|
||||||
}
|
}
|
||||||
return userPrjPath;
|
return prjRootPath + userPrjPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserUploadPath() {
|
public String getUserUploadPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + userUploadPath;
|
return winPrefix + prjRootPath + userUploadPath;
|
||||||
}
|
}
|
||||||
return userUploadPath;
|
return prjRootPath + userUploadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserDownloadPath() {
|
public String getUserDownloadPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + userDownloadPath;
|
return winPrefix + prjRootPath + userDownloadPath;
|
||||||
}
|
}
|
||||||
return userDownloadPath;
|
return prjRootPath + userDownloadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRepoPrjPath() {
|
public String getRepoPrjPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + repoPrjPath;
|
return winPrefix + prjRootPath + repoPrjPath;
|
||||||
}
|
}
|
||||||
return repoPrjPath;
|
return prjRootPath + repoPrjPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRepoUploadPath() {
|
public String getRepoUploadPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + repoUploadPath;
|
return winPrefix + prjRootPath + repoUploadPath;
|
||||||
}
|
}
|
||||||
return repoUploadPath;
|
return prjRootPath + repoUploadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRepoDownloadPath() {
|
public String getRepoDownloadPath() {
|
||||||
if (EleCommonUtil.isWinOs()) {
|
if (EleCommonUtil.isWinOs()) {
|
||||||
return winPrefix + repoDownloadPath;
|
return winPrefix + prjRootPath + repoDownloadPath;
|
||||||
}
|
}
|
||||||
return repoDownloadPath;
|
return prjRootPath + repoDownloadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUploadDataDir(int dataOwnCode) {
|
public String getUploadDataDir(int dataOwnCode) {
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,6 @@ public class LoginInterceptor implements HandlerInterceptor {
|
||||||
.setReqArgs(reqArgs)
|
.setReqArgs(reqArgs)
|
||||||
.setRemoteAddr(getRealIp(request))
|
.setRemoteAddr(getRealIp(request))
|
||||||
.setAccessSuccess(true)
|
.setAccessSuccess(true)
|
||||||
.setCreateTime(new Date())
|
|
||||||
.setOperationModule(userOperation.modelName().key)
|
.setOperationModule(userOperation.modelName().key)
|
||||||
.setOperationMsg(res.getErrorMessage())
|
.setOperationMsg(res.getErrorMessage())
|
||||||
.setDataId("")
|
.setDataId("")
|
||||||
|
|
@ -193,7 +192,6 @@ public class LoginInterceptor implements HandlerInterceptor {
|
||||||
.setReqArgs(reqArgs)
|
.setReqArgs(reqArgs)
|
||||||
.setRemoteAddr(getRealIp(request))
|
.setRemoteAddr(getRealIp(request))
|
||||||
.setAccessSuccess(true)
|
.setAccessSuccess(true)
|
||||||
.setCreateTime(new Date())
|
|
||||||
.setOperationModule(userOperation.modelName().key)
|
.setOperationModule(userOperation.modelName().key)
|
||||||
.setOperationMsg(accessSuccessInfo.getSuccessMsg())
|
.setOperationMsg(accessSuccessInfo.getSuccessMsg())
|
||||||
.setDataId(accessSuccessInfo.getDataId())
|
.setDataId(accessSuccessInfo.getDataId())
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/data/ed/backup/")
|
@RequestMapping("/data/ed/backup/")
|
||||||
public class FileBackupLogController {
|
public class FileBackupLogController {
|
||||||
|
|
@ -27,7 +29,7 @@ public class FileBackupLogController {
|
||||||
@GetMapping(value = "restore")
|
@GetMapping(value = "restore")
|
||||||
@UserOperation(value = "系统恢复", modelName = UserOperationModuleEnum.BACKUP_FILE)
|
@UserOperation(value = "系统恢复", modelName = UserOperationModuleEnum.BACKUP_FILE)
|
||||||
public ElectromagneticResult<?> restore() {
|
public ElectromagneticResult<?> restore() {
|
||||||
fileBackLogService.restore();
|
List<String> restorePaths = fileBackLogService.restore();
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(restorePaths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,13 @@ package com.electromagnetic.industry.software.manage.pojo.models;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
|
||||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import lombok.experimental.FieldNameConstants;
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("ed_file_info")
|
@TableName("ed_file_info")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
|
@ -125,17 +121,10 @@ public class EdFileInfo extends BaseModel {
|
||||||
private Boolean permanentDeleted;
|
private Boolean permanentDeleted;
|
||||||
|
|
||||||
public void newInit() {
|
public void newInit() {
|
||||||
String userId = UserThreadLocal.getUserId();
|
|
||||||
String newFileDbId = IdWorker.getSnowFlakeIdString();
|
String newFileDbId = IdWorker.getSnowFlakeIdString();
|
||||||
String fileTime = EleCommonUtil.getNowTimeStr();
|
String fileTime = EleCommonUtil.getNowTimeStr();
|
||||||
Date now = new Date();
|
|
||||||
this.setUpdatedBy(userId);
|
|
||||||
this.setId(newFileDbId);
|
this.setId(newFileDbId);
|
||||||
this.setUpdatedTime(now);
|
|
||||||
this.setCreatedTime(now);
|
|
||||||
this.setFileTime(fileTime);
|
this.setFileTime(fileTime);
|
||||||
this.setCreatedBy(userId);
|
|
||||||
this.setFileId(newFileDbId);
|
this.setFileId(newFileDbId);
|
||||||
this.setEffectFlag(EffectFlagEnum.EFFECT.code);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@TableName("file_tag_relations")
|
@TableName("file_tag_relations")
|
||||||
public class FileTagRelation extends BaseModel {
|
public class FileTagRelation extends BaseModel {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,20 @@
|
||||||
package com.electromagnetic.industry.software.manage.pojo.models;
|
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
||||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@TableName("ed_role") // 指定表名
|
@TableName("ed_role") // 指定表名
|
||||||
public class Role extends BaseModel{
|
public class Role extends BaseModel {
|
||||||
|
|
||||||
@TableId(value = "id")
|
@TableId(value = "id")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
||||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@TableName("ed_role_permission")
|
@TableName("ed_role_permission")
|
||||||
public class RolePermission extends BaseModel{
|
public class RolePermission extends BaseModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,6 @@ public class UserAccessLog extends BaseModel {
|
||||||
// 异常信息 供开发者异常查看
|
// 异常信息 供开发者异常查看
|
||||||
private String exceptionDetail;
|
private String exceptionDetail;
|
||||||
|
|
||||||
// 创建时间,对应操作时间
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
// 操作对象
|
// 操作对象
|
||||||
private String operationModule;
|
private String operationModule;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@ package com.electromagnetic.industry.software.manage.service;
|
||||||
|
|
||||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface FileBackLogService {
|
public interface FileBackLogService {
|
||||||
|
|
||||||
ElectromagneticResult<?> query(Integer pageNumber, Integer pageSize);
|
ElectromagneticResult<?> query(Integer pageNumber, Integer pageSize);
|
||||||
|
|
||||||
void restore();
|
List<String> restore();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -191,8 +191,8 @@ public class ChatService {
|
||||||
UserLoginInfo userLoginInfo = new UserLoginInfo();
|
UserLoginInfo userLoginInfo = new UserLoginInfo();
|
||||||
userLoginInfo.setUserId(queryDTO.getUserId());
|
userLoginInfo.setUserId(queryDTO.getUserId());
|
||||||
UserThreadLocal.set(userLoginInfo);
|
UserThreadLocal.set(userLoginInfo);
|
||||||
UserThreadLocal.remove();
|
|
||||||
aiQuestionRecordMapper.insert(record);
|
aiQuestionRecordMapper.insert(record);
|
||||||
|
UserThreadLocal.remove();
|
||||||
return ChatClient.builder(model)
|
return ChatClient.builder(model)
|
||||||
.defaultSystem("必须用中文回答")
|
.defaultSystem("必须用中文回答")
|
||||||
.defaultAdvisors(messageChatMemoryAdvisor, questionAnswerAdvisor)
|
.defaultAdvisors(messageChatMemoryAdvisor, questionAnswerAdvisor)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||||
import cn.hutool.core.lang.tree.TreeUtil;
|
import cn.hutool.core.lang.tree.TreeUtil;
|
||||||
import cn.hutool.core.text.StrFormatter;
|
import cn.hutool.core.text.StrFormatter;
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
|
@ -201,7 +200,7 @@ public class CommonService {
|
||||||
EdFileInfo fileInfo = map.get(id);
|
EdFileInfo fileInfo = map.get(id);
|
||||||
String tmp;
|
String tmp;
|
||||||
if (fileInfo.getDataType().equals(EleDataTypeEnum.FILE.code)) {
|
if (fileInfo.getDataType().equals(EleDataTypeEnum.FILE.code)) {
|
||||||
tmp = fileInfo.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode();
|
tmp = fileInfo.getFileName() + "." + fileInfo.getFileType();
|
||||||
} else {
|
} else {
|
||||||
tmp = fileInfo.getFileName() + File.separator;
|
tmp = fileInfo.getFileName() + File.separator;
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +236,7 @@ public class CommonService {
|
||||||
case USER_FILE, USER_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code);
|
case USER_FILE, USER_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code);
|
||||||
case SYS_FILE, SYS_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code);
|
case SYS_FILE, SYS_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code);
|
||||||
case REPO_PRJ, REPO_FILE -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.REPO_PRJ.code);
|
case REPO_PRJ, REPO_FILE -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.REPO_PRJ.code);
|
||||||
default -> ElectromagneticResultUtil.fail("-1", "参数错误");
|
default -> throw new BizException("参数错误");
|
||||||
}
|
}
|
||||||
return edFileInfoMapper.selectList(queryWrapper);
|
return edFileInfoMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
@ -463,8 +462,6 @@ public class CommonService {
|
||||||
// 如果文件夹下存在文件(包括文件夹和已经逻辑删除的文件),则不允许删除。后面管理员选择会有物理删除文件夹和文件的功能,此时MySQL和文件系统则会进行物理删除该文件。
|
// 如果文件夹下存在文件(包括文件夹和已经逻辑删除的文件),则不允许删除。后面管理员选择会有物理删除文件夹和文件的功能,此时MySQL和文件系统则会进行物理删除该文件。
|
||||||
EdFileInfo srcFileInfo = edFileInfoMapper.selectById(id);
|
EdFileInfo srcFileInfo = edFileInfoMapper.selectById(id);
|
||||||
Assert.isTrue(srcFileInfo.getDataType().equals(EleDataTypeEnum.FOLDER.code), "禁止删除目录");
|
Assert.isTrue(srcFileInfo.getDataType().equals(EleDataTypeEnum.FOLDER.code), "禁止删除目录");
|
||||||
String srcFilePath = getFileSysPath(srcFileInfo.getId());
|
|
||||||
String uuid = IdUtil.fastSimpleUUID();
|
|
||||||
try {
|
try {
|
||||||
// 这里要分两种情况,1是删除层级目录,2是删除用户创建的文件夹
|
// 这里要分两种情况,1是删除层级目录,2是删除用户创建的文件夹
|
||||||
String parentId = srcFileInfo.getParentId();
|
String parentId = srcFileInfo.getParentId();
|
||||||
|
|
@ -535,11 +532,8 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> selectPrjLeafs(int dataOwnCode, List<String> accessibleIds) {
|
public Set<String> selectPrjLeafs(int dataOwnCode, List<String> accessibleIds) {
|
||||||
|
|
||||||
Set<String> res = new HashSet<>();
|
Set<String> res = new HashSet<>();
|
||||||
|
List<String> prjInfo;
|
||||||
List<String> prjInfo = List.of();
|
|
||||||
|
|
||||||
DataOwnEnum obj = DataOwnEnum.getEnumByCode(dataOwnCode);
|
DataOwnEnum obj = DataOwnEnum.getEnumByCode(dataOwnCode);
|
||||||
switch (Objects.requireNonNull(obj)) {
|
switch (Objects.requireNonNull(obj)) {
|
||||||
case USER_FILE, USER_PRJ ->
|
case USER_FILE, USER_PRJ ->
|
||||||
|
|
@ -548,7 +542,7 @@ public class CommonService {
|
||||||
prjInfo = querySysPrjTree(PrjQuerySource.SYS_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.SYS_DB.value, new ArrayList<>());
|
prjInfo = querySysPrjTree(PrjQuerySource.SYS_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.SYS_DB.value, new ArrayList<>());
|
||||||
case REPO_PRJ, REPO_FILE ->
|
case REPO_PRJ, REPO_FILE ->
|
||||||
prjInfo = queryRepoPrjTree(PrjQuerySource.REPO_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.REPO_DB.value, new ArrayList<>());
|
prjInfo = queryRepoPrjTree(PrjQuerySource.REPO_DB.value, accessibleIds, new FileProjectVO()).getOrDefault(PrjQuerySource.REPO_DB.value, new ArrayList<>());
|
||||||
default -> ElectromagneticResultUtil.fail("-1", "参数错误");
|
default -> throw new BizException("参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String info : prjInfo) {
|
for (String info : prjInfo) {
|
||||||
|
|
@ -619,7 +613,7 @@ public class CommonService {
|
||||||
case USER_FILE, USER_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code);
|
case USER_FILE, USER_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code);
|
||||||
case SYS_FILE, SYS_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code);
|
case SYS_FILE, SYS_PRJ -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code);
|
||||||
case REPO_PRJ, REPO_FILE -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.REPO_PRJ.code);
|
case REPO_PRJ, REPO_FILE -> queryWrapper.eq(EdFileInfo::getDataOwn, DataOwnEnum.REPO_PRJ.code);
|
||||||
default -> ElectromagneticResultUtil.fail("-1", "参数错误");
|
default -> throw new BizException("参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
long dirCount = edFileInfoMapper.selectCount(queryWrapper);
|
long dirCount = edFileInfoMapper.selectCount(queryWrapper);
|
||||||
|
|
@ -681,7 +675,7 @@ public class CommonService {
|
||||||
throw new BizException(info);
|
throw new BizException(info);
|
||||||
}
|
}
|
||||||
UserThreadLocal.setSuccessInfo(Optional.ofNullable(finalEdFileInfo).map(EdFileInfo::getParentId).orElse(""),
|
UserThreadLocal.setSuccessInfo(Optional.ofNullable(finalEdFileInfo).map(EdFileInfo::getParentId).orElse(""),
|
||||||
Optional.ofNullable(finalEdFileInfo).map(EdFileInfo::getFileId).orElse(""),
|
Optional.ofNullable(finalEdFileInfo).map(EdFileInfo::getId).orElse(""),
|
||||||
"文件 {} 为上传到 {} 成功,同名同后缀的处理方式为 {},存入的文件名为 {}",
|
"文件 {} 为上传到 {} 成功,同名同后缀的处理方式为 {},存入的文件名为 {}",
|
||||||
fileName,
|
fileName,
|
||||||
destPath,
|
destPath,
|
||||||
|
|
|
||||||
|
|
@ -873,6 +873,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
maps.putAll(edFileInfos);
|
maps.putAll(edFileInfos);
|
||||||
}
|
}
|
||||||
Set<EdFileInfo> resFiles = new HashSet<>(maps.values());
|
Set<EdFileInfo> resFiles = new HashSet<>(maps.values());
|
||||||
|
|
||||||
String prjId = resFiles.stream().findFirst().get().getFilePath().split(MYSQL_FILE_PATH_SPLIT)[0];
|
String prjId = resFiles.stream().findFirst().get().getFilePath().split(MYSQL_FILE_PATH_SPLIT)[0];
|
||||||
List<EdFileInfo> prjFolders = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> prjFolders = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.likeRight(EdFileInfo::getFilePath, prjId + MYSQL_FILE_PATH_SPLIT)
|
.likeRight(EdFileInfo::getFilePath, prjId + MYSQL_FILE_PATH_SPLIT)
|
||||||
|
|
@ -886,12 +887,22 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
resFiles.clear();
|
resFiles.clear();
|
||||||
resFiles.addAll(tmps.values());
|
resFiles.addAll(tmps.values());
|
||||||
resFiles.add(prjFileInfo);
|
resFiles.add(prjFileInfo);
|
||||||
|
|
||||||
List<EdFileInfo> files = resFiles.stream().filter(e -> e.getDataType().equals(EleDataTypeEnum.FILE.code)).toList();
|
List<EdFileInfo> files = resFiles.stream().filter(e -> e.getDataType().equals(EleDataTypeEnum.FILE.code)).toList();
|
||||||
for (EdFileInfo edFileInfo : files) {
|
for (EdFileInfo edFileInfo : files) {
|
||||||
String filePath = commonService.getFileSysPath(edFileInfo.getId()); // file
|
String filePath = commonService.getFileSysPath(edFileInfo.getId()); // file
|
||||||
String destPath = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + EXPORT_PRJ_NAME + File.separator + edFileInfo.getId();
|
String destPath = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + EXPORT_PRJ_NAME + File.separator + edFileInfo.getId();
|
||||||
fileSystemService.copyFile(filePath, destPath);
|
fileSystemService.copyFile(filePath, destPath);
|
||||||
}
|
}
|
||||||
|
// 去除用户创建的空文件夹
|
||||||
|
List<EdFileInfo> userFolders = resFiles.stream().filter(e ->
|
||||||
|
e.getDataType().equals(EleDataTypeEnum.FOLDER.code) && DataOwnEnum.isFileCode(e.getDataOwn())
|
||||||
|
).toList();
|
||||||
|
List<String> userFolderIds = userFolders.stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||||
|
List<String> fileParentIds = files.stream().map(EdFileInfo::getParentId).toList();
|
||||||
|
userFolderIds.removeAll(fileParentIds);
|
||||||
|
resFiles = resFiles.stream().filter(e -> !userFolderIds.contains(e.getId())).collect(Collectors.toSet());
|
||||||
|
|
||||||
String json = JSONUtil.toJsonStr(resFiles);
|
String json = JSONUtil.toJsonStr(resFiles);
|
||||||
String mysqlFilePath = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + PRJ_INFO + ".json";
|
String mysqlFilePath = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + PRJ_INFO + ".json";
|
||||||
fileSystemService.writeStringToFile(mysqlFilePath, json);
|
fileSystemService.writeStringToFile(mysqlFilePath, json);
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public class FileBackLogServiceImpl extends ServiceImpl<FileBackupLogMapper, Fil
|
||||||
fileBackLogVO.setBackStartTime(DateUtil.date(fileBackupLog.getStartTime()));
|
fileBackLogVO.setBackStartTime(DateUtil.date(fileBackupLog.getStartTime()));
|
||||||
fileBackLogVO.setBackEndTime(DateUtil.date(fileBackupLog.getEndTime()));
|
fileBackLogVO.setBackEndTime(DateUtil.date(fileBackupLog.getEndTime()));
|
||||||
fileBackLogVO.setDataOwn(map.get(fileBackupLog.getFileId()).getDataOwn());
|
fileBackLogVO.setDataOwn(map.get(fileBackupLog.getFileId()).getDataOwn());
|
||||||
fileBackLogVO.setDataOwner(DataOwnEnum.getTypeByCode(map.get(fileBackupLog.getFileId()).getDataOwn()));
|
fileBackLogVO.setDataOwner(DataOwnEnum.getEnumByCode(map.get(fileBackupLog.getFileId()).getDataOwn()).type);
|
||||||
fileBackLogVO.setFilePath(paths.get(map.get(fileBackupLog.getFileId()).getFilePath()));
|
fileBackLogVO.setFilePath(paths.get(map.get(fileBackupLog.getFileId()).getFilePath()));
|
||||||
list.add(fileBackLogVO);
|
list.add(fileBackLogVO);
|
||||||
}
|
}
|
||||||
|
|
@ -79,18 +79,19 @@ public class FileBackLogServiceImpl extends ServiceImpl<FileBackupLogMapper, Fil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restore() {
|
public List<String> restore() {
|
||||||
List<EdFileInfo> edFileInfos = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> edFileInfos = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo.class, file -> !StrUtil.equals(file.getColumn(), "file_content"))
|
.select(EdFileInfo.class, file -> !StrUtil.equals(file.getColumn(), "file_content"))
|
||||||
.eq(EdFileInfo::getPermanentDeleted, false)
|
.eq(EdFileInfo::getPermanentDeleted, false)
|
||||||
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FILE.code));
|
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FILE.code));
|
||||||
|
List<String> restoreFilePaths = new ArrayList<>();
|
||||||
for (EdFileInfo edFileInfo : edFileInfos) {
|
for (EdFileInfo edFileInfo : edFileInfos) {
|
||||||
|
|
||||||
String destPath = "";
|
String destPath;
|
||||||
if (DataOwnEnum.isUserCode(edFileInfo.getDataOwn())) {
|
if (DataOwnEnum.isUserCode(edFileInfo.getDataOwn())) {
|
||||||
destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + edFileInfo.getCreatedBy() + File.separator + commonService.getDbPath(edFileInfo.getFilePath());
|
destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + edFileInfo.getCreatedBy() + File.separator + edFileInfo.getId();
|
||||||
} else {
|
} else {
|
||||||
destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + commonService.getDbPath(edFileInfo.getFilePath());
|
destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + edFileInfo.getId();
|
||||||
}
|
}
|
||||||
destPath = destPath.replace("//", "/");
|
destPath = destPath.replace("//", "/");
|
||||||
log.info("back up file path is {}", destPath);
|
log.info("back up file path is {}", destPath);
|
||||||
|
|
@ -98,9 +99,11 @@ public class FileBackLogServiceImpl extends ServiceImpl<FileBackupLogMapper, Fil
|
||||||
byte[] bytes = backupHandler.downloadFile(edFileInfo.getId());
|
byte[] bytes = backupHandler.downloadFile(edFileInfo.getId());
|
||||||
FileUtil.writeBytes(bytes, destPath);
|
FileUtil.writeBytes(bytes, destPath);
|
||||||
String dbPath = commonService.getDbPath(edFileInfo.getFilePath());
|
String dbPath = commonService.getDbPath(edFileInfo.getFilePath());
|
||||||
|
restoreFilePaths.add(dbPath);
|
||||||
UserThreadLocal.setSuccessInfo(edFileInfo.getParentId(), edFileInfo.getId(), "{} 恢复成功,路径为 {}", edFileInfo.getFileName() + "." + edFileInfo.getFileType(), dbPath);
|
UserThreadLocal.setSuccessInfo(edFileInfo.getParentId(), edFileInfo.getId(), "{} 恢复成功,路径为 {}", edFileInfo.getFileName() + "." + edFileInfo.getFileType(), dbPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UserThreadLocal.setSuccessInfo("", "", "数据库恢复成功");
|
UserThreadLocal.setSuccessInfo("", "", "数据库恢复成功");
|
||||||
|
return restoreFilePaths;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
||||||
Map<String, String> filesPath = commonService.getFilesPath(filePaths);
|
Map<String, String> filesPath = commonService.getFilesPath(filePaths);
|
||||||
Map<String, String> userIdNameMap = getUserIdNameMap(records.stream().map(FileRecycleQueryVO::getUpdatedBy).toList());
|
Map<String, String> userIdNameMap = getUserIdNameMap(records.stream().map(FileRecycleQueryVO::getUpdatedBy).toList());
|
||||||
records.forEach(e -> {
|
records.forEach(e -> {
|
||||||
e.setDataOwner(DataOwnEnum.getTypeByCode(e.getDataOwn()));
|
e.setDataOwner(DataOwnEnum.getEnumByCode(e.getDataOwn()).type);
|
||||||
e.setFilePrjPath(filesPath.get(e.getFilePath()));
|
e.setFilePrjPath(filesPath.get(e.getFilePath()));
|
||||||
e.setFileSizeShow(EleCommonUtil.convertFileSize(e.getFileSize()));
|
e.setFileSizeShow(EleCommonUtil.convertFileSize(e.getFileSize()));
|
||||||
e.setUserName(userIdNameMap.get(e.getUpdatedBy()));
|
e.setUserName(userIdNameMap.get(e.getUpdatedBy()));
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper,
|
||||||
// 查询包括已失效的记录
|
// 查询包括已失效的记录
|
||||||
RolePermission exist = this.getOne(new LambdaQueryWrapper<RolePermission>()
|
RolePermission exist = this.getOne(new LambdaQueryWrapper<RolePermission>()
|
||||||
.eq(RolePermission::getFileId, rp.getFileId())
|
.eq(RolePermission::getFileId, rp.getFileId())
|
||||||
.eq(RolePermission::getRoleId,rp.getRoleId())
|
.eq(RolePermission::getRoleId, rp.getRoleId())
|
||||||
.eq(RolePermission::getPermissionCode, rp.getPermissionCode()));
|
.eq(RolePermission::getPermissionCode, rp.getPermissionCode()));
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
rp.setId(exist.getId()); // 赋值已有 ID,避免重复插入
|
rp.setId(exist.getId()); // 赋值已有 ID,避免重复插入
|
||||||
|
|
|
||||||
|
|
@ -399,7 +399,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
/**
|
/**
|
||||||
* 失效角色权限关系
|
* 失效角色权限关系
|
||||||
*/
|
*/
|
||||||
private void disableRolePermission (String roleId) {
|
private void disableRolePermission(String roleId) {
|
||||||
// 失效旧权限信息
|
// 失效旧权限信息
|
||||||
LambdaQueryWrapper<RolePermission> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RolePermission> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(RolePermission::getRoleId, roleId);
|
queryWrapper.eq(RolePermission::getRoleId, roleId);
|
||||||
|
|
@ -410,7 +410,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
/**
|
/**
|
||||||
* 失效角色用户关系
|
* 失效角色用户关系
|
||||||
*/
|
*/
|
||||||
private void disableUserRole (String roleId) {
|
private void disableUserRole(String roleId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class UserAccessLogServiceImpl extends ServiceImpl<UserAccessLogMapper, U
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> info(AccessLogQueryDTO pars, boolean adminQuery) {
|
public ElectromagneticResult<?> info(AccessLogQueryDTO pars, boolean adminQuery) {
|
||||||
|
|
||||||
LambdaQueryWrapper<UserAccessLog> queryWrapper = Wrappers.lambdaQuery(UserAccessLog.class).orderByDesc(UserAccessLog::getCreateTime);
|
LambdaQueryWrapper<UserAccessLog> queryWrapper = Wrappers.lambdaQuery(UserAccessLog.class).orderByDesc(UserAccessLog::getCreatedTime);
|
||||||
if (!adminQuery) {
|
if (!adminQuery) {
|
||||||
queryWrapper.eq(UserAccessLog::getDataId, pars.getDataId());
|
queryWrapper.eq(UserAccessLog::getDataId, pars.getDataId());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -157,8 +157,7 @@ public class BackupTask {
|
||||||
.setReqArgs("")
|
.setReqArgs("")
|
||||||
.setRemoteAddr("")
|
.setRemoteAddr("")
|
||||||
.setAccessSuccess(true)
|
.setAccessSuccess(true)
|
||||||
.setOperationMsg("从系统中物理删除了文件" + file.getName())
|
.setOperationMsg("从系统中物理删除了文件--->" + file.getAbsolutePath())
|
||||||
.setCreateTime(new Date())
|
|
||||||
.setOperationModule(UserOperationModuleEnum.TMP.key)
|
.setOperationModule(UserOperationModuleEnum.TMP.key)
|
||||||
.setDataId("")
|
.setDataId("")
|
||||||
.setParentId("")
|
.setParentId("")
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,13 @@ public enum DataOwnEnum {
|
||||||
REPO_FILE(3, "库数据文件(文件夹)", "库数据");
|
REPO_FILE(3, "库数据文件(文件夹)", "库数据");
|
||||||
|
|
||||||
private static final Map<Integer, Integer> FILE_PRJ_MAP = new HashMap<>();
|
private static final Map<Integer, Integer> FILE_PRJ_MAP = new HashMap<>();
|
||||||
|
private static final Map<Integer, DataOwnEnum> CODE_ENUM = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
FILE_PRJ_MAP.put(DataOwnEnum.SYS_FILE.code, DataOwnEnum.SYS_PRJ.code);
|
FILE_PRJ_MAP.put(DataOwnEnum.SYS_FILE.code, DataOwnEnum.SYS_PRJ.code);
|
||||||
FILE_PRJ_MAP.put(DataOwnEnum.USER_FILE.code, DataOwnEnum.USER_PRJ.code);
|
FILE_PRJ_MAP.put(DataOwnEnum.USER_FILE.code, DataOwnEnum.USER_PRJ.code);
|
||||||
FILE_PRJ_MAP.put(DataOwnEnum.REPO_FILE.code, DataOwnEnum.REPO_PRJ.code);
|
FILE_PRJ_MAP.put(DataOwnEnum.REPO_FILE.code, DataOwnEnum.REPO_PRJ.code);
|
||||||
|
addEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int code;
|
public final int code;
|
||||||
|
|
@ -52,21 +54,14 @@ public enum DataOwnEnum {
|
||||||
return code == REPO_FILE.code || code == REPO_PRJ.code;
|
return code == REPO_FILE.code || code == REPO_PRJ.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTypeByCode(int code) {
|
public static DataOwnEnum getEnumByCode(int code) {
|
||||||
for (DataOwnEnum e : DataOwnEnum.values()) {
|
return CODE_ENUM.getOrDefault(code, null);
|
||||||
if (e.code == code) {
|
|
||||||
return e.type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataOwnEnum getEnumByCode(int code) {
|
private static void addEnum() {
|
||||||
for (DataOwnEnum e : DataOwnEnum.values()) {
|
for (DataOwnEnum value : DataOwnEnum.values()) {
|
||||||
if (e.code == code) {
|
CODE_ENUM.put(value.code, value);
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue