Commit 7dbf7450 authored by neo's avatar neo

[bugfix] use optional instead use get directe

parent 185bad36
......@@ -36,6 +36,7 @@ import pwc.taxtech.atms.vat.entity.ValidationInfoExample;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccountExample;
import javax.swing.text.html.Option;
import java.io.StringReader;
import java.math.BigDecimal;
import java.util.ArrayList;
......@@ -43,6 +44,7 @@ import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
......@@ -220,11 +222,11 @@ public class DataImportServiceImpl {
List<Balance> addlist = new ArrayList<>();
List<VatEnterpriseAccount> vats = vatEnterpriseAccountMapper.selectByExample(null);
companyBalanceList.forEach(compbalance -> {
VatEnterpriseAccount directionDto = vats.stream().filter(m -> m.getAcctCode().equals(compbalance.getAcctCode()))
.findFirst().get();
Optional<VatEnterpriseAccount> directionDto = vats.stream().filter(m -> m.getAcctCode().equals(compbalance.getAcctCode()))
.findFirst();
if (directionDto != null) {
Integer direction = directionDto.getDirection();
if (directionDto.isPresent()) {
Integer direction = directionDto.get().getDirection();
Balance balanceDto = new Balance();
balanceDto.setBalanceId(UUID.randomUUID().toString());
balanceDto.setPeriodId(compbalance.getPeriodId());
......
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