Commit 7ec11571 authored by neo's avatar neo

[DEV] outputInvoiceImport getEvidenceList impl

parent 6a18d012
......@@ -3,12 +3,14 @@ package pwc.taxtech.atms.controller;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RestController;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryEvidenceDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.service.OutputInvoiceService;
......@@ -38,17 +40,15 @@ public class OutputInvoiceController {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.setHeader("x-file-name",UUID.randomUUID() + ".xlsx");
response.setHeader("x-file-name", UUID.randomUUID() + ".xlsx");
OutputStream os = null;
try {
os = response.getOutputStream();
int count = getDownloadFilePath(paras, os);
if(count==0){
if (count == 0) {
response.setStatus(HttpStatus.SC_NO_CONTENT);
}
else
{
} else {
response.setStatus(HttpStatus.SC_OK);
}
} catch (IOException e) {
......@@ -56,6 +56,11 @@ public class OutputInvoiceController {
}
}
@RequestMapping(value = "getEvidenceList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity getEvidenceList(@RequestBody QueryEvidenceDto queryDto) {
return ResponseEntity.ok().body(outputInvoiceService.getEvidenceList(queryDto));
}
private int getDownloadFilePath(QueryOutputDto paras, OutputStream outputStream) {
List<OutputVATInvoiceInfoDto> list = outputInvoiceService.getExportOutputInvoiceList(paras).getData();
if (list.size() == 0) {
......
package pwc.taxtech.atms.dto.vatdto;
public class QueryEvidenceDto {
private Integer queryType;
private String queryString;
private Boolean isCurrentPeriod;
private Integer periodId;
public Integer getQueryType() {
return queryType;
}
public void setQueryType(Integer queryType) {
this.queryType = queryType;
}
public String getQueryString() {
return queryString;
}
public void setQueryString(String queryString) {
this.queryString = queryString;
}
public Boolean getCurrentPeriod() {
return isCurrentPeriod;
}
public void setCurrentPeriod(Boolean currentPeriod) {
isCurrentPeriod = currentPeriod;
}
public Integer getPeriodId() {
return periodId;
}
public void setPeriodId(Integer periodId) {
this.periodId = periodId;
}
}
......@@ -3,7 +3,9 @@ package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryEvidenceDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.vat.entity.ImportFile;
import java.util.List;
......@@ -11,4 +13,6 @@ public interface OutputInvoiceService {
PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(QueryOutputDto queryDto);
OperationResultDto<List<OutputVATInvoiceInfoDto>> getExportOutputInvoiceList(QueryOutputDto queryDto);
List<ImportFile> getEvidenceList(QueryEvidenceDto queryDto);
}
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.VatErpImportValidation;
import pwc.taxtech.atms.constant.enums.ErpCheckType;
import pwc.taxtech.atms.constant.enums.ImageType;
......@@ -40,6 +41,7 @@ import static pwc.taxtech.atms.constant.VATCommon.ValidationExisted;
import static pwc.taxtech.atms.constant.enums.EnumValidationType.ErpBasicCheck;
import static pwc.taxtech.atms.constant.enums.ImageType.Alert;
@Service
public class FinanceDataImportServiceImpl implements FinanceDataImportService {
@Autowired
private ValidationInfoMapper validationInfoMapper;
......
package pwc.taxtech.atms.vat.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.reflections.util.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.PagingList;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryEvidenceDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.vat.dao.ImportFileMapper;
import pwc.taxtech.atms.vat.entity.ImportFile;
import pwc.taxtech.atms.vat.entity.ImportFileExample;
import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItem;
import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItemExample;
import pwc.taxtech.atms.vat.service.OutputInvoiceService;
......@@ -23,6 +29,9 @@ import java.util.stream.Stream;
@Service
public class OutputInvoiceServiceImpl extends VatAbstractService implements OutputInvoiceService {
@Autowired
private ImportFileMapper importFileMapper;
@Override
public PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(QueryOutputDto queryDto) {
PagingResultDto<OutputVATInvoiceInfoDto> qResult = new PagingResultDto<>();
......@@ -48,6 +57,26 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp
return result;
}
@Override
public List<ImportFile> getEvidenceList(QueryEvidenceDto queryDto) {
ImportFileExample example = new ImportFileExample();
if (queryDto.getCurrentPeriod()) {
if (Utils.isEmpty(queryDto.getQueryString())) {
example.createCriteria().andFileImportTypeEqualTo(2).andPeriodIDEqualTo(queryDto.getPeriodId().intValue());
} else {
example.createCriteria().andFileImportTypeEqualTo(2).andPeriodIDEqualTo(queryDto.getPeriodId().intValue()).andFileNameLike(queryDto.getQueryString());
}
} else {
if (Utils.isEmpty(queryDto.getQueryString())) {
example.createCriteria().andFileImportTypeEqualTo(2);
} else {
example.createCriteria().andFileImportTypeEqualTo(2).andFileNameLike(queryDto.getQueryString());
}
}
return importFileMapper.selectByExample(example);
}
private List<OutputVATInvoiceInfoDto> getOutputDetailInfoList(List<OutputVATInvoiceInfoDto> query) {
List<OutputVATInvoiceInfoDto> list = new ArrayList<>();
List<OutputVATInvoiceItem> outItem = outputVATInvoiceItemMapper.selectByExample(new OutputVATInvoiceItemExample());
......
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