|
@@ -1,6 +1,5 @@
|
|
|
package com.tzld.piaoquan.api.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.tzld.piaoquan.api.dao.mapper.AutoReplyMsgSendRecordMapper;
|
|
@@ -9,6 +8,7 @@ import com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecord;
|
|
|
import com.tzld.piaoquan.api.model.vo.WeComPushMessageVo;
|
|
|
import com.tzld.piaoquan.api.service.WeComAutoReply;
|
|
|
import com.tzld.piaoquan.api.service.WeComService;
|
|
|
+import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
|
|
|
import com.tzld.piaoquan.growth.common.dao.mapper.CorpMapper;
|
|
|
import com.tzld.piaoquan.growth.common.model.bo.MsgResult;
|
|
|
import com.tzld.piaoquan.growth.common.model.po.Corp;
|
|
@@ -17,15 +17,14 @@ import com.tzld.piaoquan.growth.common.service.MessageService;
|
|
|
import com.tzld.piaoquan.growth.common.service.WeComUserService;
|
|
|
import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import lombok.val;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.Random;
|
|
|
|
|
|
@Slf4j
|
|
@@ -47,11 +46,18 @@ public class WeComAutoReplyImpl implements WeComAutoReply {
|
|
|
@Autowired
|
|
|
private WeComUserService weComUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HttpPoolClient httpPoolClient;
|
|
|
+
|
|
|
@Autowired
|
|
|
private AutoReplyMsgSendRecordMapper autoReplyMsgSendRecordMapper;
|
|
|
|
|
|
@Override
|
|
|
public void AutoReplyMessage(String externalUserId, String userId, Long corpId) {
|
|
|
+ if (!Objects.equals(userId, "SongYi")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
Corp corp = corpMapper.selectByPrimaryKey(corpId);
|
|
|
String corpCorpId = corp.getCorpId();
|
|
|
List<WeComPushMessageVo> weComPushMessageVoList = weComService.getPushMessageByUserId(userId);
|
|
@@ -124,6 +130,7 @@ public class WeComAutoReplyImpl implements WeComAutoReply {
|
|
|
long resultTime = System.currentTimeMillis();
|
|
|
for (AutoReplyMsgSendRecord autoReplyMsgSendRecord : autoReplyMsgSendRecords) {
|
|
|
try {
|
|
|
+ autoReplyMsgSendRecord.setMsgId(0L);
|
|
|
if (msgResult.getErrcode() == 0) {
|
|
|
autoReplyMsgSendRecord.setStatus(1);
|
|
|
} else {
|
|
@@ -132,6 +139,7 @@ public class WeComAutoReplyImpl implements WeComAutoReply {
|
|
|
}
|
|
|
autoReplyMsgSendRecord.setSendTimestamp(resultTime);
|
|
|
autoReplyMsgSendRecordMapper.insertSelective(autoReplyMsgSendRecord);
|
|
|
+ sendResult(autoReplyMsgSendRecord);
|
|
|
} catch (Exception e) {
|
|
|
log.error("saveAutoReplyMsgSendRecord error", e);
|
|
|
}
|
|
@@ -157,4 +165,14 @@ public class WeComAutoReplyImpl implements WeComAutoReply {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ private void sendResult(AutoReplyMsgSendRecord autoReplyMsgSendRecord) {
|
|
|
+ try {
|
|
|
+ String url = "http://aigc-api.cybertogether.net//aigc/publish/api/saveWorkWxAutoReplyMsgSendRecords";
|
|
|
+ String res = httpPoolClient.post(url, JSONObject.toJSONString(autoReplyMsgSendRecord));
|
|
|
+ log.info("WeComAutoReplyImpl sendResult res={}", res);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("sendResult error", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|