添加个人屏蔽企业,并且推荐岗位时,并且企业对应的岗位
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cms.domain.AppUserBlockCompany;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AppUserBlockCompanyService extends IService<AppUserBlockCompany> {
|
||||
|
||||
/**
|
||||
* 新增屏蔽企业(去重校验)
|
||||
*/
|
||||
int addBlockCompany(AppUserBlockCompany entity);
|
||||
|
||||
/**
|
||||
* 取消屏蔽(逻辑删除)
|
||||
*/
|
||||
int cancelBlock(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取用户所有屏蔽企业ID
|
||||
*/
|
||||
List<Long> getBlockCompanyIds(Long userId);
|
||||
|
||||
/**
|
||||
* 校验是否已屏蔽
|
||||
*/
|
||||
boolean isBlocked(Long userId, Long companyId);
|
||||
|
||||
/**
|
||||
* 查询用户屏蔽列表
|
||||
*/
|
||||
List<AppUserBlockCompany> listByUserId(Long userId);
|
||||
|
||||
int batchCancelBlock(Long userId,List<Long> companyIdList);
|
||||
|
||||
List<AppUserBlockCompany> selectListByUserId(Long userId);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.AppUserBlockCompany;
|
||||
import com.ruoyi.cms.mapper.AppUserBlockCompanyMapper;
|
||||
import com.ruoyi.cms.service.AppUserBlockCompanyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AppUserBlockCompanyServiceImpl extends ServiceImpl<AppUserBlockCompanyMapper, AppUserBlockCompany>
|
||||
implements AppUserBlockCompanyService {
|
||||
|
||||
@Autowired
|
||||
private AppUserBlockCompanyMapper appUserBlockCompanyMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int addBlockCompany(AppUserBlockCompany entity) {
|
||||
if (isBlocked(entity.getUserId(), entity.getCompanyId())) {
|
||||
throw new RuntimeException("已屏蔽该企业,无需重复操作");
|
||||
}
|
||||
return baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int cancelBlock(Long[] ids) {
|
||||
return appUserBlockCompanyMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getBlockCompanyIds(Long userId) {
|
||||
return baseMapper.selectBlockCompanyIdsByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlocked(Long userId, Long companyId) {
|
||||
return baseMapper.checkUserBlockCompany(userId, companyId) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppUserBlockCompany> listByUserId(Long userId) {
|
||||
LambdaQueryWrapper<AppUserBlockCompany> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AppUserBlockCompany::getUserId, userId)
|
||||
.orderByDesc(AppUserBlockCompany::getCreateTime);
|
||||
return baseMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchCancelBlock(Long userId, List<Long> companyIdList) {
|
||||
LambdaQueryWrapper<AppUserBlockCompany> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AppUserBlockCompany::getUserId, userId)
|
||||
.eq(AppUserBlockCompany::getDelFlag, "0")
|
||||
.in(AppUserBlockCompany::getCompanyId, companyIdList);
|
||||
AppUserBlockCompany updateEntity = new AppUserBlockCompany();
|
||||
updateEntity.setDelFlag("2");
|
||||
return baseMapper.update(updateEntity, wrapper);
|
||||
}
|
||||
|
||||
public List<AppUserBlockCompany> selectListByUserId(Long userId){
|
||||
return appUserBlockCompanyMapper.selectListByUserId(userId);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.cms.domain.vo.CompanyVo;
|
||||
import com.ruoyi.cms.mapper.AppUserBlockCompanyMapper;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.cms.domain.ESJobDocument;
|
||||
@@ -58,6 +59,8 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
private ICompanyService iCompanyService;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@Autowired
|
||||
private AppUserBlockCompanyMapper appUserBlockCompanyMapper;
|
||||
|
||||
// 锁的key(唯一标识ES索引初始化)
|
||||
private static final String ES_INIT_LOCK_KEY = "es:job_document:init:lock";
|
||||
@@ -241,6 +244,10 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
//查询
|
||||
if(SiteSecurityUtils.isLogin()){
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
List<Long> jobs=appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId());
|
||||
if (jobs != null) {
|
||||
jobIds.addAll(jobs.stream().distinct().collect(Collectors.toList()));
|
||||
}
|
||||
if (!StringUtil.isEmptyOrNull(esJobSearch.getCode())) {
|
||||
newSearch.setCode(esJobSearch.getCode());
|
||||
}
|
||||
@@ -423,7 +430,13 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
public EsPageInfo<ESJobDocument> nearJob(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery,null);
|
||||
//添加屏蔽的企业
|
||||
List<Long> jobIds=null;
|
||||
if(SiteSecurityUtils.isLogin()) {
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
jobIds = appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId());
|
||||
}
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery,jobIds);
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
@@ -433,6 +446,13 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery, null);
|
||||
//添加屏蔽的企业
|
||||
List<Long> jobIds=null;
|
||||
if(SiteSecurityUtils.isLogin()) {
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
jobIds = appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId());
|
||||
wrapper.not().in(ESJobDocument::getJobId, jobIds);
|
||||
}
|
||||
if(jobQuery.getCountyIds()!=null){
|
||||
wrapper.and(x->x.in(ESJobDocument::getJobLocationAreaCode,jobQuery.getCountyIds()));
|
||||
}
|
||||
@@ -444,7 +464,12 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
public EsPageInfo<ESJobDocument> subway(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery,null);
|
||||
List<Long> jobIds=null;
|
||||
if(SiteSecurityUtils.isLogin()) {
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
jobIds = appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId());
|
||||
}
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery,jobIds);
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
@@ -453,7 +478,12 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
public EsPageInfo<ESJobDocument> commercialArea(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery,null);
|
||||
List<Long> jobIds=null;
|
||||
if(SiteSecurityUtils.isLogin()) {
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
jobIds = appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId());
|
||||
}
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery,jobIds);
|
||||
if(jobQuery.getLongitude()!=null){
|
||||
wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(jobQuery.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(jobQuery.getLatitude().toString()), Double.parseDouble(jobQuery.getLongitude().toString())));
|
||||
}
|
||||
@@ -652,13 +682,17 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
// if(SiteSecurityUtils.isLogin()){
|
||||
// AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
if(SiteSecurityUtils.isLogin()){
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
List<Long> jobs=appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId());
|
||||
if (ListUtil.isListEmptyOrNull(jobs)) {
|
||||
wrapper.not().in(ESJobDocument::getJobId, jobs);
|
||||
}
|
||||
// if(!ListUtil.isEmptyOrNull(appUser.getJobTitle())){
|
||||
// List<String> jobTitle = appUser.getJobTitle();
|
||||
// jobQuery.setJobTitle(String.join(",", jobTitle));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if(hasText(jobQuery.getJobTitle())){
|
||||
wrapper.and(a->a.match(ESJobDocument::getJobTitle,jobQuery.getJobTitle().trim(),5.0f)
|
||||
.or()
|
||||
|
||||
Reference in New Issue
Block a user