Skip to content

Commit

Permalink
V2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shopizer-ecommerce committed Aug 28, 2020
1 parent 7a9772b commit 7a9a86c
Show file tree
Hide file tree
Showing 25 changed files with 203 additions and 142 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Shopizer (for java 1.8 +)
-------------------

[![last_version](https://img.shields.io/badge/last_version-v2.12.0-blue.svg?style=flat)](https://github.com/shopizer-ecommerce/shopizer/tree/2.12.0)
[![last_version](https://img.shields.io/badge/last_version-v2.13.0-blue.svg?style=flat)](https://github.com/shopizer-ecommerce/shopizer/tree/2.13.0)
[![Official site](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=official%20site)](http://www.shopizer.com/)
[![Docker Pulls](https://img.shields.io/docker/pulls/shopizerecomm/shopizer.svg)](https://hub.docker.com/r/shopizerecomm/shopizer)
[![stackoverflow](https://img.shields.io/badge/shopizer-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/shopizer)
Expand Down
2 changes: 1 addition & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Release changes in version 2.12.0
Release changes in version 2.13.0


Spring boot 2.2.6.RELEASE
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.shopizer</groupId>
<artifactId>shopizer</artifactId>
<version>2.12.0</version>
<version>2.13.0</version>
<packaging>pom</packaging>

<name>shopizer</name>
Expand Down Expand Up @@ -44,7 +44,7 @@
<m2eclipse.wtp.contextRoot>/</m2eclipse.wtp.contextRoot>

<!--shopizer version -->
<shopizer.version>2.12.0</shopizer.version>
<shopizer.version>2.13.0</shopizer.version>
<shopizer.search.version>2.11.1</shopizer.search.version>
<shopizer-canadapost.version>2.11.0</shopizer-canadapost.version>

Expand Down
2 changes: 1 addition & 1 deletion sm-core-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.shopizer</groupId>
<artifactId>shopizer</artifactId>
<version>2.12.0</version>
<version>2.13.0</version>
</parent>

<artifactId>sm-core-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sm-core-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.shopizer</groupId>
<artifactId>shopizer</artifactId>
<version>2.12.0</version>
<version>2.13.0</version>
</parent>

<name>sm-core-modules</name>
Expand Down
2 changes: 1 addition & 1 deletion sm-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.shopizer</groupId>
<artifactId>shopizer</artifactId>
<version>2.12.0</version>
<version>2.13.0</version>
</parent>

<artifactId>sm-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.salesmanager.core.model.catalog.product.type.ProductType;

public interface PageableProductTypeRepository extends PagingAndSortingRepository<ProductType, Long> {

//Page<ProductType> listByStore(Integer storeId, Pageable pageable);

@Query(value = "select distinct p from ProductType p left join fetch p.descriptions pd left join fetch p.merchantStore pm where pm.id=?1",
countQuery = "select count(c) from ProductType p left join p.merchantStore pm where pm.id = ?1")
Page<ProductType> listByStore(Integer storeId, Pageable pageable);

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public interface PageableUserRepository extends PagingAndSortingRepository<User,
Page<User> listByStore(String store, String email, Pageable pageable);

@Query(value = "select distinct u from User as u left join fetch u.groups ug left join fetch ug.permissions ugp left join fetch u.defaultLanguage ud join fetch u.merchantStore um where (?1 is null or u.adminEmail like %?1%)",
countQuery = "select count(distinct u) from User as u join u.merchantStore um where (?1 is null or u.adminEmail like %?1%)")
countQuery = "select count(distinct u) from User as u join u.groups ug join ug.permissions ugp join u.merchantStore um where (?1 is null or u.adminEmail like %?1%)")
Page<User> listAll(String email, Pageable pageable);

@Query(value = "select distinct u from User as u left join fetch u.groups ug left join fetch ug.permissions ugp left join fetch u.defaultLanguage ud join fetch u.merchantStore um where um.id in ?1 and (?2 is null or u.adminEmail like %?2%)",
countQuery = "select count(distinct u) from User as u join u.merchantStore um where um.id in ?1 and (?2 is null or u.adminEmail like %?2%)")
countQuery = "select count(distinct u) from User as u join u.groups ug join ug.permissions ugp join u.merchantStore um where um.id in ?1 and (?2 is null or u.adminEmail like %?2%)")
Page<User> listByStoreIds(List<Integer> stores, String email, Pageable pageable);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public interface UserService extends SalesManagerEntityService<Long, User> {
User getByUserName(String userName, String storeCode) throws ServiceException;

List<User> listUser() throws ServiceException;

User getById(Long id, MerchantStore store);

/**
* Create or update a User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import javax.inject.Inject;

import org.apache.commons.lang3.StringUtils;
import org.jsoup.helper.Validate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -20,112 +21,108 @@
import com.salesmanager.core.model.user.User;
import com.salesmanager.core.model.user.UserCriteria;

public class UserServiceImpl extends SalesManagerEntityServiceImpl<Long, User> implements UserService {

private UserRepository userRepository;

public class UserServiceImpl extends SalesManagerEntityServiceImpl<Long, User>
implements UserService {
@Autowired
private MerchantStoreService merchantStoreService;

@Autowired
private PageableUserRepository pageableUserRepository;

private UserRepository userRepository;

@Autowired
private MerchantStoreService merchantStoreService;

@Autowired
private PageableUserRepository pageableUserRepository;

@Inject
public UserServiceImpl(UserRepository userRepository) {
super(userRepository);
this.userRepository = userRepository;

}


@Override
public User getByUserName(String userName) throws ServiceException {
return userRepository.findByUserName(userName);
}

@Inject
public UserServiceImpl(UserRepository userRepository) {
super(userRepository);
this.userRepository = userRepository;

}

@Override
public void delete(User user) throws ServiceException {
User u = this.getById(user.getId());
super.delete(u);
@Override
public User getByUserName(String userName) throws ServiceException {
return userRepository.findByUserName(userName);
}

}
@Override
public void delete(User user) throws ServiceException {
User u = this.getById(user.getId());
super.delete(u);

@Override
public List<User> listUser() throws ServiceException {
try {
return userRepository.findAll();
} catch (Exception e) {
throw new ServiceException(e);
}
}
}

@Override
public List<User> listByStore(MerchantStore store) throws ServiceException {
try {
return userRepository.findByStore(store.getId());
} catch (Exception e) {
throw new ServiceException(e);
}
}
@Override
public List<User> listUser() throws ServiceException {
try {
return userRepository.findAll();
} catch (Exception e) {
throw new ServiceException(e);
}
}

@Override
public List<User> listByStore(MerchantStore store) throws ServiceException {
try {
return userRepository.findByStore(store.getId());
} catch (Exception e) {
throw new ServiceException(e);
}
}

@Override
public void saveOrUpdate(User user) throws ServiceException {
userRepository.save(user);
}
@Override
public void saveOrUpdate(User user) throws ServiceException {
userRepository.save(user);
}

@Override
public User findByStore(Long userId, String storeCode) throws ServiceException {

@Override
public User findByStore(Long userId, String storeCode) throws ServiceException {


User user = userRepository.findOne(userId);

//store must be in lineage
boolean isFound = merchantStoreService.isStoreInGroup(storeCode);

if(isFound)
return user;
User user = userRepository.findOne(userId);

return null;

}
// store must be in lineage
boolean isFound = merchantStoreService.isStoreInGroup(storeCode);

if (isFound)
return user;

@Override
public GenericEntityList<User> listByCriteria(Criteria criteria) throws ServiceException {
return userRepository.listByCriteria(criteria);
}
return null;

}

@Override
public User getByUserName(String userName, String storeCode) throws ServiceException {
return userRepository.findByUserName(userName, storeCode);
}
@Override
public GenericEntityList<User> listByCriteria(Criteria criteria) throws ServiceException {
return userRepository.listByCriteria(criteria);
}

@Override
public User getByUserName(String userName, String storeCode) throws ServiceException {
return userRepository.findByUserName(userName, storeCode);
}

@Override
public Page<User> listByCriteria(UserCriteria criteria, int page, int count) throws ServiceException {

Pageable pageRequest = PageRequest.of(page, count);
Page<User> users = null;
if(criteria.getStoreIds() != null) {//search within a predefined list of stores
users = pageableUserRepository.listByStoreIds(criteria.getStoreIds(), criteria.getAdminEmail(), pageRequest);
} else if(StringUtils.isBlank(criteria.getStoreCode())) {//search for a specific store
users = pageableUserRepository.listAll(criteria.getAdminEmail(), pageRequest);
} else if(criteria.getStoreIds() != null) {//full search
users = pageableUserRepository.listByStore(criteria.getStoreCode(), criteria.getAdminEmail(), pageRequest);
@Override
public Page<User> listByCriteria(UserCriteria criteria, int page, int count) throws ServiceException {

Pageable pageRequest = PageRequest.of(page, count);
Page<User> users = null;
if (criteria.getStoreIds() != null) {// search within a predefined list
// of stores
users = pageableUserRepository.listByStoreIds(criteria.getStoreIds(), criteria.getAdminEmail(),
pageRequest);
} else if (StringUtils.isBlank(criteria.getStoreCode())) {// search for
// a
// specific
// store
users = pageableUserRepository.listAll(criteria.getAdminEmail(), pageRequest);
} else if (criteria.getStoreIds() != null) {// full search
users = pageableUserRepository.listByStore(criteria.getStoreCode(), criteria.getAdminEmail(), pageRequest);
}

return users;
}


return users;
}

@Override
public User getById(Long id, MerchantStore store) {
Validate.notNull(store, "MerchantStore cannot be null");
return userRepository.findByUserId(id, store.getCode());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,10 @@ public Page<User> listByCriteria(UserCriteria criteria, int page, int count) thr
// TODO Auto-generated method stub
return null;
}

@Override
public User getById(Long id, MerchantStore store) {
// TODO Auto-generated method stub
return null;
}
}
2 changes: 1 addition & 1 deletion sm-shop-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.shopizer</groupId>
<artifactId>shopizer</artifactId>
<version>2.12.0</version>
<version>2.13.0</version>
</parent>

<artifactId>sm-shop-model</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.salesmanager.shop.model.catalog.product.type;

import java.util.ArrayList;
import java.util.List;

import com.salesmanager.shop.model.entity.ReadableList;

public class ReadableProductTypeList extends ReadableList {

/**
*
*/
private static final long serialVersionUID = 1L;

List<ReadableProductType> list = new ArrayList<ReadableProductType>();

public List<ReadableProductType> getList() {
return list;
}

public void setList(List<ReadableProductType> list) {
this.list = list;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ReadableShoppingCart extends ShoppingCartEntity {
private BigDecimal total;
private String displayTotal;
private int quantity;
private Long order;

List<ReadableShoppingCartItem> products = new ArrayList<ReadableShoppingCartItem>();
List<ReadableOrderTotal> totals;
Expand Down Expand Up @@ -140,5 +141,17 @@ public void setQuantity(int quantity) {



public Long getOrder() {
return order;
}



public void setOrder(Long order) {
this.order = order;
}




}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.salesmanager.shop.store.controller.product.facade;

import java.util.List;

import com.salesmanager.core.model.merchant.MerchantStore;
import com.salesmanager.core.model.reference.language.Language;
import com.salesmanager.shop.model.catalog.product.type.PersistableProductType;
import com.salesmanager.shop.model.catalog.product.type.ReadableProductType;
import com.salesmanager.shop.model.catalog.product.type.ReadableProductTypeList;

public interface ProductTypeFacade {

List<ReadableProductType> getByMerchant(MerchantStore store, Language language);
ReadableProductTypeList getByMerchant(MerchantStore store, Language language, int count, int page);

ReadableProductType get(MerchantStore store, String code, Language language);

Expand Down
Loading

0 comments on commit 7a9a86c

Please sign in to comment.