Commit 09841cd4 by danmo

fix

1 parent 9c0e0e13
...@@ -167,6 +167,7 @@ forest: ...@@ -167,6 +167,7 @@ forest:
wecome: wecome:
chatKey: finance
serverUrl: https://qyapi.weixin.qq.com/ serverUrl: https://qyapi.weixin.qq.com/
weComePrefix: cgi-bin weComePrefix: cgi-bin
noAccessTokenUrl: noAccessTokenUrl:
......
...@@ -19,6 +19,7 @@ import org.elasticsearch.search.sort.SortBuilder; ...@@ -19,6 +19,7 @@ import org.elasticsearch.search.sort.SortBuilder;
import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
...@@ -53,6 +54,9 @@ public class RyTask { ...@@ -53,6 +54,9 @@ public class RyTask {
@Autowired @Autowired
private IWeCustomerMessageService weCustomerMessageService; private IWeCustomerMessageService weCustomerMessageService;
@Value("${wecome.chatKey}")
private String chartKey;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
...@@ -70,7 +74,7 @@ public class RyTask { ...@@ -70,7 +74,7 @@ public class RyTask {
public void FinanceTask(String corpId, String secret) throws IOException { public void FinanceTask(String corpId, String secret) throws IOException {
log.info("执行有参方法: params:{},{}", corpId, secret); log.info("执行有参方法: params:{},{}", corpId, secret);
//创建索引 //创建索引
elasticSearch.createIndex2(WeConstans.WECOM_FINANCE_INDEX, elasticSearch.getFinanceMapping()); elasticSearch.createIndex2(chartKey, elasticSearch.getFinanceMapping());
//从缓存中获取消息标识 //从缓存中获取消息标识
Object seqObject = Optional.ofNullable(redisCache.getCacheObject(WeConstans.CONTACT_SEQ_KEY)).orElse(0L); Object seqObject = Optional.ofNullable(redisCache.getCacheObject(WeConstans.CONTACT_SEQ_KEY)).orElse(0L);
...@@ -90,7 +94,7 @@ public class RyTask { ...@@ -90,7 +94,7 @@ public class RyTask {
List<JSONObject> elasticSearchEntities = weChatContactMappingService.saveWeChatContactMapping(chatDataList); List<JSONObject> elasticSearchEntities = weChatContactMappingService.saveWeChatContactMapping(chatDataList);
//获取敏感行为命中信息 //获取敏感行为命中信息
weSensitiveActHitService.hitWeSensitiveAct(chatDataList); weSensitiveActHitService.hitWeSensitiveAct(chatDataList);
elasticSearch.insertBatchAsync(WeConstans.WECOM_FINANCE_INDEX, elasticSearchEntities, weSensitiveService::hitSensitive); elasticSearch.insertBatchAsync(chartKey, elasticSearchEntities, weSensitiveService::hitSensitive);
} catch (Exception e) { } catch (Exception e) {
log.error("消息处理异常:ex:{}", e); log.error("消息处理异常:ex:{}", e);
e.printStackTrace(); e.printStackTrace();
...@@ -118,7 +122,7 @@ public class RyTask { ...@@ -118,7 +122,7 @@ public class RyTask {
SortBuilder<?> sortBuilderPrice = SortBuilders.fieldSort(WeConstans.CONTACT_SEQ_KEY).order(SortOrder.DESC); SortBuilder<?> sortBuilderPrice = SortBuilders.fieldSort(WeConstans.CONTACT_SEQ_KEY).order(SortOrder.DESC);
searchSourceBuilder.sort(sortBuilderPrice); searchSourceBuilder.sort(sortBuilderPrice);
searchSourceBuilder.size(1); searchSourceBuilder.size(1);
List<JSONObject> searchResultList = elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, searchSourceBuilder, JSONObject.class); List<JSONObject> searchResultList = elasticSearch.search(chartKey, searchSourceBuilder, JSONObject.class);
searchResultList.stream().findFirst().ifPresent(result -> { searchResultList.stream().findFirst().ifPresent(result -> {
index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1); index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1);
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!