Commit c2fd3bc5 by sunxiwang

fix

1 parent 514bfbe9
......@@ -167,6 +167,7 @@ forest:
wecome:
chatKey: finance
serverUrl: https://qyapi.weixin.qq.com/
weComePrefix: cgi-bin
noAccessTokenUrl:
......
......@@ -19,6 +19,7 @@ import org.elasticsearch.search.sort.SortBuilder;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.IOException;
......@@ -53,6 +54,9 @@ public class RyTask {
@Autowired
private IWeCustomerMessageService weCustomerMessageService;
@Value("${wecome.chatKey}")
private String chartKey;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
......@@ -70,7 +74,7 @@ public class RyTask {
public void FinanceTask(String corpId, String secret) throws IOException {
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);
......@@ -90,7 +94,7 @@ public class RyTask {
List<JSONObject> elasticSearchEntities = weChatContactMappingService.saveWeChatContactMapping(chatDataList);
//获取敏感行为命中信息
weSensitiveActHitService.hitWeSensitiveAct(chatDataList);
elasticSearch.insertBatchAsync(WeConstans.WECOM_FINANCE_INDEX, elasticSearchEntities, weSensitiveService::hitSensitive);
elasticSearch.insertBatchAsync(chartKey, elasticSearchEntities, weSensitiveService::hitSensitive);
} catch (Exception e) {
log.error("消息处理异常:ex:{}", e);
e.printStackTrace();
......@@ -118,7 +122,7 @@ public class RyTask {
SortBuilder<?> sortBuilderPrice = SortBuilders.fieldSort(WeConstans.CONTACT_SEQ_KEY).order(SortOrder.DESC);
searchSourceBuilder.sort(sortBuilderPrice);
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 -> {
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!