mirror of https://gitee.com/stylefeng/roses
				
				
				
			【7.0.4】【c】更新用户登录获取用户头像url
							parent
							
								
									9ce08f494f
								
							
						
					
					
						commit
						352fb63a2b
					
				| 
						 | 
				
			
			@ -145,6 +145,12 @@ public class LoginUser implements Serializable {
 | 
			
		|||
    @ChineseDescription("用户的ws-url")
 | 
			
		||||
    private String wsUrl;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * 头像url
 | 
			
		||||
     */
 | 
			
		||||
    @ChineseDescription("用户头像url")
 | 
			
		||||
    private String avatarUrl;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 当前用户语种的标识,例如:chinese,english
 | 
			
		||||
     * <p>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@ import cn.stylefeng.roses.kernel.customer.api.expander.CustomerConfigExpander;
 | 
			
		|||
import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
 | 
			
		||||
import cn.stylefeng.roses.kernel.customer.modular.request.CustomerRequest;
 | 
			
		||||
import cn.stylefeng.roses.kernel.email.api.pojo.SendMailParam;
 | 
			
		||||
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
 | 
			
		||||
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
 | 
			
		||||
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
 | 
			
		||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +90,7 @@ public class CustomerFactory {
 | 
			
		|||
     * @author fengshuonan
 | 
			
		||||
     * @date 2021/6/7 17:06
 | 
			
		||||
     */
 | 
			
		||||
    public static LoginUser createLoginUser(Customer customer) {
 | 
			
		||||
    public static LoginUser createLoginUser(Customer customer, FileOperatorApi fileOperatorApi) {
 | 
			
		||||
        LoginUser loginUser = new LoginUser();
 | 
			
		||||
        loginUser.setUserId(customer.getCustomerId());
 | 
			
		||||
        loginUser.setAccount(customer.getAccount());
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +103,10 @@ public class CustomerFactory {
 | 
			
		|||
        simpleUserInfo.setPhone(customer.getTelephone());
 | 
			
		||||
        loginUser.setSimpleUserInfo(simpleUserInfo);
 | 
			
		||||
 | 
			
		||||
        // 设置用户头像url
 | 
			
		||||
        String fileAuthUrl = fileOperatorApi.getFileAuthUrl(CustomerConfigExpander.getCustomerBucket(), customer.getAvatarObjectName(), CustomerConfigExpander.getCustomerBucketExpiredSeconds());
 | 
			
		||||
        loginUser.setAvatarUrl(fileAuthUrl);
 | 
			
		||||
 | 
			
		||||
        return loginUser;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -116,7 +116,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
 | 
			
		|||
        wrapper.set(Customer::getVerifiedFlag, YesOrNotEnum.Y.getCode());
 | 
			
		||||
        wrapper.eq(Customer::getVerifyCode, customerRequest.getVerifyCode());
 | 
			
		||||
        boolean result = this.update(wrapper);
 | 
			
		||||
        if(!result){
 | 
			
		||||
        if (!result) {
 | 
			
		||||
            throw new CustomerException(CustomerExceptionEnum.ACTIVE_ERROR);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -155,7 +155,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        // 获取LoginUser,用于用户的缓存
 | 
			
		||||
        LoginUser loginUser = CustomerFactory.createLoginUser(customer);
 | 
			
		||||
        LoginUser loginUser = CustomerFactory.createLoginUser(customer, fileOperatorApi);
 | 
			
		||||
 | 
			
		||||
        // 生成用户的token
 | 
			
		||||
        DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), loginRequest.getRememberMe(), null);
 | 
			
		||||
| 
						 | 
				
			
			@ -195,7 +195,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
 | 
			
		|||
        customerLambdaQueryWrapper.eq(Customer::getEmail, customerRequest.getEmail());
 | 
			
		||||
        Customer customer = this.getOne(customerLambdaQueryWrapper, false);
 | 
			
		||||
        if (customer == null) {
 | 
			
		||||
            throw new CustomerException(CustomerExceptionEnum.CANT_FIND_CUSTOMER,customerRequest.getEmail());
 | 
			
		||||
            throw new CustomerException(CustomerExceptionEnum.CANT_FIND_CUSTOMER, customerRequest.getEmail());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 邮箱验证码
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue