Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
dcf2bcb3
Commit
dcf2bcb3
authored
Dec 09, 2018
by
songxiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://192.168.89.173/rays/pcloud-common-parent.git
parents
7bf01732
90a817e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
QrcodeUtils.java
...on/src/main/java/com/pcloud/common/utils/QrcodeUtils.java
+27
-0
No files found.
pcloud-common/src/main/java/com/pcloud/common/utils/QrcodeUtils.java
View file @
dcf2bcb3
...
@@ -215,6 +215,33 @@ public class QrcodeUtils {
...
@@ -215,6 +215,33 @@ public class QrcodeUtils {
}
}
/**
/**
* 创建二维码
*
* @param url
* 二维码响应地址
* @return
* @throws Exception
*/
public
static
String
createWithMargin
(
String
url
,
Integer
marginNum
)
throws
BizException
{
LOGGER
.
info
(
"【二维码】创建二维码,<START>.[url]="
+
url
);
Map
<
EncodeHintType
,
Object
>
hints
=
new
HashMap
<
EncodeHintType
,
Object
>();
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
"UTF-8"
);
hints
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
level
);
hints
.
put
(
EncodeHintType
.
MARGIN
,
marginNum
);
// 设置白边
try
{
// 生成矩阵
BitMatrix
bitMatrix
=
new
MultiFormatWriter
().
encode
(
url
,
BarcodeFormat
.
QR_CODE
,
ImageConstant
.
QRCODE_WITH
,
ImageConstant
.
QRCODE_HEIGHT
,
hints
);
BufferedImage
bufferedImage
=
toBufferedImage
(
bitMatrix
,
onColor
);
bufferedImage
.
flush
();
return
uploadImage
(
bufferedImage
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【二维码】创建二维码失败,<ERROR>:"
+
e
.
getMessage
(),
e
);
throw
new
FileException
(
FileException
.
FILE_UPLOAD_FAILURE
,
"创建二维码失败"
);
}
}
/**
* 创建带颜色的二维码
* 创建带颜色的二维码
* @param url
* @param url
* @param onColor
* @param onColor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment