添加微信抓取判重的方法

This commit is contained in:
sh
2025-12-11 15:51:13 +08:00
parent 6385dd163b
commit 3822488f26
5 changed files with 46 additions and 8 deletions

View File

@@ -346,6 +346,12 @@ public class CmsJobController extends BaseController
if (job.getJobContactList() == null) {
job.setJobContactList(new ArrayList<>());
}
return toAjax(jobService.insertJob(job));
Integer total=jobService.getTotals(job);
int totalNum = total != null ? total : 0;
System.out.println("岗位条数======================"+totalNum);
if (totalNum == 0) {
return toAjax(jobService.insertJob(job));
}
return AjaxResult.success("此岗位已存在!");
}
}

View File

@@ -58,4 +58,6 @@ public interface JobMapper extends BaseMapper<Job>
* @return
*/
Job getJobInfo(Long jobId);
Integer getTotals(Job job);
}

View File

@@ -103,4 +103,11 @@ public interface IJobService
public Job selectHttpJobByJobId(Long jobId, HttpServletRequest request);
public List<Job> selectHttpJobList(Job job,HttpServletRequest request);
/**
* 获取微信抓取的重复数据条数
* @param job
* @return
*/
public Integer getTotals(Job job);
}

View File

@@ -357,13 +357,13 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
{
int insert = jobMapper.insert(job);
//todo 线程池管理
Thread thread = new Thread(() -> {
VectorJob jobVector = jobMapper.selectVectorJob(job.getJobId());
jobVector.setJobUrl("http://39.98.44.136/app#/packageA/pages/post/post?jobId="+job.getJobId());
String jsonBody = JSONUtil.toJsonStr(jobVector);
HttpUtil.post("http://39.98.44.136:6004/insert_vector", jsonBody);
});
thread.start();
// Thread thread = new Thread(() -> {
// VectorJob jobVector = jobMapper.selectVectorJob(job.getJobId());
// jobVector.setJobUrl("http://39.98.44.136/app#/packageA/pages/post/post?jobId="+job.getJobId());
// String jsonBody = JSONUtil.toJsonStr(jobVector);
// HttpUtil.post("http://39.98.44.136:6004/insert_vector", jsonBody);
// });
// thread.start();
if(insert>0){
//添加联系人
List<JobContact> jobContactList = job.getJobContactList() != null ? job.getJobContactList() : Collections.emptyList();
@@ -1132,4 +1132,9 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
params.put("offset", offset*batchSize);
return jobMapper.selectAllJob(params);
}
@Override
public Integer getTotals(Job job) {
return jobMapper.getTotals(job);
}
}

View File

@@ -331,4 +331,22 @@
left join company as c on c.company_id = j.company_id and j.del_flag='0' and j.job_id=#{jobId}
and c.del_flag='0' limit 1
</select>
<select id="getTotals" parameterType="Job" resultType="java.lang.Integer">
select count(job_id) as total_count from job
<where> del_flag = '0'
<if test="companyName != null and companyName != ''"> and company_name =#{companyName}</if>
<if test="dataSource != null and dataSource!='' "> and data_source = #{dataSource}</if>
<if test="description != null and description!='' "> and description = #{description}</if>
<if test="education != null and education != ''"> and education = #{education}</if>
<if test="experience != null and experience != ''"> and experience = #{experience}</if>
<if test="isPublish != null "> and is_publish = #{isPublish}</if>
<if test="jobLocation != null and jobLocation != ''"> and job_location = #{jobLocation}</if>
<if test="jobTitle != null and jobTitle != ''"> and job_title = #{jobTitle}</if>
<if test="minSalary != null "> and min_salary = #{minSalary}</if>
<if test="maxSalary != null "> and max_salary = #{maxSalary}</if>
<if test="vacancies != null "> and vacancies = #{vacancies}</if>
</where>
</select>
</mapper>