|
|
@ -195,11 +195,8 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
// String returnContent = content+ModuleConstant._CALL_BACK;
|
|
|
|
String returnContent = "TESTCOMPONENT_MSG_TYPE_TEXT_callback"; |
|
|
|
log.info("拼接的回复内容【普通】:"+returnContent); |
|
|
|
String resultContent = replyTextMessage(request, response, returnContent, toUserName, fromUserName); |
|
|
|
log.info("加密的回复内容为:"+result); |
|
|
|
PrintWriter pw = response.getWriter(); |
|
|
|
pw.write(resultContent); |
|
|
|
pw.flush(); |
|
|
|
replyTextMessage(request, response, returnContent, toUserName, fromUserName); |
|
|
|
|
|
|
|
}else if(StringUtils.startsWithIgnoreCase(content, ModuleConstant.QUERY_AUTH_CODE)){ |
|
|
|
PrintWriter pw = response.getWriter();//需在5秒内返回空串表明暂时不回复,然后再立即使用客服消息接口发送消息回复粉丝
|
|
|
|
pw.write(""); |
|
|
@ -243,14 +240,9 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
break; |
|
|
|
} |
|
|
|
request.setMarkdown(markdown); |
|
|
|
try { |
|
|
|
String url = "https://oapi.dingtalk.com/robot/send?access_token=2438902efbcc15909deb7076963c5cbe2d6fdbfdb9d66750faab2f2cce6eb09f"; |
|
|
|
String secret = "SECe3c785dd254659608667a4a623acc5a0395636143411617f6e36838b48941e74"; |
|
|
|
this.sendCodeMsg(request,url,secret); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("机器人生病了......"); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
String url = "https://oapi.dingtalk.com/robot/send?access_token=2438902efbcc15909deb7076963c5cbe2d6fdbfdb9d66750faab2f2cce6eb09f"; |
|
|
|
String secret = "SECe3c785dd254659608667a4a623acc5a0395636143411617f6e36838b48941e74"; |
|
|
|
this.sendCodeMsg(request,url,secret); |
|
|
|
} |
|
|
|
/* |
|
|
|
public static void main(String[] args) { |
|
|
@ -295,10 +287,7 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
throws DocumentException, IOException { |
|
|
|
log.info("================ event + from_callback..................."); |
|
|
|
String content = event + ModuleConstant.FROM_CALLBACK; |
|
|
|
String s = replyTextMessage(request, response, content, toUserName, fromUserName); |
|
|
|
PrintWriter pw = response.getWriter(); |
|
|
|
pw.write(s); |
|
|
|
pw.flush(); |
|
|
|
replyTextMessage(request, response, content, toUserName, fromUserName); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -326,7 +315,7 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
* @param fromUserName 发送人 |
|
|
|
* @author zxc |
|
|
|
*/ |
|
|
|
public String replyTextMessage(HttpServletRequest request, HttpServletResponse response, |
|
|
|
public void replyTextMessage(HttpServletRequest request, HttpServletResponse response, |
|
|
|
String content,String toUserName, String fromUserName) |
|
|
|
throws DocumentException, IOException { |
|
|
|
Long createTime = System.currentTimeMillis() / NumConstant.ONE_THOUSAND; |
|
|
@ -346,10 +335,12 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
try { |
|
|
|
wxBizMsgCrypt = new WXBizMsgCrypt(token,aesKey,componentAppId); |
|
|
|
generate = wxBizMsgCrypt.encryptMsg(replyMsg, String.valueOf(createTime), wxBizMsgCrypt.getRandomStr()); |
|
|
|
PrintWriter pw = response.getWriter(); |
|
|
|
pw.write(generate); |
|
|
|
pw.flush(); |
|
|
|
} catch (AesException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return generate; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|