| | |
| | | package com.jilongda.applet.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.model.TAppUser; |
| | | import com.jilongda.applet.service.TAppUserService; |
| | | import com.jilongda.common.model.TUser; |
| | | import com.jilongda.common.security.JwtTokenUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public class LoginInfoUtil { |
| | | |
| | | @Autowired |
| | | private TUserService tUserService; |
| | | |
| | | @Autowired |
| | | private SecUserService secUserService; |
| | | private TAppUserService appUserService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public Long getUserId1(){ |
| | | public Integer getUserId(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | TUser userName = tUserService.getOne(new QueryWrapper<TUser>().eq("userName", username).eq("isDelete",0)); |
| | | return userName.getId(); |
| | | |
| | | } |
| | | public Long getUserId(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return userName.getId(); |
| | | |
| | | } |
| | | public SecUser getLoginUserByPhone(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser tUser = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return tUser; |
| | | TAppUser appUser = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", username).eq("isDelete",0)); |
| | | return appUser.getId(); |
| | | } |
| | | |
| | | public SecUser getLoginUser(){ |
| | | public TAppUser getLoginUser(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser secUser = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return secUser; |
| | | } |
| | | |
| | | public Integer getUserType(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return userName.getUserType(); |
| | | |
| | | TAppUser TAppUser = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", username).eq("isDelete",0)); |
| | | return TAppUser; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public void logoff(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | TAppUser userName = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", username).eq("isDelete",0)); |
| | | userName.setIsDelete(true); |
| | | secUserService.saveOrUpdate(userName); |
| | | appUserService.saveOrUpdate(userName); |
| | | } |
| | | |
| | | public Boolean checkPhoneExits(String phone){ |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", phone).eq("isDelete",0)); |
| | | TAppUser userName = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", phone).eq("isDelete",0)); |
| | | if(userName!=null){ |
| | | return true; |
| | | }else{ |