zoukankan      html  css  js  c++  java
  • EBS QRCODE

    http://www.swetake.com/qrcode/java/qr_java.html

    clip_image001

     

    clip_image002

     

    qrcode_java0.50beta10.tar

     

     

    [root@ebs12vis ~]# su - applmgr

    [applmgr@ebs12vis ~]$ cd $JAVA_BASE

    [applmgr@ebs12vis java]$ pwd

    /d01/applmgr/VIS/apps/apps_st/comn/java

    [applmgr@ebs12vis java]$ ll

    total 24

    drwxr-xr-x  25 applmgr dba 12288 Jan 12 12:41 classes

    drwxr-xr-x   2 applmgr dba  4096 Jan 11 16:45 lib

    [applmgr@ebs12vis java]$ mkdir $JAVA_BASE/com

    [applmgr@ebs12vis java]$ chmod 777 $JAVA_BASE/com

    [applmgr@ebs12vis java]$ cd $JAVA_BASE/com

    [applmgr@ebs12vis com]$ pwd

    /d01/applmgr/VIS/apps/apps_st/comn/java/com

    clip_image003

     

    [applmgr@ebs12vis com]$ ll

    total 996

    -rw-r--r--  1 root root 1010702 Jun 12 15:23 qrcode_java0.50beta10.tar.gz

    [applmgr@ebs12vis com]$ tar -zxvf qrcode_java0.50beta10.tar.gz

    qrcode_java0.50beta10/

    qrcode_java0.50beta10/docs/

    qrcode_java0.50beta10/docs/constant-values.html

    qrcode_java0.50beta10/docs/overview-tree.html

    qrcode_java0.50beta10/docs/index-all.html

    qrcode_java0.50beta10/docs/deprecated-list.html

    qrcode_java0.50beta10/docs/allclasses-frame.html

    qrcode_java0.50beta10/docs/allclasses-noframe.html

    qrcode_java0.50beta10/docs/index.html

    qrcode_java0.50beta10/docs/packages.html

    qrcode_java0.50beta10/docs/com/

    qrcode_java0.50beta10/docs/com/swetake/

    qrcode_java0.50beta10/docs/com/swetake/util/

    qrcode_java0.50beta10/docs/com/swetake/util/package-frame.html

    qrcode_java0.50beta10/docs/com/swetake/util/package-summary.html

    qrcode_java0.50beta10/docs/com/swetake/util/package-tree.html

    qrcode_java0.50beta10/docs/com/swetake/util/Qrcode.html

    qrcode_java0.50beta10/docs/package-list

    qrcode_java0.50beta10/docs/help-doc.html

    qrcode_java0.50beta10/docs/stylesheet.css

    qrcode_java0.50beta10/lib/

    qrcode_java0.50beta10/lib/Qrcode.jar

    qrcode_java0.50beta10/README.txt

    qrcode_java0.50beta10/samples/

    qrcode_java0.50beta10/samples/QrAppletSample.java

    qrcode_java0.50beta10/samples/QrAppletSample.html

    qrcode_java0.50beta10/samples/sample.java

    qrcode_java0.50beta10/samples/QrAppletSample.jar

    qrcode_java0.50beta10/src/

    qrcode_java0.50beta10/src/com/

    qrcode_java0.50beta10/src/com/swetake/

    qrcode_java0.50beta10/src/com/swetake/util/

    qrcode_java0.50beta10/src/com/swetake/util/qrcode_data/

    qrcode_java0.50beta10/src/com/swetake/util/Qrcode.java

    [applmgr@ebs12vis com]$ cp $JAVA_BASE/com/qrcode_java0.50beta10/lib/Qrcode.jar $JAVA_BASE/com

     

    SELECT *

      FROM DBA_REGISTRY

     WHERE COMP_ID = 'JAVAVM';

    clip_image004

    If not exists execute $ORACLE_HOME/javavm/install/initjvm.sql

     

     

    [applmgr@ebs12vis com]$ loadjava -u apps/apps@VIS -r -v -f -genmissing -s -grant public $JAVA_BASE/com/Qrcode.jar

     

    SELECT *

    FROM DBA_OBJECTS X

    WHERE 1=1

    AND X.OBJECT_TYPE LIKE 'JAVA%'

    AND UPPER(X.OBJECT_NAME) LIKE '%QRCODE%';

    clip_image005

     

    /var/tmp/qrcode

     

     

     

    CREATE OR REPLACE AND COMPILE  JAVA SOURCE NAMED QRCodeEncoder

       AS import java.awt.image.BufferedImage; 

    import java.awt.Color; 

    import java.awt.Graphics2D; 

    import java.awt.image.BufferedImage; 

    import java.io.File; 

     

    import javax.imageio.ImageIO; 

     

    import com.swetake.util.Qrcode; 

     

    /**

     * 二维码生成器

     */ 

    public class QRCodeEncoder { 

     

        /**

         * 生成二维码(QRCode)图片

         * 

         * @param content

         * @param imgPath

         */ 

        public void encoderQRCode(String content, String imgPath) { 

            try { 

     

                Qrcode qrcodeHandler = new Qrcode(); 

                qrcodeHandler.setQrcodeErrorCorrect('M'); 

                qrcodeHandler.setQrcodeEncodeMode('B'); 

                qrcodeHandler.setQrcodeVersion(7); 

     

                System.out.println(content); 

                byte[] contentBytes = content.getBytes("gb2312"); 

     

                BufferedImage bufImg = new BufferedImage(140, 140, 

                        BufferedImage.TYPE_INT_RGB); 

     

                Graphics2D gs = bufImg.createGraphics(); 

     

                gs.setBackground(Color.WHITE); 

                gs.clearRect(0, 0, 140, 140); 

     

                // 设定图像颜色 > BLACK 

                gs.setColor(Color.BLACK); 

     

                // 设置偏移量 不设置可能导致解析出错 

                int pixoff = 2; 

                // 输出内容 > 二维码 

                if (contentBytes.length > 0 && contentBytes.length < 120) { 

                    boolean[][] codeOut = qrcodeHandler.calQrcode(contentBytes); 

                    for (int i = 0; i < codeOut.length; i++) { 

                        for (int j = 0; j < codeOut.length; j++) { 

                            if (codeOut[j][i]) { 

                                gs.fillRect(j * 3 + pixoff, i * 3 + pixoff, 3, 3); 

                            } 

                        } 

                    } 

                } else { 

                    System.err.println("QRCode content bytes length = " 

                            + contentBytes.length + " not in [ 0,120 ]. "); 

                } 

     

                gs.dispose(); 

                bufImg.flush(); 

     

                File imgFile = new File(imgPath); 

     

                // 生成二维码QRCode图片 

                ImageIO.write(bufImg, "png", imgFile); 

     

            } catch (Exception e) { 

                e.printStackTrace(); 

            } 

     

        } 

     

        /**

         * @param args

         *            the command line arguments

         */ 

        public static void main(String[] args) { 

            String imgPath = "/var/tmp/qrcode/QRCode.png"; 

     

            String content = "Oracle EBS Repository,你好,世界"; 

     

            QRCodeEncoder handler = new QRCodeEncoder(); 

            handler.encoderQRCode(content, imgPath); 

     

            System.out.println("encoder QRcode success"); 

        } 

     

    }

     

     

    CREATE OR REPLACE PROCEDURE cux_get_qrcode

    AS

    LANGUAGE JAVA

    NAME 'QRCodeEncoder.main(java.lang.String[])' ;

     

    set serveroutput on

    call dbms_java.set_output(5000);

    execute cux_get_qrcode;

    clip_image006

     

    clip_image007

     

    clip_image008

  • 相关阅读:
    Leetcode Best Time to Buy and Sell Stock II
    Leetcode Shortest Word Distance III
    Leetcode Shortest Word Distance II
    Leetcode Shortest Word Distance
    牛客多校第四场 J Free 最短路
    牛客多校第四场 A meeting 树的半径
    hdu多校第二场1008(hdu6598) Harmonious Army 最小割
    hdu多校第二场1011 (hdu6601) Keen On Everything But Triangle 主席树
    hdu多校第二场 1010 (hdu6600)Just Skip This Problem
    hdu多校第二场 1005 (hdu6595) Everything Is Generated In Equal Probability
  • 原文地址:https://www.cnblogs.com/quanweiru/p/9128175.html
Copyright © 2011-2022 走看看