kaiyu
2021-06-08 6ebaa774117610a8599d369fe9d8258e62a69031
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.moral.api.pojo.vo.login;
 
import com.fasterxml.jackson.annotation.JsonInclude;
import com.moral.api.pojo.redisBean.AccountInfoDTO;
import com.moral.api.pojo.dto.login.LoginDTO;
import com.moral.constant.ResponseCodeEnum;
import lombok.Data;
 
/**
 * @ClassName LoginVo
 * @Description TODO
 * @Author 陈凯裕
 * @Date 2021/3/13 16:09
 * @Version TODO
 **/
 
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class LoginVO {
 
    /*
     *用户token
     * */
    private String token;
 
    /*
     * 用户基本信息
     * */
    private AccountInfoVO accountInfoVO;
 
    /**
     * @Description: DTO转换VO
     * @Param: [dto]
     * @return: com.moral.api.pojo.vo.login.LoginVO
     * @Author: 陈凯裕
     * @Date: 2021/3/13
     */
    public static LoginVO convert(LoginDTO dto) {
        if (dto.getCode() != ResponseCodeEnum.SUCCESS.getCode())
            return null;
 
        LoginVO vo = new LoginVO();
        String token = dto.getToken();
        AccountInfoDTO accountInfoDTO = dto.getAccountInfoDTO();
        AccountInfoVO accountInfoVO = AccountInfoVO.convert(accountInfoDTO);
        vo.setAccountInfoVO(accountInfoVO);
        vo.setToken(token);
        return vo;
    }
}