Skip to content

Commit f57a27f

Browse files
Bug fixing, new theme
1 parent e776437 commit f57a27f

File tree

108 files changed

+17471
-772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+17471
-772
lines changed

pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@
153153
</exclusion>
154154
</exclusions>
155155
</dependency>
156+
157+
<dependency>
158+
<groupId>io.searchbox</groupId>
159+
<artifactId>jest</artifactId>
160+
<version>${io.searchbox.jest-version}</version>
161+
</dependency>
156162

157163
<!-- Elastic search -->
158164
<dependency>
@@ -167,11 +173,7 @@
167173
<version>${mysql-jdbc-version}</version>
168174
</dependency>
169175

170-
<dependency>
171-
<groupId>io.searchbox</groupId>
172-
<artifactId>jest</artifactId>
173-
<version>${io.searchbox.jest-version}</version>
174-
</dependency>
176+
175177

176178

177179

sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/type/ProductType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.HashSet;
44
import java.util.Set;
5+
56
import javax.persistence.CascadeType;
67
import javax.persistence.Column;
78
import javax.persistence.Embedded;
@@ -16,8 +17,8 @@
1617
import javax.persistence.OneToMany;
1718
import javax.persistence.Table;
1819
import javax.persistence.TableGenerator;
20+
1921
import com.salesmanager.core.constants.SchemaConstant;
20-
import com.salesmanager.core.model.catalog.product.description.ProductDescription;
2122
import com.salesmanager.core.model.common.audit.AuditListener;
2223
import com.salesmanager.core.model.common.audit.AuditSection;
2324
import com.salesmanager.core.model.common.audit.Auditable;

sm-core-model/src/main/java/com/salesmanager/core/model/merchant/MerchantStoreCriteria.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
public class MerchantStoreCriteria extends Criteria {
66

7+
private boolean retailers = false;
8+
private boolean stores = false;
9+
10+
public boolean isRetailers() {
11+
return retailers;
12+
}
13+
14+
public void setRetailers(boolean retailers) {
15+
this.retailers = retailers;
16+
}
17+
18+
public boolean isStores() {
19+
return stores;
20+
}
21+
22+
public void setStores(boolean stores) {
23+
this.stores = stores;
24+
}
25+
726

827

928

sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/catalog/PageableCatalogEntryRepository.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@
1010
public interface PageableCatalogEntryRepository extends PagingAndSortingRepository<CatalogEntry, Long> {
1111

1212

13-
@Query(value = "select distinct c from CatalogEntry c join fetch c.product cp join fetch c.category cc join fetch c.catalog cl join fetch cl.merchantStore clm left join fetch cp.descriptions cpd left join fetch cc.descriptions ccd where cl.id=?1 and clm.id=?2 and cl.id=?2 and cpd.language=?3 and (?4 is null or cpd.name like %?4%)",
14-
countQuery = "select count(c) from CatalogEntry c join c.product cp join c.category cc join c.catalog cl join cl.merchantStore clm join cp.descriptions cpd where cl.id=?1 and clm.id=?2 and cpd.language=?3 and (?4 is null or cpd.name like %?4%)")
13+
@Query(value = "select distinct c from CatalogEntry c join fetch c.product cp "
14+
+ "join fetch c.category cc "
15+
+ "join fetch c.catalog cl "
16+
+ "join fetch cl.merchantStore clm "
17+
+ "left join fetch cp.descriptions cpd "
18+
+ "left join fetch cc.descriptions ccd "
19+
+ "where cl.id=?1 and "
20+
+ "clm.id=?2 and "
21+
+ "cpd.language.id=?3 and (?4 is null or cpd.name like %?4%)",
22+
countQuery = "select count(c) from CatalogEntry c join c.product cp join c.category cc join c.catalog cl join cl.merchantStore clm join cp.descriptions cpd where cl.id=?1 and cpd.language.id=?3 and (?4 is null or cpd.name like %?4%)")
1523
Page<CatalogEntry> listByCatalog(Long catalogId, Integer storeId, Integer languageId, String name, Pageable pageable);
1624

1725

sm-core/src/main/java/com/salesmanager/core/business/repositories/merchant/PageableMerchantRepository.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ public interface PageableMerchantRepository extends PagingAndSortingRepository<M
2020
@Query(value = "select distinct m from MerchantStore m left join fetch m.parent mp left join fetch m.country mc left join fetch m.currency mc left join fetch m.zone mz left join fetch m.defaultLanguage md left join fetch m.languages mls where (?1 is null or m.storename like %?1%)",
2121
countQuery = "select count(distinct m) from MerchantStore m join m.parent where (?1 is null or m.storename like %?1%)")
2222
Page<MerchantStore> listAll(String storeName, Pageable pageable);
23+
24+
@Query(value = "select distinct m from MerchantStore m left join fetch m.parent mp "
25+
+ "left join fetch m.country mc "
26+
+ "left join fetch m.currency mc left "
27+
+ "join fetch m.zone mz "
28+
+ "left join fetch m.defaultLanguage md "
29+
+ "left join fetch m.languages mls "
30+
+ "where m.retailer = true and (?1 is null or m.storename like %?1%)",
31+
countQuery = "select count(distinct m) from MerchantStore m join m.parent "
32+
+ "where m.retailer = true and (?1 is null or m.storename like %?1%)")
33+
Page<MerchantStore> listAllRetailers(String storeName, Pageable pageable);
2334

2435

2536

sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/ProductServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public void delete(Product product) throws ServiceException {
233233
//related - featured
234234
List<ProductRelationship> relationships = productRelationshipService.listByProduct(product);
235235
for(ProductRelationship relationship : relationships) {
236-
productRelationshipService.delete(relationship);
236+
productRelationshipService.deleteRelationship(relationship);
237237
}
238238

239239
super.delete(product);

sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/relationship/ProductRelationshipService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ public interface ProductRelationshipService extends
2727
*/
2828
List<ProductRelationship> getByType(MerchantStore store, Product product,
2929
ProductRelationshipType type, Language language) throws ServiceException;
30+
31+
/**
32+
* Find by product and group name
33+
* @param store
34+
* @param product
35+
* @param name
36+
* @return
37+
* @throws ServiceException
38+
*/
39+
List<ProductRelationship> getByType(MerchantStore store, Product product,
40+
String name) throws ServiceException;
3041

3142
/**
3243
* Get product relationship List for a given type (RELATED, FEATURED...) and a given base product
@@ -87,6 +98,8 @@ void deleteGroup(MerchantStore store, String groupName)
8798

8899
void deactivateGroup(MerchantStore store, String groupName)
89100
throws ServiceException;
101+
102+
void deleteRelationship(ProductRelationship relationship) throws ServiceException;
90103

91104
void activateGroup(MerchantStore store, String groupName)
92105
throws ServiceException;

sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/relationship/ProductRelationshipServiceImpl.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void deleteGroup(MerchantStore store, String groupName) throws ServiceExc
6868

6969
@Override
7070
public void deactivateGroup(MerchantStore store, String groupName) throws ServiceException {
71-
List<ProductRelationship> entities = productRelationshipRepository.getByGroup(store, groupName);
71+
List<ProductRelationship> entities = getGroupDefinition(store, groupName);
7272
for(ProductRelationship relation : entities) {
7373
relation.setActive(false);
7474
this.saveOrUpdate(relation);
@@ -77,18 +77,21 @@ public void deactivateGroup(MerchantStore store, String groupName) throws Servic
7777

7878
@Override
7979
public void activateGroup(MerchantStore store, String groupName) throws ServiceException {
80-
List<ProductRelationship> entities = this.getByGroup(store, groupName);
80+
List<ProductRelationship> entities = getGroupDefinition(store, groupName);
8181
for(ProductRelationship relation : entities) {
8282
relation.setActive(true);
8383
this.saveOrUpdate(relation);
8484
}
8585
}
8686

87-
public void delete(ProductRelationship relationship) throws ServiceException {
87+
public void deleteRelationship(ProductRelationship relationship) throws ServiceException {
8888

8989
//throws detached exception so need to query first
9090
relationship = this.getById(relationship.getId());
91-
super.delete(relationship);
91+
if(relationship != null) {
92+
delete(relationship);
93+
}
94+
9295

9396

9497
}
@@ -148,6 +151,12 @@ public List<ProductRelationship> getGroupDefinition(MerchantStore store, String
148151
return productRelationshipRepository.getByGroup(store, name);
149152
}
150153

154+
@Override
155+
public List<ProductRelationship> getByType(MerchantStore store, Product product, String name)
156+
throws ServiceException {
157+
return productRelationshipRepository.getByType(store, name, product);
158+
}
159+
151160

152161

153162
}

sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ MerchantStore getMerchantStore(String merchantStoreCode)
1818
throws ServiceException;
1919

2020
MerchantStore getByCode(String code) throws ServiceException ;
21-
22-
//List<MerchantStore> listChildren(String code) throws ServiceException;
23-
21+
2422
Page<MerchantStore> listAll(Optional<String> storeName, int page, int count) throws ServiceException;
2523

24+
Page<MerchantStore> listAllRetailers(Optional<String> storeName, int page, int count) throws ServiceException;
25+
2626
Page<MerchantStore> listChildren(String code, int page, int count) throws ServiceException;
2727

2828
boolean existByCode(String code);

sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ public Page<MerchantStore> listAll(Optional<String> storeName, int page, int cou
9191

9292
}
9393

94+
95+
@Override
96+
public Page<MerchantStore> listAllRetailers(Optional<String> storeName, int page, int count) throws ServiceException {
97+
String store = null;
98+
if(storeName != null && storeName.isPresent()) {
99+
store = storeName.get();
100+
}
101+
Pageable pageRequest = new PageRequest(page, count);
102+
return pageableMerchantRepository.listAllRetailers(store, pageRequest);
103+
}
104+
94105

95106
/* @Override
96107
public void delete(MerchantStore merchant) throws ServiceException {

0 commit comments

Comments
 (0)