|
@@ -1,6 +1,5 @@
|
|
|
package thyyxxk.webserver.service;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
@@ -17,7 +16,6 @@ import thyyxxk.webserver.service.externalhttp.CorpWxSrvc;
|
|
|
import thyyxxk.webserver.service.redislike.RedisLikeService;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
-import javax.annotation.PostConstruct;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -45,6 +43,7 @@ public class LoginService {
|
|
|
|
|
|
public ResultVo<UserInfo> login(UserInfo userInfo) {
|
|
|
Date now = new Date();
|
|
|
+
|
|
|
UserInfo tempUserInfo = dao.findUserByCodeRsFromDjUserBase(userInfo.getCodeRs());
|
|
|
if (null == tempUserInfo) {
|
|
|
tempUserInfo = dao.findUserByCodeRsFromEmployeeMi(userInfo.getCodeRs());
|
|
@@ -54,42 +53,41 @@ public class LoginService {
|
|
|
dao.insertNewUserToDjUserBase(tempUserInfo);
|
|
|
}
|
|
|
// 如果当前时间在 限制时间之前就是锁定
|
|
|
- if (tempUserInfo.getNextInputTimes() != null && now.toInstant().isBefore(tempUserInfo.getNextInputTimes().toInstant())) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOCK_OUT_THE_USER, StrUtil.format("用户已被锁定请:【{}】后重试。", DateUtil.formatDatetime(tempUserInfo.getNextInputTimes())), tempUserInfo);
|
|
|
- }
|
|
|
-
|
|
|
+// if (tempUserInfo.getNextInputTimes() != null && now.toInstant().isBefore(tempUserInfo.getNextInputTimes().toInstant())) {
|
|
|
+// return ResultVoUtil.fail(ExceptionEnum.LOCK_OUT_THE_USER, StrUtil.format("用户已被锁定请:【{}】后重试。", DateUtil.formatDatetime(tempUserInfo.getNextInputTimes())), tempUserInfo);
|
|
|
+// }
|
|
|
String pwd = SecureUtil.md5(userInfo.getPassword());
|
|
|
if (!Objects.equals("fromTriageScreen", userInfo.getSid()) && !pwd.equals(tempUserInfo.getPassword())) {
|
|
|
- Integer times = dao.selectInputErrFrequency(tempUserInfo.getCodeRs());
|
|
|
- times = times == null ? 1 : times + 1;
|
|
|
- userInfo.setNextInputTimes(null);
|
|
|
- userInfo.setInputErrFrequency(times);
|
|
|
+// Integer times = dao.selectInputErrFrequency(tempUserInfo.getCodeRs());
|
|
|
+// times = times == null ? 1 : times + 1;
|
|
|
+// userInfo.setNextInputTimes(null);
|
|
|
+// userInfo.setInputErrFrequency(times);
|
|
|
// 输入次数大于三次锁定
|
|
|
- if (times > 3) {
|
|
|
- // 如果当前时间在限制时间之前就用限制时间
|
|
|
- if (now.toInstant().isBefore(tempUserInfo.getNextInputTimes().toInstant())) {
|
|
|
- now = tempUserInfo.getNextInputTimes();
|
|
|
- } else {
|
|
|
- // 如果不在就加 10 分钟
|
|
|
- now = DateUtil.offsetMinute(now, 10);
|
|
|
- }
|
|
|
- userInfo.setNextInputTimes(now);
|
|
|
- dao.addInputErrFrequency(tempUserInfo.getCodeRs(), times, now);
|
|
|
- }
|
|
|
- dao.addInputErrFrequency(tempUserInfo.getCodeRs(), times, now);
|
|
|
- if (userInfo.getNextInputTimes() != null) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOCK_OUT_THE_USER,
|
|
|
- StrUtil.format("用户已被锁定请:【{}】后重试。",
|
|
|
- DateUtil.formatDatetime(userInfo.getNextInputTimes())),
|
|
|
- userInfo);
|
|
|
- } else {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.INVALID_PASSWORD, userInfo);
|
|
|
- }
|
|
|
+// if (times > 3) {
|
|
|
+// // 如果当前时间在限制时间之前就用限制时间
|
|
|
+// if (now.toInstant().isBefore(tempUserInfo.getNextInputTimes().toInstant())) {
|
|
|
+// now = tempUserInfo.getNextInputTimes();
|
|
|
+// } else {
|
|
|
+// // 如果不在就加 10 分钟
|
|
|
+// now = DateUtil.offsetMinute(now, 10);
|
|
|
+// }
|
|
|
+// userInfo.setNextInputTimes(now);
|
|
|
+// dao.addInputErrFrequency(tempUserInfo.getCodeRs(), times, now);
|
|
|
+// }
|
|
|
+// dao.addInputErrFrequency(tempUserInfo.getCodeRs(), times, now);
|
|
|
+// if (userInfo.getNextInputTimes() != null) {
|
|
|
+// return ResultVoUtil.fail(ExceptionEnum.LOCK_OUT_THE_USER,
|
|
|
+// StrUtil.format("用户已被锁定请:【{}】后重试。",
|
|
|
+// DateUtil.formatDatetime(userInfo.getNextInputTimes())),
|
|
|
+// userInfo);
|
|
|
+// } else {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.INVALID_PASSWORD, userInfo);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
- if (tempUserInfo.getInputErrFrequency() > 0) {
|
|
|
- dao.addInputErrFrequency(tempUserInfo.getCodeRs(), 0, null);
|
|
|
- }
|
|
|
+// if (tempUserInfo.getInputErrFrequency() > 0) {
|
|
|
+// dao.addInputErrFrequency(tempUserInfo.getCodeRs(), 0, null);
|
|
|
+// }
|
|
|
String token = TokenUtil.getInstance().createToken(tempUserInfo.getCode());
|
|
|
try {
|
|
|
JSONObject json = srvc.getUserinfo(tokenService.getWeComAddressBookToken(), tempUserInfo.getCodeRs());
|