| Line 74... |
Line 74... |
| 74 |
|
74 |
|
| 75 |
@Autowired
|
75 |
@Autowired
|
| 76 |
private RestClient restClient;
|
76 |
private RestClient restClient;
|
| 77 |
|
77 |
|
| 78 |
public Map<String, Object> process(GoogleLoginRequest googleLoginRequest) throws ProfitMandiBusinessException {
|
78 |
public Map<String, Object> process(GoogleLoginRequest googleLoginRequest) throws ProfitMandiBusinessException {
|
| - |
|
79 |
LOGGER.info("1");
|
| 79 |
Map<String, String> params = new HashMap<>();
|
80 |
Map<String, String> params = new HashMap<>();
|
| 80 |
params.put(ProfitMandiConstants.ACCESS_TOKEN, googleLoginRequest.getToken());
|
81 |
params.put(ProfitMandiConstants.ACCESS_TOKEN, googleLoginRequest.getToken());
|
| 81 |
Map<String, String> headers = new HashMap<>(1);
|
82 |
Map<String, String> headers = new HashMap<>(1);
|
| 82 |
headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
83 |
headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
| 83 |
String responseString = null;
|
84 |
String responseString = null;
|
| Line 100... |
Line 101... |
| 100 |
}
|
101 |
}
|
| 101 |
}
|
102 |
}
|
| 102 |
}
|
103 |
}
|
| 103 |
// socialUser.setEmailId(rootNode.get("email").asText());
|
104 |
// socialUser.setEmailId(rootNode.get("email").asText());
|
| 104 |
}
|
105 |
}
|
| - |
|
106 |
LOGGER.info("2");
|
| 105 |
if (!socialUserRepository.isExistByEmailId(socialUser.getEmailId())) {
|
107 |
if (!socialUserRepository.isExistByEmailId(socialUser.getEmailId())) {
|
| 106 |
if (rootNode.has("displayName")) {
|
108 |
if (rootNode.has("displayName")) {
|
| 107 |
socialUser.setName(rootNode.get("displayName").asText());
|
109 |
socialUser.setName(rootNode.get("displayName").asText());
|
| 108 |
}
|
110 |
}
|
| 109 |
if (rootNode.has("gender")) {
|
111 |
if (rootNode.has("gender")) {
|
| Line 124... |
Line 126... |
| 124 |
socialUser.setUpdateTimestamp(LocalDateTime.now());
|
126 |
socialUser.setUpdateTimestamp(LocalDateTime.now());
|
| 125 |
socialUserRepository.persist(socialUser);
|
127 |
socialUserRepository.persist(socialUser);
|
| 126 |
}
|
128 |
}
|
| 127 |
Map<String, Object> responseMap = new HashMap<>(2);
|
129 |
Map<String, Object> responseMap = new HashMap<>(2);
|
| 128 |
|
130 |
|
| - |
|
131 |
LOGGER.info("3");
|
| 129 |
String name = authService.getNameByEmailId(socialUser.getEmailId());
|
132 |
String name = authService.getNameByEmailId(socialUser.getEmailId());
|
| 130 |
LOGGER.info("User Name from getNameByEmailId({}) is {}", socialUser.getEmailId(), name);
|
133 |
LOGGER.info("User Name from getNameByEmailId({}) is {}", socialUser.getEmailId(), name);
|
| 131 |
if(name != null) {
|
134 |
if(name != null) {
|
| 132 |
User registeredUser = null;
|
135 |
User registeredUser = null;
|
| 133 |
if(authRepository.selectByGmailId(socialUser.getEmailId())!=null) {
|
136 |
if(authRepository.selectByGmailId(socialUser.getEmailId())!=null) {
|
| Line 137... |
Line 140... |
| 137 |
int userId = userAccountRepository.selectUserIdByRetailerId(promoter.getRetailerId());
|
140 |
int userId = userAccountRepository.selectUserIdByRetailerId(promoter.getRetailerId());
|
| 138 |
registeredUser = userRepository.selectById(userId);
|
141 |
registeredUser = userRepository.selectById(userId);
|
| 139 |
} else if(userRepository.isExistBySecondryEmailId(socialUser.getEmailId())) {
|
142 |
} else if(userRepository.isExistBySecondryEmailId(socialUser.getEmailId())) {
|
| 140 |
registeredUser = userRepository.selectBySecondryEmailId(socialUser.getEmailId());
|
143 |
registeredUser = userRepository.selectBySecondryEmailId(socialUser.getEmailId());
|
| 141 |
}
|
144 |
}
|
| - |
|
145 |
LOGGER.info("4");
|
| 142 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(registeredUser.getId());
|
146 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(registeredUser.getId());
|
| 143 |
String[] roleTypes = new String[roleIds.size()];
|
147 |
String[] roleTypes = new String[roleIds.size()];
|
| 144 |
int index = 0;
|
148 |
int index = 0;
|
| 145 |
for (int roleId : roleIds) {
|
149 |
for (int roleId : roleIds) {
|
| 146 |
roleTypes[index++] = String.valueOf(roleId);
|
150 |
roleTypes[index++] = String.valueOf(roleId);
|