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 SellerSKU
addPackageItemToSellerSku(java.lang.String sellerSkuId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> packageAsMap)
This method creates a database entity.private void
addRelations(SellerSKU sellerSKU)
private void
addRelationsForUnit(Unit unit)
SellerSKU
changeType(java.lang.String sellerSkuId, java.lang.String type)
This method is changing a type of SellerSKUprivate Inventory
createInventory(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.SellerSKU
duplicate(java.lang.String sellerSkuId)
This method creates a copy of SellerSKUjava.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.CurrencyItem
getCurrencyByCode(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.SellerSKU
getSellerSkuFromChatTopic(java.lang.String topic)
This method returns database entity.private boolean
isValidToSave(SellerSKU sellerSKU)
UnitDTO
mapUnitToDto(Unit unit, boolean optimal)
This method does map product entity to dto objectprivate void
prepareRelations(SellerSKU inputSellerSKU)
private void
prepareRelationsForUnit(Unit unit)
SellerSKU
publishForSale(java.lang.String sellerSkuId)
This method does update a database entity.void
removeFileResources(java.lang.String sellerSkuId)
This method removes all attached files and images.void
removePackageItemFromSellerSku(java.lang.String sellerSkuId, java.lang.String packageId)
This method removes a database entity.private void
removeRelations(SellerSKU sUI, SellerSKU sDB)
private void
removeRelationsForUnit(Unit unitUI, Unit unitDB)
private void
removeSellerSkuAndAttributeValue(java.lang.String sellerSkuId, java.lang.String attributeValueId)
private void
removeSellerSkuAndAttributeValues(java.lang.String sellerSkuId)
void
removeSellerSkuAndClean(java.lang.String sellerSkuId)
This method removes a database entity and clean all relationships from another entities.private void
removeSellerSkuFromCommerceItem(java.lang.String sellerSkuId)
private void
removeSellerSkuFromInventory(java.lang.String sellerSkuId)
private void
removeSellerSkuFromSeller(java.lang.String sellerSkuId, java.lang.String embeddedId)
private void
removeSellerSkuFromSellers(java.lang.String sellerSkuId)
private void
removeSellerSkuFromSku(java.lang.String sellerSkuId, java.lang.String embeddedId)
private void
removeSellerSkuFromSKUs(java.lang.String sellerSkuId)
private void
removeSellerSkuFromUnit(java.lang.String sellerSkuId)
private void
removeSellerSkuPackagedItems(java.lang.String sellerSkuId)
void
removeSellerSkusByIds(java.util.ArrayList<java.lang.String> sellerSkusIds)
This method removes a list of database entities.void
removeUnitAndClean(java.lang.String unitId)
This method removes a database entity and clean all relationships from another entities.private void
removeUnitFromSellerSKU(java.lang.String unitId, java.lang.String sellerSkuId)
private void
removeUnitFromSellerSKUs(java.lang.String unitId)
private void
removeUnitFromTranslation(java.lang.String unitId, java.lang.String tranId)
private void
removeUnitFromTranslations(java.lang.String unitId)
void
removeUnitsByIds(java.util.ArrayList<java.lang.String> unitsIds)
This method removes a list of database entities.SellerSKU
saveSellerSKU(SellerSKU sSku)
This method saves a database entity.SellerSKU
saveSellerSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)
This method save an updates of database entity.SellerSKU
saveSellerSkuAsDraft(SellerSKU sellerSku)
This method saves a database entity.SellerSKU
saveSellerSkuAsDraft(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerSkuAsMap)
This method save an updates of database entity.Unit
saveUnit(Unit unit)
This method save an updates of database entity.Unit
saveUnit(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.SellerSKU
withdrawFromSale(java.lang.String sellerSkuId)
This method does update a database entity.private void
xssFiltering(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
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
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:SalesCatalogService
This method does calculation for a pages based on the request.- Specified by:
getPaginationUnits
in 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:SalesCatalogService
This method does search requests and returns data as list.- Specified by:
searchUnits
in 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:SalesCatalogService
This method does search requests and returns data as pages.- Specified by:
searchUnitsPaged
in 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:SalesCatalogService
This method returns database entities as list.- Specified by:
getAllCurrencies
in interfaceSalesCatalogService
- Returns:
- database entities as list
-
getCurrencyByCode
public CurrencyItem getCurrencyByCode(java.lang.String code)
Description copied from interface:SalesCatalogService
This method returns database entity.- Specified by:
getCurrencyByCode
in interfaceSalesCatalogService
- Parameters:
code
- for filter and return database entity- Returns:
- database entity
-
getSellerSkuFromChatTopic
public SellerSKU getSellerSkuFromChatTopic(java.lang.String topic)
Description copied from interface:SalesCatalogService
This method returns database entity.- Specified by:
getSellerSkuFromChatTopic
in 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:SalesCatalogService
This method returns data as map.- Specified by:
getCountOfSellerSkusBySeller
in 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:SalesCatalogService
This method returns data as map.- Specified by:
getCountOfSellerSkus
in 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:SalesCatalogService
This method creates a database entity.- Specified by:
createUnit
in interfaceSalesCatalogService
- Parameters:
unitAsMap
- map-representation of database entity- Returns:
- database entity
-
createUnit
public java.util.Optional<Unit> createUnit(Unit unit)
Description copied from interface:SalesCatalogService
This method creates a database entity.- Specified by:
createUnit
in 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:SalesCatalogService
This method creates a database entity.- Specified by:
addPackageItemToSellerSku
in 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:SalesCatalogService
This method removes a database entity.- Specified by:
removePackageItemFromSellerSku
in 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:SalesCatalogService
This method removes all attached files and images.- Specified by:
removeFileResources
in 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:SalesCatalogService
This method save an updates of database entity.- Specified by:
saveSellerSkuAsDraft
in interfaceSalesCatalogService
- Parameters:
sellerSkuAsMap
- map-representation of database entity- Returns:
- saved instance of database entity
-
saveSellerSkuAsDraft
public SellerSKU saveSellerSkuAsDraft(SellerSKU sellerSku)
Description copied from interface:SalesCatalogService
This method saves a database entity.- Specified by:
saveSellerSkuAsDraft
in 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:SalesCatalogService
This method save an updates of database entity.- Specified by:
saveSellerSKU
in interfaceSalesCatalogService
- Parameters:
sellerSkuAsMap
- map-representation of database entity- Returns:
- saved instance of database entity
-
saveSellerSKU
public SellerSKU saveSellerSKU(SellerSKU sSku)
Description copied from interface:SalesCatalogService
This method saves a database entity.- Specified by:
saveSellerSKU
in 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:SalesCatalogService
This method save an updates of database entity.- Specified by:
saveUnit
in interfaceSalesCatalogService
- Parameters:
unitAsMap
- map-representation of database entity- Returns:
- saved instance of database entity
-
saveUnit
public Unit saveUnit(Unit unit)
Description copied from interface:SalesCatalogService
This method save an updates of database entity.- Specified by:
saveUnit
in 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:SalesCatalogService
This method returns data as map.- Specified by:
getAllSellerTariff
in interfaceSalesCatalogService
- Returns:
- data as map
-
removeSellerSkuAndClean
@Transactional public void removeSellerSkuAndClean(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogService
This method removes a database entity and clean all relationships from another entities.- Specified by:
removeSellerSkuAndClean
in 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:SalesCatalogService
This method removes a list of database entities.- Specified by:
removeSellerSkusByIds
in 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)
-
removeSellerSkuAndAttributeValues
private void removeSellerSkuAndAttributeValues(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)
-
removeSellerSkuFromInventory
private void removeSellerSkuFromInventory(java.lang.String sellerSkuId)
-
removeSellerSkuFromUnit
private void removeSellerSkuFromUnit(java.lang.String sellerSkuId)
-
removeSellerSkuFromCommerceItem
private void removeSellerSkuFromCommerceItem(java.lang.String sellerSkuId)
-
removeSellerSkuPackagedItems
private void removeSellerSkuPackagedItems(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:SalesCatalogService
This method removes a database entity and clean all relationships from another entities.- Specified by:
removeUnitAndClean
in 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:SalesCatalogService
This method removes a list of database entities.- Specified by:
removeUnitsByIds
in interfaceSalesCatalogService
- Parameters:
unitsIds
- the list of database entities which will be removed
-
publishForSale
public SellerSKU publishForSale(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogService
This method does update a database entity.- Specified by:
publishForSale
in interfaceSalesCatalogService
- Parameters:
sellerSkuId
- database entity id- Returns:
- database entity
-
withdrawFromSale
public SellerSKU withdrawFromSale(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogService
This method does update a database entity.- Specified by:
withdrawFromSale
in 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:SalesCatalogService
This method is changing a type of SellerSKU- Specified by:
changeType
in interfaceSalesCatalogService
- Parameters:
sellerSkuId
- database entity idtype
- type to change- Returns:
- database entity
-
duplicate
public SellerSKU duplicate(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogService
This method creates a copy of SellerSKU- Specified by:
duplicate
in interfaceSalesCatalogService
- Parameters:
sellerSkuId
- database entity id- Returns:
- database entity
-
mapUnitToDto
public UnitDTO mapUnitToDto(Unit unit, boolean optimal)
Description copied from interface:SalesCatalogService
This method does map product entity to dto object- Specified by:
mapUnitToDto
in interfaceSalesCatalogService
- Parameters:
unit
- database entity which be used to map to dtooptimal
- this pointer optimises the data transfer object- Returns:
- data transport object
-
getSellerSkuDocumentUrls
public java.util.List<Attachment> getSellerSkuDocumentUrls(java.lang.String sellerSkuId)
Description copied from interface:SalesCatalogService
This method returns data as list.- Specified by:
getSellerSkuDocumentUrls
in interfaceSalesCatalogService
- Parameters:
sellerSkuId
- identification for database entity which related beans list be returned- Returns:
- database beans as list
-
isValidToSave
private boolean isValidToSave(SellerSKU sellerSKU)
-
-