|
@@ -3,6 +3,7 @@ package com.ozs.framework.web.service;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.ozs.common.config.PurchaseConfig;
|
|
|
+import com.ozs.common.core.domain.entity.SysDept;
|
|
|
import com.ozs.framework.manager.factory.AsyncFactory;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -29,6 +30,9 @@ import com.ozs.framework.manager.AsyncManager;
|
|
|
import com.ozs.framework.security.context.AuthenticationContextHolder;
|
|
|
import com.ozs.system.service.ISysConfigService;
|
|
|
import com.ozs.system.service.ISysUserService;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 登录校验方法
|
|
@@ -53,6 +57,9 @@ public class SysLoginService {
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private com.ozs.system.service.ISysDeptService sysDeptService;
|
|
|
+
|
|
|
/**
|
|
|
* 登录验证
|
|
|
*
|
|
@@ -65,12 +72,19 @@ public class SysLoginService {
|
|
|
public String login(String username, String password, String code, String uuid)
|
|
|
{
|
|
|
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
|
|
- if(PurchaseConfig.getSname().equals(username) && PurchaseConfig.getSname().equals(password)){
|
|
|
+ if(PurchaseConfig.getSname().equals(username) && PurchaseConfig.getSname().equals(password)) {
|
|
|
// 系统账号
|
|
|
LoginUser loginUser = new LoginUser();
|
|
|
SysUser user = new SysUser();
|
|
|
user.setUserId(-1L);
|
|
|
user.setUserName(username);
|
|
|
+ List<SysDept> list = sysDeptService.selectMaxDeptByParentId(0l);
|
|
|
+ if (!ObjectUtils.isEmpty(list)) {
|
|
|
+ user.setDept(list.get(0));
|
|
|
+ user.setDeptId(list.get(0).getDeptId());
|
|
|
+ user.setDeptName(list.get(0).getDeptName());
|
|
|
+ loginUser.setDeptId(list.get(0).getDeptId());
|
|
|
+ }
|
|
|
loginUser.setUser(user);
|
|
|
loginUser.setUserId(-1L);
|
|
|
// 生成token
|