USVT-136 测试完整的异步消息
This commit is contained in:
parent
36c3f92e78
commit
a54b20dc35
|
@ -57,7 +57,7 @@ public class ChatGPTService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public String processChatGPTContent(String weChatMessageXmlStr) {
|
public void processChatGPTContent(String weChatMessageXmlStr) {
|
||||||
WeChatMessage weChatMessage = WeChatUtils.covertToWeChatMessage(weChatMessageXmlStr);
|
WeChatMessage weChatMessage = WeChatUtils.covertToWeChatMessage(weChatMessageXmlStr);
|
||||||
String toUserName = weChatMessage.getFromUserName();
|
String toUserName = weChatMessage.getFromUserName();
|
||||||
String fromUserName = weChatMessage.getToUserName();
|
String fromUserName = weChatMessage.getToUserName();
|
||||||
|
@ -91,13 +91,12 @@ public class ChatGPTService {
|
||||||
weChatMessage.setCreateTime(Instant.now().toEpochMilli());
|
weChatMessage.setCreateTime(Instant.now().toEpochMilli());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
weChatService.sendMessage(toUserName);
|
weChatService.sendMessage(weChatMessage);
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return WeChatUtils.covertToWeChatMessageXmlStr(weChatMessage);
|
||||||
return WeChatUtils.covertToWeChatMessageXmlStr(weChatMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ public class WeChatService {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public String getWeChatMessage(String weChatMessageXmlStr) {
|
public String getWeChatMessage(String weChatMessageXmlStr) {
|
||||||
WeChatMessage weChatMessage = WeChatUtils.covertToWeChatMessage(weChatMessageXmlStr);
|
WeChatMessage weChatMessage = WeChatUtils.covertToWeChatMessage(weChatMessageXmlStr);
|
||||||
String toUserName = weChatMessage.getFromUserName();
|
String toUserName = weChatMessage.getFromUserName();
|
||||||
|
@ -179,11 +180,11 @@ public class WeChatService {
|
||||||
future.cancel(true); // may or may not desire this
|
future.cancel(true); // may or may not desire this
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
sendMessage(toUserName);
|
// sendMessage(toUserName);
|
||||||
} catch (WxErrorException e) {
|
// } catch (WxErrorException e) {
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// weChatMessage.setToUserName(toUserName);
|
// weChatMessage.setToUserName(toUserName);
|
||||||
// weChatMessage.setFromUserName(fromUserName);
|
// weChatMessage.setFromUserName(fromUserName);
|
||||||
|
@ -194,11 +195,11 @@ public class WeChatService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public void sendMessage(String toUserName) throws WxErrorException {
|
public void sendMessage(WeChatMessage weChatMessage) throws WxErrorException {
|
||||||
|
|
||||||
CustomMessage.KfText kfText = new CustomMessage.KfText("xxx");
|
CustomMessage.KfText kfText = new CustomMessage.KfText(weChatMessage.getContent());
|
||||||
CustomMessage customMessage = new CustomMessage();
|
CustomMessage customMessage = new CustomMessage();
|
||||||
customMessage.setToUser(toUserName);
|
customMessage.setToUser(weChatMessage.getToUserName());
|
||||||
customMessage.setMsgType("text");
|
customMessage.setMsgType("text");
|
||||||
customMessage.setText(kfText);
|
customMessage.setText(kfText);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue