|
@@ -14,6 +14,7 @@ import thyyxxk.webserver.entity.dictionary.CodeName;
|
|
|
import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
import thyyxxk.webserver.entity.settings.IntergrationMenu;
|
|
|
import thyyxxk.webserver.service.externalhttp.CorpWxSrvc;
|
|
|
+import thyyxxk.webserver.service.externalhttp.WebSocketService;
|
|
|
import thyyxxk.webserver.service.outpatient.wxapi.SendWxInfoService;
|
|
|
import thyyxxk.webserver.service.redislike.RedisLikeService;
|
|
|
import thyyxxk.webserver.service.settings.MenuSettingsService;
|
|
@@ -35,6 +36,7 @@ public class LoginService {
|
|
|
private final PublicServer publicServer;
|
|
|
private final SendWxInfoService sendWxInfoService;
|
|
|
private final MenuSettingsService menuSettingsService;
|
|
|
+ private final WebSocketService webSocketService;
|
|
|
|
|
|
@Autowired
|
|
|
public LoginService(LoginDao dao,
|
|
@@ -42,7 +44,7 @@ public class LoginService {
|
|
|
RedisLikeService redisLikeService,
|
|
|
CorpWxSrvc srvc,
|
|
|
PublicServer publicServer,
|
|
|
- SendWxInfoService sendWxInfoService, MenuSettingsService menuSettingsService) {
|
|
|
+ SendWxInfoService sendWxInfoService, MenuSettingsService menuSettingsService, WebSocketService webSocketService) {
|
|
|
this.dao = dao;
|
|
|
this.tokenService = tokenService;
|
|
|
this.redisLikeService = redisLikeService;
|
|
@@ -50,6 +52,7 @@ public class LoginService {
|
|
|
this.publicServer = publicServer;
|
|
|
this.sendWxInfoService = sendWxInfoService;
|
|
|
this.menuSettingsService = menuSettingsService;
|
|
|
+ this.webSocketService = webSocketService;
|
|
|
}
|
|
|
|
|
|
@Data
|
|
@@ -68,6 +71,11 @@ public class LoginService {
|
|
|
}
|
|
|
dao.insertNewUserToDjUserBase(tempUserInfo);
|
|
|
}
|
|
|
+ String ip = IpAddressUtil.getIPAddress(request);
|
|
|
+ ResultVo<String> socketValidate = webSocketService.hasCertainIpAndCode(ip, tempUserInfo.getCode());
|
|
|
+ if (socketValidate.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, socketValidate.getMessage());
|
|
|
+ }
|
|
|
|
|
|
String pwd = encrypt ? SecureUtil.md5(userInfo.getPassword()) : userInfo.getPassword();
|
|
|
if (!Objects.equals("fromTriageScreen", userInfo.getSid()) && !pwd.equals(tempUserInfo.getPassword())) {
|
|
@@ -80,7 +88,6 @@ public class LoginService {
|
|
|
tempUserInfo.setAvatar(json.getString("avatar"));
|
|
|
} catch (Exception ignored) {
|
|
|
}
|
|
|
- String ip = IpAddressUtil.getIPAddress(request);
|
|
|
tempUserInfo = redisLikeService.dbUserInfo(tempUserInfo.getCode());
|
|
|
tempUserInfo.setToken(token);
|
|
|
tempUserInfo.setIp(ip);
|