Commit 7665e2f0 authored by neo's avatar neo

[dev] fix queyr for input page

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