处理空指针

This commit is contained in:
钱涛 2024-03-07 14:12:16 +08:00
parent e81937c4dd
commit 729c6c7d3a
1 changed files with 4 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import java.util.*;
@ -166,9 +167,9 @@ public class TaxDeclarationDetailBO {
.setAnnualTaxSavings(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_TAX_SAVINGS))
.setAnnualRemark(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUAL_REMARK));
if (dto.getEmployeeType() == null || Objects.equals(dto.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) {
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(dto.getEmployeeId());
taxDeclarationLaborListDTO.setJobNum(simpleEmployee.getWorkcode())
.setUsername(simpleEmployee.getUsername())
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.getOrDefault(dto.getEmployeeId(),new DataCollectionEmployee());
taxDeclarationLaborListDTO.setJobNum(Util.null2String(simpleEmployee.getWorkcode()))
.setUsername(Util.null2String(simpleEmployee.getUsername()))
.setCardNum(Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getIdNo).orElse(StringUtils.EMPTY));
} else {