|
|
@ -3,6 +3,10 @@ package com.epmet.service.impl; |
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.nacos.client.config.utils.IOUtils; |
|
|
|
import com.dingtalk.api.DefaultDingTalkClient; |
|
|
|
import com.dingtalk.api.DingTalkClient; |
|
|
|
import com.dingtalk.api.request.OapiRobotSendRequest; |
|
|
|
import com.dingtalk.api.response.OapiRobotSendResponse; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
@ -24,6 +28,7 @@ import com.epmet.wxapi.constant.WxMaCodeConstant; |
|
|
|
import com.fasterxml.jackson.core.JsonEncoding; |
|
|
|
import com.fasterxml.jackson.core.JsonGenerator; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.taobao.api.ApiException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.dom4j.DocumentException; |
|
|
@ -139,16 +144,20 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); |
|
|
|
// 修改 code_audit_result 中的代码审核结果
|
|
|
|
// String event = codeAuditRecord.getEvent();
|
|
|
|
String reason = codeAuditRecord.getReason(); |
|
|
|
String codeResult = null; |
|
|
|
switch (event) { |
|
|
|
case ModuleConstant.WEAPP_AUDIT_SUCCESS: |
|
|
|
codeResult = ModuleConstant.AUDIT_SUCCESS; |
|
|
|
this.dingDingRobot(reason,null); |
|
|
|
break; |
|
|
|
case ModuleConstant.WEAPP_AUDIT_FAIL: |
|
|
|
codeResult = ModuleConstant.AUDIT_FAILED; |
|
|
|
this.dingDingRobot(reason,codeResult); |
|
|
|
break; |
|
|
|
case ModuleConstant.WEAPP_AUDIT_DELAY: |
|
|
|
codeResult = ModuleConstant.DELAY; |
|
|
|
this.dingDingRobot(reason,codeResult); |
|
|
|
break; |
|
|
|
} |
|
|
|
String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); |
|
|
@ -190,6 +199,33 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
|
return ModuleConstant.SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
public void dingDingRobot(String result,String event){ |
|
|
|
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=5b48fcbc3fde24b8ba4696aa062b7f8146479a9d3467dbb1f9cf132ec36b955a"); |
|
|
|
OapiRobotSendRequest request = new OapiRobotSendRequest(); |
|
|
|
request.setMsgtype("text"); |
|
|
|
OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text(); |
|
|
|
switch (event){ |
|
|
|
case ModuleConstant.WEAPP_AUDIT_SUCCESS: |
|
|
|
text.setContent("代码审核结果: 审核成功"); |
|
|
|
break; |
|
|
|
case ModuleConstant.WEAPP_AUDIT_FAIL: |
|
|
|
text.setContent("代码审核结果: 审核不通过,"+ |
|
|
|
"不通过原因:"+result); |
|
|
|
break; |
|
|
|
case ModuleConstant.WEAPP_AUDIT_DELAY: |
|
|
|
text.setContent("代码审核结果: 审核延时,"+ |
|
|
|
"延时原因:"+result); |
|
|
|
break; |
|
|
|
} |
|
|
|
request.setText(text); |
|
|
|
try { |
|
|
|
OapiRobotSendResponse response = client.execute(request); |
|
|
|
} catch (ApiException e) { |
|
|
|
log.error("机器人生病了......"); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 方法描述: 类型为enevt的时候,拼接 |
|
|
|
* @param request |
|
|
|