Browse Source

定时任务

傅行帆 3 years ago
parent
commit
1e80a4a1b6

+ 5
- 0
src/main/java/com/yunzhi/marketing/entity/TaRecommendCustomer.java View File

151
 
151
 
152
     private LocalDateTime verifyDate;
152
     private LocalDateTime verifyDate;
153
 
153
 
154
+    /**
155
+     * 流转使劲
156
+     */
157
+    private LocalDateTime circulationTime;
158
+
154
     /**
159
     /**
155
      * 组织结构id
160
      * 组织结构id
156
      */
161
      */

+ 32
- 0
src/main/java/com/yunzhi/marketing/job/CustomerTimeJob.java View File

1
+package com.yunzhi.marketing.job;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.yunzhi.marketing.common.CommConstant;
5
+import com.yunzhi.marketing.entity.TaRecommendCustomer;
6
+import com.yunzhi.marketing.service.ITaRecommendCustomerService;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+
9
+import java.time.LocalDateTime;
10
+import java.util.List;
11
+
12
+public class CustomerTimeJob {
13
+
14
+    @Autowired
15
+    private ITaRecommendCustomerService taRecommendCustomerService;
16
+
17
+    //    @Scheduled(cron = "* 0/1 * * * ?")
18
+    private void customerTimeJob() {
19
+        LocalDateTime nowDate = LocalDateTime.now();
20
+        LocalDateTime beforeTime = nowDate.plusDays(-15);
21
+        LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
22
+        queryWrapper.between(TaRecommendCustomer::getCirculationTime,beforeTime,nowDate);
23
+        queryWrapper.eq(TaRecommendCustomer::getVerifyStatus, CommConstant.VERIFY_AGREE);
24
+        List<TaRecommendCustomer> list = taRecommendCustomerService.list(queryWrapper);
25
+        list.forEach(e -> {
26
+            e.setBuildingId(null);
27
+            e.setRealtyConsultant(null);
28
+            e.setRecommendPerson(null);
29
+        });
30
+        taRecommendCustomerService.updateBatchById(list);
31
+    }
32
+}

+ 2
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java View File

533
             recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
533
             recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
534
             recommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
534
             recommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
535
             recommendCustomer.setRecommendPerson(consultant.getPersonId());
535
             recommendCustomer.setRecommendPerson(consultant.getPersonId());
536
+            recommendCustomer.setCirculationTime(LocalDateTime.now());
536
             customerFrom.setIsProjectFirst(true);
537
             customerFrom.setIsProjectFirst(true);
537
             customerFrom.setIsOrgFirst(true);
538
             customerFrom.setIsOrgFirst(true);
538
         }
539
         }
1003
             }
1004
             }
1004
         }
1005
         }
1005
 
1006
 
1007
+        taRecommendCustomer.setCirculationTime(LocalDateTime.now());
1006
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
1008
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
1007
         if (row < 1) {
1009
         if (row < 1) {
1008
             return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);
1010
             return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);

+ 4
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java View File

78
             taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
78
             taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
79
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
79
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
80
             taRecommendCustomer.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
80
             taRecommendCustomer.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
81
+            taRecommendCustomer.setCirculationTime(LocalDateTime.now());
81
             taRecommendCustomerMapper.insert(taRecommendCustomer);
82
             taRecommendCustomerMapper.insert(taRecommendCustomer);
82
             return ResponseBean.success("审核成功");
83
             return ResponseBean.success("审核成功");
83
         }
84
         }
131
                 taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
132
                 taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
132
                 taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
133
                 taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
133
                 taRecommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
134
                 taRecommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
135
+                taRecommendCustomer.setCirculationTime(LocalDateTime.now());
134
                 taRecommendCustomerMapper.insert(taRecommendCustomer);
136
                 taRecommendCustomerMapper.insert(taRecommendCustomer);
135
                 return ResponseBean.success("审核成功");
137
                 return ResponseBean.success("审核成功");
136
             }
138
             }
146
                 recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
148
                 recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
147
                 recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
149
                 recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
148
                 recommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
150
                 recommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
151
+                recommendCustomer.setCirculationTime(LocalDateTime.now());
149
                 taRecommendCustomerMapper.updateById(recommendCustomer);
152
                 taRecommendCustomerMapper.updateById(recommendCustomer);
150
                 return ResponseBean.success("审核成功");
153
                 return ResponseBean.success("审核成功");
151
             }
154
             }
154
             TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getId());
157
             TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getId());
155
             taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
158
             taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
156
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
159
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
160
+            taRecommendCustomer.setCirculationTime(LocalDateTime.now());
157
             taRecommendCustomerMapper.updateById(taRecommendCustomer);
161
             taRecommendCustomerMapper.updateById(taRecommendCustomer);
158
             return ResponseBean.success("审核成功");
162
             return ResponseBean.success("审核成功");
159
         }
163
         }