| Line 7... |
Line 7... |
| 7 |
import java.util.Map;
|
7 |
import java.util.Map;
|
| 8 |
import java.util.function.Predicate;
|
8 |
import java.util.function.Predicate;
|
| 9 |
|
9 |
|
| 10 |
import javax.servlet.http.HttpServletRequest;
|
10 |
import javax.servlet.http.HttpServletRequest;
|
| 11 |
|
11 |
|
| - |
|
12 |
import org.hibernate.annotations.common.util.impl.Log_.logger;
|
| 12 |
import org.slf4j.Logger;
|
13 |
import org.slf4j.Logger;
|
| 13 |
import org.slf4j.LoggerFactory;
|
14 |
import org.slf4j.LoggerFactory;
|
| 14 |
import org.springframework.beans.factory.annotation.Autowired;
|
15 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 15 |
import org.springframework.beans.factory.annotation.Value;
|
16 |
import org.springframework.beans.factory.annotation.Value;
|
| 16 |
import org.springframework.http.HttpStatus;
|
17 |
import org.springframework.http.HttpStatus;
|
| Line 151... |
Line 152... |
| 151 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, user.getEmailId());
|
152 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, user.getEmailId());
|
| 152 |
responseMap.put(ProfitMandiConstants.USER_ID, user.getId());
|
153 |
responseMap.put(ProfitMandiConstants.USER_ID, user.getId());
|
| 153 |
responseMap.put(ProfitMandiConstants.USER_NAME, user.getFirstName() + " " + user.getLastName());
|
154 |
responseMap.put(ProfitMandiConstants.USER_NAME, user.getFirstName() + " " + user.getLastName());
|
| 154 |
|
155 |
|
| 155 |
List<UserRole> userRoles = userRoleRepository.selectByUserId(user.getId());
|
156 |
List<UserRole> userRoles = userRoleRepository.selectByUserId(user.getId());
|
| - |
|
157 |
LOGGER.info("userRoles {} ", userRoles);
|
| 156 |
String[] roleTypes = new String[userRoles.size()];
|
158 |
String[] roleTypes = new String[userRoles.size()];
|
| 157 |
|
159 |
|
| 158 |
// generate new token if roles have been updated
|
160 |
// generate new token if roles have been updated
|
| 159 |
if (userInfo.getRoleNames() == null || userRoles.size() != userInfo.getRoleNames().size()) {
|
161 |
if (userInfo.getRoleNames() == null || userRoles.size() != userInfo.getRoleNames().size()) {
|
| 160 |
// String[] roleTypes = new String[userRoles.size()];
|
162 |
// String[] roleTypes = new String[userRoles.size()];
|
| Line 168... |
Line 170... |
| 168 |
|
170 |
|
| 169 |
// if user is retailer
|
171 |
// if user is retailer
|
| 170 |
if (userRoles.stream().anyMatch(new Predicate<UserRole>() {
|
172 |
if (userRoles.stream().anyMatch(new Predicate<UserRole>() {
|
| 171 |
@Override
|
173 |
@Override
|
| 172 |
public boolean test(UserRole t) {
|
174 |
public boolean test(UserRole t) {
|
| 173 |
return t.getRoleType().equals(RoleType.RETAILER);
|
175 |
return t.getRoleType() == RoleType.RETAILER;
|
| 174 |
}
|
176 |
}
|
| 175 |
})) {
|
177 |
})) {
|
| - |
|
178 |
|
| 176 |
UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
|
179 |
UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
|
| 177 |
Retailer retailer = retailerRepository.selectById(uc.getUserId());
|
180 |
Retailer retailer = retailerRepository.selectById(uc.getUserId());
|
| 178 |
// if retailer is activated 1 then verified retailer
|
181 |
// if retailer is activated 1 then verified retailer
|
| 179 |
// else if migrated is 1 then old retailer
|
182 |
// else if migrated is 1 then old retailer
|
| 180 |
// else retailer is not verifed
|
183 |
// else retailer is not verifed
|
| Line 190... |
Line 193... |
| 190 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_VERIFIED_RETAILER.getValue());
|
193 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_VERIFIED_RETAILER.getValue());
|
| 191 |
}
|
194 |
}
|
| 192 |
} else if (userRoles.stream().anyMatch(new Predicate<UserRole>() {
|
195 |
} else if (userRoles.stream().anyMatch(new Predicate<UserRole>() {
|
| 193 |
@Override
|
196 |
@Override
|
| 194 |
public boolean test(UserRole t) {
|
197 |
public boolean test(UserRole t) {
|
| 195 |
return t.getRoleType().equals(RoleType.USER);
|
198 |
return t.getRoleType() == RoleType.USER;
|
| 196 |
}
|
199 |
}
|
| 197 |
})) {
|
200 |
})) {
|
| 198 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.REGISTERED.getValue());
|
201 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.REGISTERED.getValue());
|
| 199 |
}
|
202 |
}
|
| 200 |
} else {
|
203 |
} else {
|