发布准备
This commit is contained in:
@@ -1,221 +0,0 @@
|
||||
/*
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.AiDaApplication;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.PantoneUtils;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.model.vo.DesignItemDetailVO;
|
||||
import com.ai.da.service.DesignItemService;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.minio.MinioClient;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = AiDaApplication.class)
|
||||
public class ApplicationTest {
|
||||
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
private DesignItemService designItemService;
|
||||
|
||||
@Autowired
|
||||
private MinioClient minioClient;
|
||||
|
||||
@Test
|
||||
public void testDesignDetail(){
|
||||
DesignItemDetailVO detail = designService.detail(32929L, 33130L);
|
||||
System.out.println(JSONObject.toJSON(detail));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDate(){
|
||||
String timeZone = "Asia/Shanghai";
|
||||
Date date = DateUtil.getByTimeZone(timeZone);
|
||||
|
||||
LocalDateTime localDateTime = LocalDateTime.now(ZoneId.of(timeZone));
|
||||
|
||||
System.out.println("date : " + date);
|
||||
|
||||
System.out.println("localdatetime : " + localDateTime);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPantone(){
|
||||
|
||||
int[] a1 = new int[]{161,23,41};
|
||||
int[] a2 = new int[]{244,222,222};
|
||||
System.out.println(Arrays.toString(PantoneUtils.rgbToHsv(a1)));
|
||||
System.out.println(Arrays.toString(PantoneUtils.rgbToHsv(a2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLength(){
|
||||
String testString = "You look gorgeous!";
|
||||
String[] s = testString.split("\\s+");
|
||||
System.out.println(s.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRgbToHsv(){
|
||||
int[] ints = PantoneUtils.rgbToHsv(new int[]{150, 147, 204});
|
||||
System.out.println(Arrays.toString(ints));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pngToSvg() throws TranscoderException {
|
||||
String pngImages = "D:\\download\\images\\result1.png";
|
||||
String svgImages = "D:\\download\\images\\result1.svg";
|
||||
|
||||
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(pngImages);
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(svgImages);
|
||||
|
||||
Transcoder pngTranscoder = new PNGTranscoder();
|
||||
|
||||
TranscoderInput transcoderInput = new TranscoderInput(fileInputStream);
|
||||
|
||||
TranscoderOutput transcoderOutput = new TranscoderOutput(fileOutputStream);
|
||||
|
||||
pngTranscoder.transcode(transcoderInput,transcoderOutput);
|
||||
|
||||
fileInputStream.close();
|
||||
fileOutputStream.flush();
|
||||
fileOutputStream.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
System.out.println("转换完成");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pngToSvg2() throws IOException {
|
||||
String pngImages = "D:\\download\\images\\result_1.png";
|
||||
String svgImages = "D:\\download\\images\\result1.svg";
|
||||
|
||||
|
||||
File inputFile = new File(pngImages);
|
||||
BufferedImage bufferedImage = ImageIO.read(inputFile);
|
||||
|
||||
BufferedImage convertedImage = new BufferedImage(
|
||||
bufferedImage.getWidth(),
|
||||
bufferedImage.getHeight(),
|
||||
BufferedImage.TYPE_INT_RGB
|
||||
);
|
||||
|
||||
convertedImage.createGraphics().drawImage(bufferedImage,0,0,null);
|
||||
|
||||
// 创建SVG文档
|
||||
DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
|
||||
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
|
||||
Document document = domImpl.createDocument(svgNS, "svg", null);
|
||||
Element root = document.getDocumentElement();
|
||||
root.setAttributeNS(null, "width", String.valueOf(convertedImage.getWidth()));
|
||||
root.setAttributeNS(null, "height", String.valueOf(convertedImage.getHeight()));
|
||||
|
||||
// 转换为SVG代码
|
||||
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
|
||||
svgGenerator.drawImage(convertedImage, null, null);
|
||||
|
||||
svgGenerator.stream(root,);
|
||||
|
||||
boolean useCSS = true; // we want to use CSS style attributes
|
||||
Writer out = new OutputStreamWriter(Files.newOutputStream(Paths.get(svgImages)), StandardCharsets.UTF_8);
|
||||
svgGenerator.stream(out, useCSS);
|
||||
|
||||
String svgCode = svgGenerator.getRoot().toString();
|
||||
// .getSVGDocument().getRootElement().toString();
|
||||
FileUtils.writeStringToFile(new File(svgImages), svgCode, "UTF-8");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// new GongShiUtilTest().test4();
|
||||
String scg = "C:\\Users\\DELL\\Desktop\\WORD\\22.svg";
|
||||
File destFile=new File("C:\\Users\\DELL\\Desktop\\WORD\\22.png");
|
||||
if(!destFile.exists()){
|
||||
destFile.createNewFile();
|
||||
}
|
||||
FileInputStream inputStream = new FileInputStream(new File(scg));
|
||||
convertSvg2Png(inputStream,destFile);
|
||||
}
|
||||
|
||||
|
||||
public static void convertSvg2Png(InputStream in, File png) throws IOException, TranscoderException
|
||||
{
|
||||
OutputStream out = new FileOutputStream(png);
|
||||
out = new BufferedOutputStream(out);
|
||||
PNGTranscoder pngTranscoder = new PNGTranscoder();
|
||||
try {
|
||||
TranscoderInput input = new TranscoderInput(in);
|
||||
try {
|
||||
TranscoderOutput output = new TranscoderOutput(out);
|
||||
pngTranscoder.transcode(input, output);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void paint(Graphics2D g) throws IOException {
|
||||
File imageSrc = new File("D:\\download\\images\\result1.png");
|
||||
BufferedImage img = ImageIO.read(imageSrc);
|
||||
|
||||
g.drawImage(img,0,0,null);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
// Get a DOMImplementation.
|
||||
DOMImplementation domImpl =
|
||||
GenericDOMImplementation.getDOMImplementation();
|
||||
|
||||
// Create an instance of org.w3c.dom.Document.
|
||||
String svgNS = "http://www.w3.org/2000/svg";
|
||||
Document document = domImpl.createDocument(svgNS, "svg", null);
|
||||
|
||||
// Create an instance of the SVG Generator.
|
||||
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
|
||||
|
||||
// Ask the test to render into the SVG Graphics2D implementation.
|
||||
paint(svgGenerator);
|
||||
|
||||
// Finally, stream out SVG to the standard output using
|
||||
// UTF-8 encoding.
|
||||
boolean useCSS = true; // we want to use CSS style attributes
|
||||
Writer out = new OutputStreamWriter(Files.newOutputStream(Paths.get("D:\\download\\images\\result1.svg")), StandardCharsets.UTF_8);
|
||||
svgGenerator.stream(out, useCSS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
@@ -1,186 +0,0 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A utility class for reading and writing PGM images. Methods use integers to represent unsigned bytes.
|
||||
* <p>
|
||||
* Does not fully conform to the PGM specification because currently there is no support for:
|
||||
* <ul>
|
||||
* <li>More than one image per file</li>
|
||||
* <li>Images with more than 256 shades of gray</li>
|
||||
* <li>Comments within the raster</li>
|
||||
* </ul>
|
||||
* github https://gist.github.com/armanbilge/3276d80030d1caa2ed7c#file-pgmio-java-L2
|
||||
*
|
||||
* @author Arman Bilge
|
||||
*/
|
||||
public final class PgmIo {
|
||||
|
||||
private static final String MAGIC = "P5";
|
||||
/**
|
||||
* Character indicating a comment.
|
||||
*/
|
||||
private static final char COMMENT = '#';
|
||||
/**
|
||||
* The maximum gray value.
|
||||
*/
|
||||
private static final int MAXVAL = 255;
|
||||
|
||||
/**
|
||||
* Reads a grayscale image from a file in PGM format.
|
||||
*
|
||||
* @param file the PGM file read from
|
||||
* @return two-dimensional byte array representation of the image
|
||||
* @throws IOException
|
||||
*/
|
||||
public static int[][] read(final File file) throws IOException {
|
||||
final BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file));
|
||||
try {
|
||||
if (!next(stream).equals(MAGIC))
|
||||
throw new IOException("File " + file + " is not a binary PGM image.");
|
||||
final int col = Integer.parseInt(next(stream));
|
||||
final int row = Integer.parseInt(next(stream));
|
||||
final int max = Integer.parseInt(next(stream));
|
||||
if (max < 0 || max > MAXVAL)
|
||||
throw new IOException("The image's maximum gray value must be in range [0, " + MAXVAL + "].");
|
||||
final int[][] image = new int[row][col];
|
||||
for (int i = 0; i < row; ++i) {
|
||||
for (int j = 0; j < col; ++j) {
|
||||
final int p = stream.read();
|
||||
if (p == -1)
|
||||
throw new IOException("Reached end-of-file prematurely.");
|
||||
else if (p < 0 || p > max)
|
||||
throw new IOException("Pixel value " + p + " outside of range [0, " + max + "].");
|
||||
image[i][j] = p;
|
||||
}
|
||||
}
|
||||
return image;
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the next whitespace-delimited string in a stream, ignoring any comments.
|
||||
*
|
||||
* @param stream the stream read from
|
||||
* @return the next whitespace-delimited string
|
||||
* @throws IOException
|
||||
*/
|
||||
private static String next(final InputStream stream) throws IOException {
|
||||
final List<Byte> bytes = new ArrayList<Byte>();
|
||||
while (true) {
|
||||
final int b = stream.read();
|
||||
|
||||
if (b != -1) {
|
||||
|
||||
final char c = (char) b;
|
||||
if (c == COMMENT) {
|
||||
int d;
|
||||
do {
|
||||
d = stream.read();
|
||||
} while (d != -1 && d != '\n' && d != '\r');
|
||||
} else if (!Character.isWhitespace(c)) {
|
||||
bytes.add((byte) b);
|
||||
} else if (bytes.size() > 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
final byte[] bytesArray = new byte[bytes.size()];
|
||||
for (int i = 0; i < bytesArray.length; ++i)
|
||||
bytesArray[i] = bytes.get(i);
|
||||
return new String(bytesArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a grayscale image to a file in PGM format.
|
||||
*
|
||||
* @param image a two-dimensional byte array representation of the image
|
||||
* @param file the file to write to
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void write(final int[][] image, final File file) throws IOException {
|
||||
write(image, file, MAXVAL);
|
||||
}
|
||||
|
||||
|
||||
public static void write(BufferedImage image, final File file) throws IOException {
|
||||
int[][] rgbArray = new int[image.getHeight()][image.getWidth()];
|
||||
for (int j = 0; j < image.getHeight(); j++) {
|
||||
for (int i = 0; i < image.getWidth(); i++) {
|
||||
int p = image.getRGB(i, j);
|
||||
int a = (p >> 24) & 0xff;
|
||||
int r = (p >> 16) & 0xff;
|
||||
int g = (p >> 8) & 0xff;
|
||||
int b = p & 0xff;
|
||||
int avg = (r + g + b) / 3;
|
||||
p = (a << 24) | (avg << 16) | (avg << 8) | avg;
|
||||
//newImg.setRGB(i, j, p);
|
||||
//image.setRGB(i, j, p);
|
||||
rgbArray[j][i] = avg;
|
||||
}
|
||||
}
|
||||
write(rgbArray, file);
|
||||
}
|
||||
|
||||
public static void write(File imageFile, final File file) throws IOException {
|
||||
try {
|
||||
BufferedImage bf = ImageIO.read(imageFile);
|
||||
write(bf, file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a grayscale image to a file in PGM format.
|
||||
*
|
||||
* @param image a two-dimensional byte array representation of the image
|
||||
* @param file the file to write to
|
||||
* @param maxval the maximum gray value
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void write(final int[][] image, final File file, final int maxval) throws IOException {
|
||||
if (maxval > MAXVAL)
|
||||
throw new IllegalArgumentException("The maximum gray value cannot exceed " + MAXVAL + ".");
|
||||
final BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(file));
|
||||
try {
|
||||
stream.write(MAGIC.getBytes());
|
||||
stream.write("\n".getBytes());
|
||||
stream.write(Integer.toString(image[0].length).getBytes());
|
||||
stream.write(" ".getBytes());
|
||||
stream.write(Integer.toString(image.length).getBytes());
|
||||
stream.write("\n".getBytes());
|
||||
stream.write(Integer.toString(maxval).getBytes());
|
||||
stream.write("\n".getBytes());
|
||||
|
||||
for (int i = 0; i < image.length; i++) {
|
||||
for (int j = 0; j < image[0].length; j++) {
|
||||
final int p = image[i][j];
|
||||
if (p < 0 || p > maxval)
|
||||
throw new IOException("Pixel value " + p + " outside of range [0, " + maxval + "].");
|
||||
stream.write(image[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
//you can delete println
|
||||
System.out.println("PGM create successful, file name :" + file.getName() + "\nwidth:" + image[0].length + ",height:" + image.length);
|
||||
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
|
||||
import com.stripe.Stripe;
|
||||
import com.stripe.StripeClient;
|
||||
import com.stripe.exception.StripeException;
|
||||
import com.stripe.model.Customer;
|
||||
import com.stripe.model.PaymentIntent;
|
||||
import com.stripe.model.Product;
|
||||
import com.stripe.param.CustomerCreateParams;
|
||||
import com.stripe.param.PaymentIntentCreateParams;
|
||||
import com.stripe.param.ProductCreateParams;
|
||||
import com.stripe.param.PriceCreateParams;
|
||||
import com.stripe.model.Price;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
|
||||
public class Server {
|
||||
/*public static void main(String[] args) throws StripeException {
|
||||
Stripe.apiKey = "sk_test_51P4ZZL02n1TEydyN8qQHjOA9imsFU7Oxs2HMHGy2urHnnQgSHnZuu5vVP6pKhEACwUpsKNyrbZpdcg5TJWJLRHcY008dEO1fn2";
|
||||
|
||||
ProductCreateParams productParams =
|
||||
ProductCreateParams.builder()
|
||||
.setName("Starter Subscription")
|
||||
.setDescription("$12/Month subscription")
|
||||
.build();
|
||||
Product product = Product.create(productParams);
|
||||
System.out.println("Success! Here is your starter subscription product id: " + product.getId());
|
||||
|
||||
PriceCreateParams params =
|
||||
PriceCreateParams
|
||||
.builder()
|
||||
.setProduct(product.getId())
|
||||
.setCurrency("usd")
|
||||
.setUnitAmount(1200L)
|
||||
.setRecurring(
|
||||
PriceCreateParams.Recurring
|
||||
.builder()
|
||||
.setInterval(PriceCreateParams.Recurring.Interval.MONTH)
|
||||
.build())
|
||||
.build();
|
||||
Price price = Price.create(params);
|
||||
System.out.println("Success! Here is your starter subscription price id: " + price.getId());
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
public static void main(String[] args) {
|
||||
StripeClient client = new StripeClient("sk_test_51P4ZZL02n1TEydyN8qQHjOA9imsFU7Oxs2HMHGy2urHnnQgSHnZuu5vVP6pKhEACwUpsKNyrbZpdcg5TJWJLRHcY008dEO1fn2");
|
||||
CustomerCreateParams params =
|
||||
CustomerCreateParams
|
||||
.builder()
|
||||
.setDescription("Example description")
|
||||
.setEmail("test@example.com")
|
||||
.setPaymentMethod("pm_card_visa") // obtained via Stripe.js
|
||||
.build();
|
||||
|
||||
try {
|
||||
Customer customer = client.customers().create(params);
|
||||
System.out.println(customer);
|
||||
} catch (StripeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.MD5Utils;
|
||||
import com.ai.da.common.utils.S3Util;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
public class testS3 {
|
||||
|
||||
@Resource
|
||||
private S3Util s3Util;
|
||||
|
||||
@ApiOperation(value = "test1")
|
||||
@PostMapping("/test1")
|
||||
public Response<String> test1() {
|
||||
String bucketName = "aida-collection-element";
|
||||
String imageType = "png";
|
||||
String base64 = "iVBORw0KGgoAAAANSUhEUgAAAMMAAABPCAYAAABWDXEJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAbNSURBVHhe7ZrLTSRJFEVxARtwAR8wARvaBVZsWLBkBR60BW1BO4DEGg/woUYHRbRyUu/GLyOKoece6UmtojJ++U78qi9OxphPLIMxCctgTMIyGJOwDMYkLIMxCctgTMIyGJOwDMYkLIMxCctgTMIyGJOwDMYkLIMxCctgTMIyGJOwDMYkLIMxCctgTMIyGJOwDMYkLIMxCctgTMIyGJOwDMYkLIMxCctgTMIyLOb9/f308vJyur29PV1fX58uLi7+FTc3N6cfP36cfv78efr4+EhPma/g7DKQHPuEyHF1dZW+Nc7j42NYtorLy8s/CUnS0r4ZUA5lRnWWgmdapaDdURm1QEqeZax+/fp1WMLfv3+H9YyEYmYdlBVxdhnu7u7CBuZQDW2lV4YoSJQj7UCqqNzWQNCW+kdliIKVa7TPPBeVORKKmXWofp5dBmb/qIE5mBmPMEOGHJTVy8hqo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Cr+npuwEZZIQMSR2VSl8IyCNQvubOidsMzQwaIyogSQonT+2PhFlYmZFLnlMwKGaKLD6KUdJZBoF7QrKjNuOeWAdTBu+Vqds9+MmHLqdo+WwbkU30pbfssQ4C6FuWl0ejeiF5M7aaG5/bPED0ylPoRoc5IrTdgW6L9OuMQrRKzZWA1i8pT/c5YhoAZibhFJVlplprRBrXVU1sf9aKInnqjWzRCSTVThtL2ttYH1f//tQzRrHbkzl0d5kq/VxyVgRlY3aaUtmgqMZnVW26WVDLyvNpuzZJBnROIlrOPZdixqrHRNScJojgiA0mrrlWJ0hmAv0XbOoLPaVe01eGzUjKWxu+IDNSLgEp8gnZHbd5jGXaoLU0pgVpQWwducSKUDJTDgEbBMyqxcrQMemmrkYN6SH6iVid/L6Gep60qeKYkfA5EaFnRgDGMyqCuqA2lYAwjVB08M4spMjB7RLNi7WW2QNn7cgm1fDM40fePBMnTSosQLUGdtVlZyXA0WC1aRQCVqCOhcubbyKASQFnei7rliJJltgyl84mCVUttmVqChGjZnqyQgRW+pe4tlmFD9FJIhlmoH7aiA+0sGegTL2AUEkptHVUwI/dMIDNlYMIZ7a9lSKg7eXUdOEp00Iu2L6My8BJoM4IdPedsQQoSnGSL9urUy+qjzkAljsiQ+0vbeleCPZbBmL8My2BMwjIYk7AMxiQsgzEJy2BMwjIYk7AMxiQsgzEJy2BMwjIYk7AMxiQsgzEJy2BMwjIYk7AMxiQsgzEJy2DMJ6fTP087MrRzJGnPAAAAAElFTkSuQmCC";
|
||||
String s = s3Util.uploadImageFromBase64(bucketName, base64, imageType);
|
||||
log.info("s3Util.uploadImageFromBase64 测试成功");
|
||||
return Response.success(s);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test2")
|
||||
@PostMapping("/test2")
|
||||
public Response<String> test2(@RequestParam("file") MultipartFile file) {
|
||||
String bucketName = "aida-users";
|
||||
String path = "87/tmp";
|
||||
String s = s3Util.upload(bucketName, path, file);
|
||||
log.info("s3Util.upload 测试成功");
|
||||
return Response.success(s);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "test3")
|
||||
@PostMapping("/test3")
|
||||
public Response<String> test3(@RequestParam("file") MultipartFile file) {
|
||||
String bucketName = "aida-users";
|
||||
String path = "87/tmp";
|
||||
String s = s3Util.upload(bucketName, path, file, "");
|
||||
log.info("s3Util.upload _ copy 测试成功");
|
||||
return Response.success(s);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test4")
|
||||
@PostMapping("/test4")
|
||||
public Response<String> test4(@RequestParam("path") String path) {
|
||||
String s = MD5Utils.encryptFile(s3Util.download(path));
|
||||
log.info("s3Util.download 测试成功");
|
||||
return Response.success("图片MD5 :" + s);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test5")
|
||||
@PostMapping("/test5")
|
||||
public Response<String> test5(@RequestParam("path") String path) {
|
||||
String s = s3Util.getPreSignedUrl(path, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
log.info("s3Util.getPreSignedUrl 测试成功");
|
||||
return Response.success("S3 图片临时访问地址 :" + s);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test6")
|
||||
@PostMapping("/test6")
|
||||
public Response<Boolean> test6(@RequestParam("bucketName") String bucketName,@RequestParam("objectName") String objectName) {
|
||||
boolean b = s3Util.doesObjectExist(bucketName, objectName);
|
||||
log.info("s3Util.doesObjectExist 测试成功");
|
||||
return Response.success(b);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test7")
|
||||
@PostMapping("/test7")
|
||||
public Response<String> test7() {
|
||||
String bucketName = "aida-users";
|
||||
String path = "87/tmp";
|
||||
String base64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMMAAABPCAYAAABWDXEJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAbNSURBVHhe7ZrLTSRJFEVxARtwAR8wARvaBVZsWLBkBR60BW1BO4DEGg/woUYHRbRyUu/GLyOKoece6UmtojJ++U78q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Jy2BMwjIYk7AMxiQsgzEJy2BMwjIYk7AMxiQsgzEJy2BMwjIYk7AMxiQsgzEJy2DMJ6fTP087MrRzJGnPAAAAAElFTkSuQmCC";
|
||||
String s = s3Util.base64UploadToPath(base64, bucketName, path);
|
||||
log.info("s3Util.base64UploadToPath 测试成功");
|
||||
return Response.success(s);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test8")
|
||||
@PostMapping("/test8")
|
||||
public Response<String> test8(@RequestParam("path") String path) {
|
||||
s3Util.deleteObject(path);
|
||||
log.info("s3Util.deleteObject 测试成功");
|
||||
return Response.success(null);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user