From 8879b87bd296738df00894b35e4fd21ac6a9bd55 Mon Sep 17 00:00:00 2001 From: "zhouj1203@hotmail.com" Date: Tue, 10 Sep 2024 15:54:09 +0800 Subject: [PATCH] =?UTF-8?q?blob=20=E7=9B=B8=E5=85=B3=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/ExamController.java | 7 +++++++ .../controller/admin/service/ExamService.java | 2 ++ .../admin/service/impl/ExamServiceImpl.java | 16 ++++++++++++++++ .../model/dto/admin/exam/BlobSasDto.java | 10 ++++++++++ src/main/resources/application.yml | 3 ++- 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/main/java/cn/teammodel/model/dto/admin/exam/BlobSasDto.java diff --git a/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java b/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java index 7f35915..5720467 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java @@ -3,6 +3,7 @@ package cn.teammodel.controller.admin.controller; import cn.teammodel.common.R; import cn.teammodel.controller.admin.service.ExamService; import cn.teammodel.model.dto.admin.art.ArtFindDto; +import cn.teammodel.model.dto.admin.exam.BlobSasDto; import cn.teammodel.model.dto.admin.exam.OverViewDto; import cn.teammodel.model.vo.admin.ArtElementsVo; import io.swagger.annotations.Api; @@ -30,4 +31,10 @@ public class ExamController { Map res = examService.getAnalysis(overViewDto,request); return R.success(res); } + @PostMapping("getBlobSas") + @ApiOperation("获取blob 读写权限") + public R> getBlobSas(@Valid @RequestBody BlobSasDto blobSasDto, HttpServletRequest request) { + Map res = examService.getBlobSas(blobSasDto,request); + return R.success(res); + } } diff --git a/src/main/java/cn/teammodel/controller/admin/service/ExamService.java b/src/main/java/cn/teammodel/controller/admin/service/ExamService.java index aed11df..f2772e0 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/ExamService.java +++ b/src/main/java/cn/teammodel/controller/admin/service/ExamService.java @@ -1,5 +1,6 @@ package cn.teammodel.controller.admin.service; +import cn.teammodel.model.dto.admin.exam.BlobSasDto; import cn.teammodel.model.dto.admin.exam.OverViewDto; import javax.servlet.http.HttpServletRequest; @@ -7,4 +8,5 @@ import java.util.Map; public interface ExamService { Map getAnalysis(OverViewDto overViewDto, HttpServletRequest request); + Map getBlobSas(BlobSasDto blobSasDto, HttpServletRequest request); } diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java index a90e1b6..4674817 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java @@ -3,6 +3,7 @@ package cn.teammodel.controller.admin.service.impl; import cn.teammodel.common.ErrorCode; import cn.teammodel.config.exception.ServiceException; import cn.teammodel.controller.admin.service.ExamService; +import cn.teammodel.model.dto.admin.exam.BlobSasDto; import cn.teammodel.model.dto.admin.exam.OverViewDto; import cn.teammodel.utils.GroupUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -48,4 +49,19 @@ public class ExamServiceImpl implements ExamService { } return overView; } + + @Override + public Map getBlobSas(BlobSasDto blobSasDto, HttpServletRequest request) { + + Map sas; + String url = env.getProperty("ies.server-url-blob-sas-rcwld"); + + try { + sas = GroupUtil.getGroupId(blobSasDto,new GroupUtil(env), request,url); + + }catch (Exception e) { + throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误"); + } + return sas; + } } diff --git a/src/main/java/cn/teammodel/model/dto/admin/exam/BlobSasDto.java b/src/main/java/cn/teammodel/model/dto/admin/exam/BlobSasDto.java new file mode 100644 index 0000000..e9aef41 --- /dev/null +++ b/src/main/java/cn/teammodel/model/dto/admin/exam/BlobSasDto.java @@ -0,0 +1,10 @@ +package cn.teammodel.model.dto.admin.exam; + +import lombok.Data; + +@Data +public class BlobSasDto { + public String name; + public String role; + public String code; +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7a4f9db..d89772b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -74,4 +74,5 @@ ies: server-url-update-custom-comment: /school/art/update-custom-comment server-url-overview: /overall-education/overview server-url-exam-rate: /common/exam/get-exam-point - server-url-art-analysis: /analysis/art/statistics \ No newline at end of file + server-url-art-analysis: /analysis/art/statistics + server-url-blob-sas-rcwld: /blob/sas-rcwld \ No newline at end of file