Browse Source

更改参数

gaoyu 3 years ago
parent
commit
4345d7c3d9

+ 7 - 5
apm-common/src/main/java/com/persagy/apm/common/handler/PoemsRequestBodyWrapper.java

@@ -54,8 +54,8 @@ public class PoemsRequestBodyWrapper extends HttpServletRequestWrapper {
 
 		String reqUserId = request.getParameter("userId");
 		String reqGroupCode = request.getParameter("groupCode");
-		//String reqGrojectId = request.getParameter("projectId");
-		String reqPd="1";
+		String reqProjectId = request.getParameter("projectId");
+		String reqPd = "1";
 		// reqBodyStr转为Map对象
 		Map<String, Object> paramMap = new ObjectMapper().readValue(reqBodyStr,
 				new TypeReference<HashMap<String, Object>>() {
@@ -69,13 +69,15 @@ public class PoemsRequestBodyWrapper extends HttpServletRequestWrapper {
 		if (StringUtils.isBlank(groupCode) && StringUtils.isBlank(reqGroupCode)) {
 			throw new IllegalArgumentException(super.getRequestURI() + ": 请求体或请求参数中缺少groupCode");
 		}
-		if (StringUtils.isBlank(userId)  && StringUtils.isBlank(reqUserId)) {
+		if (StringUtils.isBlank(userId) && StringUtils.isBlank(reqUserId)) {
 			throw new IllegalArgumentException(super.getRequestURI() + ": 请求体或请求参数中缺少userId");
 		}
-		if (StringUtils.isBlank(pd) &&StringUtils.isBlank(reqPd) ) {
+		if (StringUtils.isBlank(pd) && StringUtils.isBlank(reqPd)) {
 			throw new IllegalArgumentException(super.getRequestURI() + ": 请求体或请求参数中缺少pd ");
 		}
-		PoemsContext.setContext(userId, loginDevice, pd, groupCode, projectId);
+		PoemsContext.setContext(StringUtils.isNotBlank(userId) ? userId : reqUserId, loginDevice, pd,
+				StringUtils.isNotBlank(groupCode) ? groupCode : reqGroupCode,
+				StringUtils.isNotBlank(projectId) ? projectId : reqProjectId);
 	}
 
 	@Override