|
@@ -1,5 +1,6 @@
|
|
|
package com.fs.company.controller.company;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.common.constant.Constants;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
@@ -13,6 +14,8 @@ import com.fs.framework.security.LoginUser;
|
|
|
import com.fs.framework.service.CompanyLoginService;
|
|
|
import com.fs.framework.service.CompanyPermissionService;
|
|
|
import com.fs.framework.service.TokenService;
|
|
|
+import com.fs.system.domain.SysConfig;
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -43,6 +46,8 @@ public class CompanyLoginController
|
|
|
private TokenService tokenService;
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService configService;
|
|
|
|
|
|
/**
|
|
|
* 登录方法
|
|
@@ -104,5 +109,29 @@ public class CompanyLoginController
|
|
|
return AjaxResult.success(menuService.buildMenus(menus));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据系统配置去查询是否需要首次登录,并开启校验
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("getFirstLogin")
|
|
|
+ public AjaxResult getFirstLogin()
|
|
|
+ {
|
|
|
+ SysConfig config = configService.selectConfigByConfigKey("his.login");
|
|
|
+ if(config != null && config.getConfigValue() != null){
|
|
|
+ String configValue = config.getConfigValue();
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(configValue);
|
|
|
+ Boolean disabled = jsonObject.getBoolean("disabled");
|
|
|
+ if(disabled){
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = redisCache.getCacheObject("newCompanyUser:" + loginUser.getUser().getCompanyId() + ":" + loginUser.getUser().getUserName());
|
|
|
+ if (loginUser.getUser().getUserId().equals(userId)) {
|
|
|
+ return AjaxResult.success(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(false);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|