| | |
| | | */ |
| | | package org.springblade.modules.mechanism.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.google.zxing.WriterException; |
| | | import io.minio.*; |
| | | import io.minio.errors.*; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.resource.builder.oss.OssBuilder; |
| | | import org.springblade.modules.resource.entity.Oss; |
| | | import org.springblade.modules.resource.service.IOssService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.mechanism.entity.Mechanism; |
| | |
| | | public class MechanismController extends BladeController { |
| | | |
| | | private final IMechanismService mechanismService; |
| | | |
| | | private final IOssService ossService; |
| | | |
| | | /** |
| | | * 对象存储构建类 |
| | |
| | | } |
| | | |
| | | private String upload(ByteArrayInputStream in) throws IOException, InvalidKeyException, InvalidResponseException, InsufficientDataException, NoSuchAlgorithmException, ServerException, InternalException, XmlParserException, ErrorResponseException { |
| | | QueryWrapper<Oss> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0); |
| | | Oss one = ossService.getOne(wrapper); |
| | | //填写你文件上传的地址以及相应信息 |
| | | String url = "http://106.225.193.35:2081"; |
| | | String access = "zhbaadmin"; |
| | | String secret = "zhbapassword"; |
| | | String bucket = "zhxy"; |
| | | // String url = "http://106.225.193.35:2081"; |
| | | // String access = "zhbaadmin"; |
| | | // String secret = "zhbapassword"; |
| | | // String bucket = "zhxy"; |
| | | String url = one.getEndpoint(); |
| | | String access = one.getAccessKey(); |
| | | String secret = one.getSecretKey(); |
| | | String bucket = one.getBucketName(); |
| | | MinioClient minioClient = |
| | | MinioClient.builder() |
| | | .endpoint(url) |
| | |
| | | .build()); |
| | | |
| | | //文件推送 |
| | | String urls = "https://dev.jxpskj.com:8023/zhxy/"+newName; |
| | | // String urls = "https://dev.jxpskj.com:8023/zhxy/"+newName; |
| | | String urls = url + "/"+ bucket + "/" + newName; |
| | | //返回 |
| | | return urls; |
| | | } |