blob 相关权限内容

develop
zhouj1203@hotmail.com 4 months ago
parent 8879b87bd2
commit 7ddcf2aed5

@ -0,0 +1,31 @@
package cn.teammodel.controller.admin.controller;
import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.BlobService;
import cn.teammodel.model.dto.admin.exam.BlobSasDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
@RestController
@RequestMapping("admin/blob")
@Api(tags = "管理员-blob相关操作")
public class BlobController {
@Resource
private BlobService blobService;
@PostMapping("getBlobSas")
@ApiOperation("获取blob 读写权限")
public R<Map<String, Object>> getBlobSas(@Valid @RequestBody BlobSasDto blobSasDto, HttpServletRequest request) {
Map<String, Object> res = blobService.getBlobSas(blobSasDto,request);
return R.success(res);
}
}

@ -31,10 +31,4 @@ public class ExamController {
Map<String, Object> res = examService.getAnalysis(overViewDto,request); Map<String, Object> res = examService.getAnalysis(overViewDto,request);
return R.success(res); return R.success(res);
} }
@PostMapping("getBlobSas")
@ApiOperation("获取blob 读写权限")
public R<Map<String, Object>> getBlobSas(@Valid @RequestBody BlobSasDto blobSasDto, HttpServletRequest request) {
Map<String, Object> res = examService.getBlobSas(blobSasDto,request);
return R.success(res);
}
} }

@ -0,0 +1,10 @@
package cn.teammodel.controller.admin.service;
import cn.teammodel.model.dto.admin.exam.BlobSasDto;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public interface BlobService {
Map<String,Object> getBlobSas(BlobSasDto blobSasDto, HttpServletRequest request);
}

@ -8,5 +8,4 @@ import java.util.Map;
public interface ExamService { public interface ExamService {
Map<String,Object> getAnalysis(OverViewDto overViewDto, HttpServletRequest request); Map<String,Object> getAnalysis(OverViewDto overViewDto, HttpServletRequest request);
Map<String,Object> getBlobSas(BlobSasDto blobSasDto, HttpServletRequest request);
} }

@ -0,0 +1,33 @@
package cn.teammodel.controller.admin.service.impl;
import cn.teammodel.common.ErrorCode;
import cn.teammodel.config.exception.ServiceException;
import cn.teammodel.controller.admin.service.BlobService;
import cn.teammodel.model.dto.admin.exam.BlobSasDto;
import cn.teammodel.utils.GroupUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Service
public class BlobServiceImpl implements BlobService {
@Autowired
private Environment env;
@Override
public Map<String, Object> getBlobSas(BlobSasDto blobSasDto, HttpServletRequest request) {
Map<String, Object> 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;
}
}

@ -49,19 +49,4 @@ public class ExamServiceImpl implements ExamService {
} }
return overView; return overView;
} }
@Override
public Map<String, Object> getBlobSas(BlobSasDto blobSasDto, HttpServletRequest request) {
Map<String, Object> 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;
}
} }

Loading…
Cancel
Save