1.添加用户投诉岗位
2.管理员对企业和岗位下架
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.AppUserJobComplaint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAppUserJobComplaintService {
|
||||
|
||||
/**
|
||||
* 查询投诉列表
|
||||
*/
|
||||
List<AppUserJobComplaint> selectAppUserJobComplaintList(AppUserJobComplaint appUserJobComplaint);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*/
|
||||
AppUserJobComplaint selectAppUserJobComplaintById(Long id);
|
||||
|
||||
/**
|
||||
* 新增投诉
|
||||
*/
|
||||
int insertAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint);
|
||||
|
||||
/**
|
||||
* 修改投诉
|
||||
*/
|
||||
int updateAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
int deleteAppUserJobComplaintByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 校验用户是否已投诉该岗位
|
||||
* @param userId 用户ID
|
||||
* @param jobId 岗位ID
|
||||
* @return true=已投诉 false=未投诉
|
||||
*/
|
||||
boolean checkUserHasComplaint(Long userId, Long jobId);
|
||||
}
|
||||
@@ -83,4 +83,6 @@ public interface IAppUserService
|
||||
public MyChart getMyTj(Long userId);
|
||||
|
||||
public List<AppUserShow> selectUserApplyList(AppUser appUser);
|
||||
|
||||
int editUserSafety(AppUser appUser);
|
||||
}
|
||||
|
||||
@@ -81,4 +81,8 @@ public interface ICompanyService
|
||||
Company queryCodeCompany(String code);
|
||||
|
||||
List<Company> selectLikeCompanyList(Company company);
|
||||
|
||||
int companyDown(Long companyId);
|
||||
|
||||
int companyUp(Long companyId);
|
||||
}
|
||||
|
||||
@@ -72,4 +72,6 @@ public interface IESJobSearchService
|
||||
List<ESJobDocument> selectByIds(Long[] jobIds);
|
||||
|
||||
List<ESJobDocument> selectSysTextListExceptJobId(ESJobSearch esJobSearch, List<Long> jobIds, AppUser appUser);
|
||||
|
||||
void batchUpdateJob(List<Long> jobIdList);
|
||||
}
|
||||
|
||||
@@ -118,4 +118,8 @@ public interface IJobService
|
||||
List<AppUser> getRecommendByJobId(Long jobId);
|
||||
|
||||
void shzLocalUploadFile(List<Job> jobs);
|
||||
|
||||
public int jobDown(Long jobId);
|
||||
|
||||
public int jobUp(Long jobId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.AppUserJobComplaint;
|
||||
import com.ruoyi.cms.mapper.AppUserJobComplaintMapper;
|
||||
import com.ruoyi.cms.service.IAppUserJobComplaintService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AppUserJobComplaintServiceImpl extends ServiceImpl<AppUserJobComplaintMapper, AppUserJobComplaint> implements IAppUserJobComplaintService {
|
||||
|
||||
@Autowired
|
||||
private AppUserJobComplaintMapper appUserJobComplaintMapper;
|
||||
|
||||
@Override
|
||||
public List<AppUserJobComplaint> selectAppUserJobComplaintList(AppUserJobComplaint appUserJobComplaint) {
|
||||
return appUserJobComplaintMapper.selectAppUserJobComplaintList(appUserJobComplaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUserJobComplaint selectAppUserJobComplaintById(Long id) {
|
||||
return appUserJobComplaintMapper.selectAppUserJobComplaintById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint) {
|
||||
Long userId = appUserJobComplaint.getUserId();
|
||||
Long jobId = appUserJobComplaint.getJobId();
|
||||
// 校验重复投诉
|
||||
if (checkUserHasComplaint(userId, jobId)) {
|
||||
throw new ServiceException("您已投诉过该岗位,请勿重复提交");
|
||||
}
|
||||
return appUserJobComplaintMapper.insert(appUserJobComplaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint) {
|
||||
return appUserJobComplaintMapper.updateById(appUserJobComplaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAppUserJobComplaintByIds(Long[] ids) {
|
||||
return appUserJobComplaintMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户是否已经投诉该岗位
|
||||
*/
|
||||
@Override
|
||||
public boolean checkUserHasComplaint(Long userId, Long jobId) {
|
||||
if (userId == null || jobId == null) {
|
||||
return false;
|
||||
}
|
||||
AppUserJobComplaint exist = appUserJobComplaintMapper.selectExistComplaint(userId, jobId);
|
||||
return exist != null;
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,11 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.util.http.HttpClientUtils;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.entity.MyChart;
|
||||
import com.ruoyi.common.core.domain.entity.File;
|
||||
import com.ruoyi.cms.domain.vo.AppSkillVo;
|
||||
@@ -15,11 +18,13 @@ import com.ruoyi.common.core.domain.entity.*;
|
||||
import com.ruoyi.cms.domain.vo.AppUserLky;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -47,6 +52,14 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper,AppUser> imple
|
||||
private CompanyMapper companyMapper;
|
||||
@Autowired
|
||||
private FileMapper fileMapper;
|
||||
@Autowired
|
||||
private HttpClientUtils httpClientUtils;
|
||||
|
||||
//互联网修改个人信息
|
||||
@Value("${lc_web_auth.editUserInfoUrl}")
|
||||
String WEB_UPDATE_USER_INFO;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 查询APP用户
|
||||
@@ -632,4 +645,31 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper,AppUser> imple
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int editUserSafety(AppUser appUser) {
|
||||
appUserMapper.updateById(appUser);
|
||||
String lcUserToken=redisCache.getCacheObject(CacheConstants.LC_HLW_TOKEN+appUser.getUserId());
|
||||
if(StringUtils.isBlank(lcUserToken)){
|
||||
throw new RuntimeException("token已失效");
|
||||
}
|
||||
//修改门户个人信息
|
||||
JSONObject pJson = new JSONObject();
|
||||
if (StringUtils.isNotBlank(appUser.getEmail())) {
|
||||
pJson.put("personEmail", appUser.getEmail());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUser.getPhone())) {
|
||||
pJson.put("personPhone", appUser.getPhone());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUser.getPassword())) {
|
||||
pJson.put("password", appUser.getPassword());
|
||||
}
|
||||
String result=httpClientUtils.sendHttpPost(WEB_UPDATE_USER_INFO,lcUserToken,pJson.toJSONString());
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new RuntimeException("调用门户修改用户信息接口响应为空");
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(result);
|
||||
System.out.println("门户修改个人信息返回:"+json);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.ruoyi.cms.domain.query.CompanySearch;
|
||||
import com.ruoyi.cms.domain.query.JobSearch;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.service.IESJobSearchService;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
@@ -53,6 +54,8 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
||||
private CompanyLabelMapper companyLabelMapper;
|
||||
@Autowired
|
||||
private CompanyContactMapper companyContactMapper;
|
||||
@Autowired
|
||||
private IESJobSearchService iesJobSearchService;
|
||||
/**
|
||||
* 查询公司
|
||||
*
|
||||
@@ -338,4 +341,50 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
||||
public List<Company> selectLikeCompanyList(Company company) {
|
||||
return companyMapper.selectLikeCompanyList(company);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int companyDown(Long companyId) {
|
||||
//更新企业状态
|
||||
Company company=new Company();
|
||||
company.setCompanyId(companyId);
|
||||
company.setCompanyStatus("1");
|
||||
int i=companyMapper.updateStatus(company);
|
||||
//批量下架所有岗位
|
||||
jobMapper.updateBatchDownStatus(companyId);
|
||||
//查询企业下所有岗位
|
||||
JobSearch parJob=new JobSearch();
|
||||
parJob.setCompanyId(company.getCompanyId());
|
||||
List<Job> jobs=jobMapper.selectJobList(parJob);
|
||||
//批量刷新es
|
||||
if (jobs != null && !jobs.isEmpty()) {
|
||||
List<Long> jobIdList = jobs.stream()
|
||||
.map(Job::getJobId)
|
||||
.collect(Collectors.toList());
|
||||
iesJobSearchService.batchUpdateJob(jobIdList);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int companyUp(Long companyId) {
|
||||
//更新企业状态
|
||||
Company company=new Company();
|
||||
company.setCompanyId(companyId);
|
||||
company.setCompanyStatus("0");
|
||||
int i=companyMapper.updateStatus(company);
|
||||
//批量上架所有岗位
|
||||
jobMapper.updateBatchUpStatus(companyId);
|
||||
//查询企业下所有岗位
|
||||
JobSearch parJob=new JobSearch();
|
||||
parJob.setCompanyId(company.getCompanyId());
|
||||
List<Job> jobs=jobMapper.selectJobList(parJob);
|
||||
//批量刷新es
|
||||
if (jobs != null && !jobs.isEmpty()) {
|
||||
List<Long> jobIdList = jobs.stream()
|
||||
.map(Job::getJobId)
|
||||
.collect(Collectors.toList());
|
||||
iesJobSearchService.batchUpdateJob(jobIdList);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,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.mapper.CompanyMapper;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.cms.domain.ESJobDocument;
|
||||
@@ -75,6 +76,9 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
@Autowired
|
||||
private JobTitleMapper jobTitleMapper;
|
||||
Logger logger = LoggerFactory.getLogger(JobServiceImpl.class);
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化索引及数据
|
||||
*/
|
||||
@@ -919,7 +923,7 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
|
||||
BeanUtils.copyBeanProp(esJobDocument, job);
|
||||
esJobDocument.setJobCategory(resolveJobCategoryLabel(job.getJobCategory()));
|
||||
esJobDocument.setAppJobUrl("https://www.xjksly.cn/app#/packageA/pages/post/post?jobId="+ Base64.getEncoder().encodeToString(String.valueOf(job.getJobId()).getBytes()));
|
||||
esJobDocument.setAppJobUrl("https://xjshzly.longbiosphere.com/app#/packageA/pages/post/post?jobId="+ Base64.getEncoder().encodeToString(String.valueOf(job.getJobId()).getBytes()));
|
||||
if(!StringUtil.isEmptyOrNull(job.getScale())){
|
||||
esJobDocument.setScale(Integer.valueOf(job.getScale()));
|
||||
}else {
|
||||
@@ -941,7 +945,7 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
esJobDocument.setLatAndLon(esJobDocument.getLatitude().toString() + "," + esJobDocument.getLongitude().toString());
|
||||
}
|
||||
if(StringUtil.isEmptyOrNull(job.getCompanyNature())){
|
||||
esJobDocument.setCompanyNature("6");
|
||||
esJobDocument.setCompanyNature("4");
|
||||
}
|
||||
ensureJobDocumentIndexExists();
|
||||
|
||||
@@ -1127,4 +1131,129 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
}
|
||||
return jobCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位id批量更新es
|
||||
* @param jobIdList
|
||||
*/
|
||||
@Override
|
||||
public void batchUpdateJob(List<Long> jobIdList) {
|
||||
if (jobIdList == null || jobIdList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
//索引初始化
|
||||
ensureJobDocumentIndexExists();
|
||||
//查询所有岗位数据
|
||||
List<Job> allJobList = jobMapper.selectBatchIds(jobIdList);
|
||||
if (allJobList == null || allJobList.isEmpty()) {
|
||||
LambdaEsQueryWrapper<ESJobDocument> delWrapper = new LambdaEsQueryWrapper<>();
|
||||
delWrapper.in(ESJobDocument::getJobId, jobIdList);
|
||||
esJobDocumentMapper.delete(delWrapper);
|
||||
return;
|
||||
}
|
||||
//查询所有企业数据
|
||||
List<Long> companyIdList = allJobList.stream()
|
||||
.map(Job::getCompanyId)
|
||||
.filter(id -> id != null)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<Company> companyList = new ArrayList<>();
|
||||
if (!companyIdList.isEmpty()) {
|
||||
companyList = companyMapper.selectBatchIds(companyIdList);
|
||||
}
|
||||
Map<Long, Company> companyMap = companyList.stream()
|
||||
.collect(Collectors.toMap(Company::getCompanyId, c -> c));
|
||||
|
||||
// 批量转换ES
|
||||
List<ESJobDocument> esDocList = allJobList.stream()
|
||||
.map(job -> convertToEsDoc(job, companyMap))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
try {
|
||||
// 批量删除旧索引
|
||||
LambdaEsQueryWrapper<ESJobDocument> delWrapper = new LambdaEsQueryWrapper<>();
|
||||
delWrapper.in(ESJobDocument::getJobId, jobIdList);
|
||||
esJobDocumentMapper.delete(delWrapper);
|
||||
// 批量插入新索引
|
||||
esJobDocumentMapper.insertBatch(esDocList);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("ES批量更新失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Job 转 ESJobDocument 抽取单独方法
|
||||
*/
|
||||
private ESJobDocument convertToEsDoc(Job job, Map<Long, Company> companyMap) {
|
||||
ESJobDocument esDoc = new ESJobDocument();
|
||||
BeanUtils.copyBeanProp(esDoc, job);
|
||||
// 企业编码赋值
|
||||
if (job.getCompanyId() != null) {
|
||||
Company company = companyMap.get(job.getCompanyId());
|
||||
if (company != null) {
|
||||
esDoc.setCode(company.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
esDoc.setJobCategory(resolveJobCategoryLabel(job.getJobCategory()));
|
||||
esDoc.setAppJobUrl("https://www.xjksly.cn/app#/packageA/pages/post/post?jobId="+ job.getJobId());
|
||||
esDoc.setScale(parseIntDefaultZero(job.getScale()));
|
||||
//工作经验
|
||||
if (StringUtil.isEmptyOrNull(job.getExperience())) {
|
||||
esDoc.setExperience("0");
|
||||
esDoc.setExperience_int(0);
|
||||
} else {
|
||||
Integer expInt = parseIntDefaultZero(job.getExperience());
|
||||
esDoc.setExperience_int(expInt);
|
||||
}
|
||||
|
||||
// 学历字段统一处理
|
||||
if (StringUtil.isEmptyOrNull(job.getEducation())) {
|
||||
esDoc.setEducation("-1");
|
||||
esDoc.setEducation_int(-1);
|
||||
} else {
|
||||
Integer eduInt = parseIntDefaultMinusOne(job.getEducation());
|
||||
esDoc.setEducation_int(eduInt);
|
||||
}
|
||||
|
||||
// 经纬度拼接
|
||||
if (esDoc.getLatitude() != null && esDoc.getLongitude() != null) {
|
||||
esDoc.setLatAndLon(esDoc.getLatitude() + "," + esDoc.getLongitude());
|
||||
}
|
||||
|
||||
// 企业行业默认值
|
||||
if (StringUtil.isEmptyOrNull(job.getCompanyNature())) {
|
||||
esDoc.setCompanyNature("4");
|
||||
}
|
||||
|
||||
return esDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数字,空/非法返回0
|
||||
*/
|
||||
private Integer parseIntDefaultZero(String str) {
|
||||
if (StringUtil.isEmptyOrNull(str)) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return Integer.valueOf(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数字,空/非法返回-1
|
||||
*/
|
||||
private Integer parseIntDefaultMinusOne(String str) {
|
||||
if (StringUtil.isEmptyOrNull(str)) {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
return Integer.valueOf(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
import org.slf4j.Logger;
|
||||
@@ -1305,4 +1304,28 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
|
||||
//刷新es
|
||||
iesJobSearchService.resetTextCache();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public int jobDown(Long jobId) {
|
||||
Job job=new Job();
|
||||
job.setJobId(jobId);
|
||||
job.setJobStatus("1");
|
||||
int i=jobMapper.updateStatus(job);
|
||||
//刷新单条数据
|
||||
iesJobSearchService.updateJob(jobId);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public int jobUp(Long jobId) {
|
||||
Job job=new Job();
|
||||
job.setJobId(jobId);
|
||||
job.setJobStatus("0");
|
||||
//刷新单条数据
|
||||
int i=jobMapper.updateStatus(job);
|
||||
iesJobSearchService.updateJob(jobId);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user