| Line 49... |
Line 49... |
| 49 |
import com.spice.profitmandi.dao.repository.dtr.RoleRepository;
|
49 |
import com.spice.profitmandi.dao.repository.dtr.RoleRepository;
|
| 50 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
50 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 51 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
51 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
| 52 |
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
|
52 |
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
|
| 53 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
53 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| - |
|
54 |
import com.spice.profitmandi.service.AuthService;
|
| 54 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
55 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 55 |
import com.spice.profitmandi.service.user.UserService;
|
56 |
import com.spice.profitmandi.service.user.UserService;
|
| 56 |
import com.spice.profitmandi.web.enumuration.UserStatus;
|
57 |
import com.spice.profitmandi.web.enumuration.UserStatus;
|
| 57 |
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
|
58 |
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
|
| 58 |
import com.spice.profitmandi.web.req.UserRequest;
|
59 |
import com.spice.profitmandi.web.req.UserRequest;
|
| Line 97... |
Line 98... |
| 97 |
|
98 |
|
| 98 |
@Autowired
|
99 |
@Autowired
|
| 99 |
private UserAccountRepository userAccountRepository;
|
100 |
private UserAccountRepository userAccountRepository;
|
| 100 |
|
101 |
|
| 101 |
@Autowired
|
102 |
@Autowired
|
| - |
|
103 |
private AuthService authService;
|
| - |
|
104 |
|
| - |
|
105 |
@Autowired
|
| 102 |
private AddressRepository addressRepository;
|
106 |
private AddressRepository addressRepository;
|
| 103 |
|
107 |
|
| 104 |
@Autowired
|
108 |
@Autowired
|
| 105 |
private GoogleLoginProcessor googleLoginProcessor;
|
109 |
private GoogleLoginProcessor googleLoginProcessor;
|
| 106 |
|
110 |
|
| Line 135... |
Line 139... |
| 135 |
Map<String, Object> responseMap = new HashMap<>();
|
139 |
Map<String, Object> responseMap = new HashMap<>();
|
| 136 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
140 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 137 |
User user = null;
|
141 |
User user = null;
|
| 138 |
if (userInfo.getUserId() > -1) {
|
142 |
if (userInfo.getUserId() > -1) {
|
| 139 |
user = userRepository.selectById(userInfo.getUserId());
|
143 |
user = userRepository.selectById(userInfo.getUserId());
|
| - |
|
144 |
if(!user.getEmailId().equalsIgnoreCase(userInfo.getEmail())) {
|
| - |
|
145 |
String userName = null;
|
| - |
|
146 |
if(user.getSecondryEmailId()!=null && user.getSecondryEmailId().equals(userInfo.getEmail())) {
|
| - |
|
147 |
userName = user.getFirstName() + " " + user.getLastName();
|
| - |
|
148 |
} else {
|
| - |
|
149 |
userName = authService.getNameByEmailId(userInfo.getEmail());
|
| - |
|
150 |
}
|
| - |
|
151 |
responseMap.put(ProfitMandiConstants.USER_ID, userInfo.getUserId());
|
| - |
|
152 |
responseMap.put(ProfitMandiConstants.USER_NAME, userName);
|
| - |
|
153 |
responseMap.put(ProfitMandiConstants.USER_STATUS, "fofoAssociate");
|
| - |
|
154 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
|
| - |
|
155 |
return responseSender.ok(responseMap);
|
| - |
|
156 |
}
|
| 140 |
} else {
|
157 |
} else {
|
| 141 |
try {
|
158 |
try {
|
| 142 |
user = userRepository.selectByEmailId(userInfo.getEmail());
|
159 |
user = userRepository.selectByEmailId(userInfo.getEmail());
|
| 143 |
} catch (ProfitMandiBusinessException e1) {
|
160 |
} catch (ProfitMandiBusinessException e1) {
|
| 144 |
}
|
161 |
}
|
| Line 349... |
Line 366... |
| 349 |
int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
|
366 |
int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
|
| 350 |
return responseSender.ok(userService.getEmailsAndFofoStoreCodeByUserId(userId));
|
367 |
return responseSender.ok(userService.getEmailsAndFofoStoreCodeByUserId(userId));
|
| 351 |
}
|
368 |
}
|
| 352 |
|
369 |
|
| 353 |
@ApiImplicitParams({
|
370 |
@ApiImplicitParams({
|
| 354 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
371 |
@ApiImplicitParam(name = "Auth-Token", value = "-Token", required = true, dataType = "string", paramType = "header") })
|
| 355 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_SECONDRY_EMAIL_ID, method = RequestMethod.PUT)
|
372 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_SECONDRY_EMAIL_ID, method = RequestMethod.PUT)
|
| 356 |
public ResponseEntity<?> updateSecondryEmailId(HttpServletRequest request,
|
373 |
public ResponseEntity<?> updateSecondryEmailId(HttpServletRequest request,
|
| 357 |
@RequestParam(name = ProfitMandiConstants.SECONDRY_EMAIL_ID) String secondryEmailId) throws Throwable {
|
374 |
@RequestParam(name = ProfitMandiConstants.SECONDRY_EMAIL_ID) String secondryEmailId) throws Throwable {
|
| 358 |
int userId = (int) request.getAttribute("userId");
|
375 |
int userId = (int) request.getAttribute("userId");
|
| 359 |
User user = userRepository.selectById(userId);
|
376 |
User user = userRepository.selectById(userId);
|