Commit d9a990d2 authored by neo's avatar neo

[DEV] output vat invoice getlist impl

parent 2ec9521c
...@@ -10,3 +10,4 @@ rebel.xml ...@@ -10,3 +10,4 @@ rebel.xml
/atms-web/src/main/webapp/node_modules /atms-web/src/main/webapp/node_modules
**/*.iml **/*.iml
**/.idea/ **/.idea/
atms-api/~
...@@ -4,6 +4,7 @@ import org.apache.http.HttpStatus; ...@@ -4,6 +4,7 @@ import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
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;
...@@ -13,7 +14,7 @@ import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto; ...@@ -13,7 +14,7 @@ import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryEvidenceDto; import pwc.taxtech.atms.dto.vatdto.QueryEvidenceDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto; import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.thirdparty.ExcelUtil; import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.service.OutputInvoiceService; import pwc.taxtech.atms.vat.service.impl.OutputInvoiceServiceImpl;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
...@@ -28,7 +29,7 @@ import java.util.UUID; ...@@ -28,7 +29,7 @@ import java.util.UUID;
public class OutputInvoiceController { public class OutputInvoiceController {
@Autowired @Autowired
OutputInvoiceService outputInvoiceService; OutputInvoiceServiceImpl outputInvoiceService;
@RequestMapping(value = "queryOutputInvoiceList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "queryOutputInvoiceList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(@RequestBody QueryOutputDto queryDto) { public PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(@RequestBody QueryOutputDto queryDto) {
...@@ -61,6 +62,11 @@ public class OutputInvoiceController { ...@@ -61,6 +62,11 @@ public class OutputInvoiceController {
return ResponseEntity.ok().body(outputInvoiceService.getEvidenceList(queryDto)); return ResponseEntity.ok().body(outputInvoiceService.getEvidenceList(queryDto));
} }
@RequestMapping(value = "getOutputInvoiceList/{period:int}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity getEvidenceList(@PathVariable Integer period) {
return ResponseEntity.ok().body(outputInvoiceService.getOutputInvoiceList(period));
}
private int getDownloadFilePath(QueryOutputDto paras, OutputStream outputStream) { private int getDownloadFilePath(QueryOutputDto paras, OutputStream outputStream) {
List<OutputVATInvoiceInfoDto> list = outputInvoiceService.getExportOutputInvoiceList(paras).getData(); List<OutputVATInvoiceInfoDto> list = outputInvoiceService.getExportOutputInvoiceList(paras).getData();
if (list.size() == 0) { if (list.size() == 0) {
...@@ -89,4 +95,6 @@ public class OutputInvoiceController { ...@@ -89,4 +95,6 @@ public class OutputInvoiceController {
ExcelUtil.exportExcel(header, list, outputStream); ExcelUtil.exportExcel(header, list, outputStream);
return list.size(); return list.size();
} }
} }
...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dao; ...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dao;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto; import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
...@@ -109,4 +110,75 @@ public interface OutputVATInvoiceMapper extends MyVatMapper { ...@@ -109,4 +110,75 @@ public interface OutputVATInvoiceMapper extends MyVatMapper {
int updateByPrimaryKey(OutputVATInvoice record); int updateByPrimaryKey(OutputVATInvoice record);
List<OutputVATInvoiceInfoDto> selectOutputVATInvoiceInfoLeftJoinItem(@Param("queryDto")QueryOutputDto queryDto); List<OutputVATInvoiceInfoDto> selectOutputVATInvoiceInfoLeftJoinItem(@Param("queryDto")QueryOutputDto queryDto);
@Select("SELECT " +
" o.PeriodID, " +
" o.InvoiceType, " +
" o.ClassCode, " +
" o.InvoiceNumber, " +
" o.BuyerName, " +
" o.BuyerTaxNumber, " +
" o.BankAccount, " +
" o.PhoneNum, " +
" o.InvoiceDate, " +
" oi.CodeVersion, " +
" oi.ProductName, " +
" oi.DocumentNum, " +
" oi.ProductStandard, " +
" oi.Unit, " +
" oi.Quantity, " +
" oi.UnitPrice, " +
" oi.Amount, " +
" oi.TaxRate, " +
" oi.TaxAmount, " +
" oi.TaxClassCode " +
"FROM " +
" OutputVATInvoice o, " +
" OutputVATInvoiceItem oi, " +
" (SELECT " +
" InvoiceID, MIN(SeqNo) minSeqNo " +
" FROM " +
" OutputVATInvoiceItem " +
" GROUP BY InvoiceID) m " +
"WHERE " +
" o.InvoiceID = oi.InvoiceID " +
" AND o.InvoiceID = m.InvoiceID " +
" AND oi.SeqNo = m.minSeqNo " +
" AND o.PeriodID = #{period}" +
"UNION SELECT " +
" o2.PeriodID, " +
" NULL AS InvoiceType, " +
" '' AS ClassCode, " +
" '' AS InvoiceNumber, " +
" '' AS BuyerName, " +
" '' AS BuyerTaxNumber, " +
" '' AS BankAccount, " +
" '' AS PhoneNum, " +
" NULL AS InvoiceDate, " +
" oi2.CodeVersion, " +
" oi2.ProductName, " +
" oi2.DocumentNum, " +
" oi2.ProductStandard, " +
" oi2.Unit, " +
" oi2.Quantity, " +
" oi2.UnitPrice, " +
" oi2.Amount, " +
" oi2.TaxRate, " +
" oi2.TaxAmount, " +
" oi2.TaxClassCode " +
"FROM " +
" OutputVATInvoice o2, " +
" OutputVATInvoiceItem oi2, " +
" (SELECT " +
" InvoiceID, MIN(SeqNo) minSeqNo " +
" FROM " +
" OutputVATInvoiceItem " +
" GROUP BY InvoiceID) m2 " +
"WHERE " +
" o2.InvoiceID = oi2.InvoiceID " +
" AND o2.InvoiceID = m2.InvoiceID " +
" AND oi2.SeqNo != m2.minSeqNo " +
" AND o.PeriodID = #{period}" +
" ")
List<OutputVATInvoiceInfoDto> queryOutputDetailWithItem(Integer period);
} }
\ No newline at end of file
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;
public interface OutputInvoiceService {
PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(QueryOutputDto queryDto);
OperationResultDto<List<OutputVATInvoiceInfoDto>> getExportOutputInvoiceList(QueryOutputDto queryDto);
List<ImportFile> getEvidenceList(QueryEvidenceDto queryDto);
}
...@@ -14,9 +14,9 @@ import pwc.taxtech.atms.dto.vatdto.QueryOutputDto; ...@@ -14,9 +14,9 @@ import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.vat.dao.ImportFileMapper; import pwc.taxtech.atms.vat.dao.ImportFileMapper;
import pwc.taxtech.atms.vat.entity.ImportFile; import pwc.taxtech.atms.vat.entity.ImportFile;
import pwc.taxtech.atms.vat.entity.ImportFileExample; import pwc.taxtech.atms.vat.entity.ImportFileExample;
import pwc.taxtech.atms.vat.entity.OutputVATInvoiceExample;
import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItem; import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItem;
import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItemExample; import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItemExample;
import pwc.taxtech.atms.vat.service.OutputInvoiceService;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -28,11 +28,10 @@ import java.util.stream.Collectors; ...@@ -28,11 +28,10 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@Service @Service
public class OutputInvoiceServiceImpl extends VatAbstractService implements OutputInvoiceService { public class OutputInvoiceServiceImpl extends VatAbstractService {
@Autowired @Autowired
private ImportFileMapper importFileMapper; private ImportFileMapper importFileMapper;
@Override
public PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(QueryOutputDto queryDto) { public PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(QueryOutputDto queryDto) {
PagingResultDto<OutputVATInvoiceInfoDto> qResult = new PagingResultDto<>(); PagingResultDto<OutputVATInvoiceInfoDto> qResult = new PagingResultDto<>();
qResult.setPageInfo(queryDto.getPageInfo()); qResult.setPageInfo(queryDto.getPageInfo());
...@@ -47,7 +46,6 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp ...@@ -47,7 +46,6 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp
return qResult; return qResult;
} }
@Override
public OperationResultDto<List<OutputVATInvoiceInfoDto>> getExportOutputInvoiceList(QueryOutputDto queryDto) { public OperationResultDto<List<OutputVATInvoiceInfoDto>> getExportOutputInvoiceList(QueryOutputDto queryDto) {
OperationResultDto<List<OutputVATInvoiceInfoDto>> result = new OperationResultDto<>(); OperationResultDto<List<OutputVATInvoiceInfoDto>> result = new OperationResultDto<>();
List<OutputVATInvoiceInfoDto> finalList = getQueryList(queryDto); List<OutputVATInvoiceInfoDto> finalList = getQueryList(queryDto);
...@@ -57,7 +55,6 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp ...@@ -57,7 +55,6 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp
return result; return result;
} }
@Override
public List<ImportFile> getEvidenceList(QueryEvidenceDto queryDto) { public List<ImportFile> getEvidenceList(QueryEvidenceDto queryDto) {
ImportFileExample example = new ImportFileExample(); ImportFileExample example = new ImportFileExample();
...@@ -77,6 +74,20 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp ...@@ -77,6 +74,20 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp
return importFileMapper.selectByExample(example); return importFileMapper.selectByExample(example);
} }
public OperationResultDto<List<OutputVATInvoiceInfoDto>> getOutputInvoiceList(Integer period) {
List<OutputVATInvoiceInfoDto> result = outputVATInvoiceMapper.queryOutputDetailWithItem(period);
result.sort(Comparator.comparing(OutputVATInvoiceInfoDto::getInvoiceID));
OperationResultDto<List<OutputVATInvoiceInfoDto>> dtoResult = new OperationResultDto();
OutputVATInvoiceExample example = new OutputVATInvoiceExample();
example.createCriteria().andPeriodIDEqualTo(period.intValue());
dtoResult.setData(result);
dtoResult.setReturnCode(Long.valueOf(outputVATInvoiceMapper.countByExample(example)).intValue());
dtoResult.setResult(true);
return dtoResult;
}
private List<OutputVATInvoiceInfoDto> getOutputDetailInfoList(List<OutputVATInvoiceInfoDto> query) { private List<OutputVATInvoiceInfoDto> getOutputDetailInfoList(List<OutputVATInvoiceInfoDto> query) {
List<OutputVATInvoiceInfoDto> list = new ArrayList<>(); List<OutputVATInvoiceInfoDto> list = new ArrayList<>();
List<OutputVATInvoiceItem> outItem = outputVATInvoiceItemMapper.selectByExample(new OutputVATInvoiceItemExample()); 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