根据企业id查询企业信息时——用户未登录,报错问题

This commit is contained in:
sh
2026-04-28 17:42:15 +08:00
parent f6253850d0
commit 7d8f941c85

View File

@@ -71,12 +71,19 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
userId = loginUser.getUserId(); userId = loginUser.getUserId();
}catch (Exception ignored){ }catch (Exception ignored){
try {
LoginSiteUser siteUser = SiteSecurityUtils.getLoginSiteUser(); LoginSiteUser siteUser = SiteSecurityUtils.getLoginSiteUser();
userId = siteUser.getUserId(); userId = siteUser.getUserId();
} catch (Exception ignored2) {
}
} }
//收藏 //收藏
if (userId == null) {
company.setIsCollection(0);
} else {
Long l = companyCollectionMapper.selectCount(Wrappers.<CompanyCollection>lambdaQuery().eq(CompanyCollection::getCompanyId, companyId).eq(CompanyCollection::getUserId, userId)); Long l = companyCollectionMapper.selectCount(Wrappers.<CompanyCollection>lambdaQuery().eq(CompanyCollection::getCompanyId, companyId).eq(CompanyCollection::getUserId, userId));
company.setIsCollection(l>0?1:0); company.setIsCollection(l>0?1:0);
}
//联系人 //联系人
CompanyContact contact=new CompanyContact(); CompanyContact contact=new CompanyContact();
contact.setCompanyId(company.getCompanyId()); contact.setCompanyId(company.getCompanyId());