feat(我的绩效): 开发我的绩效功能。
This commit is contained in:
@@ -16,6 +16,15 @@ public class DeptRespDTO {
|
||||
@Schema(description = "父部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "组织节点类型", example = "direction")
|
||||
private String orgType;
|
||||
|
||||
@Schema(description = "组织编码", example = "rd")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "组织物化路径", example = "/100/101")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "部门状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -21,4 +21,14 @@ public interface FileApi {
|
||||
@Parameter(name = "url", description = "文件 URL", required = true)
|
||||
CommonResult<FileRespDTO> getFileByUrl(@RequestParam("url") String url);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "通过文件 ID 查询文件")
|
||||
@Parameter(name = "id", description = "文件 ID", required = true)
|
||||
CommonResult<FileRespDTO> getFile(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/content")
|
||||
@Operation(summary = "通过文件 ID 读取文件内容")
|
||||
@Parameter(name = "id", description = "文件 ID", required = true)
|
||||
CommonResult<byte[]> getFileContent(@RequestParam("id") Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,11 @@ public class FileRespDTO {
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件配置编号。
|
||||
*/
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 文件名称。
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ public enum DeptOrgTypeEnum {
|
||||
COMPANY("company"),
|
||||
DEPT("dept"),
|
||||
DIRECTION("direction"),
|
||||
FUNCTION("function"),
|
||||
TEAM("team");
|
||||
|
||||
private final String type;
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.njcn.rdms.module.system.api.dept.dto.DeptRespDTO;
|
||||
import com.njcn.rdms.module.system.dal.dataobject.dept.DeptDO;
|
||||
import com.njcn.rdms.module.system.service.dept.DeptService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@@ -26,4 +26,23 @@ public class FileApiImpl implements FileApi {
|
||||
return success(BeanUtils.toBean(file, FileRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<FileRespDTO> getFile(Long id) {
|
||||
FileDO file = fileService.getFile(id);
|
||||
return success(BeanUtils.toBean(file, FileRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<byte[]> getFileContent(Long id) {
|
||||
try {
|
||||
FileDO file = fileService.getFile(id);
|
||||
if (file == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(fileService.getFileContent(file.getConfigId(), file.getPath()));
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException("读取文件内容失败", ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class FileController {
|
||||
@GetMapping("/download")
|
||||
@Operation(summary = "下载文件")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:file:query')")
|
||||
//@PreAuthorize("@ss.hasPermission('system:file:query')")
|
||||
public void downloadFile(@RequestParam("id") Long id, HttpServletResponse response) throws Exception {
|
||||
FileDO file = fileService.getFile(id);
|
||||
byte[] content = fileService.getFileContent(file.getConfigId(), file.getPath());
|
||||
|
||||
Reference in New Issue
Block a user