Commit f35d5b0b authored by neo's avatar neo

[bugfix] fix null point for empty list

parent d8dfcedd
...@@ -86,15 +86,20 @@ public class OutputInvoiceServiceImpl extends VatAbstractService { ...@@ -86,15 +86,20 @@ public class OutputInvoiceServiceImpl extends VatAbstractService {
} }
public OperationResultDto<List<OutputVATInvoiceInfoDto>> getOutputInvoiceList(Integer period) { public OperationResultDto<List<OutputVATInvoiceInfoDto>> getOutputInvoiceList(Integer period) {
List<OutputVATInvoiceInfoDto> result = outputVATInvoiceMapper.queryOutputDetailWithItem(period); List<OutputVATInvoiceInfoDto> result = new ArrayList<>();
result.sort(Comparator.comparing(OutputVATInvoiceInfoDto::getInvoiceID));
OperationResultDto<List<OutputVATInvoiceInfoDto>> dtoResult = new OperationResultDto(); OperationResultDto<List<OutputVATInvoiceInfoDto>> dtoResult = new OperationResultDto();
result.addAll(outputVATInvoiceMapper.queryOutputDetailWithItem(period));
if (!result.isEmpty()) {
result.sort(Comparator.comparing(OutputVATInvoiceInfoDto::getInvoiceID));
OutputVATInvoiceExample example = new OutputVATInvoiceExample(); OutputVATInvoiceExample example = new OutputVATInvoiceExample();
example.createCriteria().andPeriodIDEqualTo(period.intValue()); example.createCriteria().andPeriodIDEqualTo(period.intValue());
dtoResult.setReturnCode(Long.valueOf(outputVATInvoiceMapper.countByExample(example)).intValue());
}else {
dtoResult.setReturnCode(0);
}
dtoResult.setData(result); dtoResult.setData(result);
dtoResult.setReturnCode(Long.valueOf(outputVATInvoiceMapper.countByExample(example)).intValue());
dtoResult.setResult(true); dtoResult.setResult(true);
return dtoResult; return dtoResult;
} }
......
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