| 
					
				 | 
			
			
				@@ -10,21 +10,20 @@ import org.apache.shiro.SecurityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.entity.SysUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.imageio.ImageIO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.print.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.print.attribute.HashPrintRequestAttributeSet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.print.attribute.PrintRequestAttributeSet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.awt.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.awt.image.BufferedImage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.io.File; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.io.UnsupportedEncodingException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigInteger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.net.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.nio.file.FileSystems; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.nio.file.Path; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.sql.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.regex.Matcher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.regex.Pattern; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -646,23 +645,24 @@ public class oConvertUtils { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /*** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * 字段信息生成二维码图片 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 字段信息生成二维码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param text 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param width 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param height 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param filePath 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @throws WriterException 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @throws IOException 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public static void generateQRCodeImage(String text, int width, int height, String filePath) throws WriterException, IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static BufferedImage getBufferedImage(String text, int width, int height) throws WriterException, IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QRCodeWriter qrCodeWriter = new QRCodeWriter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         HashMap<EncodeHintType, Object> hints = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height,hints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BufferedImage bufferedImage=MatrixToImageWriter.toBufferedImage(bitMatrix); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return bufferedImage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Path path = FileSystems.getDefault().getPath(filePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //生成文件至指定位置 filePath生成文件位置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        Path path = FileSystems.getDefault().getPath(filePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -701,4 +701,33 @@ public class oConvertUtils { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ImageIO.write(bufferedImage, "PNG", outputfile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return bufferedImage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /*** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 打印 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param filePath 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param printName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static void print(List<String> filePath,String printName) throws FileNotFoundException, PrintException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PrintService myPrintService=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (PrintService printService : printServices) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (printService.getName().trim().equals(printName)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                myPrintService=myPrintService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        myPrintService=printServices[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 设置打印格式,如果未确定类型,可选择autosense 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DocFlavor flavor = DocFlavor.INPUT_STREAM.PNG; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 设置打印参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int i=0;i<filePath.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            File file=new File(filePath.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            FileInputStream fis = new FileInputStream(file); // 构造待打印的文件流 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Doc doc = new SimpleDoc(fis, flavor, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DocPrintJob job = myPrintService.createPrintJob(); // 创建打印作业 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            job.print(doc, aset); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |