ecology_maven/customization/test/UploadTest.java

50 lines
119 KiB
Java
Raw Normal View History

2021-11-14 15:29:16 +08:00
package customization.test;
import org.apache.axiom.util.base64.Base64Utils;
import org.junit.Test;
import weaver.file.ImageFileManager;
import weaver.soa.workflow.FileProcessor;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.util.UUID;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/2 0002 11:11
* shangchuan ceshi
*/
public class UploadTest extends BaseTest {
@Test
public void testBaseUpload() throws IOException {
2021-11-25 21:46:05 +08:00
// String base = "/9j/4AAQSkZJRgABAQEAeAB4AAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCANBBMkDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD1Skpe1JTEBoo7UdqACkxS0UAJig0tFMBMUYpaKQCUYpaSmAmKWiigBMCjFL3ooATHFFLSUAJRS4ooATn1opaKAG0tFLQAnPrSc+tL2ooAOaTmlooATmjmlooAbzR3p2KSgBOaKWigBOaOfWlpKBBSUtLQA2jFLRQAmKXFFLQAmKTtS0UAFFLRQAlLSUtABRS0UAFFFFABRRS0AJS0UUAFJS0lABS0naigBaKKKACkpaSgAoopaACiiigAo60UUAFFFFABS0lKKACiiigAooooASiiloASilooAQ0dqKO1ABRRRQAlFLRQAneilooASjvS0lAC0UlFAC0UUUAJ2o7UUUAFFFFABRRQaACiikoAKKKKACkpfrRQAUUUUAJiilooATtRS0lABRRTWzgAUAOooooAKSlooASkpaSgAopaSgAoooNABSUtFACUUUUAFFLRigBKKKWgYlFLiigBKKXFFIBKTFOpKBCUUuKKACiiigYYopaKAEo7UtJSAWiiigYVDcDKLU1R3H3F+tYVdi4lXGetJgelO4pM+1cLNjWopaTFescgUUUUxhSUtFABSUtFACUUtJQAUUUUAJRS0YoEJRRRQMKKKKAE7UUtJQAUUUUCEopaSgYUUUUCCiiigYUlLRQAUlLRQAlFFJQIKKWigAoo7UUAJRS0UAJRS9qKAEopaKADtS0lLQAlFLRimMKKKKQgoopaACijpRQAlFLSUALSUUtAB2ooooAKKKKACiiigBKKWigAooooAKKKWgBKWiigAooooAKKKKACikpaACiiigAooooAKMUUUAFFFFACd6O9LRQAlJS0UAFFFFABRR2ooAKKKKAEo7UtFABSUUUDCiikAxQIWkpaKACkpaKAE70UUUAFFLRQAlLSUUAFFFFAB2pKKKACiiigApKKWgBKKWkoAKKSigAooooAKO9FFABiiiigAooopAFFFLQAUlLRQAlFFGKYBRR2opAFFFFABRS0UDEo98UtFACUUtFIBKWjvRQAVDcnEYOO9T1Bdf6kfWsamxpAqCQE07cvtUe1c5xRtHpXCbo26KDRXrHIFJS0UAJRRRQAUUUUAFFGKKACkpcUUAJiilpKACiijFACUUuKKAEopaSgBKSnUlAhKWkooAKKKKACiiigYUUUlAC0lLRQAlFFFAgooooAKKWkoAO1FFFABRRS0AJR3paKACiiigApaSlpgFFFFABRS0UgEooooASloo7UAJS0UUAFFFFABR2oooAKPwoooAKKKWgAoooNABRRRQAd6O9FLQAlFLSUAFFFFABR2ooFABRRxRQAUUdqO1AB3ooooAKKSloASiiigAopaKACkoooAO9HejvRQAUUUUAFFHakoAKKWkoAWkoooAKKKKADtRRR3oAKKKKACiiigApKKKAEpaSloASiiigAooooAKKKKACik7UUABpKKKACiiigApaKKAEpe9FFAB2ooopAFApaSmAUUd6KACiiikAlFFFMAooopAFLRRQMKKKKACiiigApRSUo6UgCorjmD6GpelR3AzA1ZVNi4lHjtRS0mD6V573OhGzRRRXrnIHaiikoAKKKKACiig0AFLTefSgZ9KAHUlHtSZoAWim55xS0ALRTd1GeKAHUU3dRmgBaKTNGaADFFGaKAE70UGigQUUUUDEpaMUUAFJS0lABRRRQAd6MUUUAFFFFACUtFFACUUtFAhKKWigAoo7UUAFFFFAxe9FHSigQtFJS0AFFFFABRRSUALRRR7UAFFFFABRRRQAUUUUAFFFFABSUtHSgAo70UUAFFL3oxQAlLRiigAoxS0UAJiilooASkxTqKAG0UvajFACUUYoxQAUUUUAFFFFABRRRQAd6KO9FABRRRQAUUUUAFFFFACUUe1FABSUtFACUtFFACUUtFACUd6KKAA0Ue9FABRSGloASjvRRmgApKWkoAO9FFGeKACiiigBaSiigApKM0UAFFFFACUGlpM0ALS0lHpQAUUd6WgAopKWgApB0paKAE70UYooAKKKKQBSUvSkoAO1FFFMAoo70Uhi9aKKKACikpaADvS0lFIBaZMMwsPan0yX/AFLn2rOexcdyjjml2+9GRijeK857nQjXooor1zkCkpaSgApaKKAEprHCu3opP6U+o5jiCYntEx/SgDh9Ml1y80galceJIrOJ5mjUSxjHB9auxprtyzCy8V2E7KpbYsYJ4rFl0m91v4Y2UNhbNcSi+eRkX0yaPBfhvU9I166ubzTpLaH7K43N0BxQB0vhTWbjUNBkvNWniV0naPzPuggVWfxVNqGbbTraS0uc5WW8TEZUdea5O6fy/hXGwBcnVMgDv8x4ro/EN+PEPhMQQ2s0N35sYa1cYkC9yB6UAWbfxaNc82w0LZ/a0YyRMP3Zx1wapaRq3jfVrV547SwRUkMeJMgkjrWjpXhK30bxGmpWIEVubby2izltx6mrepanczXB0rRVT7Yy7vtDrmFR3GR3oAqDXNVjDadcQ2g1wrviiV/kZO5z61S0nxF4p1mB5rXSrNo43MbEyYyw64rn9M8ITR+Lzb6vctcK0TStPbSE/wDAc/0rd0jxP4Z0G1ks7ZNTWLzWYl7djg9+aANE+IdUTfZS6Yg1gfMkCtlWTuc1f07xHpWqXS2ltdA3WCXiwflI6iue0jWbHSg1/BK1xoU0hRrucHzo5D/D67a2NH0htE1VhaQRS6fcK032lgPMVjzj6UAZun+LdZ1cSyaf4eM8Echj3+aByKuf254hXO/wrMMdxIK5C2urq1+GN9LaTyQynUTh4+uM8074f6tqt34nMNzqF1LAbd22SscZAoA73w9rS6/pbXq27QbZWjZGOeRWr2rlfh8c+GZT63kv866rtQAUUfSigBKKWigQlFFFAwooooAKSlooASiiloASiiigQUdqWkoAO1HalooASiiigApaSloAKMUtFAxKKWigAoopaBCUUUd6YCUUtJSAWjFFGaACjtRRQAUCijNABRRmkzQAuKKAaCaACjvRmigBaMUA0tABiim5pN3egB/am5pM54pHZIl3Suka+rtigB26jdWPeeKvD9hkXGrW4Yfwo24/pWPP8TPDEOQs1xMf9iM80Adfuo3Vwcnxa0BOlpfN/wAApo+LOit/y4Xn5CgDvt1Ga4ZPit4fYgSW96nv5ea0bb4h+FrjH/EwMJPaRCKAOpzS5qjaarpt+u601C2mH+zIM1c5AzjigB9FR7jjNOBoAdikpCfeg5HWgANA
//// FileProcessor fileProcessor = new FileProcessor();
//// fileProcessor.Process(base,)
// ImageFileManager fileManager = new ImageFileManager();
// byte[] data = null;
// data = Base64Utils.decode(base);
// fileManager.setData(data);
// String fileName = "" + System.currentTimeMillis() + UUID.randomUUID() + ".jpg";
// fileManager.setImagFileName(fileName);
// int imageFileId = fileManager.saveImageFile();
// InputStream inputStreamById = ImageFileManager.getInputStreamById(imageFileId);
// Image image1 = ImageIO.read(inputStreamById);
// int width1 = image1.getWidth(null);
// int height1 = image1.getHeight(null);
// BufferedImage bufferedImage1 = new BufferedImage(width1, height1, BufferedImage.TYPE_INT_RGB);
// Graphics graphics1 = bufferedImage1.createGraphics();
// graphics1.drawImage(image1, 0, 0, width1, height1, null);
// graphics1.dispose();
// FileOutputStream fileOutputStream = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Desktop\\"+ fileName, "utf-8"));
// ImageIO.write(bufferedImage1, "jpg", fileOutputStream);
// fileOutputStream.close();
2021-11-14 15:29:16 +08:00
}
}