PageRenderTime 55ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/web/src/main/java/com/fasheng/web/helper/UserHelper.java

https://github.com/dawnsait/holywar
Java | 44 lines | 39 code | 5 blank | 0 comment | 0 complexity | e82001c04868504c1f2da9f4c16173c9 MD5 | raw file
  1. package com.fasheng.web.helper;
  2. import com.alibaba.fastjson.JSON;
  3. import com.fasheng.service.dto.PartnerUserDTO;
  4. import com.fasheng.service.dto.UserDTO;
  5. import com.fasheng.web.request.user.PartnerUserLoginRequest;
  6. import com.fasheng.web.request.user.UserRequest;
  7. public class UserHelper {
  8. public static PartnerUserLoginRequest getPartnerUserLoginRequest(String requestInfo) {
  9. return JSON.parseObject(requestInfo, PartnerUserLoginRequest.class);
  10. }
  11. public static PartnerUserDTO buildPartnerUserDTO(PartnerUserLoginRequest request) {
  12. PartnerUserDTO dto = new PartnerUserDTO();
  13. dto.setAccessToken(request.getAccessToken());
  14. dto.setRefreshToken(request.getRefreshToken());
  15. dto.setPartnerUserId(request.getPartnerUserId());
  16. dto.setVersion(request.getVersion());
  17. dto.setUserId(request.getUserId());
  18. dto.setType(request.getType());
  19. return dto;
  20. }
  21. public static UserDTO buildUserDTO(UserRequest userRequest) {
  22. UserDTO dto = new UserDTO();
  23. dto.setDegrade(userRequest.getDegrade());
  24. dto.setEmail(userRequest.getEmail());
  25. dto.setFirstName(userRequest.getFirstName());
  26. dto.setLastName(userRequest.getLastName());
  27. dto.setMobile(userRequest.getMobile());
  28. dto.setNickName(userRequest.getNickName());
  29. dto.setPortrait(userRequest.getPortrait());
  30. dto.setRealName(userRequest.getRealName());
  31. dto.setScore(userRequest.getScore());
  32. dto.setStatus(userRequest.getStatus());
  33. dto.setTelephone(userRequest.getTelephone());
  34. dto.setUserId(userRequest.getUserId());
  35. dto.setUserName(userRequest.getUserName());
  36. dto.setPassword(userRequest.getPassword());
  37. return dto;
  38. }
  39. }