添加岗位下架功

This commit is contained in:
sh
2026-02-03 17:29:27 +08:00
parent 6b7e359234
commit 7bd42fa687
10 changed files with 130 additions and 5 deletions

View File

@@ -230,6 +230,7 @@ public class AppJobController extends BaseController
String errorMsg = "描述中包含敏感词:" + String.join("", sensitiveWords);
return AjaxResult.error(errorMsg);
}
job.setJobStatus("0");//上架
jobService.publishJob(job);
return success();
}
@@ -283,4 +284,22 @@ public class AppJobController extends BaseController
List<Job> list=jobApplyService.selectCencalList(queryApply);
return getDataTable(list);
}
@ApiOperation("岗位下架")
@PutMapping("/jobDown/{jobId}")
public AjaxResult jobDown(@ApiParam("岗位id") @PathVariable Long jobId){
if(jobId==null){
return error("岗位id为空");
}
return toAjax(jobService.jobDown(jobId));
}
@ApiOperation("岗位上架")
@PutMapping("/jobUp/{jobId}")
public AjaxResult jobUp(@ApiParam("岗位id") @PathVariable Long jobId){
if(jobId==null){
return error("岗位id为空");
}
return toAjax(jobService.jobUp(jobId));
}
}

View File

@@ -127,6 +127,7 @@ public class CmsJobController extends BaseController
String errorMsg = "描述中包含敏感词:" + String.join("", sensitiveWords);
return AjaxResult.error(errorMsg);
}
job.setJobStatus("0");//上架
// 无敏感词,执行插入
return toAjax(jobService.insertJob(job));
}
@@ -442,4 +443,22 @@ public class CmsJobController extends BaseController
ou.close();
in.close();
}
@ApiOperation("岗位下架")
@PutMapping("/jobDown/{jobId}")
public AjaxResult jobDown(@PathVariable("jobId") Long jobId){
if(jobId==null){
return error("岗位id为空");
}
return toAjax(jobService.jobDown(jobId));
}
@ApiOperation("岗位上架")
@PutMapping("/jobUp/{jobId}")
public AjaxResult jobUp(@PathVariable("jobId") Long jobId){
if(jobId==null){
return error("岗位id为空");
}
return toAjax(jobService.jobUp(jobId));
}
}

View File

@@ -26,4 +26,6 @@ public class JobCron {
public void updateJobCountOfCompany(){
SpringUtils.getBean(ICompanyService.class).updateJobCountOfCompany();
}
//下架过期岗位
public void updateJobDown(){SpringUtils.getBean(IJobService.class).updateJobDown();}
}

View File

@@ -171,4 +171,11 @@ public class ESJobDocument
@ApiModelProperty("是否通过原因")
private String passReason;
@ApiModelProperty("状态 0在线1下架")
private String jobStatus;
@ApiModelProperty("下架时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String downTime;
}

View File

@@ -204,4 +204,11 @@ public class Job extends BaseEntity
@ApiModelProperty("是否通过原因")
private String passReason;
@ApiModelProperty("状态 0上架1下架")
private String jobStatus;
@ApiModelProperty("下架时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String downTime;
}

View File

@@ -62,4 +62,10 @@ public interface JobMapper extends BaseMapper<Job>
Integer getTotals(Job job);
void updateFileBatchInsert(List<Job> list);
public int updateStatus(Job job);
List<Job> getJobDownList();
void updateJobDown(List<Long> list);
}

View File

@@ -113,4 +113,10 @@ public interface IJobService
public Integer getTotals(Job job);
void uploadFileJob(List<JobExcelVo> list);
public int jobDown(Long jobId);
public int jobUp(Long jobId);
void updateJobDown();
}

View File

@@ -546,6 +546,9 @@ public class ESJobSearchImpl implements IESJobSearchService
if(!StringUtil.isEmptyOrNull(esJobSearch.getStaffType())){
wrapper.and(x->x.like(ESJobDocument::getStaffType,esJobSearch.getStaffType()));
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobStatus())){
wrapper.and(x->x.eq(ESJobDocument::getJobStatus,esJobSearch.getJobStatus()));
}
if(Objects.nonNull(esJobSearch.getOrder())){
if(esJobSearch.getOrder()==1){
wrapper.orderByDesc(ESJobDocument::getIsHot);

View File

@@ -1370,4 +1370,42 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
return new ArrayList<>(dedupMap.values());
}
@Transactional
@Override
public int jobDown(Long jobId) {
Job job=new Job();
job.setJobId(jobId);
job.setJobStatus("1");
job.setDownTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
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;
}
@Override
public void updateJobDown() {
//查询下架岗位
List<Job> list=jobMapper.getJobDownList();
List<Long> ids=list.stream().map(Job::getJobId).collect(Collectors.toList());
//更新岗位状态
jobMapper.updateJobDown(ids);
//刷新es
ids.forEach(it->{
iesJobSearchService.updateJob(it);
});
}
}