|
@@ -1,21 +1,17 @@
|
|
|
package com.seecoder.BlueWhale.serviceImpl;
|
|
package com.seecoder.BlueWhale.serviceImpl;
|
|
|
|
|
|
|
|
-import com.seecoder.BlueWhale.enums.RoleEnum;
|
|
|
|
|
import com.seecoder.BlueWhale.exception.BlueWhaleException;
|
|
import com.seecoder.BlueWhale.exception.BlueWhaleException;
|
|
|
-import com.seecoder.BlueWhale.repository.StoreRepository;
|
|
|
|
|
-import com.seecoder.BlueWhale.repository.UserRepository;
|
|
|
|
|
-import com.seecoder.BlueWhale.po.Store;
|
|
|
|
|
import com.seecoder.BlueWhale.po.User;
|
|
import com.seecoder.BlueWhale.po.User;
|
|
|
|
|
+import com.seecoder.BlueWhale.repository.UserRepository;
|
|
|
import com.seecoder.BlueWhale.service.UserService;
|
|
import com.seecoder.BlueWhale.service.UserService;
|
|
|
import com.seecoder.BlueWhale.util.SecurityUtil;
|
|
import com.seecoder.BlueWhale.util.SecurityUtil;
|
|
|
import com.seecoder.BlueWhale.util.TokenUtil;
|
|
import com.seecoder.BlueWhale.util.TokenUtil;
|
|
|
import com.seecoder.BlueWhale.vo.UserVO;
|
|
import com.seecoder.BlueWhale.vo.UserVO;
|
|
|
-
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @Author: GaoZhaolong
|
|
* @Author: GaoZhaolong
|
|
|
* @Date: 14:46 2023/11/26
|
|
* @Date: 14:46 2023/11/26
|
|
@@ -34,8 +30,6 @@ public class UserServiceImpl implements UserService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
SecurityUtil securityUtil;
|
|
SecurityUtil securityUtil;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- StoreRepository storeRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean register(UserVO userVO) {
|
|
public Boolean register(UserVO userVO) {
|
|
@@ -61,9 +55,6 @@ public class UserServiceImpl implements UserService {
|
|
|
@Override
|
|
@Override
|
|
|
public UserVO getInformation() {
|
|
public UserVO getInformation() {
|
|
|
User user=securityUtil.getCurrentUser();
|
|
User user=securityUtil.getCurrentUser();
|
|
|
- if (user.getRole()==RoleEnum.STAFF) {
|
|
|
|
|
- return wrapWithStoreName(user.toVO());
|
|
|
|
|
- }
|
|
|
|
|
return user.toVO();
|
|
return user.toVO();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -83,13 +74,4 @@ public class UserServiceImpl implements UserService {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private UserVO wrapWithStoreName(UserVO userVO){
|
|
|
|
|
- Integer storeId = userVO.getStoreId();
|
|
|
|
|
- if (storeId==null){
|
|
|
|
|
- return userVO;
|
|
|
|
|
- }
|
|
|
|
|
- Store store = storeRepository.findById(storeId).get();
|
|
|
|
|
- userVO.setStoreName(store.getName());
|
|
|
|
|
- return userVO;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|