|
@@ -17,6 +17,7 @@ import org.springframework.web.client.RestTemplate;
|
|
|
import javax.crypto.Mac;
|
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
|
import java.io.IOException;
|
|
|
+import java.net.URI;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Base64;
|
|
@@ -96,11 +97,15 @@ public class DingTalkService {
|
|
|
logger.info("构造请求URL: {}", url);
|
|
|
|
|
|
// 4. 发送请求
|
|
|
- logger.info("开始向钉钉服务器发送请求...");
|
|
|
+ logger.info("url===>"+url);
|
|
|
+ // 2. 将 String URL 转换为不编码的 URI
|
|
|
+ URI uri = new URI(url); // 关键点:直接用URI构造函数,不额外编码
|
|
|
+ // 3. 发送请求(使用URI对象而非String URL)
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(
|
|
|
- url,
|
|
|
+ uri, // 传入URI对象而非String
|
|
|
new HttpEntity<>(requestBody, buildHeaders()),
|
|
|
- String.class);
|
|
|
+ String.class
|
|
|
+ );
|
|
|
logger.info("收到钉钉服务器响应,状态码: {}", response.getStatusCodeValue());
|
|
|
logger.info("完整响应: {}", response.getBody());
|
|
|
|