Commit 53aca31a by jinxin

解决空指针异常问题

parent 9e77e176
......@@ -187,7 +187,7 @@ public class StaffApiServiceImpl implements StaffApiService {
//已关联的成员需要查询关联的品牌名称
List<TabHaobanWxEnterpriseRelated> list = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterpriseId);
//解决空指针异常问题
Map<String, Object> map = list.stream().collect(Collectors.toMap(TabHaobanWxEnterpriseRelated::getEnterpriseId, a->Optional.ofNullable(a.getEnterpriseName())));
Map<String, String> map = list.stream().collect(HashMap::new,(k, v) -> k.put(v.getEnterpriseId(), v.getEnterpriseName()), HashMap::putAll);
List<StaffClerkRelationDTO> relationDTOList = staffClerkRelationService.listByWxEnterpriseIdAndStaffId(wxEnterpriseId, staffIdList);
staffDTOList.forEach(one -> {
if(relationIdList.contains(one.getStaffId())){
......@@ -196,7 +196,7 @@ public class StaffApiServiceImpl implements StaffApiService {
List<String> enterpriseNameList = new ArrayList<>(8);
for (StaffClerkRelationDTO dto : relationDTOList){
if (dto.getStaffId().equals(one.getStaffId())){
enterpriseNameList.add(String.valueOf(map.get(dto.getEnterpriseId())));
enterpriseNameList.add(map.get(dto.getEnterpriseId()));
}
}
if (CollUtil.isNotEmpty(enterpriseNameList)){
......
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