mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
Merge pull request #1068 from walt1012/v5-dev
add(QrConfig): QRConfig中添加qrVersion属性
This commit is contained in:
commit
908bbbf8f1
@ -34,6 +34,8 @@ public class QrConfig {
|
|||||||
protected Integer backColor = WHITE;
|
protected Integer backColor = WHITE;
|
||||||
/** 边距1~4 */
|
/** 边距1~4 */
|
||||||
protected Integer margin = 2;
|
protected Integer margin = 2;
|
||||||
|
/** 设置二维码中的信息量,可设置0-40的整数,二维码图片也会根据qrVersion而变化,0表示根据传入信息自动变化 */
|
||||||
|
protected Integer qrVersion = 0;
|
||||||
/** 纠错级别 */
|
/** 纠错级别 */
|
||||||
protected ErrorCorrectionLevel errorCorrection = ErrorCorrectionLevel.M;
|
protected ErrorCorrectionLevel errorCorrection = ErrorCorrectionLevel.M;
|
||||||
/** 编码 */
|
/** 编码 */
|
||||||
@ -204,6 +206,26 @@ public class QrConfig {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置二维码中的信息量,可设置0-40的整数,二维码图片也会根据qrVersion而变化,0表示根据传入信息自动变化
|
||||||
|
*
|
||||||
|
* @return 二维码中的信息量
|
||||||
|
*/
|
||||||
|
public Integer getQrVersion() {
|
||||||
|
return qrVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置二维码中的信息量,可设置0-40的整数,二维码图片也会根据qrVersion而变化,0表示根据传入信息自动变化
|
||||||
|
*
|
||||||
|
* @param qrVersion 二维码中的信息量
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public QrConfig setQrVersion(Integer qrVersion) {
|
||||||
|
this.qrVersion = qrVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取纠错级别
|
* 获取纠错级别
|
||||||
*
|
*
|
||||||
@ -321,6 +343,9 @@ public class QrConfig {
|
|||||||
if (null != this.margin) {
|
if (null != this.margin) {
|
||||||
hints.put(EncodeHintType.MARGIN, this.margin);
|
hints.put(EncodeHintType.MARGIN, this.margin);
|
||||||
}
|
}
|
||||||
|
if (null != this.qrVersion){
|
||||||
|
hints.put(EncodeHintType.QR_VERSION, this.qrVersion);
|
||||||
|
}
|
||||||
return hints;
|
return hints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user