|
|
@@ -0,0 +1,65 @@
|
|
|
+package com.jeeplus.modules.cmcandidate.timeTask;
|
|
|
+
|
|
|
+import com.jeeplus.common.config.Global;
|
|
|
+import com.jeeplus.modules.cmcandidate.entity.CmCandidateBelongDetail;
|
|
|
+import com.jeeplus.modules.cmcandidate.entity.CmCandidateTrack;
|
|
|
+import com.jeeplus.modules.cmcandidate.mapper.CmCandidateTrackMapper;
|
|
|
+import com.jeeplus.modules.cmcandidate.service.CmCandidateBelongDetailService;
|
|
|
+import com.jeeplus.modules.cmcandidate.service.CmCandidateTrackService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author: zwq
|
|
|
+ * @Description:
|
|
|
+ * @Date: Create in 13:27 2019/10/14
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Lazy(false)
|
|
|
+public class TimeTask {
|
|
|
+ @Autowired
|
|
|
+ private CmCandidateTrackMapper cmCandidateTrackMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CmCandidateTrackService cmCandidateTrackService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CmCandidateBelongDetailService cmCandidateBelongDetailService;
|
|
|
+ /**
|
|
|
+ * 每天凌晨两点执行任务:90天未跟进丢入公海
|
|
|
+ */
|
|
|
+ @Scheduled(cron = "0 30 10 * * ?")
|
|
|
+ @Transactional
|
|
|
+ public void candidatetToSea() {
|
|
|
+ List<CmCandidateTrack> list = cmCandidateTrackMapper.findBeyondContactDaysTrack(Integer.parseInt(Global.getCrmAutoDate()));
|
|
|
+ if(list!=null && list.size()>0) {
|
|
|
+ for(CmCandidateTrack track:list) {
|
|
|
+ CmCandidateTrack cmCandidateTrack = new CmCandidateTrack();
|
|
|
+ CmCandidateBelongDetail cmCandidateBelongDetail = new CmCandidateBelongDetail();
|
|
|
+ //更新track表
|
|
|
+ cmCandidateTrack.setId(track.getId());
|
|
|
+ cmCandidateTrack.setBelongOwner("0");
|
|
|
+ cmCandidateTrack.setBelongUser("");
|
|
|
+ cmCandidateTrack.setBeginBelongTime(new Date());
|
|
|
+ cmCandidateTrack.setAssignmentBy("系统");
|
|
|
+ cmCandidateTrack.setBelongReason("到期未联系,自动移入公海");
|
|
|
+ cmCandidateTrackService.save(cmCandidateTrack);
|
|
|
+
|
|
|
+ //新增归属表
|
|
|
+ cmCandidateBelongDetail.setCandidateTrackId(Integer.parseInt(track.getId()));
|
|
|
+ cmCandidateBelongDetail.setBelongOwner("0");
|
|
|
+ cmCandidateBelongDetail.setBelongUser("");
|
|
|
+ cmCandidateBelongDetail.setBelongTime(new Date());
|
|
|
+ cmCandidateBelongDetail.setAssignmentBy("系统");
|
|
|
+ cmCandidateBelongDetail.setBelongReason("到期未联系,自动移入公海");
|
|
|
+ cmCandidateBelongDetailService.save(cmCandidateBelongDetail);// 更新
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|