代码是自己封装,可能会存在问题,有问题指正下,谢谢。
代码pom依赖
com.google.zxing core 3.1.0 ## 封装实体
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
public class QRCode {
//二维码尺寸
private Integer size;
//纠错等级
private ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.H;
//编码格式
private String charSet = "utf-8";
//二维码边框
private Integer margin = 0;
//是否插入logo
private Boolean isLogo = false;
//LOGO显示宽度
private Integer width;
//LOGO显示高度
private Integer height;
//Logo地址
private String logoPath;
//内容
private String content;
//二维码颜色
private Integer begColor = ColorConstant.WHITE;
//
private Integer afterColor = ColorConstant.BLACK;
private String formatName = "png";
public QRCode(Integer size){
this.size = size;
}
public QRCode(){
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
public ErrorCorrectionLevel getErrorCorrectionLevel() {
return errorCorrectionLevel;
}
public void setErrorCorrectionLevel(ErrorCorrectionLevel errorCorrectionLevel) {
this.errorCorrectionLevel = errorCorrectionLevel;
}
public String getCharSet() {
return charSet;
}
public void setCharSet(String charSet) {
this.charSet = charSet;
}
public Integer getMargin() {
return margin;
}
public void setMargin(Integer margin) {
this.margin = margin;
}
public Boolean getLogo() {
return isLogo;
}
public void setLogo(Boolean logo) {
isLogo = logo;
}
public Integer getWidth() {
return width;
}
public void setWidth(Integer width) {
this.width = width;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Integer getBegColor() {
return begColor;
}
public void setBegColor(Integer begColor) {
this.begColor = begColor;
}
public Integer getAfterColor() {
return afterColor;
}
public void setAfterColor(Integer afterColor