| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service.user;
|
1 |
package com.spice.profitmandi.service.user;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.nio.charset.StandardCharsets;
|
| 3 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| 4 |
import java.util.ArrayList;
|
5 |
import java.util.ArrayList;
|
| 5 |
import java.util.HashMap;
|
6 |
import java.util.HashMap;
|
| 6 |
import java.util.HashSet;
|
7 |
import java.util.HashSet;
|
| 7 |
import java.util.List;
|
8 |
import java.util.List;
|
| Line 15... |
Line 16... |
| 15 |
import org.springframework.beans.factory.annotation.Autowired;
|
16 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 16 |
import org.springframework.beans.factory.annotation.Qualifier;
|
17 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 17 |
import org.springframework.cache.annotation.Cacheable;
|
18 |
import org.springframework.cache.annotation.Cacheable;
|
| 18 |
import org.springframework.stereotype.Component;
|
19 |
import org.springframework.stereotype.Component;
|
| 19 |
|
20 |
|
| - |
|
21 |
import com.google.common.hash.Hashing;
|
| 20 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
22 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 21 |
import com.spice.profitmandi.common.model.CustomAddress;
|
23 |
import com.spice.profitmandi.common.model.CustomAddress;
|
| 22 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
24 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 23 |
import com.spice.profitmandi.common.model.CustomShop;
|
25 |
import com.spice.profitmandi.common.model.CustomShop;
|
| 24 |
import com.spice.profitmandi.common.model.MapWrapper;
|
26 |
import com.spice.profitmandi.common.model.MapWrapper;
|
| Line 419... |
Line 421... |
| 419 |
if (saholicUser == null) {
|
421 |
if (saholicUser == null) {
|
| 420 |
Cart cart = new Cart();
|
422 |
Cart cart = new Cart();
|
| 421 |
cart.setCartStatus(CartStatus.ACTIVE);
|
423 |
cart.setCartStatus(CartStatus.ACTIVE);
|
| 422 |
cartRepository.persist(cart);
|
424 |
cartRepository.persist(cart);
|
| 423 |
saholicUser = new com.spice.profitmandi.dao.entity.user.User();
|
425 |
saholicUser = new com.spice.profitmandi.dao.entity.user.User();
|
| 424 |
saholicUser.setPassword(loginRequestResponseModel.getPassword());
|
426 |
saholicUser.setPassword(getHash256(loginRequestResponseModel.getPassword()));
|
| 425 |
saholicUser.setEmailId(loginRequestResponseModel.getEmail());
|
427 |
saholicUser.setEmailId(loginRequestResponseModel.getEmail());
|
| 426 |
saholicUser.setName(loginRequestResponseModel.getCustomerName());
|
428 |
saholicUser.setName(loginRequestResponseModel.getCustomerName());
|
| 427 |
saholicUser.setActiveCartId(cart.getId());
|
429 |
saholicUser.setActiveCartId(cart.getId());
|
| 428 |
saholicUser.setCreateTimestamp(LocalDateTime.now());
|
430 |
saholicUser.setCreateTimestamp(LocalDateTime.now());
|
| 429 |
loginRequestResponseModel.setPassword(null);
|
431 |
loginRequestResponseModel.setPassword(null);
|
| Line 1092... |
Line 1094... |
| 1092 |
throws ProfitMandiBusinessException {
|
1094 |
throws ProfitMandiBusinessException {
|
| 1093 |
Address businessAddress = loginRequestResponseModel.getBusinessAddress();
|
1095 |
Address businessAddress = loginRequestResponseModel.getBusinessAddress();
|
| 1094 |
businessAddress.setRetaierId(loginRequestResponseModel.getUserId());
|
1096 |
businessAddress.setRetaierId(loginRequestResponseModel.getUserId());
|
| 1095 |
addressRepository.persist(businessAddress);
|
1097 |
addressRepository.persist(businessAddress);
|
| 1096 |
}
|
1098 |
}
|
| - |
|
1099 |
|
| - |
|
1100 |
private String getHash256(String originalString) {
|
| - |
|
1101 |
return Hashing.sha256().hashString(originalString, StandardCharsets.UTF_8).toString();
|
| - |
|
1102 |
}
|
| 1097 |
}
|
1103 |
}
|