Commit 5240c0d7 authored by neo's avatar neo

[dev] fix input page result return direct

parent cc73d672
......@@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.vatdto.ImportInputInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.ImportInputInvoiceItemDto;
......@@ -43,8 +42,7 @@ public class InputInvoiceImportController {
private IdentityService identityService;
@RequestMapping(value = "inputInvoicePreviewList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
Page<InputInvoice> getInputInvoiceTreeViewData(@RequestBody InputInvoicePreviewQueryParam paras) {
public String getInputInvoiceTreeViewData(@RequestBody InputInvoicePreviewQueryParam paras) {
return inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras);
}
......@@ -81,7 +79,8 @@ public class InputInvoiceImportController {
}
private int getDownloadFilePath(InputInvoicePreviewQueryParam paras, OutputStream outputStream) {
List<InputInvoice> list = inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras).get().collect(Collectors.toList());
// List<InputInvoice> list = inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras);
List<InputInvoice> list = new ArrayList<>();
if (list.size() == 0) {
return 0;
}
......
package pwc.taxtech.atms.vat.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
......@@ -11,13 +9,11 @@ import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.constant.enums.EnumValidationType;
import pwc.taxtech.atms.dto.FieldsMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.InputInvoice;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto;
import pwc.taxtech.atms.vat.dpo.InputInvoicePreviewQueryParam;
import pwc.taxtech.atms.vat.entity.InputVatInvoice;
......@@ -41,22 +37,21 @@ public class InputInvoiceDataImportServiceImpl extends VatAbstractService {
@Autowired
private SqlSessionTemplate dynamicSqlSessionTemplate;
public Page<InputInvoice> getInputInvoiceTreeViewData(InputInvoicePreviewQueryParam paras) {
public String getInputInvoiceTreeViewData(InputInvoicePreviewQueryParam paras) {
return get(paras.getInvoiceCode(), paras.getPeriodStart(), paras.getPageInfo().getPageIndex(), paras.getPageInfo().getPageSize());
}
private Page<InputInvoice> get(String code, int period, int page, int size) {
private String get(String code, int period, int page, int size) {
try (CloseableHttpClient httpclient = HttpClients.createDefault();) {
HttpGet httpget = new HttpGet("http://localhost:8089/input_invoices?page=" + page + "&size=" + size
+ "&code=" + code + "&period=" + period);
try (CloseableHttpResponse response = httpclient.execute(httpget)) {
return JSONObject.parseObject(EntityUtils.toString(response.getEntity()), new TypeReference<Page<InputInvoice>>() {
});
return EntityUtils.toString(response.getEntity());
}
} catch (IOException e) {
e.printStackTrace();
}
return Page.empty();
return "";
}
......
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