|
|
@ -1,5 +1,6 @@ |
|
|
package cn.chjyj.szwh.utils; |
|
|
package cn.chjyj.szwh.utils; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.logging.Log; |
|
|
import org.apache.commons.logging.Log; |
|
|
@ -17,6 +18,7 @@ import java.io.IOException; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
import java.net.HttpURLConnection; |
|
|
import java.net.HttpURLConnection; |
|
|
import java.net.URL; |
|
|
import java.net.URL; |
|
|
|
|
|
import java.util.Calendar; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -47,13 +49,14 @@ public class RequestUtils { |
|
|
httpcon.connect(); |
|
|
httpcon.connect(); |
|
|
//获取返回的字符
|
|
|
//获取返回的字符
|
|
|
InputStream inputStream = httpcon.getInputStream(); |
|
|
InputStream inputStream = httpcon.getInputStream(); |
|
|
int size = inputStream.available(); |
|
|
//请求结果写入
|
|
|
byte[] bs = new byte[size]; |
|
|
String filename =String.valueOf(Calendar.getInstance().getTimeInMillis()); |
|
|
inputStream.read(bs); |
|
|
SzFileUtils.createFile(inputStream,filename); |
|
|
//字节转为utf-8
|
|
|
//字节转为utf-8
|
|
|
String message = new String(bs, "UTF-8"); |
|
|
String message=SzFileUtils.readJson(filename); |
|
|
System.out.println("url ret string :"+message); |
|
|
if(message!=null){ |
|
|
jsonObject = JSONObject.parseObject(message); |
|
|
jsonObject = JSONObject.parseObject(message); |
|
|
|
|
|
} |
|
|
logger.info("respone message :"+message); |
|
|
logger.info("respone message :"+message); |
|
|
}catch (IOException ex){ |
|
|
}catch (IOException ex){ |
|
|
// 罗列出明细错误
|
|
|
// 罗列出明细错误
|
|
|
|