添加岗位下架功
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,6 @@ public class JobCron {
|
||||
public void updateJobCountOfCompany(){
|
||||
SpringUtils.getBean(ICompanyService.class).updateJobCountOfCompany();
|
||||
}
|
||||
//下架过期岗位
|
||||
public void updateJobDown(){SpringUtils.getBean(IJobService.class).updateJobDown();}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
<result property="pass" column="pass" />
|
||||
<result property="passReason" column="pass_reason" />
|
||||
<result property="jobLocationAreaCode" column="job_location_area_code" />
|
||||
<result property="jobStatus" column="job_status" />
|
||||
<result property="downTime" column="down_time" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
@@ -106,7 +108,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectJobVo">
|
||||
select job_id, job_title, min_salary, max_salary, education, experience, company_name, job_location, posting_date, vacancies, del_flag, create_by, create_time, update_by, update_time, remark, latitude, longitude, "view", company_id , is_hot ,apply_num,is_publish, description,job_location_area_code,data_source,job_url,job_category,is_explain,explain_url,cover,job_type,job_address,region_code,staff_type,pass,pass_reason from job
|
||||
select job_id, job_title, min_salary, max_salary, education, experience, company_name, job_location, posting_date, vacancies, del_flag, create_by, create_time, update_by, update_time, remark, latitude, longitude, "view", company_id , is_hot ,apply_num,is_publish, description,job_location_area_code,data_source,job_url,job_category,is_explain,explain_url,cover,job_type,job_address,region_code,staff_type,pass,pass_reason,job_status,down_time from job
|
||||
</sql>
|
||||
<insert id="insertBatchRowWork">
|
||||
INSERT INTO row_work (
|
||||
@@ -136,7 +138,8 @@
|
||||
job_title, min_salary, max_salary, education, experience, company_name, job_location,
|
||||
job_location_area_code, posting_date, vacancies, latitude, longitude, "view", company_id,
|
||||
is_hot, apply_num, description, is_publish, data_source, job_url, remark, del_flag,
|
||||
create_by, create_time, row_id, job_category,job_type,type,job_address,region_code,staff_type,pass,pass_reason
|
||||
create_by, create_time, row_id, job_category,job_type,type,job_address,region_code,staff_type
|
||||
,pass,pass_reason,job_status
|
||||
) VALUES
|
||||
<foreach collection="list" item="job" separator=",">
|
||||
(
|
||||
@@ -146,7 +149,7 @@
|
||||
#{job.isHot}, #{job.applyNum}, #{job.description}, #{job.isPublish}, #{job.dataSource},
|
||||
#{job.jobUrl}, #{job.remark}, #{job.delFlag}, #{job.createBy}, #{job.createTime},
|
||||
#{job.rowId}, #{job.jobCategory},#{job.jobType},#{job.type},#{job.jobAddress},
|
||||
#{job.regionCode},#{job.staffType},#{job.pass},#{job.passReason}
|
||||
#{job.regionCode},#{job.staffType},#{job.pass},#{job.passReason},'0'
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -366,7 +369,7 @@
|
||||
job_location_area_code, posting_date, vacancies, latitude, longitude, "view", company_id,
|
||||
is_hot, apply_num, description, is_publish, data_source, job_url, remark, del_flag,
|
||||
create_by, create_time, row_id, job_category,job_type,type,job_address,region_code,
|
||||
staff_type,pass,pass_reason
|
||||
staff_type,pass,pass_reason,job_status
|
||||
) VALUES
|
||||
<foreach collection="list" item="job" separator=",">
|
||||
(
|
||||
@@ -376,9 +379,24 @@
|
||||
#{job.isHot}, #{job.applyNum}, #{job.description}, #{job.isPublish}, #{job.dataSource},
|
||||
#{job.jobUrl}, #{job.remark}, #{job.delFlag}, #{job.createBy}, #{job.createTime},
|
||||
#{job.rowId}, #{job.jobCategory},#{job.jobType},#{job.type},#{job.jobAddress},
|
||||
#{job.regionCode},#{job.staffType},#{job.pass},#{job.passReason}
|
||||
#{job.regionCode},#{job.staffType},#{job.pass},#{job.passReason},'0'
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateStatus" parameterType="Job">
|
||||
update job set job_status=#{jobStatus},down_time=#{downTime},update_time=#{updateTime},update_by=#{updateBy} where job_id=#{jobId}
|
||||
</update>
|
||||
|
||||
<select id="getJobDownList" resultType="java.util.List">
|
||||
select job_id from job where create_time <=now() and job_status='0'
|
||||
</select>
|
||||
|
||||
<update id="updateJobDown" parameterType="java.util.List">
|
||||
update job set job_status='1' where del_flag='0' AND job_id in
|
||||
<foreach collection="list" item="jobId" open="(" close=")" separator=",">
|
||||
#{jobId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user