|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.diagbot.client.AuthServiceClient;
|
|
|
import com.diagbot.client.DiagbotmanClient;
|
|
|
import com.diagbot.dto.GetConsoleUserInfoDTO;
|
|
|
+import com.diagbot.dto.JwtDTO;
|
|
|
import com.diagbot.dto.LoginDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.UserAndProdutUDTO;
|
|
@@ -219,11 +220,46 @@ public class UserFacade extends UserServiceImpl {
|
|
|
/**
|
|
|
* 登录
|
|
|
*
|
|
|
+ * @return 登录相关信息
|
|
|
+ */
|
|
|
+ public LoginDTO getUserOrgMenu() {
|
|
|
+ LoginDTO data = new LoginDTO();
|
|
|
+
|
|
|
+ Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
+ User user = this.getById(userId);
|
|
|
+ if (user == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "用户不存在【" + userId + "】");
|
|
|
+ }
|
|
|
+ //添加用户
|
|
|
+ UserLoginDTO userLoginDTO = new UserLoginDTO();
|
|
|
+ BeanUtil.copyProperties(user, userLoginDTO);
|
|
|
+ data.setUserLoginDTO(userLoginDTO);
|
|
|
+
|
|
|
+ //添加机构信息
|
|
|
+ Organization org = organizationFacade.getById(user.getId());
|
|
|
+ data.setOrganization(org);
|
|
|
+ //添加菜单信息
|
|
|
+ List<MenuWrapper> menuList = menuFacade.getByRole(user.getId());
|
|
|
+ Map<Long, List<MenuWrapper>> menuMap = EntityUtil.makeEntityListMap(menuList, "parentId");
|
|
|
+ List<MenuWrapper> menuRes = menuMap.get(-1L);
|
|
|
+ for(MenuWrapper bean : menuRes) {
|
|
|
+ getSonMenu(bean, menuMap);
|
|
|
+ }
|
|
|
+ data.setMenuWrappers(menuRes);
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取jwt
|
|
|
+ *
|
|
|
* @param username 用户名
|
|
|
* @param password 密码
|
|
|
- * @return 登录相关信息
|
|
|
+ * @return jwt
|
|
|
*/
|
|
|
- public RespDTO login(String username, String password) {
|
|
|
+ public JwtDTO getJwt(String username, String password) {
|
|
|
+ JwtDTO data = new JwtDTO();
|
|
|
if (StringUtil.isBlank(username)) {
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
|
|
|
"请输入手机号!");
|
|
@@ -241,29 +277,9 @@ public class UserFacade extends UserServiceImpl {
|
|
|
throw new CommonException(ServiceErrorCode.USER_PASSWORD_ERROR);
|
|
|
}
|
|
|
JWT jwt = authServiceClient.getToken("Basic dWFhLXNlcnZpY2U6MTIzNDU2", "password", username, password);
|
|
|
- // 获得用户菜单
|
|
|
- if (null == jwt) {
|
|
|
- throw new CommonException(ServiceErrorCode.GET_TOKEN_FAIL);
|
|
|
- }
|
|
|
- LoginDTO loginDTO = new LoginDTO();
|
|
|
- //添加用户
|
|
|
- UserLoginDTO userLoginDTO = new UserLoginDTO();
|
|
|
- BeanUtil.copyProperties(user, userLoginDTO);
|
|
|
- loginDTO.setUserLoginDTO(userLoginDTO);
|
|
|
- //添加token
|
|
|
- loginDTO.setToken(jwt.getAccess_token());
|
|
|
- //添加机构信息
|
|
|
- Organization org = organizationFacade.getById(user.getId());
|
|
|
- loginDTO.setOrganization(org);
|
|
|
- //添加菜单信息
|
|
|
- List<MenuWrapper> menuList = menuFacade.getByRole(user.getId());
|
|
|
- Map<Long, List<MenuWrapper>> menuMap = EntityUtil.makeEntityListMap(menuList, "parentId");
|
|
|
- List<MenuWrapper> menuRes = menuMap.get(-1L);
|
|
|
- for(MenuWrapper bean : menuRes) {
|
|
|
- getSonMenu(bean, menuMap);
|
|
|
- }
|
|
|
- loginDTO.setMenuWrappers(menuRes);
|
|
|
- return RespDTO.onSuc(loginDTO);
|
|
|
+ data.setToken(jwt.getAccess_token());
|
|
|
+ data.setType(user.getType());
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -682,8 +698,10 @@ public class UserFacade extends UserServiceImpl {
|
|
|
return RespDTO.onSuc("绑定成功");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * @param userId
|
|
|
+ * 删除用户信息和机构信息
|
|
|
+ * @param baseIdVO 参数
|
|
|
* @return 删除用户信息和机构信息
|
|
|
*/
|
|
|
public RespDTO<Boolean> updateDeleteds(BaseIdVO baseIdVO) {
|