Commit 5d2ce66f authored by liuchao1's avatar liuchao1

控制报告只钉钉推送一次

parent 1a0dbc2b
...@@ -4,11 +4,13 @@ import io.restassured.response.Response; ...@@ -4,11 +4,13 @@ import io.restassured.response.Response;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
public class DingTalkUtils { public class DingTalkUtils {
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
private static final AtomicBoolean hasSend = new AtomicBoolean(true);
// 通过钉钉机器人发送消息到钉钉群中 // 通过钉钉机器人发送消息到钉钉群中
public static void sendVal(String context)throws Exception{ public static void sendVal(String context)throws Exception{
...@@ -28,9 +30,9 @@ public class DingTalkUtils { ...@@ -28,9 +30,9 @@ public class DingTalkUtils {
params.put("text",contentParams); params.put("text",contentParams);
//发起dingding机器人通知 //发起dingding机器人通知
if (isPushReport){ if (isPushReport && hasSend.compareAndSet(true, false)){
Response response = network.dingTalkRobot(params); // Response response = network.dingTalkRobot(params);
System.out.println("钉钉 response:"+response.asString()); // System.out.println("钉钉 response:"+response.asString());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment