|
@@ -52,13 +52,13 @@ public class QRCodeController {
|
|
}
|
|
}
|
|
|
|
|
|
private String replaceChar(String str){
|
|
private String replaceChar(String str){
|
|
- String res = "";
|
|
|
|
- if(StringUtils.isBlank(str)){
|
|
|
|
- return res;
|
|
|
|
|
|
+ String res = str;
|
|
|
|
+ if(StringUtils.isBlank(res)){
|
|
|
|
+ return "";
|
|
}
|
|
}
|
|
for (String specialChar : SPECIAL_CHARS) {
|
|
for (String specialChar : SPECIAL_CHARS) {
|
|
- if(str.contains(specialChar)){
|
|
|
|
- res = str.replace(specialChar,"-");
|
|
|
|
|
|
+ if(res.contains(specialChar)){
|
|
|
|
+ res = res.replace(specialChar,"-");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return res;
|
|
return res;
|
|
@@ -89,8 +89,12 @@ public class QRCodeController {
|
|
String footerLine2 = String.format("行号: %s",null == erpOrderInfo.getLine()?"":erpOrderInfo.getLine());
|
|
String footerLine2 = String.format("行号: %s",null == erpOrderInfo.getLine()?"":erpOrderInfo.getLine());
|
|
|
|
|
|
// String s = null != erpOrderInfo.getMoDId() ? erpOrderInfo.getMoDId() : "";
|
|
// String s = null != erpOrderInfo.getMoDId() ? erpOrderInfo.getMoDId() : "";
|
|
|
|
+
|
|
String fileName = erpOrderInfo.getProjectName()+erpOrderInfo.getOrderId()+erpOrderInfo.getLine()+".png";
|
|
String fileName = erpOrderInfo.getProjectName()+erpOrderInfo.getOrderId()+erpOrderInfo.getLine()+".png";
|
|
fileName = replaceChar(fileName);
|
|
fileName = replaceChar(fileName);
|
|
|
|
+ if(StringUtils.isBlank(fileName)){
|
|
|
|
+ System.out.println("here=== "+fileName);
|
|
|
|
+ }
|
|
|
|
|
|
try {
|
|
try {
|
|
BufferedImage qrImage = QRCodeUtil.generateQRCodeImage(data, width, height);
|
|
BufferedImage qrImage = QRCodeUtil.generateQRCodeImage(data, width, height);
|
|
@@ -105,7 +109,6 @@ public class QRCodeController {
|
|
|
|
|
|
// 保存最终图片
|
|
// 保存最终图片
|
|
File outputFile = new File(uploadPath+fileName);
|
|
File outputFile = new File(uploadPath+fileName);
|
|
- System.out.println("fileName=== "+fileName);
|
|
|
|
ImageIO.write(combinedImage, "png", outputFile);
|
|
ImageIO.write(combinedImage, "png", outputFile);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|