generated from dxfeng/secondev-chapanda-feishu
47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
|
|
package com.engine.recruit.util;
|
||
|
|
|
||
|
|
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||
|
|
import org.apache.commons.lang3.StringUtils;
|
||
|
|
import weaver.general.BaseBean;
|
||
|
|
|
||
|
|
import java.net.URLDecoder;
|
||
|
|
import java.util.HashMap;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author:dxfeng
|
||
|
|
* @createTime: 2023/10/12
|
||
|
|
* @version: 1.0
|
||
|
|
*/
|
||
|
|
public class RecruitFlowUtil {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 解析url中参数信息
|
||
|
|
*
|
||
|
|
* @param urlString url地址
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public static Map<String, String> parseURL(String urlString) {
|
||
|
|
Map<String, String> params = new HashMap<>();
|
||
|
|
try {
|
||
|
|
if (StringUtils.isNotBlank(urlString)) {
|
||
|
|
if (urlString.contains("?")) {
|
||
|
|
urlString = urlString.split("\\?")[1];
|
||
|
|
}
|
||
|
|
String[] paramPairs = urlString.split("&");
|
||
|
|
for (String paramPair : paramPairs) {
|
||
|
|
String[] keyValue = paramPair.split("=");
|
||
|
|
String key = URLDecoder.decode(keyValue[0], "UTF-8");
|
||
|
|
String value = URLDecoder.decode(keyValue[1], "UTF-8");
|
||
|
|
params.put(key, value);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
} catch (Exception e) {
|
||
|
|
new BaseBean().writeLog(e);
|
||
|
|
throw new CustomizeRunTimeException(urlString + "解析失败");
|
||
|
|
}
|
||
|
|
|
||
|
|
return params;
|
||
|
|
}
|
||
|
|
}
|