Browse Source

Merge remote-tracking branch 'origin/dev_thirdplatform' into dev

dev_shibei_match
zxc 5 years ago
parent
commit
a2350e9714
  1. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java

@ -170,7 +170,9 @@ public class WarrantServiceImpl implements WarrantService {
codeResult = ModuleConstant.DELAY;
break;
}
log.info("开始寻找机器人发送消息");
this.dingDingRobot(reason,codeResult,customerName,client);
log.info("已找到robot,并发送消息......");
String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord);
codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult);
log.info("消息与事件接收URL【代码审核结果】结束......");
@ -240,6 +242,7 @@ public class WarrantServiceImpl implements WarrantService {
break;
}
request.setMarkdown(markdown);
log.info("robot需要发送的内容为:"+markdown.getTitle());
String url = "https://oapi.dingtalk.com/robot/send?access_token=2438902efbcc15909deb7076963c5cbe2d6fdbfdb9d66750faab2f2cce6eb09f";
String secret = "SECe3c785dd254659608667a4a623acc5a0395636143411617f6e36838b48941e74";
this.sendCodeMsg(request,url,secret);
@ -252,16 +255,17 @@ public class WarrantServiceImpl implements WarrantService {
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("&timestamp=" + timestamp + "&sign=" + sign);
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(request));
String data = stringResult.getData();
log.info("robot发送消息结果为:"+stringResult.getData());
return stringResult;
} catch (Exception e) {
e.printStackTrace();
}

Loading…
Cancel
Save