mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、柜体板件视图分页和cadinfo接口支持多柜体入参;2、新增订单详情柜体数和部件树返回cad图纸id和图纸fileHash;
This commit is contained in:
+7
@@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 文件")
|
||||
public interface FileApi {
|
||||
@@ -95,4 +98,8 @@ public interface FileApi {
|
||||
default Long createFileAndReturnId(byte[] content, String fileName) {
|
||||
return createFileAndReturnId(new FileCreateReqDTO().setName(fileName).setPath(null).setContent(content)).getCheckedData();
|
||||
}
|
||||
|
||||
@PostMapping(PREFIX + "/getFileHashByIds")
|
||||
@Operation(summary = "根据文件id请求和fileHash的对应关系")
|
||||
CommonResult<Map<Long, String>> getFileHashMapByIds(@RequestBody Set<Long> fileIds);
|
||||
}
|
||||
|
||||
+15
@@ -2,12 +2,18 @@ package com.cf.imes.module.infra.api.file;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
|
||||
import com.cf.imes.module.infra.service.file.FileService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@@ -39,4 +45,13 @@ public class FileApiImpl implements FileApi {
|
||||
return success(fileService.createFileDO(createReqDTO.getName(), createReqDTO.getPath(),
|
||||
createReqDTO.getContent()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Map<Long, String>> getFileHashMapByIds(Set<Long> fileIds) {
|
||||
List<FileDO> fileDOList = fileService.getByIds(fileIds);
|
||||
return success(fileDOList.stream().collect(Collectors.toMap(
|
||||
FileDO::getId,
|
||||
FileDO::getName
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -29,6 +29,8 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 文件存储")
|
||||
@@ -44,7 +46,7 @@ public class FileController {
|
||||
@PostMapping("/upload")
|
||||
@Operation(summary = "上传文件")
|
||||
@OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要
|
||||
public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception {
|
||||
public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws IOException {
|
||||
MultipartFile file = uploadReqVO.getFile();
|
||||
String path = uploadReqVO.getPath();
|
||||
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
|
||||
@@ -53,8 +55,8 @@ public class FileController {
|
||||
@PostMapping("/cadview")
|
||||
@Operation(summary = "上传CAD图纸数据")
|
||||
@OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要
|
||||
public CommonResult<Long> uploadCadViewFile(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
return success(fileService.createFileDO("cadViewFile", null, file.getBytes()));
|
||||
public CommonResult<Long> uploadCadViewFile(@RequestPart("file") MultipartFile file) throws IOException {
|
||||
return success(fileService.createFileDO(file.getOriginalFilename(), null, file.getBytes()));
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +64,7 @@ public class FileController {
|
||||
@Operation(summary = "删除文件")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
|
||||
public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception {
|
||||
public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) {
|
||||
fileService.deleteFile(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
+11
@@ -4,6 +4,9 @@ import com.cf.imes.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 文件 Service 接口
|
||||
*
|
||||
@@ -70,4 +73,12 @@ public interface FileService {
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteFileByPath(String path);
|
||||
|
||||
/**
|
||||
* 通过文件id获取文件列表
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<FileDO> getByIds(Set<Long> ids);
|
||||
}
|
||||
|
||||
+6
@@ -17,7 +17,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
@@ -170,4 +172,8 @@ public class FileServiceImpl implements FileService {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileDO> getByIds(Set<Long> ids) {
|
||||
return fileMapper.selectByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user