kerry il y a 4 ans
Parent
révision
8e493c10f5

+ 3 - 0
elastic-publish-service/req/http-client.env.json Voir le fichier

@@ -7,5 +7,8 @@
7 7
   },
8 8
   "beta-out": {
9 9
     "host": "http://103.239.204.35:8092"
10
+  },
11
+  "beta-out-2": {
12
+    "host": "http://103.239.204.35:8094"
10 13
   }
11 14
 }

+ 16 - 1
elastic-publish-service/req/load.http Voir le fichier

@@ -1,3 +1,18 @@
1
+
1 2
 GET http://{{host}}/load
2 3
 
3
-### load data
4
+### load data
5
+
6
+GET http://{{host}}/set-load
7
+
8
+### load data
9
+
10
+
11
+GET http://{{host}}/loadByAgencyIds?agencyIds=190084,196581
12
+
13
+### load data
14
+
15
+
16
+GET http://{{host}}/loadByUnitIds?unitIds=545775
17
+
18
+### load by unitId

+ 2 - 20
elastic-publish-service/req/main-controller.http Voir le fichier

@@ -21,9 +21,9 @@ Content-Type: application/json
21 21
 
22 22
 {
23 23
   "agencyPath": "/1",
24
-  "keyword": "33E9D1",
24
+  "keyword": "宁县店",
25 25
   "page": 1,
26
-  "size": 10,
26
+  "size": 20,
27 27
   "regulatoryLevelId": "",
28 28
   "property": "",
29 29
   "classify": "",
@@ -33,21 +33,3 @@ Content-Type: application/json
33 33
 
34 34
 ### 详情信息
35 35
 
36
-
37
-GET http://{{host}}/load
38
-
39
-### load data
40
-
41
-GET http://{{host}}/set-load
42
-
43
-### load data
44
-
45
-
46
-GET http://{{host}}/loadByAgencyIds?agencyIds=190084,196581
47
-
48
-### load data
49
-
50
-
51
-GET http://{{host}}/loadByUnitIds?unitIds=545775
52
-
53
-### load by unitId

+ 1 - 0
elastic-publish-service/src/main/java/com/vcarecity/publish/elastic/service/ElasticUpdateService.java Voir le fichier

@@ -34,6 +34,7 @@ public interface ElasticUpdateService {
34 34
      * @return
35 35
      * @throws IOException
36 36
      */
37
+    @Deprecated
37 38
     List<UnitAgencyMergeEntity> updateDataByQuery(String key, List<UnitAgencyMergeEntity> data) throws IOException;
38 39
 
39 40
 

+ 8 - 1
elastic-publish-service/src/main/java/com/vcarecity/publish/elastic/service/impl/ElasticUpdateServiceImpl.java Voir le fichier

@@ -32,6 +32,7 @@ import java.util.ArrayList;
32 32
 import java.util.HashMap;
33 33
 import java.util.List;
34 34
 import java.util.Map;
35
+import java.util.stream.Collectors;
35 36
 
36 37
 /**
37 38
  * @author Kerry on 12/17/19
@@ -107,7 +108,12 @@ public class ElasticUpdateServiceImpl implements ElasticUpdateService {
107 108
             return;
108 109
         }
109 110
         // 更新数据
110
-        List<UnitAgencyMergeEntity> addData = updateDataByQuery(key, updateList);
111
+        // List<UnitAgencyMergeEntity> addData = updateDataByQuery(key, updateList);
112
+
113
+        // 2020年2月26日
114
+        List<Long> collect = updateList.stream().map(UnitAgencyMergeEntity::getUnitId).collect(Collectors.toList());
115
+        this.deleteByQuery(key, collect);
116
+        List<UnitAgencyMergeEntity> addData = updateList;
111 117
 
112 118
         logger.info("add data size = {}", addData.size());
113 119
 
@@ -128,6 +134,7 @@ public class ElasticUpdateServiceImpl implements ElasticUpdateService {
128 134
         }
129 135
     }
130 136
 
137
+
131 138
     @Override
132 139
     public List<UnitAgencyMergeEntity> updateDataByQuery(String key, List<UnitAgencyMergeEntity> data) throws IOException {
133 140
         List<UnitAgencyMergeEntity> addList = new ArrayList<>();

+ 5 - 4
elastic-publish-service/src/main/java/com/vcarecity/publish/service/impl/CheckTimeServiceImpl.java Voir le fichier

@@ -3,6 +3,7 @@ package com.vcarecity.publish.service.impl;
3 3
 import com.vcarecity.publish.constants.ElasticConstant;
4 4
 import com.vcarecity.publish.service.CheckTimeService;
5 5
 import com.vcarecity.publish.util.DateUtil;
6
+import org.springframework.beans.factory.annotation.Value;
6 7
 import org.springframework.data.redis.core.RedisTemplate;
7 8
 import org.springframework.stereotype.Service;
8 9
 
@@ -18,10 +19,10 @@ import java.util.Date;
18 19
 public class CheckTimeServiceImpl implements CheckTimeService {
19 20
 
20 21
 
21
-    public static final String REDIS_KEY_PREFIX = "elastic:";
22
-
23 22
     private final RedisTemplate<String, Object> redisTemplate;
24 23
 
24
+    @Value("${app.redis-key-prefix}")
25
+    private String redisKeyPrefix;
25 26
 
26 27
     public CheckTimeServiceImpl(RedisTemplate<String, Object> redisTemplate) {
27 28
         this.redisTemplate = redisTemplate;
@@ -29,7 +30,7 @@ public class CheckTimeServiceImpl implements CheckTimeService {
29 30
 
30 31
     @Override
31 32
     public String getLastDateTime(String key) {
32
-        String redisKey = REDIS_KEY_PREFIX + key;
33
+        String redisKey = redisKeyPrefix + key;
33 34
 
34 35
         Object value = redisTemplate.opsForValue().get(redisKey);
35 36
         long last;
@@ -45,7 +46,7 @@ public class CheckTimeServiceImpl implements CheckTimeService {
45 46
 
46 47
     @Override
47 48
     public void setLastDateTime(String key, long lastDateTime) {
48
-        String redisKey = REDIS_KEY_PREFIX + key;
49
+        String redisKey = redisKeyPrefix + key;
49 50
         redisTemplate.opsForValue().set(redisKey, lastDateTime);
50 51
     }
51 52
 }

+ 1 - 0
elastic-publish-service/src/main/resources/application-beta.yml Voir le fichier

@@ -24,6 +24,7 @@ mybatis:
24 24
     map-underscore-to-camel-case: true
25 25
 debug: true
26 26
 app:
27
+  redis-key-prefix: "elastic:2:"
27 28
   index:
28 29
     name: unit-agency
29 30
     config: index-text

+ 1 - 0
elastic-publish-service/src/main/resources/application-dev.yml Voir le fichier

@@ -25,6 +25,7 @@ mybatis:
25 25
     map-underscore-to-camel-case: true
26 26
 debug: true
27 27
 app:
28
+  redis-key-prefix: "elastic:2:"
28 29
   index:
29 30
     name: unit-agency
30 31
     config: index-text

+ 1 - 0
elastic-publish-service/src/main/resources/application-production.yml Voir le fichier

@@ -26,6 +26,7 @@ mybatis:
26 26
   configuration:
27 27
     map-underscore-to-camel-case: true
28 28
 app:
29
+  redis-key-prefix: "elastic:2:"
29 30
   index:
30 31
     name: unit-agency
31 32
     config: index-text