jyy
2021-03-11 403acdaee34690cf0798ea83e8db33079d8a3720
zq-erp/src/main/java/com/matrix/component/tools/WxacodeUtil.java
@@ -61,12 +61,6 @@
            HttpResponse response;
            response = httpClient.execute(httpPost);
            InputStream inputStream = response.getEntity().getContent();
            /*Object inputObj= response.getEntity().getContent();
            if(inputObj instanceof InputStream){
                String strError = streamToString(inputStream,"GBK");
                LogUtil.info("-------------二维码生成------"+strError);
                return "error:" + strError;
            }*/
            // 图片保存目录路径
          String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH);
@@ -74,11 +68,6 @@
            if(!targetFile.exists()){
                targetFile.mkdirs();
            }
            /*String inputstreamtofile = inputstreamtofile(inputStream, targetFile);
            if(null != inputstreamtofile){
                return inputstreamtofile;
            }*/
            // 创建图片文件夹
            baseSavePath += "wxacode" + File.separatorChar;
@@ -89,23 +78,15 @@
            String qrcodePath = baseSavePath + fileName + ".png";
            FileOutputStream out = new FileOutputStream(qrcodePath);
            LogUtil.debug("qrcodePath:{}",qrcodePath);
            //本地调试创建(不用删)
            /*String filePath = "e:/test.png";
            File file = new File(filePath);
            if (!file.exists()) {
                file.mkdir();
            }
            FileOutputStream outs = new FileOutputStream(file);*/
            byte[] buffer = new byte[1024];
            int bytesRead = 0;
            while((bytesRead = inputStream.read(buffer, 0, 1024)) != -1) {
                out.write(buffer, 0, bytesRead);
                //outs.write(buffer, 0, bytesRead);
            }
            out.flush();
            out.close();
            //outs.flush();
            //outs.close();
            return qrcodePath;
        } else {