fix(系统参数): 获取系统参数组接口优化
This commit is contained in:
parent
5955774552
commit
d6c84019f6
@ -96,7 +96,7 @@ public class GlobalExceptionHandlerAdvice {
|
||||
/**-------- 自定义定异常处理方法 --------**/
|
||||
@ExceptionHandler(QiwenException.class)
|
||||
@ResponseBody
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public RestResult error(QiwenException e) {
|
||||
e.printStackTrace();
|
||||
log.error("全局异常捕获:" + e);
|
||||
|
@ -17,7 +17,7 @@ public interface IUserFileService extends IService<UserFile> {
|
||||
void userFileCopy(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);
|
||||
|
||||
IPage<FileListVo> getFileByFileType(Integer fileTypeId, Long currentPage, Long pageCount, long userId);
|
||||
|
||||
List<UserFile> selectUserFileListByPath(String filePath, Long userId);
|
||||
List<UserFile> selectFileListLikeRightFilePath(String filePath, long userId);
|
||||
List<UserFile> selectFilePathTreeByUserId(Long userId);
|
||||
void deleteUserFile(Long userFileId, Long sessionUserId);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.qiwenshare.file.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
@ -49,15 +50,15 @@ public class CommonFileController {
|
||||
commonFile.setUserFileId(commonFileDTO.getUserFileId());
|
||||
commonFileService.save(commonFile);
|
||||
|
||||
// List<Long> list = JSON.parseArray(commonFileDTO.getCommonUserIds(), Long.class);
|
||||
List<Long> list = JSON.parseArray(commonFileDTO.getCommonUserIds(), Long.class);
|
||||
List<FilePermission> filePermissionList = new ArrayList<>();
|
||||
// for (Long userId : list) {
|
||||
for (Long userId : list) {
|
||||
FilePermission filePermission = new FilePermission();
|
||||
filePermission.setUserId(Long.parseLong(commonFileDTO.getCommonUserIds()));
|
||||
filePermission.setCommonFileId(commonFile.commonFileId);
|
||||
filePermission.setFilePermissionCode(commonFileDTO.getPermissionCode());
|
||||
filePermissionList.add(filePermission);
|
||||
// }
|
||||
}
|
||||
filePermissionService.saveBatch(filePermissionList);
|
||||
|
||||
return RestResult.success();
|
||||
|
@ -48,6 +48,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Tag(name = "file", description = "该接口为文件接口,主要用来做一些文件的基本操作,如创建目录,删除,移动,复制等。")
|
||||
@RestController
|
||||
|
@ -15,7 +15,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "系统参数管理")
|
||||
@RestController
|
||||
@ -27,13 +29,18 @@ public class SysParamController {
|
||||
@Operation(summary = "查询系统参数组", tags = {"系统参数管理"})
|
||||
@RequestMapping(value = "/grouplist", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public RestResult<SysParam> groupList(
|
||||
public RestResult<Map> groupList(
|
||||
@Parameter(description = "查询参数dto", required = false)
|
||||
QueryGroupParamDTO queryGroupParamDTO
|
||||
) {
|
||||
List<SysParam> list = sysParamService.list(new QueryWrapper<SysParam>().lambda().eq(SysParam::getGroupName, queryGroupParamDTO.getGroupName()));
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
return RestResult.success().data(list);
|
||||
for (SysParam sysParam : list) {
|
||||
result.put(sysParam.getSysParamKey(), sysParam.getSysParamValue());
|
||||
}
|
||||
|
||||
return RestResult.success().data(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,8 +12,12 @@ import lombok.Data;
|
||||
@Data
|
||||
@Schema(name = "共享文件DTO",required = true)
|
||||
public class CommonFileDTO {
|
||||
@Schema(name = "用户文件id")
|
||||
private Long userFileId;
|
||||
@Schema(name = "共享文件类型")
|
||||
private Integer commonFileType;
|
||||
@Schema(name = "共享用户id集合")
|
||||
private String commonUserIds;
|
||||
@Schema(name = "权限码")
|
||||
private Integer permissionCode;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qiwenshare.common.constant.FileConstant;
|
||||
import com.qiwenshare.common.exception.QiwenException;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.util.security.JwtUser;
|
||||
import com.qiwenshare.common.util.security.SessionUtil;
|
||||
@ -28,6 +30,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -103,6 +106,12 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
if ("null".equals(extendName)){
|
||||
extendName = null;
|
||||
}
|
||||
List<UserFile> userFileList = selectUserFileListByPath(newfilePath, userId);
|
||||
List<String> userFileNameList = userFileList.stream().map(UserFile::getFileName).collect(Collectors.toList());
|
||||
if (userFileNameList != null && userFileNameList.size() > 0 && userFileNameList.contains(fileName)) {
|
||||
throw new QiwenException(200000, "目的路径同名文件已存在,不能移动");
|
||||
}
|
||||
|
||||
//移动根目录
|
||||
userFileMapper.updateFilepathByPathAndName(oldfilePath, newfilePath, fileName, extendName, userId);
|
||||
|
||||
@ -158,6 +167,16 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
return userFileMapper.selectPageVo(page, userFile, fileTypeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserFile> selectUserFileListByPath(String filePath, Long userId) {
|
||||
LambdaQueryWrapper<UserFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper
|
||||
.eq(UserFile::getFilePath, filePath)
|
||||
.eq(UserFile::getUserId, userId)
|
||||
.eq(UserFile::getDeleteFlag, 0);
|
||||
return userFileMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserFile> selectFileListLikeRightFilePath(String filePath, long userId) {
|
||||
filePath = filePath.replace("\\", "\\\\\\\\");
|
||||
|
Loading…
Reference in New Issue
Block a user