|
@@ -64,14 +64,17 @@ public class RyTask
|
|
|
if(token.equals("")||(new Date().getTime()/1000 - tokentime)>exp){
|
|
|
getToken();
|
|
|
}
|
|
|
- try {
|
|
|
- DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
|
|
|
- OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request();
|
|
|
- request.setAgentId(agentId);
|
|
|
- request.setUseridList(userids);
|
|
|
- request.setToAllUser(false);
|
|
|
-
|
|
|
- OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
|
|
|
+ Thread t = new Thread(){
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
|
|
|
+ OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request();
|
|
|
+ request.setAgentId(agentId);
|
|
|
+ request.setUseridList(userids);
|
|
|
+ request.setToAllUser(false);
|
|
|
+
|
|
|
+ OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
|
|
|
// msg.setMsgtype("text");
|
|
|
// msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
|
|
|
// msg.getText().setContent("test123");
|
|
@@ -109,19 +112,23 @@ public class RyTask
|
|
|
// msg.setMsgtype("oa");
|
|
|
// request.setMsg(msg);
|
|
|
|
|
|
- msg.setActionCard(new OapiMessageCorpconversationAsyncsendV2Request.ActionCard());
|
|
|
- msg.getActionCard().setTitle(title);
|
|
|
- msg.getActionCard().setMarkdown(content==null?("### "+title):content);
|
|
|
- msg.getActionCard().setSingleTitle("测试测试"+new Date().getTime());
|
|
|
- msg.getActionCard().setSingleUrl(url);
|
|
|
- msg.setMsgtype("action_card");
|
|
|
- request.setMsg(msg);
|
|
|
- OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(request, token);
|
|
|
- log.debug("发送钉钉消息");
|
|
|
+ msg.setActionCard(new OapiMessageCorpconversationAsyncsendV2Request.ActionCard());
|
|
|
+ msg.getActionCard().setTitle(title);
|
|
|
+ msg.getActionCard().setMarkdown(content==null?("### "+title):content);
|
|
|
+ msg.getActionCard().setSingleTitle("测试测试"+new Date().getTime());
|
|
|
+ msg.getActionCard().setSingleUrl(url);
|
|
|
+ msg.setMsgtype("action_card");
|
|
|
+ request.setMsg(msg);
|
|
|
+ OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(request, token);
|
|
|
+ log.debug("发送钉钉消息");
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ t.run();
|
|
|
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|