瀏覽代碼

联系人相关bug修改

zhouyy 4 月之前
父節點
當前提交
4e5d2c4a88

+ 19 - 16
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsServiceImpl.java

@@ -17,6 +17,7 @@ import com.management.platform.service.SysFunctionService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFCell;
@@ -358,23 +359,25 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
             List<BusinessOpportunity> opportunityList = businessOpportunityMapper.selectList(bLqw);
             LambdaQueryWrapper<Stage> stageLQW = new LambdaQueryWrapper<>();
             List<Stage> stages = stageMapper.selectList(stageLQW);
+            if(CollectionUtils.isNotEmpty(opportunityList)){
+                opportunityList.forEach(businessOpportunity -> {
+                    Custom custom = customMapper.selectById(businessOpportunity.getCustomerId());
+                    businessOpportunity.setCustomerName(custom.getCustomName());
+                    if (StringUtils.isNotBlank(businessOpportunity.getInchargerId())){
+                        User chargeUser = userMapper.selectById(businessOpportunity.getInchargerId());
+                        businessOpportunity.setInchargerName(chargeUser.getName());
+                    }
+                    if (StringUtils.isNotBlank(businessOpportunity.getCreatorId())){
+                        User creatorUser = userMapper.selectById(businessOpportunity.getCreatorId());
+                        businessOpportunity.setCreatorName(creatorUser.getName());
+                    }
+                    if (businessOpportunity.getStageId()!=null){
+                        Optional<Stage> first = stages.stream().filter(s -> s.getId().equals(businessOpportunity.getStageId())).findFirst();
+                        first.ifPresent(stage -> businessOpportunity.setStageValue(stage.getName()));
+                    }
+                });
+            }
 
-            opportunityList.forEach(businessOpportunity -> {
-                Custom custom = customMapper.selectById(businessOpportunity.getCustomerId());
-                businessOpportunity.setCustomerName(custom.getCustomName());
-                if (businessOpportunity.getInchargerId()!=null){
-                    User chargeUser = userMapper.selectById(businessOpportunity.getInchargerId());
-                    businessOpportunity.setInchargerName(chargeUser.getName());
-                }
-                if (businessOpportunity.getCreatorId()!=null){
-                    User creatorUser = userMapper.selectById(businessOpportunity.getCreatorId());
-                    businessOpportunity.setCreatorName(creatorUser.getName());
-                }
-                if (businessOpportunity.getStageId()!=null){
-                    Optional<Stage> first = stages.stream().filter(s -> s.getId().equals(businessOpportunity.getStageId())).findFirst();
-                    first.ifPresent(stage -> businessOpportunity.setStageValue(stage.getName()));
-                }
-            });
 
             //附件信息查询
             LambdaQueryWrapper<ContactsDocument> cDLqw = new LambdaQueryWrapper<>();