【7.0.4】新增一个工具类

pull/20/head
fengshuonan 2021-05-24 11:24:27 +08:00
parent e55c88e106
commit f708fd496f
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
package cn.stylefeng.roses.kernel.rule.util;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
/**
* redirect url
*
* @author fengshuonan
* @date 2021/1/22 11:07
*/
@Slf4j
public class RedirectUrlBuildUtil {
/**
* redirect url
* <p>
* originUrl?xx1=xx&xx2=xx&xx3=xx
*
* @param originUrl url
* @param paramsMap url
* @author fengshuonan
* @date 2021/1/22 11:07
*/
public static String createRedirectUrl(String originUrl, Map<String, ?> paramsMap) {
if (StrUtil.isBlank(originUrl)) {
return null;
}
if (ObjectUtil.isEmpty(paramsMap)) {
return originUrl;
} else {
return originUrl + "?" + URLUtil.buildQuery(paramsMap, CharsetUtil.CHARSET_UTF_8);
}
}
}