|
@@ -6,6 +6,7 @@ import com.hz.employmentsite.filter.exception.BaseException;
|
|
|
import com.hz.employmentsite.mapper.*;
|
|
|
import com.hz.employmentsite.mapper.cquery.CompanyCQuery;
|
|
|
import com.hz.employmentsite.mapper.cquery.LabelCQuery;
|
|
|
+import com.hz.employmentsite.mapper.cquery.PostCQuery;
|
|
|
import com.hz.employmentsite.model.*;
|
|
|
import com.hz.employmentsite.services.service.companyService.CompanyService;
|
|
|
import com.hz.employmentsite.services.service.companyService.FirmService;
|
|
@@ -13,8 +14,10 @@ import com.hz.employmentsite.services.service.companyService.IndustryService;
|
|
|
import com.hz.employmentsite.services.service.system.DictionaryService;
|
|
|
import com.hz.employmentsite.util.RegexUtils;
|
|
|
import com.hz.employmentsite.util.StringUtils;
|
|
|
+import com.hz.employmentsite.vo.baseSettings.LabelVo;
|
|
|
import com.hz.employmentsite.vo.companyService.AppCompanyPostVo;
|
|
|
import com.hz.employmentsite.vo.companyService.CompanyVo;
|
|
|
+import com.hz.employmentsite.vo.companyService.PostVo;
|
|
|
import com.hz.employmentsite.vo.dataMap.CompanyPostMapVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -69,6 +72,9 @@ public class CompanyServiceImpl implements CompanyService {
|
|
|
@Autowired
|
|
|
private LabelCQuery labelCQuery;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PostCQuery postCQuery;
|
|
|
+
|
|
|
@Override
|
|
|
public PageInfo<CompanyVo> getList(Integer pageIndex, Integer pageSize,
|
|
|
List<String> companyIDList, String companyName,
|
|
@@ -627,7 +633,44 @@ public class CompanyServiceImpl implements CompanyService {
|
|
|
Double latitude, Double longitude) {
|
|
|
PageHelper.startPage(pageIndex, pageSize);
|
|
|
List<CompanyPostMapVo> dataMapList = companyCQuery.getDataMapList(companyName, maxDistance, companyModel, recordStatus, regionCode, siteID, latitude, longitude);
|
|
|
- PageInfo<CompanyPostMapVo> result = new PageInfo(dataMapList);
|
|
|
+ PageInfo<CompanyPostMapVo> result = new PageInfo<>(dataMapList);
|
|
|
+
|
|
|
+ // 获取所有的企业ID
|
|
|
+ List<String> companyIDs = result.getList().stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(CompanyPostMapVo::getCompanyID)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (!companyIDs.isEmpty()) {
|
|
|
+ // 查询岗位并映射到企业
|
|
|
+ List<PostVo> postList = postCQuery.selectPostInCompanyIDs(stringUtils.ListToInSql(companyIDs));
|
|
|
+ Map<String, List<PostVo>> postMap = (postList != null) ?
|
|
|
+ postList.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.groupingBy(PostVo::getCompanyID))
|
|
|
+ : new HashMap<>();
|
|
|
+ // 填充岗位数据
|
|
|
+ result.getList().forEach(company -> {
|
|
|
+ if (company != null && company.getCompanyID() != null) {
|
|
|
+ company.setPostList(postMap.getOrDefault(company.getCompanyID(), new ArrayList<>()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 查询标签并映射到企业
|
|
|
+ List<LabelVo> companyLabelList = labelCQuery.getCompanyLabelListInCompanyIDs(stringUtils.ListToInSql(companyIDs));
|
|
|
+ Map<String, List<LabelVo>> labelMap = (companyLabelList != null) ?
|
|
|
+ companyLabelList.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.groupingBy(LabelVo::getCompanyID))
|
|
|
+ : new HashMap<>();
|
|
|
+ // 填充标签数据
|
|
|
+ result.getList().forEach(company -> {
|
|
|
+ if (company != null && company.getCompanyID() != null) {
|
|
|
+ company.setCompanyLabelList(labelMap.getOrDefault(company.getCompanyID(), new ArrayList<>()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|