|
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
+import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -60,6 +61,10 @@ public class Sending<T> {
|
|
|
StringBuilder urlBuilder = new StringBuilder(url);
|
|
|
urlBuilder.append("?");
|
|
|
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
|
|
+ if (entry.getValue() instanceof Collection && ((Collection<?>) entry.getValue()).isEmpty()) {
|
|
|
+ // 如果值是集合且为空,跳过拼接
|
|
|
+ continue;
|
|
|
+ }
|
|
|
urlBuilder.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
|
|
|
}
|
|
|
url = urlBuilder.toString();
|