|
@@ -20,10 +20,7 @@ import com.fdkankan.ucenter.common.RedisKeyUtil;
|
|
|
import com.fdkankan.ucenter.common.constants.NacosProperty;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
import com.fdkankan.ucenter.constant.QrCodeFilePath;
|
|
|
-import com.fdkankan.ucenter.entity.Camera;
|
|
|
-import com.fdkankan.ucenter.entity.CameraDetail;
|
|
|
-import com.fdkankan.ucenter.entity.MailTemplate;
|
|
|
-import com.fdkankan.ucenter.entity.User;
|
|
|
+import com.fdkankan.ucenter.entity.*;
|
|
|
import com.fdkankan.ucenter.service.*;
|
|
|
import com.fdkankan.ucenter.vo.request.LoginParam;
|
|
|
import com.fdkankan.ucenter.vo.request.RegisterParam;
|
|
@@ -31,9 +28,8 @@ import com.fdkankan.ucenter.vo.response.LoginVo;
|
|
|
import com.fdkankan.ucenter.vo.response.UserVo;
|
|
|
|
|
|
import java.io.File;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -67,6 +63,10 @@ public class LoginService {
|
|
|
private FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
@Autowired
|
|
|
IMailTemplateService mailTemplateService;
|
|
|
+ @Autowired
|
|
|
+ IUserRoleService userRoleService;
|
|
|
+ @Autowired
|
|
|
+ IPlatformService platformService;
|
|
|
|
|
|
public LoginVo login(LoginParam param) {
|
|
|
if (StringUtils.isEmpty(param.getPassword()) || StringUtils.isEmpty(param.getPhoneNum())){
|
|
@@ -93,7 +93,14 @@ public class LoginService {
|
|
|
LoginVo vo = new LoginVo();
|
|
|
vo.setToken(token);
|
|
|
vo.setUser(userVo);
|
|
|
- vo.setPlatformKeys(userPlatformService.getByUserId(user.getId()));
|
|
|
+
|
|
|
+ Set<Long> byUser = userRoleService.getByUser(user);
|
|
|
+ if(byUser.contains(1L) || byUser.contains(5L)){
|
|
|
+ List<String> keyIds = platformService.list().stream().map(Platform::getPlatformKey).collect(Collectors.toList());
|
|
|
+ vo.setPlatformKeys(keyIds);
|
|
|
+ }else {
|
|
|
+ vo.setPlatformKeys(userPlatformService.getByUserId(user.getId()));
|
|
|
+ }
|
|
|
return vo;
|
|
|
}
|
|
|
|