Class SalesCatalogServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.SalesCatalogServiceImpl
-
- All Implemented Interfaces:
SalesCatalogService
@Service public class SalesCatalogServiceImpl extends java.lang.Object implements SalesCatalogService
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SalesCatalogServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SellerSKUaddPackageItemToSellerSku(java.lang.String sellerSkuId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> packageAsMap)This method creates a database entity.private voidaddRelations(SellerSKU sellerSKU)private voidaddRelationsForUnit(Unit unit)SellerSKUchangeType(java.lang.String sellerSkuId, java.lang.String type)This method is changing a type of SellerSKUprivate InventorycreateInventory(Inventory inventoryUI)private java.util.Optional<SellerSKU>createSellerSKU(SellerSKU sellerSku)java.util.Optional<SellerSKU>createSellerSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)java.util.Optional<Unit>createUnit(Unit unit)This method creates a database entity.java.util.Optional<Unit>createUnit(java.util.LinkedHashMap<java.lang.String,java.lang.Object> unitAsMap)This method creates a database entity.SellerSKUduplicate(java.lang.String sellerSkuId)This method creates a copy of SellerSKUjava.util.List<SellerSkuExcelModel>exportListings(co.mastermindcms.modules.beans.SearchRequest request)Exports listings based on the given search request.java.util.List<CurrencyItem>getAllCurrencies()This method returns database entities as list.java.util.Map<java.lang.String,java.lang.String>getAllSellerTariff()This method returns data as map.java.util.Map<java.lang.String,java.lang.String>getCountOfSellerSkus(java.lang.String requestJson)This method returns data as map.java.util.Map<java.lang.String,java.lang.String>getCountOfSellerSkusBySeller(java.lang.String sellerId)This method returns data as map.CurrencyItemgetCurrencyByCode(java.lang.String code)This method returns database entity.java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>getPaginationUnits(java.lang.String requestJson)This method does calculation for a pages based on the request.java.util.List<Attachment>getSellerSkuDocumentUrls(java.lang.String sellerSkuId)This method returns data as list.SellerSKUgetSellerSkuFromChatTopic(java.lang.String topic)This method returns database entity.private booleanisValidToSave(SellerSKU sellerSKU)UnitDTOmapUnitToDto(Unit unit, boolean optimal)This method does map product entity to dto objectprivate voidprepareRelations(SellerSKU inputSellerSKU)private voidprepareRelationsForUnit(Unit unit)SellerSKUpublishForSale(java.lang.String sellerSkuId)This method does update a database entity.private voidremoveAttributeValuesFromSellerSku(java.lang.String sellerSkuId)voidremoveFileResources(java.lang.String sellerSkuId)This method removes all attached files and images.private voidremoveInventoryFromSellerSku(java.lang.String sellerSkuId)private voidremovePackagedItemsFromSellerSku(java.lang.String sellerSkuId)voidremovePackageItemFromSellerSku(java.lang.String sellerSkuId, java.lang.String packageId)This method removes a database entity.private voidremoveRelations(SellerSKU sUI, SellerSKU sDB)private voidremoveRelationsForUnit(Unit unitUI, Unit unitDB)private voidremoveSellerSkuAndAttributeValue(java.lang.String sellerSkuId, java.lang.String attributeValueId)voidremoveSellerSkuAndClean(java.lang.String sellerSkuId)This method removes a database entity and clean all relationships from another entities.private voidremoveSellerSkuFromCommerceItem(java.lang.String sellerSkuId)private voidremoveSellerSkuFromSeller(java.lang.String sellerSkuId, java.lang.String embeddedId)private voidremoveSellerSkuFromSellers(java.lang.String sellerSkuId)private voidremoveSellerSkuFromSku(java.lang.String sellerSkuId, java.lang.String embeddedId)private voidremoveSellerSkuFromSKUs(java.lang.String sellerSkuId)private voidremoveSellerSkuFromUnit(java.lang.String sellerSkuId)voidremoveSellerSkusByIds(java.util.ArrayList<java.lang.String> sellerSkusIds)This method removes a list of database entities.voidremoveUnitAndClean(java.lang.String unitId)This method removes a database entity and clean all relationships from another entities.private voidremoveUnitFromSellerSKU(java.lang.String unitId, java.lang.String sellerSkuId)private voidremoveUnitFromSellerSKUs(java.lang.String unitId)private voidremoveUnitFromTranslation(java.lang.String unitId, java.lang.String tranId)private voidremoveUnitFromTranslations(java.lang.String unitId)voidremoveUnitsByIds(java.util.ArrayList<java.lang.String> unitsIds)This method removes a list of database entities.SellerSKUsaveSellerSKU(SellerSKU sSku)This method saves a database entity.SellerSKUsaveSellerSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)This method save an updates of database entity.SellerSKUsaveSellerSkuAsDraft(SellerSKU sellerSku)This method saves a database entity.SellerSKUsaveSellerSkuAsDraft(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)This method save an updates of database entity.UnitsaveUnit(Unit unit)This method save an updates of database entity.UnitsaveUnit(java.util.LinkedHashMap<java.lang.String,java.lang.Object> unitAsMap)This method save an updates of database entity.java.util.LinkedHashSet<UnitDTO>searchUnits(java.lang.String requestJson)This method does search requests and returns data as list.org.springframework.data.domain.Page<Unit>searchUnitsPaged(java.lang.String requestJson)This method does search requests and returns data as pages.voiduploadListings(java.io.File file, java.lang.String lang, java.lang.String username)Uploads listings to the server for the given user.SellerSKUwithdrawFromSale(java.lang.String sellerSkuId)This method does update a database entity.private voidxssFiltering(SellerSKU sku)
-
-
-
Field Detail
-
sellerSkuRepository
@Autowired private SellerSkuRepository sellerSkuRepository
-
sellerRepository
@Autowired private SellerRepository sellerRepository
-
translationsRepository
@Autowired private TranslationsRepository translationsRepository
-
attributeValueRepository
@Autowired private AttributeValueRepository attributeValueRepository
-
inventoryRepository
@Autowired private InventoryRepository inventoryRepository
-
commerceItemRepository
@Autowired private CommerceItemRepository commerceItemRepository
-
skuRepository
@Autowired private SKURepository skuRepository
-
unitRepository
@Autowired private UnitRepository unitRepository
-
attributeRepository
@Autowired private AttributeRepository attributeRepository
-
geoLocationService
@Autowired private GeoLocationService geoLocationService
-
fileManagerService
@Autowired private co.mastermindcms.modules.filestorage.services.FileManagerService fileManagerService
-
accessManagementService
@Autowired private AccessManagementService accessManagementService
-
commerceProperties
@Autowired private CommerceProperties commerceProperties
-
commonProperties
@Autowired private CommonProperties commonProperties
-
storageService
@Autowired private MongoStorageService storageService
-
translationService
@Autowired private TranslationService translationService
-
jobService
@Autowired private JobsManagementService jobService
-
webSocketService
@Autowired private WebSocketService webSocketService
-
sellerSkuUtil
@Autowired private SellerSkuUtil sellerSkuUtil
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
sellerSkuExcelReader
@Autowired private SellerSkuExcelReader sellerSkuExcelReader
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
-
Method Detail
-
getPaginationUnits
public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationUnits(java.lang.String requestJson)
Description copied from interface:SalesCatalogServiceThis method does calculation for a pages based on the request.- Specified by:
getPaginationUnitsin interfaceSalesCatalogService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchUnits
public java.util.LinkedHashSet<UnitDTO> searchUnits(java.lang.String requestJson)
Description copied from interface:SalesCatalogServiceThis method does search requests and returns data as list.- Specified by:
searchUnitsin interfaceSalesCatalogService- Parameters:
requestJson- search request- Returns:
- data transport entities as list
-
searchUnitsPaged
public org.springframework.data.domain.Page<Unit> searchUnitsPaged(java.lang.String requestJson)
Description copied from interface:SalesCatalogServiceThis method does search requests and returns data as pages.- Specified by:
searchUnitsPagedin interfaceSalesCatalogService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
getAllCurrencies
public java.util.List<CurrencyItem> getAllCurrencies()
Description copied from interface:SalesCatalogServiceThis method returns database entities as list.- Specified by:
getAllCurrenciesin interfaceSalesCatalogService- Returns:
- database entities as list
-
getCurrencyByCode
public CurrencyItem getCurrencyByCode(java.lang.String code)
Description copied from interface:SalesCatalogServiceThis method returns database entity.- Specified by:
getCurrencyByCodein interfaceSalesCatalogService- Parameters:
code- for filter and return database entity- Returns:
- database entity
-
getSellerSkuFromChatTopic
public SellerSKU getSellerSkuFromChatTopic(java.lang.String topic)
Description copied from interface:SalesCatalogServiceThis method returns database entity.- Specified by:
getSellerSkuFromChatTopicin interfaceSalesCatalogService- Parameters:
topic- field for database entity which related entities list be returned- Returns:
- database entity
-
getCountOfSellerSkusBySeller
public java.util.Map<java.lang.String,java.lang.String> getCountOfSellerSkusBySeller(java.lang.String sellerId)
Description copied from interface:SalesCatalogServiceThis method returns data as map.- Specified by:
getCountOfSellerSkusBySellerin interfaceSalesCatalogService- Parameters:
sellerId- identification for filter and return data- Returns:
- data as map
-
getCountOfSellerSkus
public java.util.Map<java.lang.String,java.lang.String> getCountOfSellerSkus(java.lang.String requestJson)
Description copied from interface:SalesCatalogServiceThis method returns data as map.- Specified by:
getCountOfSellerSkusin interfaceSalesCatalogService- Parameters:
requestJson- identification for filter and return data- Returns:
- data as map
-
xssFiltering
private void xssFiltering(SellerSKU sku)
-
addRelations
private void addRelations(SellerSKU sellerSKU)
-
prepareRelations
private void prepareRelations(SellerSKU inputSellerSKU)
-
addRelationsForUnit
private void addRelationsForUnit(Unit unit)
-
prepareRelationsForUnit
private void prepareRelationsForUnit(Unit unit)
-
createUnit
@Transactional public java.util.Optional<Unit> createUnit(java.util.LinkedHashMap<java.lang.String,java.lang.Object> unitAsMap)
Description copied from interface:SalesCatalogServiceThis method creates a database entity.- Specified by:
createUnitin interfaceSalesCatalogService- Parameters:
unitAsMap- map-representation of database entity- Returns:
- database entity
-
createUnit
public java.util.Optional<Unit> createUnit(Unit unit)
Description copied from interface:SalesCatalogServiceThis method creates a database entity.- Specified by:
createUnitin interfaceSalesCatalogService- Parameters:
unit- database entity- Returns:
- database entity
-
addPackageItemToSellerSku
public SellerSKU addPackageItemToSellerSku(java.lang.String sellerSkuId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> packageAsMap)
Description copied from interface:SalesCatalogServiceThis method creates a database entity.- Specified by:
addPackageItemToSellerSkuin interfaceSalesCatalogService- Parameters:
sellerSkuId- unique identification for database entitypackageAsMap- map-representation of database entity- Returns:
- database entity
-
removePackageItemFromSellerSku
public void removePackageItemFromSellerSku(java.lang.String sellerSkuId, java.lang.String packageId)Description copied from interface:SalesCatalogServiceThis method removes a database entity.- Specified by:
removePackageItemFromSellerSkuin interfaceSalesCatalogService- Parameters:
sellerSkuId- unique identification for database entitypackageId- unique identification for database entity
-
removeFileResources
public void removeFileResources(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogServiceThis method removes all attached files and images.- Specified by:
removeFileResourcesin interfaceSalesCatalogService- Parameters:
sellerSkuId- unique identification for database entity
-
saveSellerSkuAsDraft
public SellerSKU saveSellerSkuAsDraft(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)
Description copied from interface:SalesCatalogServiceThis method save an updates of database entity.- Specified by:
saveSellerSkuAsDraftin interfaceSalesCatalogService- Parameters:
sellerSkuAsMap- map-representation of database entity- Returns:
- saved instance of database entity
-
saveSellerSkuAsDraft
public SellerSKU saveSellerSkuAsDraft(SellerSKU sellerSku)
Description copied from interface:SalesCatalogServiceThis method saves a database entity.- Specified by:
saveSellerSkuAsDraftin interfaceSalesCatalogService- Parameters:
sellerSku- database entity- Returns:
- saved instance of database entity
-
saveSellerSKU
@Transactional public SellerSKU saveSellerSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)
Description copied from interface:SalesCatalogServiceThis method save an updates of database entity.- Specified by:
saveSellerSKUin interfaceSalesCatalogService- Parameters:
sellerSkuAsMap- map-representation of database entity- Returns:
- saved instance of database entity
-
saveSellerSKU
public SellerSKU saveSellerSKU(SellerSKU sSku)
Description copied from interface:SalesCatalogServiceThis method saves a database entity.- Specified by:
saveSellerSKUin interfaceSalesCatalogService- Parameters:
sSku- database entity- Returns:
- saved instance of database entity
-
saveUnit
@Transactional public Unit saveUnit(java.util.LinkedHashMap<java.lang.String,java.lang.Object> unitAsMap)
Description copied from interface:SalesCatalogServiceThis method save an updates of database entity.- Specified by:
saveUnitin interfaceSalesCatalogService- Parameters:
unitAsMap- map-representation of database entity- Returns:
- saved instance of database entity
-
saveUnit
public Unit saveUnit(Unit unit)
Description copied from interface:SalesCatalogServiceThis method save an updates of database entity.- Specified by:
saveUnitin interfaceSalesCatalogService- Parameters:
unit- database entity- Returns:
- saved instance of database entity
-
getAllSellerTariff
public java.util.Map<java.lang.String,java.lang.String> getAllSellerTariff()
Description copied from interface:SalesCatalogServiceThis method returns data as map.- Specified by:
getAllSellerTariffin interfaceSalesCatalogService- Returns:
- data as map
-
removeSellerSkuAndClean
@Transactional public void removeSellerSkuAndClean(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogServiceThis method removes a database entity and clean all relationships from another entities.- Specified by:
removeSellerSkuAndCleanin interfaceSalesCatalogService- Parameters:
sellerSkuId- identification for database entity which will be removed
-
removeSellerSkusByIds
public void removeSellerSkusByIds(java.util.ArrayList<java.lang.String> sellerSkusIds)
Description copied from interface:SalesCatalogServiceThis method removes a list of database entities.- Specified by:
removeSellerSkusByIdsin interfaceSalesCatalogService- Parameters:
sellerSkusIds- the list of database entities which will be removed
-
createSellerSKU
@Transactional public java.util.Optional<SellerSKU> createSellerSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)
-
removeSellerSkuFromSKUs
private void removeSellerSkuFromSKUs(java.lang.String sellerSkuId)
-
removeSellerSkuFromSellers
private void removeSellerSkuFromSellers(java.lang.String sellerSkuId)
-
removeAttributeValuesFromSellerSku
private void removeAttributeValuesFromSellerSku(java.lang.String sellerSkuId)
-
removeSellerSkuAndAttributeValue
private void removeSellerSkuAndAttributeValue(java.lang.String sellerSkuId, java.lang.String attributeValueId)
-
removeSellerSkuFromSku
private void removeSellerSkuFromSku(java.lang.String sellerSkuId, java.lang.String embeddedId)
-
removeSellerSkuFromSeller
private void removeSellerSkuFromSeller(java.lang.String sellerSkuId, java.lang.String embeddedId)
-
removeInventoryFromSellerSku
private void removeInventoryFromSellerSku(java.lang.String sellerSkuId)
-
removeSellerSkuFromUnit
private void removeSellerSkuFromUnit(java.lang.String sellerSkuId)
-
removeSellerSkuFromCommerceItem
private void removeSellerSkuFromCommerceItem(java.lang.String sellerSkuId)
-
removePackagedItemsFromSellerSku
private void removePackagedItemsFromSellerSku(java.lang.String sellerSkuId)
-
removeUnitFromTranslation
private void removeUnitFromTranslation(java.lang.String unitId, java.lang.String tranId)
-
removeUnitFromTranslations
private void removeUnitFromTranslations(java.lang.String unitId)
-
removeUnitFromSellerSKU
private void removeUnitFromSellerSKU(java.lang.String unitId, java.lang.String sellerSkuId)
-
removeUnitFromSellerSKUs
private void removeUnitFromSellerSKUs(java.lang.String unitId)
-
removeUnitAndClean
@Transactional public void removeUnitAndClean(java.lang.String unitId)
Description copied from interface:SalesCatalogServiceThis method removes a database entity and clean all relationships from another entities.- Specified by:
removeUnitAndCleanin interfaceSalesCatalogService- Parameters:
unitId- identification for database entity which will be removed
-
removeUnitsByIds
@Transactional public void removeUnitsByIds(java.util.ArrayList<java.lang.String> unitsIds)
Description copied from interface:SalesCatalogServiceThis method removes a list of database entities.- Specified by:
removeUnitsByIdsin interfaceSalesCatalogService- Parameters:
unitsIds- the list of database entities which will be removed
-
publishForSale
public SellerSKU publishForSale(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogServiceThis method does update a database entity.- Specified by:
publishForSalein interfaceSalesCatalogService- Parameters:
sellerSkuId- database entity id- Returns:
- database entity
-
withdrawFromSale
public SellerSKU withdrawFromSale(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogServiceThis method does update a database entity.- Specified by:
withdrawFromSalein interfaceSalesCatalogService- Parameters:
sellerSkuId- database entity id- Returns:
- database entity
-
changeType
public SellerSKU changeType(java.lang.String sellerSkuId, java.lang.String type)
Description copied from interface:SalesCatalogServiceThis method is changing a type of SellerSKU- Specified by:
changeTypein interfaceSalesCatalogService- Parameters:
sellerSkuId- database entity idtype- type to change- Returns:
- database entity
-
duplicate
public SellerSKU duplicate(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogServiceThis method creates a copy of SellerSKU- Specified by:
duplicatein interfaceSalesCatalogService- Parameters:
sellerSkuId- database entity id- Returns:
- database entity
-
mapUnitToDto
public UnitDTO mapUnitToDto(Unit unit, boolean optimal)
Description copied from interface:SalesCatalogServiceThis method does map product entity to dto object- Specified by:
mapUnitToDtoin interfaceSalesCatalogService- Parameters:
unit- database entity which be used to map to dtooptimal- this pointer optimises the data transfer object- Returns:
- data transport object
-
exportListings
public java.util.List<SellerSkuExcelModel> exportListings(co.mastermindcms.modules.beans.SearchRequest request)
Description copied from interface:SalesCatalogServiceExports listings based on the given search request.- Specified by:
exportListingsin interfaceSalesCatalogService- Parameters:
request- the search request containing the necessary criteria for exporting listings- Returns:
- a list of TranslationExport objects representing the exported listings
-
uploadListings
@Async("asyncTaskExecutor") public void uploadListings(java.io.File file, java.lang.String lang, java.lang.String username)Description copied from interface:SalesCatalogServiceUploads listings to the server for the given user.- Specified by:
uploadListingsin interfaceSalesCatalogService- Parameters:
file- the file containing the listings to be uploadedlang- the language from contextusername- the username of the user uploading the listings
-
getSellerSkuDocumentUrls
public java.util.List<Attachment> getSellerSkuDocumentUrls(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogServiceThis method returns data as list.- Specified by:
getSellerSkuDocumentUrlsin interfaceSalesCatalogService- Parameters:
sellerSkuId- identification for database entity which related beans list be returned- Returns:
- database beans as list
-
isValidToSave
private boolean isValidToSave(SellerSKU sellerSKU)
-
-