|
|
@ -163,7 +163,7 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
break; |
|
|
|
} |
|
|
|
log.info("开始寻找机器人发送消息"); |
|
|
|
this.dingDingRobot(reason,codeResult,customerName,client); |
|
|
|
this.dingDingRobot(reason,event,customerName,client); |
|
|
|
log.info("已找到robot,并发送消息......"); |
|
|
|
String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); |
|
|
|
codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); |
|
|
@ -193,7 +193,6 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
PrintWriter pw = response.getWriter();//需在5秒内返回空串表明暂时不回复,然后再立即使用客服消息接口发送消息回复粉丝
|
|
|
|
pw.write(""); |
|
|
|
pw.flush(); |
|
|
|
|
|
|
|
log.info(String.format(ThirdRunTimeInfoConstant.TEXT_MESSAGE_LOG_INFO,content,content.split(ThirdRedisKeyConstant.COLON)[NumConstant.ONE],fromUserName,toUserName)); |
|
|
|
//接下来客服API再回复一次消息
|
|
|
|
String[] split = content.split(ThirdRedisKeyConstant.COLON); |
|
|
@ -239,34 +238,9 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
log.info("robot需要发送的内容为:"+markdown.getText()); |
|
|
|
String url = "https://oapi.dingtalk.com/robot/send?access_token=2438902efbcc15909deb7076963c5cbe2d6fdbfdb9d66750faab2f2cce6eb09f"; |
|
|
|
String secret = "SECe3c785dd254659608667a4a623acc5a0395636143411617f6e36838b48941e74"; |
|
|
|
this.sendCodeMsg(request,url,secret); |
|
|
|
HttpClientManager.getInstance().sendDingMsg(JSON.toJSONString(request),url,secret); |
|
|
|
} |
|
|
|
// public static void main(String[] args) {
|
|
|
|
// WarrantServiceImpl w = new WarrantServiceImpl();
|
|
|
|
// w.dingDingRobot("审核失败","weapp_audit_fail","机器人测试","居民端");
|
|
|
|
// }
|
|
|
|
|
|
|
|
public Result<String> sendCodeMsg(OapiRobotSendRequest request,String url,String secret) { |
|
|
|
Long timestamp = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
String stringToSign = timestamp + "\n" + secret; |
|
|
|
Mac mac = Mac.getInstance("HmacSHA256"); |
|
|
|
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256")); |
|
|
|
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8")); |
|
|
|
String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8"); |
|
|
|
log.info("sign为:"+sign); |
|
|
|
url = url.concat("×tamp=" + timestamp + "&sign=" + sign); |
|
|
|
log.info("发送url:"+url); |
|
|
|
String requestString = JSON.toJSONString(request); |
|
|
|
log.info("发送内容:"+requestString); |
|
|
|
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, requestString); |
|
|
|
log.info("robot发送消息结果为:"+stringResult.getData()); |
|
|
|
return stringResult; |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return new Result<String>().error(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 方法描述: 类型为event的时候,拼接 |
|
|
|