|
@@ -4,6 +4,7 @@ import cn.hnthyy.thmz.Utils.*;
|
|
|
import cn.hnthyy.thmz.comment.UserLoginToken;
|
|
|
import cn.hnthyy.thmz.common.Constants;
|
|
|
import cn.hnthyy.thmz.entity.his.mz.Employee;
|
|
|
+import cn.hnthyy.thmz.entity.thmz.EvaluateInfo;
|
|
|
import cn.hnthyy.thmz.entity.thmz.LoginErr;
|
|
|
import cn.hnthyy.thmz.entity.thmz.User;
|
|
|
import cn.hnthyy.thmz.entity.thmz.UserControls;
|
|
@@ -15,6 +16,7 @@ import cn.hnthyy.thmz.service.his.zd.DictDataService;
|
|
|
import cn.hnthyy.thmz.service.thmz.EvaluationService;
|
|
|
import cn.hnthyy.thmz.service.thmz.LoginErrService;
|
|
|
import cn.hnthyy.thmz.service.thmz.TokenService;
|
|
|
+import cn.hnthyy.thmz.service.thmz.TsmzService;
|
|
|
import cn.hnthyy.thmz.service.thmz.UserService;
|
|
|
import cn.hnthyy.thmz.service.thmz.WindowsService;
|
|
|
import cn.hutool.core.codec.Base64;
|
|
@@ -24,6 +26,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -46,6 +50,8 @@ public class LoginController {
|
|
|
//private LoginErrService loginErrService;
|
|
|
@Autowired
|
|
|
private DictDataService dictDataService;
|
|
|
+ @Resource
|
|
|
+ private TsmzService tsmzService;
|
|
|
/**登录错误次数 锁定账户临界值*/
|
|
|
//private static final int LOGIN__ERR_COUNT = 10000;
|
|
|
//private static final int LOGIN__ERR_COUNT_TIME = 1;
|
|
@@ -57,7 +63,7 @@ public class LoginController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
|
- public Map<String, Object> login(@RequestBody User userParam) {
|
|
|
+ public Map<String, Object> login(@RequestBody User userParam,HttpServletRequest request) {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
if (userParam == null) {
|
|
|
resultMap.put("code", -1);
|
|
@@ -156,6 +162,10 @@ public class LoginController {
|
|
|
TokenUtil.USER_CONTROL_MAP.clear();
|
|
|
}
|
|
|
}
|
|
|
+ tsmzService.signInWhenUserLogin(EvaluateInfo.builder()
|
|
|
+ .staffId(user.getUserIdCode())
|
|
|
+ .staffName(user.getUserName())
|
|
|
+ .clientIp(HttpUtil.getIPAddress(request)).build());
|
|
|
Date deadTime = DateUtil.getDate(Constants.JWT_TTL);
|
|
|
String token =TokenUtil.createJWT(JsonUtil.object2Json(user),deadTime);
|
|
|
resultMap.put("code", 0);
|