Commit 5c36f7f5 authored by neo's avatar neo

dev replate gson parase jsonstr

parent 7665e2f0
......@@ -337,6 +337,13 @@
<artifactId>spring-data-commons</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
<profiles>
......
package pwc.taxtech.atms.vat.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.google.gson.Gson;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
......@@ -51,8 +51,9 @@ public class InputInvoiceDataImportServiceImpl extends VatAbstractService {
HttpGet httpget = new HttpGet("http://localhost:8089/input_invoices?page=" + page + "&size=" + size
+ "&code=" + code + "&period=" + period);
try (CloseableHttpResponse response = httpclient.execute(httpget)) {
pageInput = JSONObject.parseObject(EntityUtils.toString(response.getEntity()), new TypeReference<Page<InputInvoice>>() {
});
String inputStr = EntityUtils.toString(response.getEntity());
pageInput = new Gson().fromJson(inputStr, new TypeReference<Page<InputInvoice>>() {
}.getType());
}
} catch (IOException e) {
e.printStackTrace();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment