|
@ -12,10 +12,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.service.common.account.RoleService;
|
|
|
import com.yihu.wlyy.service.common.account.TokenService;
|
|
|
import com.yihu.wlyy.service.common.login.LoginLogService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.MD5;
|
|
|
import com.yihu.wlyy.util.RSAUtils;
|
|
|
import com.yihu.wlyy.util.SystemData;
|
|
|
import com.yihu.wlyy.util.*;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
@ -75,6 +72,9 @@ public class LoginController extends BaseController {
|
|
|
@Autowired
|
|
|
private DoctorInfoService doctorInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private SystemDataRedis systemDataRedis;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 公钥生成并返回接口
|
|
@ -438,13 +438,15 @@ public class LoginController extends BaseController {
|
|
|
// response.getWriter().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!"));
|
|
|
return error(-1, "系统异常,操作失败");
|
|
|
}
|
|
|
|
|
|
Token token = SystemData.doctorTokens.get(uid);
|
|
|
//1.5.0 存储redis缓存
|
|
|
Token token = systemDataRedis.getDoctorToken(uid);
|
|
|
//Token token = SystemData.doctorTokens.get(uid);
|
|
|
if (token == null) {
|
|
|
token = tokenDao.findByToken(tokenStr);
|
|
|
if (token != null) {
|
|
|
// 加入缓存
|
|
|
SystemData.doctorTokens.put(uid, token);
|
|
|
systemDataRedis.setDoctorToken(token);
|
|
|
//SystemData.doctorTokens.put(uid, token);
|
|
|
}
|
|
|
}
|
|
|
if (token == null || token.getPlatform() != 2) {
|
|
@ -466,7 +468,8 @@ public class LoginController extends BaseController {
|
|
|
// 今天未更新,则更新缓存
|
|
|
token.setCzrq(new Date());
|
|
|
// 更新内存
|
|
|
SystemData.doctorTokens.put(uid, token);
|
|
|
systemDataRedis.setDoctorToken(token);
|
|
|
//SystemData.doctorTokens.put(uid, token);
|
|
|
// 更新数据库
|
|
|
tokenDao.save(token);
|
|
|
}
|
|
@ -560,5 +563,27 @@ public class LoginController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "setTokenTest", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String setToken(String uid){
|
|
|
Token token = new Token();
|
|
|
token.setToken("123456");
|
|
|
token.setDel("1");
|
|
|
token.setCzrq(new Date());
|
|
|
token.setUser(uid);
|
|
|
return write(200,systemDataRedis.setDoctorPCToken(token));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "getTokenTest", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getToken(String uid){
|
|
|
return write(200,systemDataRedis.getDoctorPCToken(uid).toJson());
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "getTokenNumberTest", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getTokenNumber(){
|
|
|
return write(200,systemDataRedis.getTokenMember(SystemDataRedis.doctorTokens)+"");
|
|
|
}
|
|
|
|
|
|
}
|