添加微信抓取判重的方法
This commit is contained in:
@@ -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("此岗位已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface JobMapper extends BaseMapper<Job>
|
||||
* @return
|
||||
*/
|
||||
Job getJobInfo(Long jobId);
|
||||
|
||||
Integer getTotals(Job job);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user