|
|
@@ -22,10 +22,7 @@ import org.apache.http.Header;
|
|
|
import org.apache.http.message.BasicHeader;
|
|
|
import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestHeader;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.Arrays;
|
|
|
@@ -71,6 +68,7 @@ public class UserController {
|
|
|
* @return 临时token
|
|
|
*/
|
|
|
@GetMapping(value = Api.URI_XXX_TICKET_EXCHANGE)
|
|
|
+ @ResponseBody
|
|
|
public ResultResponse<String> getUser(
|
|
|
HttpServletRequest request,
|
|
|
@RequestHeader(value = Api.HEADER_CLIENT_TYPE, required = false) String strClientType,
|
|
|
@@ -78,14 +76,15 @@ public class UserController {
|
|
|
@RequestParam(value = "ticket", required = false) String ticket) throws SelfException {
|
|
|
//初始化序列
|
|
|
requestSeq.putIfAbsent(Api.URI_XXX_TICKET_EXCHANGE, new AtomicInteger(0));
|
|
|
- final String URI_PATH = request.getRequestURI();
|
|
|
+ //请求信息
|
|
|
+ final String requestURI = request.getRequestURI();
|
|
|
final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
|
|
|
//参数校验
|
|
|
if (ticket == null || StringUtils.isBlank(ticket)) {
|
|
|
throw new SelfException(ResponseCode.STATUS_ERROR_JSON_FORMAT.getCode() + ""
|
|
|
, String.format(Api.EXCEPTION_FORMAT
|
|
|
, strPlatform
|
|
|
- , URI_PATH
|
|
|
+ , requestURI
|
|
|
, ResponseCode.STATUS_ERROR_JSON_FORMAT.getMessage()));
|
|
|
}
|
|
|
|
|
|
@@ -93,7 +92,7 @@ public class UserController {
|
|
|
long begin = System.currentTimeMillis();
|
|
|
String seqMsg = String.format("%d-%d", begin, requestSeq.get(Api.URI_XXX_TICKET_EXCHANGE).incrementAndGet());
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, BIZ_TYPE, CLASS_NAME
|
|
|
- , String.format("%s:%s seq:{%s} param:%s begin====>", strPlatform, URI_PATH, seqMsg, ticket));
|
|
|
+ , String.format("%s:%s seq:{%s} param:%s begin====>", strPlatform, requestURI, seqMsg, ticket));
|
|
|
//构建result
|
|
|
ResultResponse<String> resultResponse = ResultResponse.failed();
|
|
|
|
|
|
@@ -132,7 +131,7 @@ public class UserController {
|
|
|
resultResponse.setTimestamp(System.currentTimeMillis());
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, BIZ_TYPE, CLASS_NAME,
|
|
|
String.format("%s:%s seq:{%s} rescode:{%s} resmsg:{%s} time:{%d ms} end<===="
|
|
|
- , strPlatform, URI_PATH, seqMsg, resultResponse.getRescode(), resultResponse.getResmsg()
|
|
|
+ , strPlatform, requestURI, seqMsg, resultResponse.getRescode(), resultResponse.getResmsg()
|
|
|
, resultResponse.getTimestamp() - begin));
|
|
|
return resultResponse;
|
|
|
}
|