package com.doumee.config.Jwt; 
 | 
  
 | 
import io.swagger.models.auth.In; 
 | 
import lombok.Data; 
 | 
  
 | 
import java.util.HashMap; 
 | 
import java.util.Map; 
 | 
  
 | 
/** 
 | 
 * jwt的第二部分 
 | 
 * 
 | 
 * @author fengshuonan 
 | 
 * @Date 2019/7/20 20:45 
 | 
 */ 
 | 
@Data 
 | 
public class JwtPayLoad { 
 | 
  
 | 
    /** 
 | 
     * 用户id 
 | 
     */ 
 | 
    private Integer memberId; 
 | 
    private long expire; 
 | 
  
 | 
  
 | 
    public JwtPayLoad() { 
 | 
    } 
 | 
  
 | 
    public JwtPayLoad(Integer memberId) { 
 | 
        this.memberId = memberId; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * payload转化为map形式 
 | 
     * 
 | 
     * @author fengshuonan 
 | 
     * @Date 2019/7/20 20:50 
 | 
     */ 
 | 
    public Map<String, Object> toMap() { 
 | 
        HashMap<String, Object> map = new HashMap<>(); 
 | 
        map.put("memberId", this.memberId); 
 | 
        return map; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * payload转化为map形式 
 | 
     * 
 | 
     * @author fengshuonan 
 | 
     * @Date 2019/7/20 20:50 
 | 
     */ 
 | 
    public static JwtPayLoad toBean(Map<String, Object> map) { 
 | 
        if (map == null || map.size() == 0) { 
 | 
            return new JwtPayLoad(); 
 | 
        } else { 
 | 
            JwtPayLoad jwtPayLoad = new JwtPayLoad(); 
 | 
            jwtPayLoad.setMemberId((Integer) map.get("memberId")); 
 | 
  
 | 
            return jwtPayLoad; 
 | 
        } 
 | 
    } 
 | 
  
 | 
  
 | 
  
 | 
} 
 |