Commit 92b46606 by 孙喜旺

会话存档定时任务修改

1 parent 14131f86
...@@ -32,21 +32,22 @@ public class ConversationArchiveTask { ...@@ -32,21 +32,22 @@ public class ConversationArchiveTask {
@Autowired @Autowired
private IWeChatContactMsgService weChatContactMsgService; private IWeChatContactMsgService weChatContactMsgService;
public void FinanceTask(String corpId, String secret, String privateKey){ public void FinanceTask(){
log.info("执行有参方法: params:{},{}", corpId, secret); log.info("会话存档定时任务执行----------------->");
Long seqLong = 0L; Long seqLong = 0L;
log.info(">>>>>>>seq:{}", seqLong); log.info(">>>>>>>seq:{}", seqLong);
if(StringUtils.isEmpty(privateKey)){ WeCorpAccount corpAccount = weCorpAccountService.findValidWeCorpAccount();
WeCorpAccount validWeCorpAccount = weCorpAccountService.findValidWeCorpAccount(); if(corpAccount == null){
privateKey = validWeCorpAccount.getFinancePrivateKey(); log.info("无有效企业----------------->");
return;
} }
LambdaQueryWrapper<WeChatContactMsg> wrapper = new LambdaQueryWrapper<WeChatContactMsg>().orderByDesc(WeChatContactMsg::getSeq).last("limit 1"); LambdaQueryWrapper<WeChatContactMsg> wrapper = new LambdaQueryWrapper<WeChatContactMsg>().orderByDesc(WeChatContactMsg::getSeq).last("limit 1");
WeChatContactMsg weChatContactMsg = weChatContactMsgService.getOne(wrapper); WeChatContactMsg weChatContactMsg = weChatContactMsgService.getOne(wrapper);
if(weChatContactMsg != null){ if(weChatContactMsg != null){
seqLong = weChatContactMsg.getSeq(); seqLong = weChatContactMsg.getSeq();
} }
FinanceService financeService = new FinanceService(corpId,secret,privateKey); FinanceService financeService = new FinanceService(corpAccount.getCorpId(),corpAccount.getChatSecret(),corpAccount.getFinancePrivateKey());
financeService.getChatData(seqLong,(data) -> redisCache.convertAndSend(WeConstans.CONVERSATION_MSG_CHANNEL,data)); financeService.getChatData(seqLong,(data) -> redisCache.convertAndSend(WeConstans.CONVERSATION_MSG_CHANNEL,data));
log.info("会话存档定时任务执行完成----------------->");
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!