Commit 88bd2194 authored by neo's avatar neo

[dev] add output page

parent fc1f45ae
......@@ -47,8 +47,7 @@ public class InputInvoiceImportController {
@RequestMapping(value = "inputInvoicePreviewList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
PagingResultDto<InputInvoice> getInputInvoiceTreeViewData(@RequestBody InputInvoicePreviewQueryParam paras, @RequestHeader String from) {
logger.warn("get from {}", from);
PagingResultDto<InputInvoice> getInputInvoiceTreeViewData(@RequestBody InputInvoicePreviewQueryParam paras) {
return inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras);
}
......
package pwc.taxtech.atms.dto.vatdto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OutputInvoice {
private String id;
private String fpqqlsh;
private String fpdm;
private String fphm;
private String kprq;
private String fplxdm;
private String ewm;
private String jqbh;
private String jym;
private String gfmc;
private String gfsh;
private String gfdzdh;
private String gfyhzh;
private String xfsh;
private String xfmc;
private String xfdzdh;
private String xfyhzh;
private String bz;
private String skr;
private String fhr;
private String kpr;
private String kddh;
private String kduuid;
private String fplx;
private String kpzt;
private String fpzt;
private String yfpdm;
private String yfphm;
private String gfgsbm;
private String xfgsbm;
private String spbh;
private String xtly;
private String cjsj;
private String hjje;
private String hjse;
private String jshj;
private String xxbbh;
private String dyzt;
private String gdjlh;
private String zkje;
private String zkse;
private String zkjshj;
private String slv;
private String qy;
private String jszt;
private String kdgs;
private String shzt;
private String thkpsq;
private String jsfj;
private String sqr;
private String bscdm;
private String bsc;
private String qydm;
private String sqbh;
private String htbh;
private String sqrq;
private String yzrq;
}
package pwc.taxtech.atms.vat.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.SqlSessionTemplate;
......@@ -13,6 +20,8 @@ import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.dpo.PagingResultDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.ImportOutputInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.InputInvoice;
import pwc.taxtech.atms.dto.vatdto.OutputInvoice;
import pwc.taxtech.atms.dto.vatdto.QueryEvidenceDto;
import pwc.taxtech.atms.vat.dao.ImportFileMapper;
import pwc.taxtech.atms.vat.dpo.OutputVATInvoiceInfoDto;
......@@ -23,6 +32,7 @@ import pwc.taxtech.atms.vat.entity.OutputVatInvoiceExample;
import pwc.taxtech.atms.vat.entity.OutputVatInvoiceItem;
import pwc.taxtech.atms.vat.entity.OutputVatInvoiceItemExample;
import java.io.IOException;
import java.io.StringReader;
import java.math.BigDecimal;
import java.util.ArrayList;
......@@ -57,6 +67,22 @@ public class OutputInvoiceServiceImpl extends VatAbstractService {
return qResult;
}
private PagingResultDto<OutputInvoice> get(String code, int period, int page, int size) {
PagingResultDto<OutputInvoice> pageInput = null;
try (CloseableHttpClient httpclient = HttpClients.createDefault();) {
HttpGet httpget = new HttpGet("http://localhost:8089/output_invoices?page=" + page + "&size=" + size
+ "&code=" + code + "&period=" + period);
try (CloseableHttpResponse response = httpclient.execute(httpget)) {
String inputStr = EntityUtils.toString(response.getEntity());
pageInput = JSONObject.parseObject(inputStr, new TypeReference<PagingResultDto<OutputInvoice>>() {
}.getType());
}
} catch (IOException e) {
e.printStackTrace();
}
return pageInput;
}
public OperationResultDto<List<OutputVATInvoiceInfoDto>> getExportOutputInvoiceList(QueryOutputDto queryDto) {
OperationResultDto<List<OutputVATInvoiceInfoDto>> result = new OperationResultDto<>();
List<OutputVATInvoiceInfoDto> finalList = getQueryList(queryDto);
......
......@@ -6,6 +6,8 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.invoice.common.PagingDto;
import pwc.taxtech.invoice.common.PagingResultDto;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
......@@ -16,7 +18,12 @@ public class OutputInvoiceController {
OutputInvoiceRepository repository;
@RequestMapping(method = GET)
public Page<OutputInvoice> getAll(@RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "20") int size) {
return repository.findAll(PageRequest.of(page, size));
public PagingResultDto<OutputInvoice> getAll(@RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "20") int size) {
if (page < 0) page = 0;
Page<OutputInvoice> pageResult = repository.findAll(PageRequest.of(page - 1, size));
PagingResultDto<OutputInvoice> pageReturn = new PagingResultDto();
pageReturn.setList(pageResult.getContent());
pageReturn.setPageInfo(new PagingDto(pageResult.getTotalPages(), pageResult.getPageable().getPageNumber(), pageResult.getPageable().getPageSize()));
return pageReturn;
}
}
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