Class SellerRegistrationServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.SellerRegistrationServiceImpl
-
- All Implemented Interfaces:
SellerRegistrationService
@Service public class SellerRegistrationServiceImpl extends java.lang.Object implements SellerRegistrationService
-
-
Field Summary
Fields Modifier and Type Field Description private AccessManagementService
accessManagementService
private CertificateRepository
certificateRepository
private ChatRepository
chatRepository
private CommonProperties
commonProperties
private EmailProperties
emailProperties
private EmailSenderService
emailSenderService
private GeoLocationService
geoLocationService
private static com.fasterxml.jackson.databind.ObjectMapper
mapper
private OrderRepository
orderRepository
private org.springframework.security.crypto.password.PasswordEncoder
passwordEncoder
private ProfileManagementService
profileManagementService
private SalesCatalogService
salesCatalogService
private SellerRepository
sellerRepository
private SellerSkuRepository
sellerSkuRepository
private SequenceGeneratorService
sequenceGenerator
private UserManagementService
userManagementService
-
Constructor Summary
Constructors Constructor Description SellerRegistrationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.HashSet<java.lang.String>
addFavoriteSeller(java.lang.String sellerId)
This method adds database entity at already in the existing database entities list.java.util.LinkedHashSet<java.lang.String>
addFavoriteSellerSKU(java.lang.String sellerSkuId)
This method adds database entity at already in the existing database entities list.private void
addRelations(Seller seller)
void
changeProfileEmbeddedParent(java.lang.String profileId, java.lang.String sellerId)
This method updates database entities.private void
deactivateAllProfiles(java.lang.String sellerId)
java.util.List<Certificate>
getCertificates()
This method returns database entities as list.java.util.List<Chat>
getChatsByLoggedProfile()
This method does returns database entities list.Country
getCountryBySellerId(java.lang.String sellerId)
This method returns data as list.java.util.HashSet<Seller>
getFavoriteSellers()
This method returns database entities as list.java.util.LinkedHashSet<SellerSKU>
getFavoriteSellerSKUs()
This method returns database entities as list.Profile
getLoggedProfile()
This method does returns database entity which logged in system.Seller
getLoggedSeller()
This method does returns database entity which logged in system.SellerRepository
getRepository()
java.util.List<Attachment>
getSellerDocumentUrls(java.lang.String sellerId, java.lang.String type)
This method returns data as list.java.util.List<java.util.Map<java.lang.String,java.lang.String>>
getSellers()
This method retrieves a map, which can be processed in a templates.java.util.List<SellerSKU>
getSellerSellerSkus(java.lang.String sellerId)
This method returns data as list.java.util.Map<java.lang.String,java.lang.Boolean>
isEmailNotificationEnabled(java.lang.String sellerId)
This method checks and returns mapboolean
isEmailTaken(java.lang.String email)
Checks if given email is taken by any user.boolean
isFavoriteSellerExists(java.lang.String sellerId)
This method checks is exists database entity.boolean
isFavoriteSellerNotExists(java.lang.String sellerId)
This method checks is not exists database entity.boolean
isFavoriteSellerSkuExists(java.lang.String sellerSkuId)
This method checks is exists database entity.boolean
isFavoriteSellerSkuNotExists(java.lang.String sellerSkuId)
This method checks is not exists database entity.boolean
isLogged()
This method does check is database entity logged in system.boolean
isNotLogged()
This method does check is not database entity logged in system.boolean
isTariffNotPaid(java.lang.String sellerId)
This method checks is database entity field had some value.boolean
isTariffPaid(java.lang.String sellerId)
This method checks is database entity field had some value.private void
prepareRelations(Seller seller)
java.util.Optional<Seller>
registerSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)
This method creates a database entity.private void
removeCategoryFromSeller(java.lang.String sellerId, java.lang.String catId)
private void
removeDocumentFromSeller(java.lang.String sellerId, java.lang.String docUrl)
void
removeFavoriteSeller(java.lang.String sellerId)
This method removes database entity.void
removeFavoriteSellerSKU(java.lang.String sellerSkuId)
This method removes database entity.private void
removeImageUrlFromSeller(java.lang.String sellerId, java.lang.String imageUrl)
private void
removeProductFromSeller(java.lang.String sellerId, java.lang.String prodId)
private void
removeProfileFromSeller(java.lang.String sellerId, java.lang.String profileId)
private void
removeProfilesFromSeller(java.lang.String sellerId)
private void
removeRelations(Seller sUI, Seller sDB)
void
removeSellerAndClean(java.lang.String sellerId)
This method removes a database entity and clean all relationships from another entities.private void
removeSellerAndSellerSKUs(java.lang.String sellerId)
private void
removeSellerFromAddress(java.lang.String sellerId)
private void
removeSellerFromCertificate(java.lang.String sellerId, java.lang.String certificateId)
private void
removeSellerFromCertificates(java.lang.String sellerId)
void
removeSellersByIds(java.util.ArrayList<java.lang.String> sellersIds)
This method removes a list of database entities.private void
removeSellerSkuFromSeller(java.lang.String sellerId, java.lang.String sellerSkuId)
Seller
saveSeller(Seller seller)
This method saves database entity.Seller
saveSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)
This method saves database entity.void
sendContactSupplierEmail(java.lang.String sellerId, java.lang.String messageText, java.lang.String topic)
This method sends a email for contact supplier.private void
updateAddressFromSeller(Seller seller, Seller sellerDB)
private void
updateProfilesFromSeller(Seller seller, Seller sellerDB, boolean verifyRequired)
Seller
updateSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap, java.lang.Boolean verifyRequired)
This method save an updates of database entity.private User
updateUser(User user, Profile profileDB, User userDB, java.lang.String password, boolean verifyRequired)
-
-
-
Field Detail
-
chatRepository
@Autowired private ChatRepository chatRepository
-
sellerRepository
@Autowired private SellerRepository sellerRepository
-
sellerSkuRepository
@Autowired private SellerSkuRepository sellerSkuRepository
-
certificateRepository
@Autowired private CertificateRepository certificateRepository
-
orderRepository
@Autowired private OrderRepository orderRepository
-
userManagementService
@Autowired private UserManagementService userManagementService
-
profileManagementService
@Autowired private ProfileManagementService profileManagementService
-
geoLocationService
@Autowired private GeoLocationService geoLocationService
-
salesCatalogService
@Autowired private SalesCatalogService salesCatalogService
-
accessManagementService
@Autowired private AccessManagementService accessManagementService
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
emailSenderService
@Autowired private EmailSenderService emailSenderService
-
emailProperties
@Autowired private EmailProperties emailProperties
-
passwordEncoder
@Autowired private org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
-
commonProperties
@Autowired private CommonProperties commonProperties
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public SellerRepository getRepository()
- Specified by:
getRepository
in interfaceSellerRegistrationService
-
isLogged
public boolean isLogged()
Description copied from interface:SellerRegistrationService
This method does check is database entity logged in system.- Specified by:
isLogged
in interfaceSellerRegistrationService
- Returns:
- value as boolean
-
isNotLogged
public boolean isNotLogged()
Description copied from interface:SellerRegistrationService
This method does check is not database entity logged in system.- Specified by:
isNotLogged
in interfaceSellerRegistrationService
- Returns:
- value as boolean
-
getLoggedSeller
public Seller getLoggedSeller()
Description copied from interface:SellerRegistrationService
This method does returns database entity which logged in system.- Specified by:
getLoggedSeller
in interfaceSellerRegistrationService
- Returns:
- database entity
-
getLoggedProfile
public Profile getLoggedProfile()
Description copied from interface:SellerRegistrationService
This method does returns database entity which logged in system.- Specified by:
getLoggedProfile
in interfaceSellerRegistrationService
- Returns:
- database entity
-
getChatsByLoggedProfile
public java.util.List<Chat> getChatsByLoggedProfile()
Description copied from interface:SellerRegistrationService
This method does returns database entities list.- Specified by:
getChatsByLoggedProfile
in interfaceSellerRegistrationService
- Returns:
- database entities as list
-
getCertificates
public java.util.List<Certificate> getCertificates()
Description copied from interface:SellerRegistrationService
This method returns database entities as list.- Specified by:
getCertificates
in interfaceSellerRegistrationService
- Returns:
- database entities as list
-
registerSeller
@Transactional public java.util.Optional<Seller> registerSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)
Description copied from interface:SellerRegistrationService
This method creates a database entity.- Specified by:
registerSeller
in interfaceSellerRegistrationService
- Parameters:
sellerAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
sendContactSupplierEmail
public void sendContactSupplierEmail(java.lang.String sellerId, java.lang.String messageText, java.lang.String topic)
Description copied from interface:SellerRegistrationService
This method sends a email for contact supplier.- Specified by:
sendContactSupplierEmail
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification database entity who send emailmessageText
- email massage texttopic
- email message topic
-
saveSeller
@Transactional public Seller saveSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)
Description copied from interface:SellerRegistrationService
This method saves database entity.- Specified by:
saveSeller
in interfaceSellerRegistrationService
- Parameters:
sellerAsMap
- map-representation of database entity- Returns:
- saved instance of database entity
-
saveSeller
@Transactional public Seller saveSeller(Seller seller)
Description copied from interface:SellerRegistrationService
This method saves database entity.- Specified by:
saveSeller
in interfaceSellerRegistrationService
- Parameters:
seller
- database entity- Returns:
- saved instance of database entity
-
updateSeller
@Transactional public Seller updateSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap, java.lang.Boolean verifyRequired)
Description copied from interface:SellerRegistrationService
This method save an updates of database entity.- Specified by:
updateSeller
in interfaceSellerRegistrationService
- Parameters:
sellerAsMap
- map-representation of database entityverifyRequired
- boolean value- Returns:
- saved instance of database entity
-
removeSellerAndClean
@Transactional public void removeSellerAndClean(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method removes a database entity and clean all relationships from another entities.- Specified by:
removeSellerAndClean
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which will be removed
-
removeSellersByIds
@Transactional public void removeSellersByIds(java.util.ArrayList<java.lang.String> sellersIds)
Description copied from interface:SellerRegistrationService
This method removes a list of database entities.- Specified by:
removeSellersByIds
in interfaceSellerRegistrationService
- Parameters:
sellersIds
- the list of database entities which will be removed
-
getSellerSellerSkus
public java.util.List<SellerSKU> getSellerSellerSkus(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method returns data as list.- Specified by:
getSellerSellerSkus
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which related entities list be returned- Returns:
- database entities as list
-
getCountryBySellerId
public Country getCountryBySellerId(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method returns data as list.- Specified by:
getCountryBySellerId
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which related entities list be returned- Returns:
- country entity
-
isTariffPaid
public boolean isTariffPaid(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method checks is database entity field had some value.- Specified by:
isTariffPaid
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which will be checked- Returns:
- value as boolean
-
isTariffNotPaid
public boolean isTariffNotPaid(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method checks is database entity field had some value.- Specified by:
isTariffNotPaid
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerNotExists
public boolean isFavoriteSellerNotExists(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method checks is not exists database entity.- Specified by:
isFavoriteSellerNotExists
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerExists
public boolean isFavoriteSellerExists(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method checks is exists database entity.- Specified by:
isFavoriteSellerExists
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerSkuNotExists
public boolean isFavoriteSellerSkuNotExists(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationService
This method checks is not exists database entity.- Specified by:
isFavoriteSellerSkuNotExists
in interfaceSellerRegistrationService
- Parameters:
sellerSkuId
- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerSkuExists
public boolean isFavoriteSellerSkuExists(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationService
This method checks is exists database entity.- Specified by:
isFavoriteSellerSkuExists
in interfaceSellerRegistrationService
- Parameters:
sellerSkuId
- identification for database entity which will be checked- Returns:
- value as boolean
-
isEmailNotificationEnabled
public java.util.Map<java.lang.String,java.lang.Boolean> isEmailNotificationEnabled(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method checks and returns map- Specified by:
isEmailNotificationEnabled
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which will be checked- Returns:
- value as boolean
-
getSellerDocumentUrls
public java.util.List<Attachment> getSellerDocumentUrls(java.lang.String sellerId, java.lang.String type)
Description copied from interface:SellerRegistrationService
This method returns data as list.- Specified by:
getSellerDocumentUrls
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which related beans list be returnedtype
- field for database entity from filter- Returns:
- database beans as list
-
getFavoriteSellers
public java.util.HashSet<Seller> getFavoriteSellers()
Description copied from interface:SellerRegistrationService
This method returns database entities as list.- Specified by:
getFavoriteSellers
in interfaceSellerRegistrationService
- Returns:
- database entities as list
-
addFavoriteSeller
@Transactional public java.util.HashSet<java.lang.String> addFavoriteSeller(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method adds database entity at already in the existing database entities list.- Specified by:
addFavoriteSeller
in interfaceSellerRegistrationService
- Parameters:
sellerId
- identification for database entity which added in list- Returns:
- database entities as list
-
removeFavoriteSeller
@Transactional public void removeFavoriteSeller(java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method removes database entity.- Specified by:
removeFavoriteSeller
in interfaceSellerRegistrationService
- Parameters:
sellerId
- database entity which will be removed
-
getFavoriteSellerSKUs
public java.util.LinkedHashSet<SellerSKU> getFavoriteSellerSKUs()
Description copied from interface:SellerRegistrationService
This method returns database entities as list.- Specified by:
getFavoriteSellerSKUs
in interfaceSellerRegistrationService
- Returns:
- database entities as list
-
addFavoriteSellerSKU
@Transactional public java.util.LinkedHashSet<java.lang.String> addFavoriteSellerSKU(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationService
This method adds database entity at already in the existing database entities list.- Specified by:
addFavoriteSellerSKU
in interfaceSellerRegistrationService
- Parameters:
sellerSkuId
- identification for database entity which added in list- Returns:
- database entities as list
-
removeFavoriteSellerSKU
@Transactional public void removeFavoriteSellerSKU(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationService
This method removes database entity.- Specified by:
removeFavoriteSellerSKU
in interfaceSellerRegistrationService
- Parameters:
sellerSkuId
- database entity which will be removed
-
getSellers
public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getSellers()
Description copied from interface:SellerRegistrationService
This method retrieves a map, which can be processed in a templates.- Specified by:
getSellers
in interfaceSellerRegistrationService
- Returns:
- map-representation of data
-
changeProfileEmbeddedParent
@Transactional public void changeProfileEmbeddedParent(java.lang.String profileId, java.lang.String sellerId)
Description copied from interface:SellerRegistrationService
This method updates database entities.- Specified by:
changeProfileEmbeddedParent
in interfaceSellerRegistrationService
- Parameters:
profileId
- identification for database entity which will be updatedsellerId
- identification for database entity which will be updated
-
isEmailTaken
public boolean isEmailTaken(java.lang.String email)
Description copied from interface:SellerRegistrationService
Checks if given email is taken by any user.- Specified by:
isEmailTaken
in interfaceSellerRegistrationService
- Parameters:
email
- email- Returns:
true
if email is taken
-
addRelations
private void addRelations(Seller seller)
-
prepareRelations
private void prepareRelations(Seller seller)
-
removeProfilesFromSeller
private void removeProfilesFromSeller(java.lang.String sellerId)
-
removeProfileFromSeller
private void removeProfileFromSeller(java.lang.String sellerId, java.lang.String profileId)
-
removeSellerFromCertificates
private void removeSellerFromCertificates(java.lang.String sellerId)
-
removeSellerFromCertificate
private void removeSellerFromCertificate(java.lang.String sellerId, java.lang.String certificateId)
-
removeSellerAndSellerSKUs
private void removeSellerAndSellerSKUs(java.lang.String sellerId)
-
removeSellerSkuFromSeller
private void removeSellerSkuFromSeller(java.lang.String sellerId, java.lang.String sellerSkuId)
-
removeSellerFromAddress
private void removeSellerFromAddress(java.lang.String sellerId)
-
removeDocumentFromSeller
private void removeDocumentFromSeller(java.lang.String sellerId, java.lang.String docUrl)
-
removeImageUrlFromSeller
private void removeImageUrlFromSeller(java.lang.String sellerId, java.lang.String imageUrl)
-
removeCategoryFromSeller
private void removeCategoryFromSeller(java.lang.String sellerId, java.lang.String catId)
-
removeProductFromSeller
private void removeProductFromSeller(java.lang.String sellerId, java.lang.String prodId)
-
deactivateAllProfiles
private void deactivateAllProfiles(java.lang.String sellerId)
-
updateProfilesFromSeller
private void updateProfilesFromSeller(Seller seller, Seller sellerDB, boolean verifyRequired)
-
-