|
@@ -1,148 +0,0 @@
|
|
|
-package com.ywt.outpatient.interceptors;
|
|
|
-
|
|
|
-/**
|
|
|
- * 保存当前请求与业务相关的信息上下文
|
|
|
- * 由拦截器层提供信息初始化
|
|
|
- * Created by huangguoping.
|
|
|
- */
|
|
|
-public class WebAppContext {
|
|
|
- private static WebAppContext _webAppContext = null;
|
|
|
- private static Object _lockObj = new Object();
|
|
|
-
|
|
|
- private ThreadLocal<Long> _requestStartTime = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _requestID = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _ip = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _tokenid = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _unionId = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _openId = new ThreadLocal<>();
|
|
|
- private ThreadLocal<Integer> _userId = new ThreadLocal<>();
|
|
|
- private ThreadLocal<Integer> _doctorId = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _doctorName = new ThreadLocal<>();
|
|
|
- private ThreadLocal<Integer> _terminal = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _gwProtocol = new ThreadLocal<>();
|
|
|
- private ThreadLocal<String> _gwAuthAppid = new ThreadLocal<>();
|
|
|
-
|
|
|
- private WebAppContext(){
|
|
|
- }
|
|
|
-
|
|
|
- public long getRequestStartTime(){
|
|
|
- return _requestStartTime.get() == null ? 0L : _requestStartTime.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setRequestStartTime(long time){
|
|
|
- _requestStartTime.set(time);
|
|
|
- }
|
|
|
-
|
|
|
- public String getRequestID(){
|
|
|
- return _requestID.get() == null ? "" : _requestID.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setRequestID(String id){
|
|
|
- _requestID.set(id);
|
|
|
- }
|
|
|
-
|
|
|
- public String getIP(){
|
|
|
- return _ip.get() == null ? "" : _ip.get();
|
|
|
- }
|
|
|
- protected void setIP(String ip){
|
|
|
- _ip.set(ip);
|
|
|
- }
|
|
|
-
|
|
|
- public String getUnionId() {
|
|
|
- return _unionId.get() == null ? "" : _unionId.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setUnionId(String unionId){
|
|
|
- _unionId.set(unionId);
|
|
|
- }
|
|
|
-
|
|
|
- public String getOpenId() {
|
|
|
- return _openId.get() == null ? "" : _openId.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setOpenId(String openId){
|
|
|
- _openId.set(openId);
|
|
|
- }
|
|
|
-
|
|
|
- public Integer getUserId() {
|
|
|
- return _userId.get() == null ? 0 : _userId.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setUserId(Integer userId){
|
|
|
- _userId.set(userId);
|
|
|
- }
|
|
|
-
|
|
|
- public Integer getDoctorId(){
|
|
|
- return _doctorId.get() == null ? 0 : _doctorId.get();
|
|
|
- }
|
|
|
-
|
|
|
- public void setDoctorId(Integer doctorId){
|
|
|
- _doctorId.set(doctorId);
|
|
|
- }
|
|
|
-
|
|
|
- public String getTokenID() {
|
|
|
- return _tokenid.get() == null ? "" : _tokenid.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setTokenID(String tokenID){
|
|
|
- _tokenid.set(tokenID);
|
|
|
- }
|
|
|
-
|
|
|
- public String getDoctorName(){
|
|
|
- return _doctorName.get() == null ? "" : _doctorName.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setDoctorName(String doctorName){
|
|
|
- _doctorName.set(doctorName);
|
|
|
- }
|
|
|
-
|
|
|
- public Integer getTerminal() {
|
|
|
- return _terminal.get() == null ? 0 : _terminal.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setTerminal(Integer terminal) {
|
|
|
- this._terminal.set(terminal);
|
|
|
- }
|
|
|
-
|
|
|
- public String getGWProtocol() {
|
|
|
- return _gwProtocol.get() == null ? "" : _gwProtocol.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void setGWProtocol(String protocol){
|
|
|
- _gwProtocol.set(protocol);
|
|
|
- }
|
|
|
-
|
|
|
- protected void setGWAuthAppid(String appid){
|
|
|
- this._gwAuthAppid.set(appid);
|
|
|
- }
|
|
|
-
|
|
|
- public String getGWAuthAppid(){
|
|
|
- return this._gwAuthAppid.get();
|
|
|
- }
|
|
|
-
|
|
|
- protected void init(){
|
|
|
- _requestStartTime.set(0L);
|
|
|
- _requestID.set("");
|
|
|
- _ip.set("");
|
|
|
- _tokenid.set("");
|
|
|
- _unionId.set("");
|
|
|
- _openId.set("");
|
|
|
- _userId.set(0);
|
|
|
- _doctorId.set(0);
|
|
|
- _doctorName.set("");
|
|
|
- _terminal.set(0);
|
|
|
- _gwProtocol.set("");
|
|
|
- _gwAuthAppid.set("");
|
|
|
- }
|
|
|
-
|
|
|
- public static WebAppContext current(){
|
|
|
- if (_webAppContext == null){
|
|
|
- synchronized (_lockObj){
|
|
|
- if (_webAppContext == null){
|
|
|
- _webAppContext = new WebAppContext();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return _webAppContext;
|
|
|
- }
|
|
|
-}
|