EBS QRCODE
Posted quanweiru
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EBS QRCODE相关的知识,希望对你有一定的参考价值。
http://www.swetake.com/qrcode/java/qr_java.html
qrcode_java0.50beta10.tar
[[email protected] ~]# su - applmgr
[[email protected] ~]$ cd $JAVA_BASE
[[email protected] java]$ pwd
/d01/applmgr/VIS/apps/apps_st/comn/java
[[email protected] 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
[[email protected] java]$ mkdir $JAVA_BASE/com
[[email protected] java]$ chmod 777 $JAVA_BASE/com
[[email protected] java]$ cd $JAVA_BASE/com
[[email protected] com]$ pwd
/d01/applmgr/VIS/apps/apps_st/comn/java/com
[[email protected] com]$ ll
total 996
-rw-r--r-- 1 root root 1010702 Jun 12 15:23 qrcode_java0.50beta10.tar.gz
[[email protected] 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
[[email protected] com]$ cp $JAVA_BASE/com/qrcode_java0.50beta10/lib/Qrcode.jar $JAVA_BASE/com
SELECT *
FROM DBA_REGISTRY
WHERE COMP_ID = ‘JAVAVM‘;
If not exists execute $ORACLE_HOME/javavm/install/initjvm.sql
[[email protected] com]$ loadjava -u apps/[email protected] -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%‘;
/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;
以上是关于EBS QRCODE的主要内容,如果未能解决你的问题,请参考以下文章