Procházet zdrojové kódy

2021-11-23 15:30 班管家

sjw před 4 roky
rodič
revize
fff782ab46

binární
src.zip


+ 2 - 2
src/apps/tbankpaybillsboc/bocbank/service/QueryBocInfoToHy.java

@@ -96,8 +96,8 @@ public class QueryBocInfoToHy {
                 "<to>" + today + "</to>" +
                 "</datescope>" +
                 "<amountscope>" +
-                "<from>1</from>" +
-                "<to>10000</to>" +
+                "<from></from>" +
+                "<to></to>" +
                 "</amountscope>" +
                 "<begnum>" + begnum + "</begnum>" +
                 "<recnum>10</recnum>" +

+ 2 - 2
src/apps/tbankpaybillsboc/bocbank/service/QueryBocInfoToTz.java

@@ -97,8 +97,8 @@ public class QueryBocInfoToTz {
                 "<to>20201027</to>" +
                 "</datescope>" +
                 "<amountscope>" +
-                "<from>1</from>" +
-                "<to>10000</to>" +
+                "<from></from>" +
+                "<to></to>" +
                 "</amountscope>" +
                 "<begnum>1</begnum>" +
                 "<recnum>10</recnum>" +

+ 56 - 0
src/rest/openapi/base/restful/WebClientRest.java

@@ -19,6 +19,8 @@ import p2.p2server.P2Server;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import p2.util.P2Exception;
+import sun.misc.BASE64Decoder;
+import sun.misc.BASE64Encoder;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
@@ -29,6 +31,8 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.math.BigInteger;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.net.URLEncoder;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -1043,4 +1047,56 @@ public class WebClientRest {
 
     }
 
+
+
+    @Path("imagetobase64")
+    @GET
+    public void imagetobase64(@QueryParam("url") String imageurl,@QueryParam("filename") String filename,@Context HttpServletResponse response) throws IOException {
+        // 创建URL
+//        response.setContentType("image/jpeg");
+        final ByteArrayOutputStream data = new ByteArrayOutputStream();
+        String strNetImageToBase64;
+        URL url = new URL(imageurl);
+        final byte[] by = new byte[1024];
+        // 创建链接
+        final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+        conn.setRequestMethod("GET");
+        conn.setConnectTimeout(5000);
+
+        InputStream is = conn.getInputStream();
+        // 将内容读取内存中
+        int len = -1;
+        while ((len = is.read(by)) != -1) {
+            data.write(by, 0, len);
+        }
+        // 对字节数组Base64编码
+        BASE64Encoder encoder = new BASE64Encoder();
+        strNetImageToBase64 = encoder.encode(data.toByteArray());
+        // 关闭流
+        is.close();
+
+        BASE64Decoder decoder = new BASE64Decoder();
+        // Base64解码
+        byte[] b = decoder.decodeBuffer(strNetImageToBase64);
+        for (int i = 0; i < b.length; ++i) {
+            if (b[i] < 0) {// 调整异常数据
+                b[i] += 256;
+            }
+        }
+
+
+
+        ServletOutputStream out;
+        try {
+            //3.通过response获取ServletOutputStream对象(out)
+            out = response.getOutputStream();
+            out.write(b);
+            out.close();
+            out.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
 }