mirror of
https://github.com/dataease/dataease.git
synced 2026-05-20 19:48:18 +08:00
feat:增加仪表盘设计组件及设计
This commit is contained in:
@@ -29,6 +29,7 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/v2/**","anon");
|
||||
filterChainDefinitionMap.put("/v3/**","anon");
|
||||
filterChainDefinitionMap.put("/static/**", "anon");
|
||||
filterChainDefinitionMap.put("/common-files/**", "anon");
|
||||
|
||||
|
||||
// filterChainDefinitionMap.put("/401", "anon");
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.dataease.controller;
|
||||
|
||||
import io.dataease.service.CommonFilesService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("common-files")
|
||||
public class CommonFilesController {
|
||||
@Resource
|
||||
private CommonFilesService commonFilesService;
|
||||
|
||||
@GetMapping("/images/{imageId}")
|
||||
public ResponseEntity<byte[]> image(@PathVariable("imageId") String imageId) {
|
||||
return commonFilesService.getImageById(imageId);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@ import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
||||
import io.dataease.controller.request.panel.PanelGroupRequest;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import io.dataease.dto.panel.PanelGroupDTO;
|
||||
import io.dataease.service.CommonFilesService;
|
||||
import io.dataease.service.panel.PanelGroupService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.dataease.service;
|
||||
|
||||
import io.dataease.base.domain.FileMetadata;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class CommonFilesService {
|
||||
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
|
||||
public ResponseEntity<byte[]> getImageById(String imageId) {
|
||||
byte[] bytes = null;
|
||||
MediaType contentType = MediaType.parseMediaType("application/octet-stream");
|
||||
FileMetadata fileMetadata = fileService.copyFile(imageId);
|
||||
if (fileMetadata == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
bytes = fileService.loadFileAsBytes(imageId);
|
||||
return ResponseEntity.ok()
|
||||
.contentType(contentType)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileMetadata.getName() + "\"")
|
||||
.body(bytes);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user