|
|
@@ -9,6 +9,7 @@ import com.vcarecity.publish.service.CheckTimeService;
|
|
9
|
9
|
import com.vcarecity.publish.service.LoadDataStatusService;
|
|
10
|
10
|
import com.vcarecity.publish.util.DateUtil;
|
|
11
|
11
|
import lombok.extern.slf4j.Slf4j;
|
|
|
12
|
+import org.springframework.beans.factory.annotation.Value;
|
|
12
|
13
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
13
|
14
|
import org.springframework.stereotype.Component;
|
|
14
|
15
|
|
|
|
@@ -32,6 +33,14 @@ public class CheckUpdateTask {
|
|
32
|
33
|
private final UnitMapper unitMapper;
|
|
33
|
34
|
|
|
34
|
35
|
|
|
|
36
|
+ @Value("${app.index.update-unit}")
|
|
|
37
|
+ private Boolean updateUnit;
|
|
|
38
|
+
|
|
|
39
|
+
|
|
|
40
|
+ @Value("${app.index.update-agency}")
|
|
|
41
|
+ private Boolean updateAgency;
|
|
|
42
|
+
|
|
|
43
|
+
|
|
35
|
44
|
public CheckUpdateTask(CheckTimeService checkTimeService,
|
|
36
|
45
|
ElasticUpdateService elasticUpdateService,
|
|
37
|
46
|
LoadDataStatusService loadDataStatusService, AgencyMapper agencyMapper,
|
|
|
@@ -60,41 +69,47 @@ public class CheckUpdateTask {
|
|
60
|
69
|
List<UnitAgencyMergeEntity> updateUaList;
|
|
61
|
70
|
String fromDateTime;
|
|
62
|
71
|
|
|
63
|
|
- // 获取上一次的时间
|
|
64
|
|
- fromDateTime = checkTimeService.getLastDateTime("T_UNIT");
|
|
|
72
|
+ if (updateUnit) {
|
|
|
73
|
+
|
|
|
74
|
+
|
|
|
75
|
+ // 获取上一次的时间
|
|
|
76
|
+ fromDateTime = checkTimeService.getLastDateTime("T_UNIT");
|
|
65
|
77
|
|
|
66
|
|
- logger.info("start checkUpdateTask on T_UNIT from:{}. to:{}", fromDateTime, toDateTime);
|
|
|
78
|
+ logger.info("start checkUpdateTask on T_UNIT from:{}. to:{}", fromDateTime, toDateTime);
|
|
67
|
79
|
|
|
68
|
|
- try {
|
|
69
|
|
- updateUaList = unitMapper.findUpdateUaList(fromDateTime, toDateTime);
|
|
|
80
|
+ try {
|
|
|
81
|
+ updateUaList = unitMapper.findUpdateUaList(fromDateTime, toDateTime);
|
|
70
|
82
|
|
|
71
|
|
- logger.debug("T_UNIT update list size = {}", updateUaList.size());
|
|
|
83
|
+ logger.debug("T_UNIT update list size = {}", updateUaList.size());
|
|
72
|
84
|
|
|
73
|
|
- if (!updateUaList.isEmpty()) {
|
|
74
|
|
- elasticUpdateService.handlerDataChange("unitId", updateUaList);
|
|
|
85
|
+ if (!updateUaList.isEmpty()) {
|
|
|
86
|
+ elasticUpdateService.handlerDataChange("unitId", updateUaList);
|
|
|
87
|
+ }
|
|
|
88
|
+ checkTimeService.setLastDateTime("T_UNIT", curCheckTime);
|
|
|
89
|
+ updateUaList.clear();
|
|
|
90
|
+ } catch (Exception e) {
|
|
|
91
|
+ e.printStackTrace();
|
|
75
|
92
|
}
|
|
76
|
|
- checkTimeService.setLastDateTime("T_UNIT", curCheckTime);
|
|
77
|
|
- updateUaList.clear();
|
|
78
|
|
- } catch (Exception e) {
|
|
79
|
|
- e.printStackTrace();
|
|
80
|
93
|
}
|
|
81
|
94
|
|
|
82
|
|
- fromDateTime = checkTimeService.getLastDateTime("T_AGENCY");
|
|
|
95
|
+ if (updateAgency) {
|
|
|
96
|
+ fromDateTime = checkTimeService.getLastDateTime("T_AGENCY");
|
|
83
|
97
|
|
|
84
|
|
- logger.info("start checkUpdateTask on T_AGENCY from:{}. to:{}", fromDateTime, toDateTime);
|
|
|
98
|
+ logger.info("start checkUpdateTask on T_AGENCY from:{}. to:{}", fromDateTime, toDateTime);
|
|
85
|
99
|
|
|
86
|
|
- try {
|
|
87
|
|
- updateUaList = agencyMapper.findUpdateUaList(fromDateTime, toDateTime);
|
|
|
100
|
+ try {
|
|
|
101
|
+ updateUaList = agencyMapper.findUpdateUaList(fromDateTime, toDateTime);
|
|
88
|
102
|
|
|
89
|
|
- logger.debug("T_AGENCY update list size = {}", updateUaList.size());
|
|
|
103
|
+ logger.debug("T_AGENCY update list size = {}", updateUaList.size());
|
|
90
|
104
|
|
|
91
|
|
- if (!updateUaList.isEmpty()) {
|
|
92
|
|
- elasticUpdateService.handlerDataChange("agencyId", updateUaList);
|
|
|
105
|
+ if (!updateUaList.isEmpty()) {
|
|
|
106
|
+ elasticUpdateService.handlerDataChange("agencyId", updateUaList);
|
|
|
107
|
+ }
|
|
|
108
|
+ checkTimeService.setLastDateTime("T_AGENCY", curCheckTime);
|
|
|
109
|
+ updateUaList.clear();
|
|
|
110
|
+ } catch (Exception e) {
|
|
|
111
|
+ e.printStackTrace();
|
|
93
|
112
|
}
|
|
94
|
|
- checkTimeService.setLastDateTime("T_AGENCY", curCheckTime);
|
|
95
|
|
- updateUaList.clear();
|
|
96
|
|
- } catch (Exception e) {
|
|
97
|
|
- e.printStackTrace();
|
|
98
|
113
|
}
|
|
99
|
114
|
}
|
|
100
|
115
|
|