|
@ -6,10 +6,12 @@ import com.yihu.wlyy.logs.InterfaceCallLogs;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemData;
|
|
import com.yihu.wlyy.util.SystemData;
|
|
|
|
import com.yihu.wlyy.util.SystemDataRedis;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@ -34,6 +36,9 @@ public class DoctorInterceptor extends BaseInterceptor {
|
|
|
|
|
|
public static String status = "1";
|
|
public static String status = "1";
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
public SystemDataRedis systemDataRedis;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
boolean flag = true;
|
|
boolean flag = true;
|
|
@ -121,14 +126,19 @@ public class DoctorInterceptor extends BaseInterceptor {
|
|
|
|
|
|
Token token = null;
|
|
Token token = null;
|
|
Map<String, Token> tempMap = null;
|
|
Map<String, Token> tempMap = null;
|
|
|
|
|
|
|
|
//1.50 登录缓存存储为redis
|
|
if (platform == 2) {
|
|
if (platform == 2) {
|
|
tempMap = SystemData.doctorTokens;
|
|
|
|
|
|
//tempMap = SystemData.doctorTokens;
|
|
|
|
token = systemDataRedis.getDoctorToken(uid);
|
|
} else if (platform == 4) {
|
|
} else if (platform == 4) {
|
|
tempMap = SystemData.doctorPCTokens;
|
|
|
|
|
|
//tempMap = SystemData.doctorPCTokens;
|
|
|
|
token = systemDataRedis.getDoctorPCToken(uid);
|
|
}else if(platform ==5){
|
|
}else if(platform ==5){
|
|
tempMap = SystemData.doctorWXTokens;
|
|
|
|
|
|
//tempMap = SystemData.doctorWXTokens;
|
|
|
|
token = systemDataRedis.getDoctorWXToken(uid);
|
|
}
|
|
}
|
|
token = tempMap.get(uid);
|
|
|
|
|
|
//token = tempMap.get(uid);
|
|
if (token == null) {
|
|
if (token == null) {
|
|
token = tokenDao.findByPatient(uid, platform);
|
|
token = tokenDao.findByPatient(uid, platform);
|
|
if (token != null) {
|
|
if (token != null) {
|
|
@ -155,8 +165,17 @@ public class DoctorInterceptor extends BaseInterceptor {
|
|
if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
|
|
if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
|
|
// 今天未更新,则更新缓存
|
|
// 今天未更新,则更新缓存
|
|
token.setCzrq(new Date());
|
|
token.setCzrq(new Date());
|
|
// 更新内存
|
|
|
|
tempMap.put(uid, token);
|
|
|
|
|
|
|
|
|
|
//1.5.0更新redis缓存
|
|
|
|
if (platform == 2) {
|
|
|
|
systemDataRedis.setDoctorToken(token);
|
|
|
|
} else if (platform == 4) {
|
|
|
|
systemDataRedis.setDoctorPCToken(token);
|
|
|
|
}else if(platform ==5){
|
|
|
|
systemDataRedis.setDoctorWXToken(token);
|
|
|
|
}
|
|
|
|
// // 更新内存
|
|
|
|
// tempMap.put(uid, token);
|
|
// 更新数据库
|
|
// 更新数据库
|
|
tokenDao.save(token);
|
|
tokenDao.save(token);
|
|
}
|
|
}
|