spotlessApply 적용
This commit is contained in:
@@ -7,15 +7,13 @@ import java.net.UnknownHostException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import org.mindrot.jbcrypt.BCrypt;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
public class NetUtils {
|
||||
|
||||
public String getLocalIP(){
|
||||
public String getLocalIP() {
|
||||
|
||||
String ip;
|
||||
{
|
||||
@@ -30,23 +28,26 @@ public class NetUtils {
|
||||
return ip;
|
||||
}
|
||||
|
||||
|
||||
public String dtoToQueryString(Object dto, String queryString) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> map = objectMapper.convertValue(dto, Map.class);
|
||||
|
||||
String qStr = map.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() != null) // null 제외
|
||||
.map(entry -> String.format("%s=%s",
|
||||
entry.getKey(),
|
||||
URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8)))
|
||||
.collect(Collectors.joining("&"));
|
||||
String qStr =
|
||||
map.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() != null) // null 제외
|
||||
.map(
|
||||
entry ->
|
||||
String.format(
|
||||
"%s=%s",
|
||||
entry.getKey(),
|
||||
URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8)))
|
||||
.collect(Collectors.joining("&"));
|
||||
|
||||
if( queryString == null || queryString.isEmpty() ) {
|
||||
queryString = "?"+qStr;
|
||||
}else{
|
||||
queryString = queryString +"&" + qStr;
|
||||
if (queryString == null || queryString.isEmpty()) {
|
||||
queryString = "?" + qStr;
|
||||
} else {
|
||||
queryString = queryString + "&" + qStr;
|
||||
}
|
||||
|
||||
// 2. Map을 쿼리 스트링 문자열로 변환
|
||||
@@ -60,5 +61,4 @@ public class NetUtils {
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user