From fa68ced48cf3bee62b3c593e474c9b416c192ddb Mon Sep 17 00:00:00 2001 From: Xianongg Date: Thu, 13 Aug 2020 01:11:39 +0800 Subject: [PATCH 01/34] Added French version in readme --- README.md | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/README.md b/README.md index 50311bf74f..c39da60b9c 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +------------------------------------------------------------------------ +English +------------------------------------------------------------------------ Shopizer (for java 1.8 +) ------------------- @@ -105,3 +108,115 @@ Feel to use the contact form and share yo so we can send an invite to our Slack channel + +------------------------------------------------------------------------ +FRENCH +------------------------------------------------------------------------ + +Shopizer (pour 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) +[![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) + + +Logiciel de commerce électronique open source Java + +- Panier +- Catalogue +- Chercher +- Check-out +- Administration +- API REST + +Voir la démo (jsp): +------------------- +http://aws-demo.shopizer.com:8080/ + +Voir la démo (angulaire): +------------------- +Bientôt disponible + + +Obtenez le code: +------------------- +Clonez le référentiel: + + $ git clone git://github.com/shopizer-ecommerce/shopizer.git + +Si c'est la première fois que vous utilisez Github, consultez http://help.github.com to learn the basics. + + Vous pouvez également télécharger le fichier zip contenant le code depuis https://github.com/shopizer-ecommerce/shopizer + +Pour créer l'application: +------------------- +Depuis la ligne de commande: + + $ cd shopizer + $ mvnw clean install + + +Exécutez l'application depuis Tomcat +------------------- +copier sm-shop / target / ROOT.war vers tomcat ou tout autre répertoire de déploiement du serveur d'applications + +Augmenter l'espace du tas à 1024 m (Heap spaca) + +### Configuration de l'espace de tas dans Tomcat (Heap spaca): + + +Si vous utilisez Tomcat, modifiez catalina.bat pour les utilisateurs Windows ou catalina.sh pour les utilisateurs Linux / Mac + + sous Windows + set JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=256m" + + sous Linux / Mac + export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=256m" + +Exécutez l'application à partir de Spring Boot +------------------- + + $ cd sm-shop + $ mvnw spring-boot:run + +Exécutez l'application à partir de Spring Boot dans eclipse +------------------- + +Faites un clic droit sur com.salesmanager.shop.application.ShopApplication + +exécuter en tant qu'application Java + +### Accédez à l'application: +------------------- + +Accédez à l'application Web déployée à l'adresse: http: // localhost: 8080 / + +Accédez à la section d'administration à l'adresse: http: // localhost: 8080 / admin + +nom d'utilisateur: admin@shopizer.com + +mot de passe: password + +Les instructions ci-dessus vous permettront d'exécuter l'application avec les paramètres et configurations par défaut. +Veuillez lire les instructions pour vous connecter à MySQL, configurer un serveur de messagerie et configurer d'autres sous-systèmes + + +### Documentation: +------------------- + +Documentation disponible sur le wiki + +ChatOps - Rejoignez notre chaîne Slack https://shopizer-slackin.herokuapp.com/ + +Plus d'informations sont disponibles sur le site Web de Shopizer ici + +### Participation: +------------------- + +Si vous souhaitez donner votre avis ou participer de quelque manière que ce soit au projet Shopizer +N'hésitez pas à utiliser le formulaire de contact et à partager votre adresse email +afin que nous puissions envoyer une invitation sur notre chaîne Slack + + From 6769e279ba811a21d3b13f8481ae18faf56b9499 Mon Sep 17 00:00:00 2001 From: taarh Date: Sun, 16 Aug 2020 21:05:25 +0200 Subject: [PATCH 02/34] Update Dockerfile --- sm-shop/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm-shop/Dockerfile b/sm-shop/Dockerfile index e3f13d253b..51135b49c4 100755 --- a/sm-shop/Dockerfile +++ b/sm-shop/Dockerfile @@ -27,5 +27,5 @@ ENV JAVA_OPTS="-Xmx1024m" CMD ["catalina.sh", "run"] -EXPOSE 8080 +EXPOSE 8086 From 9c490de5162814e631350365ef560d918010dbdc Mon Sep 17 00:00:00 2001 From: taarh Date: Sun, 16 Aug 2020 21:05:43 +0200 Subject: [PATCH 03/34] Update Dockerfile --- sm-shop/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm-shop/Dockerfile b/sm-shop/Dockerfile index 51135b49c4..e3f13d253b 100755 --- a/sm-shop/Dockerfile +++ b/sm-shop/Dockerfile @@ -27,5 +27,5 @@ ENV JAVA_OPTS="-Xmx1024m" CMD ["catalina.sh", "run"] -EXPOSE 8086 +EXPOSE 8080 From 3a014785e623d742b67303d8b53dcfac844051f2 Mon Sep 17 00:00:00 2001 From: Shopizer Date: Sun, 23 Aug 2020 23:12:31 -0400 Subject: [PATCH 04/34] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c39da60b9c..d506afe0f6 100755 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ Voir la démo (jsp): ------------------- http://aws-demo.shopizer.com:8080/ -Voir la démo (angulaire): +Voir la démo (angular): ------------------- Bientôt disponible @@ -162,9 +162,9 @@ Exécutez l'application depuis Tomcat ------------------- copier sm-shop / target / ROOT.war vers tomcat ou tout autre répertoire de déploiement du serveur d'applications -Augmenter l'espace du tas à 1024 m (Heap spaca) +Augmenter l'espace du tas à 1024 m (Heap space) -### Configuration de l'espace de tas dans Tomcat (Heap spaca): +### Configuration de l'espace de tas dans Tomcat (Heap space): Si vous utilisez Tomcat, modifiez catalina.bat pour les utilisateurs Windows ou catalina.sh pour les utilisateurs Linux / Mac From c3f78e7809998fce943a38488db9f7a0a0279ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcios=20Rodrigues?= Date: Mon, 12 Jul 2021 21:20:55 -0300 Subject: [PATCH 05/34] Creation of bundles in Portuguese - Brazil #616 --- .../bundles/messages_pt_BR.properties | 188 +++++ .../bundles/payment_pt_BR.properties | 50 ++ .../bundles/shipping_pt_BR.properties | 107 +++ .../resources/bundles/shopizer.properties | 1 + .../resources/bundles/shopizer_es.properties | 1 + .../resources/bundles/shopizer_fr.properties | 2 +- .../bundles/shopizer_pt_BR.properties | 697 ++++++++++++++++++ 7 files changed, 1045 insertions(+), 1 deletion(-) create mode 100644 sm-shop/src/main/resources/bundles/messages_pt_BR.properties create mode 100644 sm-shop/src/main/resources/bundles/payment_pt_BR.properties create mode 100644 sm-shop/src/main/resources/bundles/shipping_pt_BR.properties create mode 100644 sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties diff --git a/sm-shop/src/main/resources/bundles/messages_pt_BR.properties b/sm-shop/src/main/resources/bundles/messages_pt_BR.properties new file mode 100644 index 0000000000..d24ac8874d --- /dev/null +++ b/sm-shop/src/main/resources/bundles/messages_pt_BR.properties @@ -0,0 +1,188 @@ +currentpassword.not.empty=Informe a sua senha atual +Email.contact.email=O formato do e-mail não é válido +Email.customer.EmailAddress=O endereço de e-mail do cliente não é válido +Email.customer.emailAddress=O endereço de e-mail não é válido +Email.order.customerEmailAddress=O endereço de e-mail do cliente não é válido +Email.store.storeEmailAddress=O endereço de e-mail da loja não é válido +error.code.99=Ocorreu um erro ao tentar processar o pagamento +merchant.files.invalid=Forneça os arquivos para upload. +merchant.storeId.invalid=Informe uma loja comercial +merchant.zone.invalid=O estado da loja é obrigatório +message.access.denied=Acesso negado +message.address.enter=Digite o seu endereço +message.cannot.empty=não pode estar vazio +message.code.available=Este código está disponível +message.code.exist=Este código já existe +message.credentials.reset=As credenciais foram alteradas +message.creditcard.invalid=Os detalhes do cartão de crédito são obrigatórios +message.email.error=Ocorreu um erro ao enviar a mensagem, tente novamente mais tarde +message.email.success=Sua mensagem foi enviada +message.error=Ocorreu um erro neste pedido +message.error.shipping=Ocorreu um erro ao estimar os custos de envio +message.error.shoppingcart.update=Ocorreu um erro ao atualizar o carrinho de compras +message.fielderror=Erro de campo +message.group.alerady.exists=Grupo {0} já existe +message.group.required=O grupo é obrigatório +message.image.height=Altura da imagem muito grande +message.image.size=Imagem muito grande +message.image.width=Largura da imagem muito grande +message.invalid.amount=Quantia inválida +message.invalid.date=Formato de data inválido +message.invalidpassword=Senha inválida +message.invalid.price=O formato do preço não é válido +message.invalid.rate=O formato da taxa não é válido +message.login.duallogin=Login duplo não autorizado no mesmo navegador +message.maximumWeight.invalid=Peso máximo deve ser maior que 0 +message.maximumWeight.null=Peso máximo não pode estar vazio +message.name.exist=Este nome já existe +message.name.required=O nome do objeto é obrigatório +message.noshipping.configured=Nenhum endereço de entrega foi configurado +message.noshippingerror=Sem envio disponível, verifique o seu país de envio, estado / província e código postal +message.noshipping=Nenhum frete disponível +message.notexist.customer=Cliente não existe +message.number.invalid=Deve ser um número válido (por exemplo, 5) +message.optionset.noassociation=Selecione uma opção e um valor de opção +message.optionset.optionassociationexists=Associação de opções já existe +message.order.canprocess=O pedido pode ser concluído +message.password.checkpassword.identical=Ambas as senhas devem coincidir +message.password.different=A nova senha e a senha repetida devem ser idênticas +message.password.invalid=Senha inválida +message.password.length=A senha deve ter pelo menos 6 caracteres +message.password.repeat.required=É necessária uma senha repetida +message.password.required=É necessária uma senha +message.password.reset=A senha foi redefinida +message.payment.declined=A transação de pagamento foi recusada +message.payment.error=Ocorreu um erro ao processar o pagamento, utilize outro método de pagamento. +message.price.cents=Por favor, insira no máximo 99 centavos +message.product.association=Esta entidade está anexada a um ou mais produtos, remova a associação antes de tentar remover. +message.product.language=O produto não foi configurado com este idioma. Edite o produto e configure-o com este idioma. +message.productoption.required=Um atributo / opção do produto é obrigatório +message.productoptionvalue.required=Um atributo de produto / valor de opção é obrigatório +message.productreview.created=Criou com sucesso uma crítica do produto +message.region.exists=Região já existe +message.region.null=Região não pode ficar vazia +message.resource.notfound=A página solicitada não existe. +message.security.caanotremovesuperadmin=Não é possível remover o usuário superadministrador +message.security.cannotrevoke.superadmin=Não é possível revogar o grupo Super Admin +messages.error.creditcard.cvc=Os dígitos de verificação do cartão de crédito não são válidos +messages.error.creditcard.dateformat=A data de validade do cartão de crédito não é válida +messages.error.creditcard=Os dados do cartão de crédito não são válidos +messages.error.creditcard.number=O número do cartão de crédito não é válido +messages.invalid.email=Forneça um endereço de e-mail válido. +message.sku.exists=Sku já existe +message.success=Pedido concluído com sucesso +message.taxclass.alreadyexist=Código da classe fiscal já existe +message.timeout=Sessão esgotada. +message.unauthorized=Esta transação não pode ser completada +message.username.notfound=Nome de usuário não encontrado +message.username.password=Login falhou. O nome de usuário ou senha está incorreto. +message.username.required=Nome de utilizador obrigatório +newpassword.not.empty=Forneça uma nova senha +NotEmpty=Campo obrigatório +NotEmpty.contact.captchaChallengeField=Pergunta desafiadora de Captcha necessária +NotEmpty.contact.captchaResponseField=Resposta Captcha necessária +NotEmpty.contact.comment=Um comentário é necessário +NotEmpty.contact.name=O nome do contato é obrigatório +NotEmpty.contact.subject=Assunto do contato obrigatório +NotEmpty.customer.address2=Endereço obrigatório +NotEmpty.customer.address=Endereço obrigatório +NotEmpty.customer.agreement=Aceite nossos termos e condições +NotEmpty.customer.billing.address=Endereço obrigatório +NotEmpty.customer.billingCity=A cidade de cobrança não deve estar vazia +NotEmpty.customer.billing.city=Cidade é obrigatória +NotEmpty.customer.billingCompany=O nome da empresa de cobrança não deve ficar em branco +NotEmpty.customer.billingCountry=País de cobrança não deve estar vazio +NotEmpty.customer.billing.country=País é obrigatório +NotEmpty.customer.billingFirstName=O nome de cobrança não deve estar vazio +NotEmpty.customer.billingLastName=O sobrenome para cobrança não deve ficar em branco +NotEmpty.customer.billing.neighborhood=Bairro obrigatório +NotEmpty.customer.billing.phone=Número de telefone obrigatório +NotEmpty.customer.billing.postalCode=Código postal obrigatório +NotEmpty.customer.billingPostCode=O código postal de cobrança não deve estar vazio +NotEmpty.customer.billingState=O status de cobrança não deve estar vazio +NotEmpty.customer.billing.stateProvince=Estado / província é obrigatório +NotEmpty.customer.billingStreetAddress=O endereço de cobrança não deve estar vazio +NotEmpty.customer.City=A cidade do cliente não deve estar vazia +NotEmpty.customer.city=Cidade é obrigatória +NotEmpty.customer.Country=O país do cliente não deve estar vazio +NotEmpty.customer.EmailAddress=O endereço de e-mail do cliente não deve estar vazio +NotEmpty.customer.emailAddress=Endereço de e-mail obrigatório +NotEmpty.customer.FirstName=O nome do cliente não deve estar vazio +NotEmpty.customer.firstName=O nome é obrigatório +NotEmpty.customer.LastName=O sobrenome do cliente não deve estar vazio +NotEmpty.customer.lastName=O sobrenome é obrigatório +NotEmpty.customer.neighborhood=Bairro obrigatório +NotEmpty.customer.phone=Número de telefone obrigatório +NotEmpty.customer.postalCode=O código postal é obrigatório +NotEmpty.customer.PostCode=O código postal do cliente não deve estar vazio +NotEmpty.customer.shipping.address=O endereço postal de envio não deve estar vazio +NotEmpty.customer.shipping.city=A cidade de envio não deve estar vazia +NotEmpty.customer.shippingCountry=O país de envio não deve estar vazio +NotEmpty.customer.shipping.firstName=O nome da remessa não deve estar vazio +NotEmpty.customer.shipping.lastName=O sobrenome de envio não deve estar vazio +NotEmpty.customer.shipping.neighborhood=Bairro de envio é obrigatório +NotEmpty.customer.shipping.phone=O telefone de envio não deve estar vazio +NotEmpty.customer.shipping.postalCode=O código postal de envio não deve estar vazio +NotEmpty.customer.shipping.stateProvince=O status / província de envio é obrigatório +NotEmpty.customer.stateProvince=Estado / província é obrigatório +NotEmpty.customer.StreetAddress=O endereço postal do cliente não deve estar vazio +NotEmpty.customer.Telephone=O telefone do cliente não deve estar vazio +NotEmpty.customer.userName=Nome de usuário obrigatório +NotEmpty.group.groupName=O nome do grupo é obrigatório +NotEmpty.group.groupType=O tipo de grupo é obrigatório +NotEmpty.keyword.keyword=A palavra-chave não pode estar vazia +NotEmpty.option.code=O código não deve estar vazio +NotEmpty.optionValue.code=O código não deve estar vazio +NotEmpty.order.billingCity=A cidade de faturamento não deve estar vazia +NotEmpty.order.billingName=O nome de cobrança não deve estar vazio +NotEmpty.order.billingPostCode=O código postal de cobrança não deve estar vazio +NotEmpty.order.billingState=O status de cobrança não deve estar vazio +NotEmpty.order.billingStreetAddress=O endereço de cobrança não deve estar vazio +NotEmpty.order.creditcard.cvv=É necessário um dígito de validação do cartão de crédito +NotEmpty.order.creditcard.name=O nome do titular do cartão de crédito é obrigatório +NotEmpty.order.creditcard.number=É necessário um número de cartão de crédito válido +NotEmpty.order.customerCity=A cidade do cliente não deve estar vazia +NotEmpty.order.customerEmailAddress=O endereço de e-mail do cliente não deve estar vazio +NotEmpty.order.customerFirstName=O nome do cliente não deve estar vazio +NotEmpty.order.customerLastName=O sobrenome do cliente não deve estar vazio +NotEmpty.order.customerPostCode=O código postal do cliente não deve estar vazio +NotEmpty.order.customerStreetAddress=O endereço postal do cliente não deve estar vazio +NotEmpty.order.customerTelephone=O telefone do cliente não deve estar vazio +NotEmpty.origin.address=Endereço obrigatório +NotEmpty.origin.city=Cidade é obrigatória +NotEmpty.origin.country=País é obrigatório +NotEmpty.origin.postalCode=O código postal é obrigatório +NotEmpty.price.code=O código de preço é obrigatório +NotEmpty.product.manufacturer=O fabricante do produto é obrigatório. +NotEmpty.product.productPrice=O preço do produto deve ser especificado +NotEmpty.review.description=Sua opinião é necessária +NotEmpty.review.rating=Avaliação do produto necessária +NotEmpty.store.storeEmailAddress=O endereço de email da loja não deve estar vazio +NotEmpty.store.storename=O nome da loja não deve estar vazio +NotEmpty.taxClass.code=O código da classe fiscal é obrigatório +NotEmpty.taxClass.title=O nome da classe fiscal é obrigatório +NotEmpty.taxRate.code=O código da taxa de imposto não deve estar vazio +NotEmpty.taxRateDescription.name=O nome da taxa de imposto não deve estar vazio +NotEmpty.taxRate.rateText=A taxa de imposto não deve estar vazia +NotEmpty.taxRate.unique.code=O código da taxa de imposto deve ser exclusivo +NotEmtpy.customer.billingNeighborhood=O bairro de cobrança não deve estar vazio +NotNull.taxRate.parent=Taxa de imposto primária deve ser selecionada +password.notequal=A nova senha e a senha de verificação devem ser as mesmas +Pattern.merchant.code=O código da loja deve ser alfanumérico +Pattern.option.code=O código deve ser alfanumérico +Pattern.optionValue.code=O código deve ser alfanumérico +Pattern.price.code=O código de preço deve ser alfanumérico +Pattern.product.sku=SKU deve ser alfanumérico +registration.failed=Não foi possível concluir o registro, tente novamente mais tarde +registration.firstName.invalid=Forneça seu nome +registration.lastName.invalid=Forneça o sobrenome +registration.password.not.empty=Forneça uma senha válida +registration.username.already.exists=Usuário com nome de usuário já existe para esta loja. +registration.username.length.invalid=O nome de usuário deve ter pelo menos 6 caracteres +registration.username.not.empty=Forneça nome de usuário +repeatpassword.not.empty=Forneça uma senha de repetição +User.resetPassword.Error=Ocorreu um erro, entre em contato com o administrador +User.resetPassword.resetSuccess=Senha alterada com sucesso, verifique seu e-mail +User.resetPassword.userNotFound=Usuário especificado não encontrado +User.resetPassword.wrongSecurityQtn=Pergunta / resposta de segurança incorreta digitada +validaion.recaptcha.not.matched=Recaptcha não corresponde à entrada do usuário diff --git a/sm-shop/src/main/resources/bundles/payment_pt_BR.properties b/sm-shop/src/main/resources/bundles/payment_pt_BR.properties new file mode 100644 index 0000000000..c71166acc9 --- /dev/null +++ b/sm-shop/src/main/resources/bundles/payment_pt_BR.properties @@ -0,0 +1,50 @@ +label.payment.cash.usercash=Usar pagamento em dinheiro +label.payment.moneyorder.usemoneyorder=Usar ordem de pagamento +module.payment.authorizenet=Autorizar rede +module.payment.beanstream=Beanstream +module.payment.beanstream.merchantid=ID do fornecedor +module.payment.beanstream.message.merchantid=ID do fornecedor necessário +module.payment.beanstream.message.password=Senha necessária +module.payment.beanstream.message.username=Nome de usuário obrigatório +module.payment.beanstream.password=Senha +module.payment.beanstream.username=Nome de usuário +module.payment.braintree=Braintree +module.payment.cash=Pagamento em dinheiro +module.payment.moneyorder.adress=Cheque a ser feito para este endereço +module.payment.moneyorder.message.address=O endereço é obrigatório +module.payment.moneyorder=Ordem postal +module.payment.paypal.clientId=ID do cliente PayPal +module.payment.paypal-express-checkout.apikey=Senha da API do PayPal +module.payment.paypal-express-checkout.applicationid=ID do aplicativo PayPal +module.payment.paypal-express-checkout.note=Siga as instruções aqui para criar seu nome de usuário, senha e assinatura de API do PayPal (https://developer.paypal.com/docs/classic/api/apiCredentials / # creation-classic- api-credentials) +module.payment.paypal-express-checkout=Check-out rápido do PayPal +module.payment.paypal-express-checkout.signature=Assinatura da API do PayPal +module.payment.paypal-express-checkout.userid=Nome de usuário da API do PayPal +module.payment.paypal.message.api=Nome de usuário da API do PayPal obrigatório +module.payment.paypal.message.clientId=ID do cliente PayPal é obrigatório +module.payment.paypal.message.identifier=O nome de usuário da API do PayPal é obrigatório +module.payment.paypal.message.password=Senha da API do PayPal necessária +module.payment.paypal.message.secret=O segredo do PayPal é obrigatório +module.payment.paypal.message.signature=Assinatura da API do PayPal necessária +module.payment.paypal.note=Crie uma conta de comerciante do PayPal (www.paypal.com). Depois de concluído, faça login no site de desenvolvedor do PayPal (https://developer.paypal.com/webapps/developer/index) usando suas credenciais de comerciante do PayPal. Clique em Aplicativos na barra de navegação superior para acessar a página Meus Aplicativos. Clique no botão Criar aplicativo, esta ação fornecerá sua ID de cliente e chaves secretas. +module.payment.paypal=PayPal +module.payment.paypal.secret=Segredo do PayPal +module.payment.pos=Cartão de Débito / Crédito +module.payment.stripe=Stripes +module.payment.transactiontype.capture=Captura +module.payment.transactiontype.preauth=Pré-autorização +module.payment.transactiontype.refund=Reembolso +module.payment.transactiontype.sale=Venda +module.payment.transactiontype=Tipo de transação +module.payment.transfer.details=Detalhes para a transferência +module.payment.transfer.message.details=Você deve preencher os dados da transferência para ajudar o cliente +module.payment.transfer=Transferência Bancária +payment.not.configured=Você não escolheu um método de pagamento +payment.type.BRAINTREE=Cartão de crédito +payment.type.CASH=Pagamento em dinheiro +payment.type.CREDITCARD=Cartão de crédito +payment.type.MONEYORDER=Vale postal +payment.type.PAYPAL=PayPal +payment.type.POS=Cartão de Débito / Crédito na entrega +payment.type.STRIPE=Cartão de crédito +payment.type.TRANSFER=Transferência Bancária \ No newline at end of file diff --git a/sm-shop/src/main/resources/bundles/shipping_pt_BR.properties b/sm-shop/src/main/resources/bundles/shipping_pt_BR.properties new file mode 100644 index 0000000000..26e63b7547 --- /dev/null +++ b/sm-shop/src/main/resources/bundles/shipping_pt_BR.properties @@ -0,0 +1,107 @@ +module.shipping.canada=Canadá +module.shipping.canadapost.apikey=Canadá Post API Key +module.shipping.canadapost=Canadá Post +module.shipping.canadapost.DOM.DT=Entregue hoje à noite +module.shipping.canadapost.DOM.EP=Pacote expresso +module.shipping.canadapost.DOM.LIB=Livros da biblioteca +module.shipping.canadapost.DOM.PC=Prioridade +module.shipping.canadapost.DOM.RP=Pacote normal +module.shipping.canadapost.DOM.XP.CERT=Certificado Xpresspost. +module.shipping.canadapost.DOM.XP=Xpresspost +module.shipping.canadapost.identifier=Identificador Postal Canadense (número CPC) +module.shipping.canadapost.INT.IP.AIR=International Parcel Air +module.shipping.canadapost.INT.IP.SURF=Área de encomendas internacionais +module.shipping.canadapost.INT.PW.ENV=Priority Worldwide Envelope International +module.shipping.canadapost.INT.PW.PAK=Priority Worldwide pak International +module.shipping.canadapost.INT.PW.PARCEL=Priority Worldwide parcel International +module.shipping.canadapost.INT.SP.AIR=Small Packet International Air +module.shipping.canadapost.INT.SP.SURF=Superfície de Pacote Pequeno Internacional +module.shipping.canadapost.INT.TP=Pacote rastreado - Internacional +module.shipping.canadapost.INT.XP=International Xpresspost +module.shipping.canadapost.message.apikey=Chave da API Canada Post necessária +module.shipping.canadapost.message.identifier=Um identificador postal canadense é necessário +module.shipping.canadapost.message.password=Canadá Post senha necessária +module.shipping.canadapost.message.username=Nome de usuário da postagem no Canadá necessário +module.shipping.canadapost.packages=Tipo de pacote +module.shipping.canadapost.password=Canadá postando senha (segunda parte da chave API após ponto e vírgula) +module.shipping.canadapost.services=Serviços a serem avaliados +module.shipping.canadapost.USA.EP=US Express Parcel +module.shipping.canadapost.USA.PW.ENV=Envelopes Prioridade Mundial dos EUA +module.shipping.canadapost.USA.PW.PAK=Priority Worldwide pak USA +module.shipping.canadapost.USA.PW.PARCEL=Parcela mundial prioritária dos EUA +module.shipping.canadapost.USA.SP.AIR=USA Air Small Packet +module.shipping.canadapost.USA.TP.LVM=Pacote rastreado - Estados Unidos - (LVM - Remessas de alto volume) +module.shipping.canadapost.USA.TP=Pacote rastreado - Estados Unidos +module.shipping.canadapost.USA.XP=Xpresspost Estados Unidos +module.shipping.canadapost.username=Nome de usuário do Canada Post (primeira parte da chave API antes de ponto e vírgula) +module.shipping.customQuotesRules=Frete por {0} +module.shipping.customQuotesRules.text=Use o sistema de regras para criar sua própria tabela de decisão de taxa de envio. A tabela de decisão de taxa de envio personalizada pode ser editada em sm-core / src / main / resources / rules / shipping-custom-rules.xls +module.shipping.customQuotesRules.title=Crie suas próprias regras de cotação de envio +module.shipping.fedex=Fedex +module.shipping.international=International +module.shipping.priceByDistance=Frete para {0} +module.shipping.priceByDistance.text=Define o preço de envio (por quilômetro). Requer calculadora de distância pré-processador. +module.shipping.priceByDistance.title=Crie seu próprio orçamento de frete com base na distância +module.shipping.storePickUp.address=Endereço para retirada que será mostrado ao cliente +module.shipping.storePickUp.address.message=O endereço de coleta é um campo obrigatório +module.shipping.storePickUp.note=Esta opção permite que você reserve seus itens através do sistema online e retire seu pedido na loja. Essa opção também é oferecida quando não há outra opção de envio disponível para sua região. +module.shipping.storePickUp.price.message=O preço de retirada na loja é obrigatório (em formato numérico) +module.shipping.storePickUp.price=Preço de retirada na loja em formato numérico (normalmente 0) +module.shipping.storePickUp=Retirada da loja +module.shipping.storePickUp.storePickUp=A ser retirado da Sede. Rota 1 Km. 17 +module.shipping.ups.identifier=Identificador UPS +module.shipping.ups.message.identifier=Identificador de conta UPS obrigatório +module.shipping.ups.message.packages=Você deve selecionar um tipo de pacote +module.shipping.ups.method.01=UPS Air no dia seguinte +module.shipping.ups.method.02=UPS no segundo dia +module.shipping.ups.method.03=UPS terrestre +module.shipping.ups.method.07=UPS Worldwide Express +module.shipping.ups.method.08=UPS mundial urgente +module.shipping.ups.method.11=UPS padrão +module.shipping.ups.method.12=UPS especial de 3 dias +module.shipping.ups.method.13=UPS do dia seguinte com desconto +module.shipping.ups.method.14=UPS Next Day Air Early A.M. +module.shipping.ups.method.54=UPS Worldwide Express Plus +module.shipping.ups.method.59=UPS Second Day Air A.M. +module.shipping.ups.method.65=UPS com desconto +module.shipping.ups.method=Métodos de Envio UPS +module.shipping.ups.method.select=Selecione um método de envio UPS específico +module.shipping.ups.method.unselect=Permitir que a UPS proponha todos os métodos de envio disponíveis +module.shipping.ups.package.02=Pacote do cliente +module.shipping.ups.package.03=Tubo UPS +module.shipping.ups.package.04=UPS Pak +module.shipping.ups.package.10=Caixa de UPS 10kg +module.shipping.ups.package.21=UPS Express Box +module.shipping.ups.package.24=Caixa UPS 25Kg +module.shipping.ups.package.25=Desconhecido +module.shipping.ups.packagel.01=Carta UPS +module.shipping.ups.packages=Tipo de pacote +module.shipping.ups.password=Senha +module.shipping.ups.shippingmethods=Selecione um método de envio +module.shipping.ups=UPS +module.shipping.ups.userid=ID do usuário +module.shipping.usa=Estados Unidos da América +module.shipping.usps.identifier=identificador de conta USPS +module.shipping.usps.message.identifier=O identificador da conta USPS é obrigatório +module.shipping.usps.message.packages=Você deve selecionar um tipo de pacote +module.shipping.usps.method.01=Correio de primeira classe +module.shipping.usps.method.02=Correio prioritário +module.shipping.usps.method.03=Express Mail +module.shipping.usps.method.04=Express SH +module.shipping.usps.method.05=HFP Express +module.shipping.usps.method.06=BPM +module.shipping.usps.method.07=Correio postal +module.shipping.usps.package.01=Variável +module.shipping.usps.package.02=Caixa de taxa fixa +module.shipping.usps.package.03=Envelope de taxa fixa +module.shipping.usps.package.04=Retangular +module.shipping.usps.package.05=Não retangular +module.shipping.usps.package.06=Caixa de taxa fixa LG +module.shipping.usps.package.07=Envelope +module.shipping.usps.package.08=Pacote +module.shipping.usps.packages=Tipo de pacote +module.shipping.usps=Serviço Postal dos Estados Unidos +module.shipping.usps.shippingmethods=Selecione até 3 métodos de envio +module.shipping.weightBased.CUSTOM_WEIGHT=Frete com base no peso da compra +module.shipping.weightBased=Preço de envio com base no peso +NO_SHIPPING_MODULE_CONFIGURED=Nenhum módulo de remessa configurado \ No newline at end of file diff --git a/sm-shop/src/main/resources/bundles/shopizer.properties b/sm-shop/src/main/resources/bundles/shopizer.properties index 77ca0fb3c3..10cbce7dc5 100755 --- a/sm-shop/src/main/resources/bundles/shopizer.properties +++ b/sm-shop/src/main/resources/bundles/shopizer.properties @@ -7,6 +7,7 @@ lang.fr=French lang.ru=Russian lang.es=Spanish lang.ar=Arabic +lang.pt-BR=Portuguese (BR) label.shop=Shop label.entity.id=Id diff --git a/sm-shop/src/main/resources/bundles/shopizer_es.properties b/sm-shop/src/main/resources/bundles/shopizer_es.properties index 0aaed18311..57a34db94f 100644 --- a/sm-shop/src/main/resources/bundles/shopizer_es.properties +++ b/sm-shop/src/main/resources/bundles/shopizer_es.properties @@ -588,6 +588,7 @@ lang.en=Inglés lang.fr=Francés lang.ru=Ruso lang.ar=Arábica +lang.pt-BR=Portugus (Brasil) menu.accounts-conf=Configuración de cuentas menu.addaddress=Agregar una nueva dirección menu.cache=Administración de caché diff --git a/sm-shop/src/main/resources/bundles/shopizer_fr.properties b/sm-shop/src/main/resources/bundles/shopizer_fr.properties index 802fbe04f8..1df60a2ca4 100755 --- a/sm-shop/src/main/resources/bundles/shopizer_fr.properties +++ b/sm-shop/src/main/resources/bundles/shopizer_fr.properties @@ -7,7 +7,7 @@ lang.fr=Français lang.ru=Russe lang.es=Espagnol lang.ar=Arabe - +lang.pt-BR=Portugais label.shop=Magasiner label.entity.id=Identifiant label.entity.name=Nom diff --git a/sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties b/sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties new file mode 100644 index 0000000000..df05ffb3b1 --- /dev/null +++ b/sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties @@ -0,0 +1,697 @@ +button.label.add=Adicionar +button.label.addToCart=Adicionar ao carrinho +button.label.cancel=Cancelar +button.label.clear.all=Limpar tudo +button.label.clear=Limpar +button.label.close=Fechar +button.label.continue=Continuar comprando +button.label.crop=Clipe +button.label.edit=Editar +button.label.esc=Tecla Esc +button.label.forgotpassword=Esqueceu sua senha? +button.label.getcode=Obter código +button.label.login=Login +button.label.logon=Login +button.label.logout=Fechar sessão +button.label.ok=Ok +button.label.printreport=Imprimir relatório +button.label.register=Registrar +button.label.removeservice=Remover serviço +button.label.resetpassword=Redefinir senha +button.label.reset=Reiniciar +button.label.select=Selecione +button.label.signin=Entrar +button.label.submit2=Enviar +button.label.submit=Salvar +button.label.submitorder=Enviar pedido +button.label.subscribe=Inscrever-se +button.label.update=Atualizar +button.label.upload.files=Carregar arquivos +button.label.upload.images=Upload de imagens +button.label.view=Detalhes +email.administration.url=URL de administração: {0} +email.contactowner=Se você tiver alguma dúvida sobre este pedido, envie um e-mail para {0} para obter mais detalhes. +email.contact.title=Formulário de contato de email +email.contact=Um novo e-mail de contato - {0} +email.copyright=Copyright @ {0} {1}, Todos os direitos reservados +email.customer.greeting=Obrigado por se associar a {0}, você pode acessar a seção do cliente clicando no seguinte link {1}. Faça login no sistema e acesse os detalhes do seu pedido. As informações para fazer login estão incluídas neste e-mail. Se você tiver alguma dificuldade para acessar a seção do cliente, envie um e-mail para {2}. +email.customer.resetpassword.text=Foi feito um pedido para redefinir a senha. Aqui você encontrará sua nova senha. +email.disclaimer=Este endereço de e-mail nos foi fornecido por você ou por um de nossos clientes. Se você acha que recebeu este e-mail por engano, envie um e-mail para {0} para desativá-lo +email.greeting=Olá {0}, +email.message.from=Mensagem de {0} +email.newstore.info=As informações do usuário serão enviadas em um e-mail separado. +email.newstore.name=Nome da loja: {0} +email.newstore.text=Uma nova loja foi criada +email.newstore.title=Nova loja criada +email.newuser.text=Um novo usuário foi criado +email.newuser.title=Novo usuário criado +email.order.comments=Notas: {0} +email.order.confirmation=Confirmação do pedido: {0} +email.order.download.text=Os arquivos de download ficarão disponíveis por {0} dias. Você deve ter recebido um e-mail com suas informações de login no sistema. Assim que estiver conectado ao sistema, vá para os detalhes do pedido {1} e clique em 'Baixar arquivos'. Você pode acessar a seção do cliente clicando no seguinte link {2}. Se você tiver alguma dificuldade para acessar a seção do cliente, envie um e-mail para {3}. +email.order.download.title=Baixe seus arquivos - Confirmação do pedido: {0} +email.order.ordered=Ordenado em: {0} +email.order.status=Atualizado em {0} - Status do último pedido {1} +email.order.statustext=O status do pedido {0} solicitado em {1} foi atualizado +email.order.status.changed=Status alterado do pedido: {0} -> {1} +email.order.status.title=Pedido {0} atualizado +email.order.thanks=Obrigado por sua compra! +email.order.title={0} - Confirmação do pedido: {1} +email.order.updated=Atualizado em: {0} +email.password.label=Senha: {0} +email.spam.disclaimer=Este email é enviado de acordo com o CAN-SPAM Act dos Estados Unidos em vigor 01-01-2004. Os pedidos de retirada podem ser enviados para este endereço e serão honrados e honrados. +email.link=Link +email.link.reset.password.title=Link para redefinir senha +email.reset.password.text=Alguém solicitou que a senha de sua conta fosse redefinida para {0}. Se você não perguntou isso, pode simplesmente ignorar o e-mail. +email.username.label=Nome de usuário: {0} +email.user.resetpassword.text=Foi feito um pedido para redefinir a senha. Aqui você encontrará sua nova senha. +label.accepteddomains=Domínios aceitos +label.adminurl=URL de administração +label.bgcolorcode=Cor de fundo +label.cart.add=Adicionar ao carrinho +label.cart=Carrinho de compras +label.cart.placeorder=Faça do seu pedido +label.cart.revieworder=Revise seu pedido +label.categories.hierarchy.title=Categoria de hierarquia +label.categories.title=Categorias +label.category.categogydetails=Detalhes da categoria +label.category.categorydescription=Descrição da categoria +label.category.categoryvisible=Categoria visível +label.category.code=Código da categoria +label.category.createcategory=Criar categoria +label.category.editcategory=Editar categoria +label.category.hierarchy.text=Arraste categorias para reorganizar a hierarquia +label.category.highlight=Destaque de categoria curta +label.category.maincategories=Categorias principais +label.category.movecategory=Mover categoria +label.category.moveundercategory=Mover para a categoria +label.category.parentcategory=Pai da categoria +label.category.root=Root +label.category.title=Título da categoria +label.changepasswordrequest=Solicitação de alteração de senha +label.checkout.additionaltext=Você tem um comentário ou sugestão para nós, envie-nos um e-mail como o ID do seu pedido. Nós valorizamos seus comentários. +label.checkout=Check-out +label.checkout.confirmation=Check-out concluído +label.checkout.downloads.completed=Aqui estão seus arquivos para download. +label.checkout.downloads.processing=Será enviado um email com instruções para baixar o arquivo bem como o pagamento deste pedido para finalização. +label.checkout.email=Um email com os detalhes do seu pedido foi enviado para {0}. +label.checkout.logon=Inicie a sua sessão ou registe-se para simplificar o processo de pagamento online! +label.checkout.moneyorder=Faça fachada de seu cheque ou ordem de pagamento nominal para: +label.checkout.orderid=Ou o número do seu pedido é {0}. +label.checkout.text=Feito por fazer do seu pedido em {0}. +label.checkout.transfer=Faça sua transferência bancária com as seguintes informações: +label.configuration.configurations=Configurações +label.configuration.facebook_page_url=página do Facebook +label.configuration.globalsearch_suggestions_path=Caminho para o arquivo de sugestão de pesquisa global predefinido +label.configuration.google_analytics_url=URL do Google Analytics (UC-XXXXXX) +label.configuration.google_api_key=Chave de API do Google (para mapas) +label.configuration.instagram=Instagram +label.configuration.options=Opções de configuração +label.configuration.pinterest=Pinterest +label.configuration.twitter_handle=Gerenciar Twitter +label.configuration.useglobalsearch_suggestions=Use sugestões de pesquisa globais predefinidas +label.configuration.whatsapp=Contato do WhatsApp +label.configuration.whatsapp_default_text=Mensagem WhatsApp pai +label.content.boxes=Caixas de conteúdo +label.content.boxes.name=Nome da caixa +label.content.boxes.position=Posição da caixa +label.content.files=Biblioteca de arquivos +label.content.friendlyurl=URL amigável +label.content.images=Biblioteca de Imagens +label.contentImages.store=Loja do comerciante +label.content.manage.content=Gerenciar conteúdo +label.content.metatag.description=Descrição metatag +label.content.page.displaymainmenu=Mostrar esta página sem menu principal +label.content.pages.manage.content=Gerenciar páginas de conteúdo +label.content.pages.page.content=Conteúdo da página +label.content.pages.page.name=Nome da página +label.content.pages=Páginas de conteúdo +label.content.sections=Seções de conteúdo +label.currency=Moeda +label.customer.accessnow=Acesse agora! +label.customer.accessportal=Você pode acessar a seção do cliente usando o seguinte url +label.customer.accountpassword=Senha da conta +label.customer.billingaddress=Endereço de cobrança +label.customer.billing.city=Cidade de faturamento +label.customer.billing.company=Empresa de cobrança +label.customer.billing.country=País de coleta +label.customer.billing.firstname=Nome de cobrança +label.customer.billinginformation=Cobrança Information +label.customer.billing.lastname=Sobrenome de cobrança +label.customer.billing.name=Nome de cobrança +label.customer.billing.neighborhood=Bairro de cobrança +label.customer.billing.postalcode=Código postal de cobrança +label.customer.billingshipping=Informações de cobrança e envio +label.customer.billing.streetaddress=Endereço de cobrança +label.customer.billing.suburb=Bairro de cobrança +label.customer.billing.zone=Status de cobrança / província +label.customer.city=Cidade do cliente +label.customer.companyname=Nome da empresa +label.customer.confirmshippingaddress=Confirmação do endereço de entrega +label.customer.contactus=Entre em contato +label.customer.country=País do cliente +label.customer.createaccount=Criar uma conta? +label.customer.createaccount.text=Crie uma conta inserindo as informações abaixo. Se você é um cliente antigo, faça o login usando o link no topo da página. +label.customer.createcustomer=Criar cliente +label.customer.currentpassword=Senha atual +label.customer.displaycustomersection=Mostrar seção do cliente +label.customer.edit.billingaddress=Editar endereço de cobrança +label.customer.editcustomer=Editar cliente +label.customer.edit.shippinginformation=Editar informações de envio +label.customer.email=Endereço de e-mail do cliente +label.customer.faster=Criar uma conta tem muitos benefícios: dê uma olhada rápida, salve mais de um endereço, rastreie pedidos e muito mais. +label.customer.firstname=Nome do cliente +label.customer.id=Id. cliente +label.customer.lastname=Sobrenome do cliente +label.customer.list=Lista de clientes +label.customer.moredetails=Mais detalhes! +label.customer.myaccount=Minha conta +label.customer.name=Nome do cliente +label.customer.neighborhood=Bairro do cliente +label.customer.new=Novo cliente +label.customer.newpassword=Nova senha +label.customer.option.code=Código de opção +label.customer.option.name=Nome da opção +label.customer.option=Opção do cliente +label.customer.options.edit=Editar opção +label.customer.option.type=Tipo de tela +label.customer.optionvalue.code=Código do valor da opção +label.customer.optionvalue.edit=Editar valor da opção +label.customer.optionvalue.name=Nome do valor da opção +label.customer.option.value=Valor da opção do cliente +label.customer.optionv.edit=Editar opção +label.customer.order.agreement=Eu concordo com os termos e condições +label.customer.order.agreement.title=Termos e condições +label.customer.order.date=Data do pedido +label.customer.postalcode=Código postal do cliente +label.customer.registered=Cliente registrado +label.customer.registered.signinemail=Se você possui uma conta, por favor entre com seu endereço de e-mail +label.customer.repeatpassword=Repita a senha +label.customer.resetpasswor.confirm=Tem certeza que deseja redefinir a senha do cliente? +label.customer.shippingaddress=Endereço de entrega +label.customer.shipping.city=Cidade de envio +label.customer.shipping.company=Transportadora +label.customer.shipping.country=País de envio +label.customer.shipping.firstname=Nome de envio +label.customer.shippinginformation=Informação de envio +label.customer.shipping.lastname=Sobrenome de envio +label.customer.shippinglocation.disclaimer=Por favor, marque seu endereço de entrega no mapa +label.customer.shippinglocation=Selecione a sua localização +label.customer.shipping.name=Nome da remessa +label.customer.shipping.neighborhood=Bairro de envio +label.customer.shipping.postalcode=Código postal de envio +label.customer.shipping.shipaddress=Enviar para este endereço +label.customer.shipping.shipdifferentaddress=Enviar para outro endereço? +label.customer.shipping.streetaddress=Endereço postal de envio +label.customer.shipping.suburb=Subúrbio de remessa +label.customer.shipping.zone=Status de envio / província +label.customer.signin.social=Facilite e faça login com sua conta {0}! +label.customer.signin.social.system=Login com {0} +label.customer.streetaddress=Endereço do cliente +label.customer.suburb=Bairro do cliente +label.customer.telephone=Telefone do cliente +label.customer.zone=Estado do cliente / província +label.defaultlanguage=Idioma padrão +label.defaultSelection=Seleção padrão +label.emailconfig.host=Host +label.emailconfig.options=Opções de configuração de e-mail +label.emailconfig.password=Senha +label.emailconfig.port=Porta +label.emailconfig.protocol=Protocolo +label.emailconfig.requiresauthentication=O servidor de e-mail requer autenticação (deve ser verdadeiro) +label.emailconfig.requiresstarttls=Alguns servidores de e-mail, como o Google Mail, requerem criptografia starttls +label.emailconfig.smtpauth=Requer autenticação +label.emailconfig.starttls=START +label.emailconfig.username=Nome de usuário +label.emptycart=Não há itens em seu carrinho de compras +label.entity.active=Ativo +label.entity.code=Código +label.entity.details=Detalhes +label.entity.enabled=Ativado +label.entity.id=Id +label.entitylist.paging=Mostrando {0} - {1} de {2} resultado (s) +label.entity.name=Nome +label.entity.order=Pedido +label.entity.public=Público +label.entity.remove.confirm=Deseja realmente remover esta entidade? +label.entity.setAsDefault.confirm=Deseja realmente definir esta entidade como padrão? +label.entity.status=Status +label.entity.type=Type +label.entity.visible=Visível +label.entity.featured=Em destaque +label.generic.add=Adicionar +label.generic.address=Endereço +label.generic.address.findus=Encontre-nos em +label.generic.all=All +label.generic.alphanumeric=Alfanumérico +label.generic.amount=Quantidade +label.generic.back=Voltar +label.generic.changepassword=Alterar senha +label.generic.city=Cidade +label.generic.comments=Comentários +label.generic.confirm=Por favor, confirme! +label.generic.country.code=Código do País +label.generic.country=País +label.generic.default=Padrão +label.generic.displayonly=Mostrar apenas +label.generic.edit=Editar +label.generic.email=Endereço de email +label.generic.environment=Meio Ambiente +label.generic.female=Mulher +label.generic.firstname=Nome +label.generic.genre=Gênero +label.generic.hi=Olá +label.generic.imageType=Tipo de mídia +label.generic.item=item +label.generic.items=items +label.generic.item.title=Ã tem +label.generic.keywords=Palavras-chave +label.generic.language=Idioma +label.generic.lastname=Sobrenome +label.generic.male=Masculino +label.generic.maximum=Máximo +label.generic.minimum=Mínimo +label.generic.name=Nome +label.generic.neighborhood=Bairro +label.generic.newpassword=Nova senha +label.generic.newpassword.repeat=Repita a nova senha +label.generic.next=Próximo +label.generic.no=Não +label.generic.office.hours=Horário de funcionamento +label.generic.password=Senha +label.generic.phone=Telefone +label.generic.pictures=Fotos +label.generic.postalcode=Código postal +label.generic.price=Preço +label.generic.print=Imprimir +label.generic.providedby=Desenvolvido por +label.generic.rebate=Reembolsar +label.generic.register=Registrar +label.generic.remove=Remover +label.generic.repeatpassword=Repita a senha +label.generic.search=Pesquisar +label.generic.send=Enviar +label.generic.setAsDefault=Definir como padrão +label.generic.sizeunit.CM=Centímetros +label.generic.sizeunit.IN=Polegadas +label.generic.sortby=Classificar por +label.generic.stateprovince=Estado / província +label.generic.streetaddress=Endereço +label.generic.subject=Assunto +label.generic.title=Título +label.generic.today=Hoje +label.generic.url=URL +label.generic.username=Nome de usuário +label.generic.videos=Vídeos +label.generic.weightunit.KG=Quilogramas +label.generic.weightunit.LB=Libras +label.generic.welcome=Bem-vindo +label.generic.yes=Sim +label.generic.youropinion=Sua opinião +label.group.creategroup=Criar grupo +label.group.editgroup=Editar grupo +label.group.groupId=Id. grupo +label.group.root=Root +label.groups.title=Grupos +label.manufacturer.brand=Marcas +label.manufacturer.categories=Categorias +label.manufacturer.create=Criar um fabricante +label.manufacturer.edit=Editar fabricante +label.manufactureredit.manufacturerdescription=Descrição do fabricante +label.manufactureredit.manufacturername=Nome do fabricante +label.manufactureredit.manufacturerorder=Pedido +label.manufactureredit.manufacturertitle=Cargo do Fabricante +label.manufactureredit.manufacturerurlclicked=URL clicado +label.manufactureredit.manufacturerurl=URL +label.manufacturer.image=Imagem +label.message.maximumWeight.exist=Peso máximo já existe +label.message.region.available=Região disponível +label.message.region.exist=Região já existe +label.metatags.description=(Meta tags) Descrição +label.metatags.keywords=(Meta tags) Palavras-chave +label.mycart=Meu carrinho +label.my.profile=Meu perfil +label.notification.message.passwordchanged=Gostaríamos de informá-lo que sua senha foi alterada recentemente em {0} +label.notification.title.passwordchanged=Notificação de alteração de senha +label.order.CANCELED=Cancelado +label.order.capture=Capturar transação +label.order.date=Data do pedido +label.order.DELIVERED=Entregue +label.order.details=Detalhes do pedido +label.order.displayagreement=Mostrar os termos do cliente e o acordo da política na página do pedido +label.order.downloademail=Enviar e-mail de download +label.order.editcustomer=Editar cliente +label.order.history=História +label.order.item=item +label.order.module=Módulo de pagamento +label.order.notes.eg=Notas para o pedido ou entrega +label.order.notes=Notas do pedido +label.order.ORDERED=Encomendado +label.order.packing=Imprimir recibo de envio +label.order.PAID=Pago +label.order.pastorders=Pedidos anteriores +label.order.paymentmode=Modo de pagamento +label.order.PREPARED=Preparado +label.order.price=Preço +label.order.printinvoice=Imprimir fatura +label.order.PROCESSING=Processando +label.order.recalculate=Recalcular +label.order.recent=Pedidos recentes +label.order.refund=Aplicar reembolso +label.order.REFUNDED=Reembolsado +label.order.sendinvoice=Enviar fatura por e-mail +label.order.SHIPPED=Entregue +label.order.shippinglocation.disclaimer=Local de entrega +label.order.shippingmethod=Modo de envio +label.order.summary=Resumo do pedido +label.order.title=Pedidos +label.order.totals=Totais +label.order.total=Total +label.order.transactions=Lista de transações +label.order.updatestatus=Enviar e-mail de status do pedido +label.page=Anúncios +label.payment.creditcard.cardcvv=Número de validação do cartão +label.payment.creditcard.cardexpiry=Data de validade do cartão +label.payment.creditcard.cardexpiry.month=Mês de vencimento do cartão +label.payment.creditcard.cardexpiry.year=Ano de validade do cartão +label.payment.creditcard.cardnumber=Número do cartão +label.payment.creditcard.cardowner=Nome do titular do cartão +label.payment.creditcard.usecredicard=Use seu cartão de crédito +label.payment.creditcard.whatiscvv=O que é um número de validação de cartão de crédito? +label.payment.module.title=Método de pagamento +label.payment.moneyorder.usemoneyorder=Usar ordem de pagamento +label.payment.paypal.usepaypal=Usar PayPal +label.payment.title=Métodos de pagamento +label.permission.createpermission=Permissão de criação +label.permission.editpermission=Editar permissão +label.permission.name=Nome da permissão +label.permissions.title=Permissões +label.proceed.checkout=Prosseguir para finalizar a compra +label.product.attribute.create=Criar opção / atributo do produto +label.product.attribute.default=Opção padrão +label.product.attribute.display=Usar atributo apenas para exibição +label.product.attribute=Opção / atributo +label.product.attribute.option.name=Opção / nome do atributo +label.product.attribute.otherweight=Peso adicional +label.product.attribute.required=Opção necessária +label.product.attributes=Opções / atributos do produto +label.product.attribute.specifications=Especificações +label.product.attribute.value=Valor do atributo +label.product.available=Disponível +label.product.brand=Marca +label.product.category.association=Associar produtos nas categorias +label.product.clickrate=Avaliação do produto (clique nas estrelas para ativar a avaliação) +label.product.code=Código do produto +label.product.configure=Definição do produto +label.product.create=Criar um produto +label.product.createsimilar=Criar produto semelhante +label.product.customer.reviews=Avaliações de clientes +label.product.customgroup.add=Adicionar grupo de produtos personalizados +label.product.customgroup.code=Código de grupo de produtos personalizados (deve ser único) +label.product.customGroup.title=Grupo de produtos +label.product.defaultImage.message=Quando selecionado por padrão, esta imagem será a imagem exibida na página do produto +label.product.details=Detalhes do produto +label.product.digitalproduct=Produto digital +label.productedit.categoryname=Nome da categoria +label.productedit.choosecategory=Escolha uma categoria +label.product.edit=Editar produto +label.productedit.productdesc=Descrição do produto +label.productedit.producthl=Breve destaque do produto +label.productedit.productname=Nome do produto +label.product.featured.meassage=Para adicionar um produto à lista de Itens Apresentados, arraste o produto desejado da lista de Produtos Disponíveis para a caixa Itens Apresentados. +label.product.group.meassage=Para adicionar um produto à lista de grupos de produtos, arraste o produto desejado da lista de produtos disponíveis para a caixa do grupo de produtos. +label.product.height=Altura +label.product.image=Imagem +label.product.itemWeight=Incremento mínimo +label.product.length=Comprimento +label.product.moreitems=Mostrar mais itens +label.product.nomoreitems=Não há mais itens disponíveis +label.product.option.code=Código de opção +label.product.option.codehelp=O código da opção é necessário para consultar produtos por atributos +label.product.option.displayonly=Opção para exibição apenas +label.product.ordermax=Quantidade máxima do pedido +label.product.ordermin=Quantidade mínima do pedido. +label.product.outofstock=Esgotado +label.product.preorder=Pré-venda +label.product.price.code=Código de preço do produto +label.product.price.create=Criar preço do produto +label.product.price.default=Preço padrão do produto +label.product.price.name=Nome do preço do produto +label.product.price=Preço do produto +label.product.price.special.enddate=Data especial de término +label.product.price.special.startdate=Data especial de início +label.product.price.special=US $ 2,99 +label.product.prices=Preços dos produtos +label.product.productoptions.comments=Comentários da opção +label.product.productoptions.create.title=Criar opção de produto +label.product.productoptions.edit.title=Editar opção de produto +label.product.productoptions.list=Lista de opções +label.product.productoptions.name=Nome da opção +label.product.productoptions.price=Preço da opção +label.product.productoptions.title=Opção de produto +label.product.productoptions.type=Tipo de opção +label.product.productoptionsvalues.list=Lista de valores de opções do produto +label.product.productoptionsvalues.title=Valores das opções do produto +label.product.productoption.type.checkbox=Caixa de seleção +label.product.productoption.type.radio=Rádio +label.product.productoption.type.select=Selecione +label.product.productoption.type.text=Texto +label.product.productoptionvalue.create.title=Criar valor de opção de produto +label.product.productoptionvalue.edit.title=Editar o valor da opção do produto +label.product.productoptionvalue=Imagem do valor da opção +label.product.productoptiosvalue.title=Valor da opção do produto +label.product.rate=Avaliar produto +label.product.refsku=Identificador do sistema de referência +label.product.related.meassage=Para adicionar um produto à lista de itens relacionados, arraste o produto desejado da lista de produtos disponíveis para a caixa de itens relacionados. +label.product.related.title=Artigos Relacionados +label.product.reviews.evaluated=Você revisou este produto +label.product.reviews.logon.write=Você deve estar autenticado para escrever um comentário +label.product.reviews.rating=Avaliação +label.product.reviews=Comentários +label.product.reviews.write=Escreva um comentário +label.product.searchkeywords=Palavras-chave de pesquisa +label.product.shipeable=O produto será enviado +label.product.sku=SKU +label.product.specials=Especiais +label.product.specification=Especificações +label.product.status=Status +label.product.title=Título do produto +label.product.uploadfile=Carregar arquivo +label.product.visible=Produto visível +label.product.weight=Peso +label.product.width=Largura +label.profile.lastaccess=Último acesso +label.profile.title=Perfil de usuário +label.quantity=Quantidade +label.register.confirmation=Registro concluído com sucesso! Um e-mail foi enviado para {0} com todos os detalhes de autenticação. Eu tenho {1} e uso suas informações de autenticação para fazer o login. +label.register.createaccount=Criar uma conta +label.register.notyetregistered=Ainda não está registado? +label.register.personal.information=Informações pessoais +label.register.registerreasons=Simplifique o processo de checkout enviando suas informações, reordene um item com um clique e obtenha acesso a informações premium. +label.register.signin.information=Informação de login +label.register.whyregister=Por que registrar? +label.search.items.found=item (ns) encontrado (s) +label.search.searchQuery=Consulta de Pesquisa +label.security.loggedinas=Você está logado como +label.security.nologinacces.store=Não podemos mostrar a caixa de login da loja +label.sefurl=URL amigável do mecanismo de pesquisa +label.shipping.addregion=Adicionar região +label.shipping.allquotes=Mostrar todas as cotações de envio +label.shipping.billingaddress=Endereço de cobrança +label.shipping.countries=Enviar para países +label.shipping.fees=Custos de envio +label.shipping.freeshippingamount=Frete grátis no valor do pedido maior que +label.shipping.freeshippingandhandling=Frete e manuseio grátis +label.shipping.freeshipping=Frete grátis! +label.shipping.freeshipping.over=Frete grátis para pedidos acima +label.shipping.handlingfees=Taxas de gerenciamento +label.shipping.international=Internacional +label.shipping.leastexpensivequotes=Mostrar cotações de envio menos caras +label.shipping.maximumWeight=Peso máximo +label.shipping.methods=Métodos de envio +label.shipping.mode=Modo de envio +label.shipping.moreexpensivequotes=Mostrar as cotações de envio mais caras +label.shipping.national=Nacional +label.shipping.nopostalcode=Uma oferta de envio estará disponível após o preenchimento do código postal +label.shipping.options=Opções de envio +label.shipping.origin.description=A origem da remessa ajudará no cálculo da distância entre a origem e o destino da entrega. Caso a origem não seja configurada, o sistema utilizará o endereço da loja comercial como origem da remessa. +label.shipping.origin.title=Origem do endereço de entrega +label.shipping.packaging.boxes=Os itens serão combinados e enviados em uma caixa. +label.shipping.packaging.box.height=Altura da caixa +label.shipping.packaging.box.length=Comprimento da caixa +label.shipping.packaging.box.maxitems=Número máximo de itens em uma caixa +label.shipping.packaging.box.maxweight=Peso máximo da caixa +label.shipping.packaging.box.weight=Peso da caixa +label.shipping.packaging.box.width=Largura da caixa +label.shipping.packaging.individual=Os itens serão enviados individualmente. +label.shipping.packaging.title=Informações sobre embalagem +label.shipping.region=Região +label.shipping.shippingaddress=Endereço de entrega +label.shipping.taxonshipping=Imposto sobre o envio +label.shipping.title=Configurações de envio +label.shop=Loja +label.social.connect=Conecte-se conosco +label.social.facebook=Facebook +label.social.twitter=Twitter +label.soldout=Esgotado +label.storeaddress=Endereço da loja +label.storeadministration=Administração da loja +label.storeadministrator=Administrador da loja +label.store.allowPurchaseItems=Permitir a compra de itens +label.storebanner=Banner da loja +label.store.baseurl=URL base de armazenamento (domínio) +label.storecity=Cidade da loja +label.storecode=Código de loja exclusivo +label.storecountry=País da loja +label.store.currency.format=Formato da moeda nacional +label.store.currency.format.help=Formato da moeda nacional ex US $ 1,345,79 ou formato da moeda internacional ex US $ 1,345,79 +label.store.debugmode=Modo de depuração (adicionar depuração adicional) +label.store.displayaddtocartfeatured=Permitir adicionar ao carrinho de itens em destaque +label.store.displaycontactussection=Mostrar página de contato +label.store.displaysearchbox=Mostrar caixa de pesquisa +label.store.displaystoreaddress=Mostrar endereço da loja +label.storeemailaddress=Endereço de email da loja +label.storefront.landingpage=Informações da página de destino +label.storefront.landingpage.title=Título da página de destino +label.storefront.metatags.description=Descrição das metatags +label.storefront.metatags.keywords=Palavras-chave de meta tag +label.storefront.storetext=Texto principal da página de destino +label.store.inbusinesssince=Site que funciona a partir de +label.store.information=Informação da loja +label.store.information.title=Informação +label.store.list=Lojas +label.storelogo=Logotipo da loja +label.storename=Nome da loja +label.storephone=Armazenar telefone +label.storepostalcode=Código postal da loja +label.store.question=Tem alguma questão? +label.storesetup=Configurações da loja +label.store.sizeunits=Unidades de tamanho +label.store.template=Tópico +label.store.testmode=Modo de teste (ocultar categoria e detalhes do produto) +label.store.title=Loja do comerciante +label.store.tofindus=Onde nos encontrar +label.store.useCache=Usar cache +label.store.weightunit=Unidades de peso +label.storezone=Status / Província da Loja +label.subtotal=Subtotal +label.supportedlanguages ​​= Idiomas suportados +label.taxclass=Classe fiscal +label.tax.compound=Composto +label.tax.piggyback=Pig's back +label.tax.storeaddress=Endereço da loja +label.tax.taxclass=Classe fiscal +label.tax.taxclass.name=Nome da classe fiscal +label.tax.taxclass.title=Classes fiscais +label.tax.taxconfiguration=Cálculo da base tributária +lang.es=espanhol +lang.en=Inglês +lang.fr=francês +lang.ru=russo +lang.ar=árabe +lang.pt-BR=português (Brasil) +menu.accounts-conf=Configurações da conta +menu.addaddress=Adicionar um novo endereço +menu.cache=gerenciamento de cache +menu.catalogue=Catálogo +menu.catalogue-categories=Categorias +menu.catalogue-categories-create=Criar categoria +menu.catalogue-categories-hierarchy=Categoria Hierarquia +menu.catalogue-categories-list=Lista de categorias +menu.catalogue-featured=Artigos em destaque +menu.catalogue-options-create=Criar opção +menu.catalogue-options-list=Lista de opções +menu.catalogue-options=Opções +menu.catalogue-optionsvalues-create=Criar valor de opção +menu.catalogue-optionsvalues-list=Lista de valores de opções +menu.catalogue-products-categories=Produtos para categorias +menu.catalogue-products-create=Criar produto +menu.catalogue-products-custom-group=Grupos de produtos personalizados +menu.catalogue-products-group=Grupo de produtos +menu.catalogue-products-images=Imagens do produto +menu.catalogue-products-images-url=URL externo das imagens do produto +menu.catalogue-products=Produtos +menu.change-password=Alterar senha +menu.configuration=Configurações +menu.content=Gerenciar conteúdo +menu.content-boxes=Gerenciar caixas +menu.content-boxes-create=Criar caixa +menu.content-files=Gerenciar arquivos +menu.content-images=Gerenciar imagens +menu.content-images-create=Criar imagens +menu.content-pages=Gerenciar páginas +menu.content-pages-create=Criar página +menu.create-store=Criar uma loja +menu.create-user=Criar um usuário +menu.customer=Clientes +menu.customer-create=Criar cliente +menu.customer-list=Lista de clientes +menu.customer-options-create=Criar opção de cliente +menu.customer-options-list=Lista de opções do cliente +menu.customer-options=Opções do cliente +menu.customer-options-set=Gerenciar conjunto de opções do cliente +menu.customer-options-values-create=Criar valor de opção do cliente +menu.customer-options-values-list=Lista de valores de opções do cliente +menu.editaddress=Alterar endereço +menu.email-conf=Configurações de e-mail +menu.home=Casa +menu.manufacturer-create=Criar fabricante +menu.manufacturer-list=Lista de fabricantes +menu.myprofile=Meu perfil +menu.order-list=Lista de pedidos +menu.order=Pedidos +menu.payment=Pagamento +menu.product.category=Associar às categorias +menu.profile=Perfil +menu.security-create-group=Criar grupo +menu.security-groups=Grupos +menu.security-permissions=Permissões +menu.security=Segurança +menu.shipping-configs=Configurações de envio +menu.shipping=Frete +menu.shipping-methods=Métodos de envio +menu.shipping-options=Opções de envio +menu.shipping-origin=Origem da remessa +menu.shipping-packages=Embalagem +menu.storeBranding=Marca da loja +menu.storeDetails=Loja +menu.storeLanding=Página inicial da loja +menu.store-list=Lojas +menu.store=Loja +menu.system-configurations=Configurações do sistema +menu.taxclass=Classes fiscais +menu.taxconfiguration=Configuração de impostos +menu.tax=Gestão tributária +menu.taxrates.code=Código da taxa de imposto +menu.taxrates.name=Nome da taxa de imposto +menu.taxrates.rate=Taxa de imposto +menu.taxrates=Taxas de imposto +menu.users=Usuários +menu.user=Usuário +order.total.discount=Reembolso +order.total.handling=Manuseio +order.total.shipping=Frete +order.total.subtotal=Subtotal +order.total.total=Total +reembolso=reembolso +security.answer.question1.message=Responder pergunta de segurança 1 +security.answer.question2.message=Responder pergunta de segurança 2 +security.answer.question3.message=Responder pergunta de segurança 3 +security.group.description.ADMIN_CATALOGUE=Um usuário desse grupo pode criar produtos, categorias e itens em destaque. +security.group.description.ADMIN_CONTENT=Um usuário atribuído a esse grupo poderá gerenciar o conteúdo dinâmico e estático do site, adicionar imagens, arquivos e arquivos ao sistema. +security.group.description.ADMIN_ORDER=Um usuário nesse grupo pode gerenciar pedidos, pesquisar pedidos, modificar informações do cliente e aplicar um reembolso a um pedido. +security.group.description.ADMIN_STORE=Um usuário parte desse grupo pode gerenciar a loja atribuída a ele também. Ele será capaz de mudar a marca e modificar qualquer coisa no menu da loja. Este grupo também dá acesso às configurações de envio e pagamento +security.group.description.ADMIN=Um usuário administrador é o usuário com mais privilégios para a administração de uma loja. Um usuário administrador pode fazer tudo como administrador de loja e também pode criar usuários com acesso mais restrito. +security.group.description.SUPERADMIN=Um único usuário pode ser um superadmin. O usuário admin é criado por padrão como o usuário superadmin. Este usuário pode fazer tudo no sistema e é o único que pode gerenciar as lojas. +security.question.1=Qual era a cor do seu primeiro carro? +security.question1=Questão 1 +security.question.2=Em que cidade você nasceu? +security.question2=Questão 2 +security.question.3=Qual era o nome do seu primeiro animal de estimação? +security.question3=Questão 3 +security.question.4=Qual é o seu gênero musical favorito? +security.question.5=Quem foi o seu herói de infância? +security.question.6=Em que cidade ou cidade foi seu primeiro emprego? +security.question.7=Onde você estava quando deu seu primeiro beijo? +security.question.8=Em que cidade conheceu seu cônjuge / companheiro? +security.question.9=Qual era o seu apelido de infância? +security.questions.differentmessages=Selecione 3 questões diferentes \ No newline at end of file From 55e84d3ba797c005436276cb94194a6bc56c2ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcios=20Rodrigues?= Date: Tue, 13 Jul 2021 11:03:26 -0300 Subject: [PATCH 06/34] [update] spell check --- sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties b/sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties index df05ffb3b1..0d5d59d1dd 100644 --- a/sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties +++ b/sm-shop/src/main/resources/bundles/shopizer_pt_BR.properties @@ -633,7 +633,7 @@ menu.customer-options-values-create=Criar valor de opção do cliente menu.customer-options-values-list=Lista de valores de opções do cliente menu.editaddress=Alterar endereço menu.email-conf=Configurações de e-mail -menu.home=Casa +menu.home=Início menu.manufacturer-create=Criar fabricante menu.manufacturer-list=Lista de fabricantes menu.myprofile=Meu perfil From 0116b8954aa62c8d0fa270269403dfc54d0483a6 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Tue, 13 Jul 2021 22:59:51 -0400 Subject: [PATCH 07/34] property set --- .../facade/ProductOptionSetFacade.java | 1 + .../product/facade/ProductTypeFacade.java | 2 + sm-shop/files/store/DownlaodRepository.dat | Bin 580794 -> 351113 bytes ...SetApi.java => ProductPropertySetApi.java} | 39 ++++++--- .../product/ProductOptionSetFacadeImpl.java | 74 ++++++++++++------ .../facade/product/ProductTypeFacadeImpl.java | 18 +++++ 6 files changed, 96 insertions(+), 38 deletions(-) rename sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/{ProductOptionSetApi.java => ProductPropertySetApi.java} (77%) diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionSetFacade.java b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionSetFacade.java index b9c1637bbd..0a3ce3e9c3 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionSetFacade.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionSetFacade.java @@ -13,6 +13,7 @@ public interface ProductOptionSetFacade { ReadableProductOptionSet get(Long id, MerchantStore store, Language language); boolean exists(String code, MerchantStore store); List list(MerchantStore store, Language language); + List list(MerchantStore store, Language language, String type); void create(PersistableProductOptionSet optionSet, MerchantStore store, Language language); void update(Long id, PersistableProductOptionSet optionSet, MerchantStore store, Language language); void delete(Long id, MerchantStore store); diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductTypeFacade.java b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductTypeFacade.java index 5c1f63506f..3fbdb8082b 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductTypeFacade.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductTypeFacade.java @@ -12,6 +12,8 @@ public interface ProductTypeFacade { ReadableProductType get(MerchantStore store, Long id, Language language); + ReadableProductType get(MerchantStore store, String code, Language language); + Long save(PersistableProductType type, MerchantStore store, Language language); void update(PersistableProductType type, Long id, MerchantStore store, Language language); diff --git a/sm-shop/files/store/DownlaodRepository.dat b/sm-shop/files/store/DownlaodRepository.dat index d879d860a2d2d4f5e5b1128f9124720da06cd9d9..f6d5890015fd0be467073b4d70c93526d39048aa 100644 GIT binary patch delta 19 acmdnBQ@L}yXhREQ3sVbo3(FSP&S(HnM+YMS delta 48 zcmeC&F1l-{azhJa3sVbo3(FSP&S(w>=0-yXAZSmx#R$YqK+L>7;TDTVBV!2wj{y)o diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionSetApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductPropertySetApi.java similarity index 77% rename from sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionSetApi.java rename to sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductPropertySetApi.java index 6344e77a1d..6b51b8cb26 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionSetApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductPropertySetApi.java @@ -4,6 +4,7 @@ import javax.validation.Valid; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -35,16 +36,16 @@ @Controller @RequestMapping("/api/v1") -@Api(tags = { "Product options set /options / options values regroupment management resource (Product Options Set Management Api)" }) +@Api(tags = { "Product property set regroupment management resource (Product Options Set Management Api)" }) @SwaggerDefinition(tags = { - @Tag(name = "Product options set /options / options values regroupment management resource", description = "Edit product option set") }) -public class ProductOptionSetApi { + @Tag(name = "Product property set regroupment management resource resource", description = "Edit product property set") }) +public class ProductPropertySetApi { @Autowired private ProductOptionSetFacade productOptionSetFacade; @ResponseStatus(HttpStatus.CREATED) - @RequestMapping(value = { "/private/product/option/set" }, method = RequestMethod.POST) + @RequestMapping(value = { "/private/product/property/set" }, method = RequestMethod.POST) @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) public void create( @@ -57,7 +58,7 @@ public void create( } @ResponseStatus(HttpStatus.OK) - @GetMapping(value = { "/private/product/option/set/unique" }, produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value = { "/private/product/property/set/unique" }, produces = MediaType.APPLICATION_JSON_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "string", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "string", defaultValue = "en") }) @ApiOperation(httpMethod = "GET", value = "Check if option set code already exists", notes = "", response = EntityExists.class) @@ -72,7 +73,7 @@ public ResponseEntity exists( @ResponseStatus(HttpStatus.OK) - @RequestMapping(value = { "/private/product/option/set/{id}" }, method = RequestMethod.GET) + @RequestMapping(value = { "/private/product/property/set/{id}" }, method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) @ResponseBody @@ -87,7 +88,7 @@ public ReadableProductOptionSet get( @ResponseStatus(HttpStatus.OK) - @RequestMapping(value = { "/private/product/option/set/{id}" }, method = RequestMethod.PUT) + @RequestMapping(value = { "/private/product/property/set/{id}" }, method = RequestMethod.PUT) @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) public void update( @@ -103,7 +104,7 @@ public void update( @ResponseStatus(HttpStatus.OK) - @RequestMapping(value = { "/private/product/option/set/{id}" }, method = RequestMethod.DELETE) + @RequestMapping(value = { "/private/product/property/set/{id}" }, method = RequestMethod.DELETE) @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) @@ -116,17 +117,31 @@ public void delete( } + /** + * Get property set by store + * filter by product type + * @param merchantStore + * @param language + * @return + */ @ResponseStatus(HttpStatus.OK) - @RequestMapping(value = { "/private/product/option/set" }, method = RequestMethod.GET) + @RequestMapping(value = { "/private/product/property/set" }, method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) public @ResponseBody List list( @ApiIgnore MerchantStore merchantStore, - @ApiIgnore Language language) { - - return productOptionSetFacade.list(merchantStore, language); + @ApiIgnore Language language, + @RequestParam(value = "productType", required = false) String type) { + + if(!StringUtils.isBlank(type)) { + return productOptionSetFacade.list(merchantStore, language, type); + } else { + return productOptionSetFacade.list(merchantStore, language); + } + } + } \ No newline at end of file diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java index 2e8f5e827b..287fab9922 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java @@ -16,32 +16,38 @@ import com.salesmanager.shop.mapper.catalog.ReadableProductOptionSetMapper; import com.salesmanager.shop.model.catalog.product.attribute.optionset.PersistableProductOptionSet; import com.salesmanager.shop.model.catalog.product.attribute.optionset.ReadableProductOptionSet; +import com.salesmanager.shop.model.catalog.product.type.ReadableProductType; import com.salesmanager.shop.store.api.exception.OperationNotAllowedException; import com.salesmanager.shop.store.api.exception.ResourceNotFoundException; import com.salesmanager.shop.store.api.exception.ServiceRuntimeException; import com.salesmanager.shop.store.controller.product.facade.ProductOptionSetFacade; +import com.salesmanager.shop.store.controller.product.facade.ProductTypeFacade; @Service public class ProductOptionSetFacadeImpl implements ProductOptionSetFacade { - + @Autowired private PersistableProductOptionSetMapper persistableProductOptionSetMapper; - + @Autowired private ReadableProductOptionSetMapper readableProductOptionSetMapper; - + @Autowired private ProductOptionSetService productOptionSetService; + @Autowired + private ProductTypeFacade productTypeFacade;; + @Override public ReadableProductOptionSet get(Long id, MerchantStore store, Language language) { Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(language, "Language cannot be null"); - ProductOptionSet optionSet = productOptionSetService.getById(store, id, language); - if(optionSet == null) { - throw new ResourceNotFoundException("ProductOptionSet not found for id [" + id +"] and store [" + store.getCode() + "]"); + ProductOptionSet optionSet = productOptionSetService.getById(store, id, language); + if (optionSet == null) { + throw new ResourceNotFoundException( + "ProductOptionSet not found for id [" + id + "] and store [" + store.getCode() + "]"); } - + return readableProductOptionSetMapper.convert(optionSet, store, language); } @@ -49,17 +55,16 @@ public ReadableProductOptionSet get(Long id, MerchantStore store, Language langu public List list(MerchantStore store, Language language) { Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(language, "Language cannot be null"); - + try { List optionSets = productOptionSetService.listByStore(store, language); return optionSets.stream().map(opt -> this.convert(opt, store, language)).collect(Collectors.toList()); } catch (ServiceException e) { throw new ServiceRuntimeException("Exception while listing ProductOptionSet", e); } - } - + private ReadableProductOptionSet convert(ProductOptionSet optionSet, MerchantStore store, Language language) { return readableProductOptionSetMapper.convert(optionSet, store, language); } @@ -69,11 +74,11 @@ public void create(PersistableProductOptionSet optionSet, MerchantStore store, L Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(language, "Language cannot be null"); Validate.notNull(optionSet, "PersistableProductOptionSet cannot be null"); - - if(this.exists(optionSet.getCode(), store)) { + + if (this.exists(optionSet.getCode(), store)) { throw new OperationNotAllowedException("Option set with code [" + optionSet.getCode() + "] already exist"); } - + ProductOptionSet opt = persistableProductOptionSetMapper.convert(optionSet, store, language); try { opt.setStore(store); @@ -89,12 +94,13 @@ public void update(Long id, PersistableProductOptionSet optionSet, MerchantStore Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(language, "Language cannot be null"); Validate.notNull(optionSet, "PersistableProductOptionSet cannot be null"); - - ProductOptionSet opt = productOptionSetService.getById(store, id, language); - if(opt == null) { - throw new ResourceNotFoundException("ProductOptionSet not found for id [" + id +"] and store [" + store.getCode() + "]"); + + ProductOptionSet opt = productOptionSetService.getById(store, id, language); + if (opt == null) { + throw new ResourceNotFoundException( + "ProductOptionSet not found for id [" + id + "] and store [" + store.getCode() + "]"); } - + optionSet.setId(id); optionSet.setCode(opt.getCode()); ProductOptionSet model = persistableProductOptionSetMapper.convert(optionSet, store, language); @@ -111,12 +117,14 @@ public void update(Long id, PersistableProductOptionSet optionSet, MerchantStore public void delete(Long id, MerchantStore store) { Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(id, "id cannot be null"); - ProductOptionSet opt = productOptionSetService.getById(id); - if(opt == null) { - throw new ResourceNotFoundException("ProductOptionSet not found for id [" + id +"] and store [" + store.getCode() + "]"); + ProductOptionSet opt = productOptionSetService.getById(id); + if (opt == null) { + throw new ResourceNotFoundException( + "ProductOptionSet not found for id [" + id + "] and store [" + store.getCode() + "]"); } - if(!opt.getStore().getCode().equals(store.getCode())) { - throw new ResourceNotFoundException("ProductOptionSet not found for id [" + id +"] and store [" + store.getCode() + "]"); + if (!opt.getStore().getCode().equals(store.getCode())) { + throw new ResourceNotFoundException( + "ProductOptionSet not found for id [" + id + "] and store [" + store.getCode() + "]"); } try { productOptionSetService.delete(opt); @@ -130,12 +138,26 @@ public void delete(Long id, MerchantStore store) { public boolean exists(String code, MerchantStore store) { Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(code, "code cannot be null"); - ProductOptionSet optionSet = productOptionSetService.getCode(store, code); - if(optionSet != null) { + ProductOptionSet optionSet = productOptionSetService.getCode(store, code); + if (optionSet != null) { return true; } - + return false; } + @Override + public List list(MerchantStore store, Language language, String type) { + Validate.notNull(store, "MerchantStore cannot be null"); + Validate.notNull(language, "Language cannot be null"); + Validate.notNull(type, "Product type cannot be null"); + + // find product type by id + ReadableProductType readable = productTypeFacade.get(store, type, language); + + List optionSets = productOptionSetService.getByProductType(readable.getId(), store, language); + return optionSets.stream().map(opt -> this.convert(opt, store, language)).collect(Collectors.toList()); + + } + } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductTypeFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductTypeFacadeImpl.java index 1b704c0229..73f5dffe0a 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductTypeFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductTypeFacadeImpl.java @@ -180,5 +180,23 @@ public boolean exists(String code, MerchantStore store, Language language) { return false; } + @Override + public ReadableProductType get(MerchantStore store, String code, Language language) { + ProductType t; + try { + t = productTypeService.getByCode(code, store, language); + } catch (ServiceException e) { + throw new RuntimeException("An exception occured while getting product type [" + code + "] for merchant store [" + store.getCode() +"]",e); + } + + if(t == null) { + throw new ResourceNotFoundException("Product type [" + code + "] not found for merchant [" + store.getCode() + "]"); + } + + ReadableProductType readableType = readableProductTypeMapper.convert(t, store, language); + return readableType; + + } + } From 818106d0184871ba1e721f73bbc1aeec43414357 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Sun, 18 Jul 2021 21:46:38 -0400 Subject: [PATCH 08/34] Product properties --- .../generic/SalesManagerEntityService.java | 5 + .../SalesManagerEntityServiceImpl.java | 4 + .../catalog/product/ReadableProduct.java | 11 ++ .../PersistableProductAttribute.java | 6 +- .../attribute/ProductOptionEntity.java | 2 +- ...Option.java => ProductPropertyOption.java} | 2 +- .../attribute/ReadableProductOption.java | 2 +- .../attribute/ReadableProductOptionValue.java | 18 +-- .../attribute/ReadableProductProperty.java | 30 +++++ .../ReadableProductPropertyValue.java | 25 ++++ .../shop/model/entity/CodeEntity.java | 17 +++ .../product/facade/ProductOptionFacade.java | 6 + .../catalog/ReadableProductPopulator.java | 111 +++++++++++++++++- .../shop/store/api/v1/product/ProductApi.java | 2 +- .../api/v1/product/ProductOptionApi.java | 50 +++++++- .../product/ProductOptionFacadeImpl.java | 66 +++++++++-- 16 files changed, 323 insertions(+), 34 deletions(-) rename sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/{ProductOption.java => ProductPropertyOption.java} (89%) create mode 100644 sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductProperty.java create mode 100644 sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductPropertyValue.java create mode 100644 sm-shop-model/src/main/java/com/salesmanager/shop/model/entity/CodeEntity.java diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityService.java b/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityService.java index 863a6e61f2..ff18c08cb5 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityService.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityService.java @@ -21,6 +21,11 @@ public interface SalesManagerEntityService entities) throws ServiceException; + /** * Met à jour l'entité dans la base de données. * diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityServiceImpl.java index f9601c7eb7..994bbfcc5a 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityServiceImpl.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/common/generic/SalesManagerEntityServiceImpl.java @@ -44,6 +44,10 @@ public void save(E entity) throws ServiceException { repository.saveAndFlush(entity); } + public void saveAll(Iterable entities) throws ServiceException { + repository.saveAll(entities); + } + public void create(E entity) throws ServiceException { save(entity); diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/ReadableProduct.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/ReadableProduct.java index e333036726..bdb2929b8c 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/ReadableProduct.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/ReadableProduct.java @@ -8,6 +8,7 @@ import com.salesmanager.shop.model.catalog.manufacturer.ReadableManufacturer; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductAttribute; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductOption; +import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductProperty; import com.salesmanager.shop.model.catalog.product.type.ReadableProductType; public class ReadableProduct extends ProductEntity implements Serializable { @@ -26,6 +27,7 @@ public class ReadableProduct extends ProductEntity implements Serializable { private ReadableManufacturer manufacturer; private List attributes = new ArrayList(); private List options = new ArrayList(); + private List properties = new ArrayList(); private List categories = new ArrayList(); private ReadableProductType type; private boolean canBePurchased = false; @@ -145,4 +147,13 @@ public void setProductPrice(ReadableProductPrice productPrice) { this.productPrice = productPrice; } + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + } diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java index 0ec4ee210c..c67442270d 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java @@ -12,7 +12,7 @@ public class PersistableProductAttribute extends ProductAttributeEntity private BigDecimal productAttributePrice; private Long productId; - private ProductOption option; + private ProductPropertyOption option; private ProductOptionValue optionValue; public void setOptionValue(ProductOptionValue optionValue) { this.optionValue = optionValue; @@ -20,10 +20,10 @@ public void setOptionValue(ProductOptionValue optionValue) { public ProductOptionValue getOptionValue() { return optionValue; } - public void setOption(ProductOption option) { + public void setOption(ProductPropertyOption option) { this.option = option; } - public ProductOption getOption() { + public ProductPropertyOption getOption() { return option; } diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductOptionEntity.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductOptionEntity.java index 4fad721658..2e77f2c2b4 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductOptionEntity.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductOptionEntity.java @@ -2,7 +2,7 @@ import java.io.Serializable; -public class ProductOptionEntity extends ProductOption implements Serializable { +public class ProductOptionEntity extends ProductPropertyOption implements Serializable { /** * diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductOption.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductPropertyOption.java similarity index 89% rename from sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductOption.java rename to sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductPropertyOption.java index 8dd9578d35..eb48c963dd 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductOption.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ProductPropertyOption.java @@ -4,7 +4,7 @@ import com.salesmanager.shop.model.entity.Entity; -public class ProductOption extends Entity implements Serializable { +public class ProductPropertyOption extends Entity implements Serializable { /** * diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOption.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOption.java index e26d5284b4..58526184f1 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOption.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOption.java @@ -5,7 +5,7 @@ import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity; -public class ReadableProductOption extends ProductOption { +public class ReadableProductOption extends ProductPropertyOption { /** * diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOptionValue.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOptionValue.java index 0a250eb65e..294fd73ee9 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOptionValue.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductOptionValue.java @@ -9,17 +9,9 @@ public class ReadableProductOptionValue extends ProductOptionValue { private String price; private String image; - private String name; + private String description; - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - public String getPrice() { return price; } @@ -36,4 +28,12 @@ public void setImage(String image) { this.image = image; } + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + } diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductProperty.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductProperty.java new file mode 100644 index 0000000000..ebba7fdb94 --- /dev/null +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductProperty.java @@ -0,0 +1,30 @@ +package com.salesmanager.shop.model.catalog.product.attribute; + +public class ReadableProductProperty extends ProductPropertyOption { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Property use option objects + */ + private ReadableProductOption property = null; + private ReadableProductPropertyValue propertyValue = null; + public ReadableProductOption getProperty() { + return property; + } + public void setProperty(ReadableProductOption property) { + this.property = property; + } + public ReadableProductPropertyValue getPropertyValue() { + return propertyValue; + } + public void setPropertyValue(ReadableProductPropertyValue propertyValue) { + this.propertyValue = propertyValue; + } + + + +} diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductPropertyValue.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductPropertyValue.java new file mode 100644 index 0000000000..cca2567349 --- /dev/null +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductPropertyValue.java @@ -0,0 +1,25 @@ +package com.salesmanager.shop.model.catalog.product.attribute; + +import java.util.ArrayList; +import java.util.List; + +public class ReadableProductPropertyValue extends ProductOptionValue{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + private List values = new ArrayList(); + + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + + +} diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/entity/CodeEntity.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/entity/CodeEntity.java new file mode 100644 index 0000000000..c393bc9974 --- /dev/null +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/entity/CodeEntity.java @@ -0,0 +1,17 @@ +package com.salesmanager.shop.model.entity; + +public class CodeEntity extends Entity { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String code; + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + +} diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java index e5702e0fd1..db0098bc8e 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java @@ -1,5 +1,7 @@ package com.salesmanager.shop.store.controller.product.facade; +import java.util.List; + import org.springframework.web.multipart.MultipartFile; import com.salesmanager.core.model.merchant.MerchantStore; @@ -13,6 +15,7 @@ import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionList; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueList; +import com.salesmanager.shop.model.entity.CodeEntity; /* @@ -28,6 +31,9 @@ public interface ProductOptionFacade { ReadableProductOptionValueEntity saveOptionValue(PersistableProductOptionValueEntity optionValue, MerchantStore store, Language language); + List createAttributes(List attributes, Long productId, MerchantStore store); + void updateAttributes(List attributes, Long productId, MerchantStore store); + void addOptionValueImage(MultipartFile image, Long optionValueId, MerchantStore store, Language language); void removeOptionValueImage(Long optionValueId, MerchantStore store, Language language); diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java index 86c9100c97..70bdcfacbc 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java @@ -41,6 +41,9 @@ import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductAttribute; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductAttributeValue; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductOption; +import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductOptionValue; +import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductProperty; +import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductPropertyValue; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.type.ProductTypeDescription; import com.salesmanager.shop.model.catalog.product.type.ReadableProductType; @@ -255,7 +258,8 @@ public ReadableProduct populate(Product source, //split read only and options - Map readOnlyAttributes = null; + //Map readOnlyAttributes = null; + Map properties = null; Map selectableOptions = null; if(!CollectionUtils.isEmpty(attributes)) { @@ -263,12 +267,15 @@ public ReadableProduct populate(Product source, for(ProductAttribute attribute : attributes) { ReadableProductOption opt = null; ReadableProductAttribute attr = null; + ReadableProductProperty property = null; + ReadableProductPropertyValue propertyValue = null; ReadableProductOptionValueEntity optValue = new ReadableProductOptionValueEntity(); ReadableProductAttributeValue attrValue = new ReadableProductAttributeValue(); ProductOptionValue optionValue = attribute.getProductOptionValue(); - if(attribute.getAttributeDisplayOnly()) {//read only attribute + if(attribute.getAttributeDisplayOnly()) {//read only attribute = property + /* if(readOnlyAttributes==null) { readOnlyAttributes = new TreeMap(); } @@ -314,7 +321,76 @@ public ReadableProduct populate(Product source, if(attr!=null) { attr.getAttributeValues().add(attrValue); } +*/ + + //if(properties==null) { + // properties = new TreeMap(); + //} + //property = properties.get(attribute.getProductOption().getId()); + //if(property==null) { + property = createProperty(attribute, language); + + ReadableProductOption readableOption = new ReadableProductOption(); //that is the property + ReadableProductPropertyValue readableOptionValue = new ReadableProductPropertyValue(); + + readableOption.setCode(attribute.getProductOption().getCode()); + readableOption.setId(attribute.getProductOption().getId()); + + Set podescriptions = attribute.getProductOption().getDescriptions(); + if(podescriptions!=null && podescriptions.size()>0) { + for(ProductOptionDescription optionDescription : podescriptions) { + if(optionDescription.getLanguage().getCode().equals(language.getCode())) { + readableOption.setName(optionDescription.getName()); + } + } + } + + property.setProperty(readableOption); + + Set povdescriptions = attribute.getProductOptionValue().getDescriptions(); + readableOptionValue.setId(attribute.getProductOptionValue().getId()); + if(povdescriptions!=null && povdescriptions.size()>0) { + for(ProductOptionValueDescription optionValueDescription : povdescriptions) { + if(optionValueDescription.getLanguage().getCode().equals(language.getCode())) { + readableOptionValue.setName(optionValueDescription.getName()); + } + } + } + + property.setPropertyValue(readableOptionValue); + + + //} else{ + // properties.put(attribute.getProductOption().getId(), property); + //} + +/* propertyValue.setCode(attribute.getProductOptionValue().getCode()); + propertyValue.setId(attribute.getProductOptionValue().getId()); + + + propertyValue.setSortOrder(0); + if(attribute.getProductOptionSortOrder()!=null) { + propertyValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); + } + + List podescriptions = optionValue.getDescriptionsSettoList(); + if(podescriptions!=null && podescriptions.size()>0) { + for(ProductOptionValueDescription optionValueDescription : podescriptions) { + com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription desc = new com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription(); + desc.setId(optionValueDescription.getId()); + desc.setName(optionValueDescription.getName()); + propertyValue.getValues().add(desc); + } + } + + property.setPropertyValue(propertyValue);*/ + + //if(attr!=null) { + // attr.getAttributeValues().add(attrValue); + //} + target.getProperties().add(property); + } else {//selectable option @@ -570,6 +646,37 @@ private ReadableProductAttribute createAttribute(ProductAttribute productAttribu return attr; } + + private ReadableProductProperty createProperty(ProductAttribute productAttribute, Language language) { + + + ReadableProductProperty attr = new ReadableProductProperty(); + attr.setId(productAttribute.getProductOption().getId());//attribute of the option + attr.setType(productAttribute.getProductOption().getProductOptionType()); + + + + + List descriptions = productAttribute.getProductOption().getDescriptionsSettoList(); + + ReadableProductPropertyValue propertyValue = new ReadableProductPropertyValue(); + + + if(descriptions!=null && descriptions.size()>0) { + for(ProductOptionDescription optionDescription : descriptions) { + com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription productOptionValueDescription = new com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription(); + productOptionValueDescription.setId(optionDescription.getId()); + productOptionValueDescription.setLanguage(optionDescription.getLanguage().getCode()); + productOptionValueDescription.setName(optionDescription.getName()); + propertyValue.getValues().add(productOptionValueDescription); + + } + } + + attr.setCode(productAttribute.getProductOption().getCode()); + return attr; + + } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java index 2c1f1a7a4b..33c6dafd69 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java @@ -99,7 +99,7 @@ public class ProductApi { @RequestMapping(value = { "/v1/private/product", "/auth/products" }, // private // for // api - // //auth + // auth // for // user // adding diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java index 2c4489b1d8..967b24b24c 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java @@ -1,5 +1,7 @@ package com.salesmanager.shop.store.api.v1.product; +import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @@ -30,6 +32,8 @@ import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionList; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueList; +import com.salesmanager.shop.model.entity.CodeEntity; +import com.salesmanager.shop.model.entity.Entity; import com.salesmanager.shop.model.entity.EntityExists; import com.salesmanager.shop.store.controller.product.facade.ProductOptionFacade; @@ -95,7 +99,9 @@ public ResponseEntity optionValueExists(@RequestParam(value = "cod @Valid @RequestBody PersistableProductOptionValueEntity optionValue, //@RequestParam(name = "file", required = false) MultipartFile file, @ApiIgnore MerchantStore merchantStore, - @ApiIgnore Language language, HttpServletRequest request, HttpServletResponse response) { + @ApiIgnore Language language, + HttpServletRequest request, + HttpServletResponse response) { ReadableProductOptionValueEntity entity = productOptionFacade.saveOptionValue( optionValue, merchantStore, language); @@ -278,14 +284,46 @@ public void deleteOptionValue( @RequestMapping(value = { "/private/product/{id}/attribute" }, method = RequestMethod.POST) @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) - public @ResponseBody ReadableProductAttributeEntity createAttribute( + public @ResponseBody Entity createAttribute( @PathVariable Long id, - @Valid @RequestBody PersistableProductAttribute attribute, @ApiIgnore MerchantStore merchantStore, - @ApiIgnore Language language, HttpServletRequest request, HttpServletResponse response) { + @Valid @RequestBody PersistableProductAttribute attribute, + @ApiIgnore MerchantStore merchantStore, + @ApiIgnore Language language, + HttpServletRequest request, + HttpServletResponse response) { - ReadableProductAttributeEntity entity = productOptionFacade.saveAttribute(id, attribute, merchantStore, language); + ReadableProductAttributeEntity attributeEntity = productOptionFacade.saveAttribute(id, attribute, merchantStore, language); + + Entity entity = new Entity(); + entity.setId(attributeEntity.getId()); return entity; + + } + + /** + * Create multiple attributes + * @param id + * @param attributeId + * @param merchantStore + * @param language + * @param request + * @param response + */ + @ResponseStatus(HttpStatus.CREATED) + @RequestMapping(value = { "/private/product/{id}/attributes" }, method = RequestMethod.POST) + @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), + @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) + @ApiOperation(httpMethod = "POST", value = "Saves multiple attributes", produces = "application/json", response = CodeEntity.class) + public List createAttributes( + @PathVariable Long id, + @Valid @RequestBody List attributes, + @ApiIgnore MerchantStore merchantStore, + @ApiIgnore Language language) { + + + return productOptionFacade.createAttributes(attributes, id, merchantStore); + } @ResponseStatus(HttpStatus.OK) @@ -301,6 +339,8 @@ public void updateAttribute(@PathVariable Long id, @Valid @RequestBody Persistab return; } + + @ResponseStatus(HttpStatus.OK) @RequestMapping(value = { "/private/product/{id}/attribute/{attributeId}" }, method = RequestMethod.DELETE) diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java index a85a268061..69e1a506e0 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java @@ -39,6 +39,7 @@ import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionList; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueList; +import com.salesmanager.shop.model.entity.CodeEntity; import com.salesmanager.shop.store.api.exception.ResourceNotFoundException; import com.salesmanager.shop.store.api.exception.ServiceRuntimeException; import com.salesmanager.shop.store.controller.product.facade.ProductOptionFacade; @@ -324,22 +325,28 @@ public ReadableProductAttributeEntity getAttribute(Long productId, Long attribut return readable; } + + private Product product(long id, MerchantStore store) { + Product product = productService.getById(id); + + if (product == null) { + throw new ResourceNotFoundException("Productnot found for id [" + id + "]"); + } + + if (product.getMerchantStore().getId().intValue() != store.getId().intValue()) { + throw new ResourceNotFoundException( + "Productnot found id [" + id + "] for store [" + store.getCode() + "]"); + } + + return product; + } @Override public ReadableProductAttributeList getAttributesList(Long productId, MerchantStore store, Language language) { try { - Product product = productService.getById(productId); - - if (product == null) { - throw new ResourceNotFoundException("Productnot found for id [" + productId + "]"); - } - - if (product.getMerchantStore().getId().intValue() != store.getId().intValue()) { - throw new ResourceNotFoundException( - "Productnot found id [" + productId + "] for store [" + store.getCode() + "]"); - } + Product product = this.product(productId, store); List attributes = productAttributeService.getByProductId(store, product, language); ReadableProductAttributeList attrList = new ReadableProductAttributeList(); @@ -443,10 +450,47 @@ public void removeOptionValueImage(Long optionValueId, MerchantStore store, throw new ServiceRuntimeException("Exception while removing option value image", e); } + return; + } + + @Override + public List createAttributes(List attributes, Long productId, + MerchantStore store) { + Validate.notNull(productId,"Product id must not be null"); + Validate.notNull(store,"Merchant cannot be null"); + //convert to model + List modelAttributes = attributes.stream().map(attr -> persistableProductAttributeMapper.convert(attr, store, null)).collect(Collectors.toList()); + + try { + productAttributeService.saveAll(modelAttributes); + + //save to a product + Product product = this.product(productId, store); + product.getAttributes().addAll(modelAttributes); + + + productService.save(product); + } catch (ServiceException e) { + throw new ServiceRuntimeException("Exception while saving product with attributes", e); + } + + return modelAttributes.stream().map(e -> codeEntity(e)).collect(Collectors.toList()); + + } + + private CodeEntity codeEntity(ProductAttribute attr) { + CodeEntity entity = new CodeEntity(); + entity.setId(attr.getId()); + entity.setCode(attr.getProductOption().getCode()); + return entity; + } + + @Override + public void updateAttributes(List attributes, Long productId, MerchantStore store) { + // TODO Auto-generated method stub - return; } } \ No newline at end of file From ffd88d197d87aae42f27777aeaa128b7618a1306 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Thu, 22 Jul 2021 23:20:46 -0400 Subject: [PATCH 09/34] Product specifications fix --- .../catalog/product/price/FinalPrice.java | 9 +++ .../business/utils/ProductPriceUtils.java | 18 ++++++ .../PersistableProductDefinition.java | 8 +++ .../product/definition/ProductDefinition.java | 46 +++++++++++++-- .../definition/ReadableProductDefinition.java | 7 +++ sm-shop/files/store/DownlaodRepository.dat | Bin 351113 -> 580794 bytes .../PersistableProductDefinitionMapper.java | 45 ++++++++++++--- .../ReadableProductDefinitionMapper.java | 53 +++++++++++++++++- .../catalog/ReadableProductPopulator.java | 9 ++- .../store/facade/StoreFacadeImpl.java | 2 + 10 files changed, 178 insertions(+), 19 deletions(-) diff --git a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/price/FinalPrice.java b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/price/FinalPrice.java index 8f4b9c6217..a73fe70a0c 100755 --- a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/price/FinalPrice.java +++ b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/price/FinalPrice.java @@ -22,6 +22,7 @@ public class FinalPrice implements Serializable { private BigDecimal finalPrice = null;//final price discount or not private boolean discounted = false; private int discountPercent = 0; + private String stringPrice; private Date discountEndDate = null; @@ -104,4 +105,12 @@ public ProductPrice getProductPrice() { return productPrice; } + public String getStringPrice() { + return stringPrice; + } + + public void setStringPrice(String stringPrice) { + this.stringPrice = stringPrice; + } + } diff --git a/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductPriceUtils.java b/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductPriceUtils.java index 8aea93c2ec..f70b347289 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductPriceUtils.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductPriceUtils.java @@ -163,6 +163,8 @@ public FinalPrice getFinalPrice(Product product) { finalPrice.setOriginalPrice(op); } } + + finalPrice.setStringPrice(this.getStringAmount(finalPrice.getFinalPrice())); return finalPrice; @@ -199,6 +201,22 @@ public String getAdminFormatedAmount(MerchantStore store, BigDecimal amount) thr return nf.format(amount); } + public String getStringAmount(BigDecimal amount) { + + if(amount==null) { + return ""; + } + + NumberFormat nf = NumberFormat.getInstance(Constants.DEFAULT_LOCALE); + + nf.setMaximumFractionDigits(Integer.parseInt(Character + .toString(DECIMALCOUNT))); + nf.setMinimumFractionDigits(Integer.parseInt(Character + .toString(DECIMALCOUNT))); + + return nf.format(amount); + } + /** * This method has to be used to format store front amounts diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/PersistableProductDefinition.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/PersistableProductDefinition.java index b23b772b4a..2bfeee1b79 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/PersistableProductDefinition.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/PersistableProductDefinition.java @@ -1,5 +1,6 @@ package com.salesmanager.shop.model.catalog.product.product.definition; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -19,6 +20,7 @@ public class PersistableProductDefinition extends ProductDefinition { private List categories = new ArrayList(); private String type; private String manufacturer; + private BigDecimal price; public List getDescriptions() { return descriptions; } @@ -49,5 +51,11 @@ public String getManufacturer() { public void setManufacturer(String manufacturer) { this.manufacturer = manufacturer; } + public BigDecimal getPrice() { + return price; + } + public void setPrice(BigDecimal price) { + this.price = price; + } } diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ProductDefinition.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ProductDefinition.java index 94d95d9ba9..0675422d95 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ProductDefinition.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ProductDefinition.java @@ -1,5 +1,6 @@ package com.salesmanager.shop.model.catalog.product.product.definition; +import com.salesmanager.shop.model.catalog.product.ProductSpecification; import com.salesmanager.shop.model.entity.Entity; /** @@ -14,17 +15,23 @@ public class ProductDefinition extends Entity { */ private static final long serialVersionUID = 1L; private boolean visible = true; - private Double rating = 0D; - private int ratingCount; + private boolean shipeable = true; + private boolean virtual = true; + //private Double rating = 0D; + //private int ratingCount; private String dateAvailable; private String identifier; + private ProductSpecification productSpecifications; + private int sortOrder; + private int quantity; + public boolean isVisible() { return visible; } public void setVisible(boolean visible) { this.visible = visible; } - public Double getRating() { +/* public Double getRating() { return rating; } public void setRating(Double rating) { @@ -35,7 +42,7 @@ public int getRatingCount() { } public void setRatingCount(int ratingCount) { this.ratingCount = ratingCount; - } + }*/ public String getDateAvailable() { return dateAvailable; } @@ -48,5 +55,36 @@ public String getIdentifier() { public void setIdentifier(String identifier) { this.identifier = identifier; } + public ProductSpecification getProductSpecifications() { + return productSpecifications; + } + public void setProductSpecifications(ProductSpecification productSpecifications) { + this.productSpecifications = productSpecifications; + } + public int getSortOrder() { + return sortOrder; + } + public void setSortOrder(int sortOrder) { + this.sortOrder = sortOrder; + } + public boolean isShipeable() { + return shipeable; + } + public void setShipeable(boolean shipeable) { + this.shipeable = shipeable; + } + public boolean isVirtual() { + return virtual; + } + public void setVirtual(boolean virtual) { + this.virtual = virtual; + } + public int getQuantity() { + return quantity; + } + public void setQuantity(int quantity) { + this.quantity = quantity; + } + } diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ReadableProductDefinition.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ReadableProductDefinition.java index 44ec8c4e94..8e916b49d7 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ReadableProductDefinition.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/product/definition/ReadableProductDefinition.java @@ -22,6 +22,7 @@ public class ReadableProductDefinition extends ProductDefinition { private ProductDescription description = null; private List properties = new ArrayList(); private List images = new ArrayList(); + private String price; public ReadableProductType getType() { @@ -60,6 +61,12 @@ public List getImages() { public void setImages(List images) { this.images = images; } + public String getPrice() { + return price; + } + public void setPrice(String price) { + this.price = price; + } } diff --git a/sm-shop/files/store/DownlaodRepository.dat b/sm-shop/files/store/DownlaodRepository.dat index f6d5890015fd0be467073b4d70c93526d39048aa..006c6d98b00a59407297a82dc5ed71c4ec437870 100644 GIT binary patch delta 69 zcmeC&F1l-{@`kr8o0q-c_=>T3^D~wmuQ-bsm>UflfS^6$79$Wd0WtITgj+0{jqMRY SkqDqj1W+X67K=e6V;KNOJsp7n delta 43 xcmdnBQ@L}y=!Ul}o0q-c_=>S`^D~wmuNaHkJEK{Fm<@>8w|7Q!7&J1L0s!TU6R`jQ diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java index 306ecca807..9e692d6fcc 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java @@ -10,7 +10,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; -import org.drools.core.util.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -149,10 +148,10 @@ public Product merge(PersistableProductDefinition source, Product destination, M destination.setDescriptions(descriptions); } - if(source.getRating() != null) { - destination.setProductReviewAvg(new BigDecimal(source.getRating())); - } - destination.setProductReviewCount(source.getRatingCount()); + //if(source.getRating() != null) { + // destination.setProductReviewAvg(new BigDecimal(source.getRating())); + //} + //destination.setProductReviewCount(source.getRatingCount()); /** * Product definition @@ -169,7 +168,7 @@ public Product merge(PersistableProductDefinition source, Product destination, M defaultPrice = p; break; } - p.setDefaultPrice(false); + //p.setDefaultPrice(false); } } } @@ -179,7 +178,7 @@ public Product merge(PersistableProductDefinition source, Product destination, M productAvailability = new ProductAvailability(destination, store); destination.getAvailabilities().add(productAvailability); - productAvailability.setProductQuantity(1); + productAvailability.setProductQuantity(source.getQuantity()); productAvailability.setProductQuantityOrderMin(1); productAvailability.setProductQuantityOrderMax(1); productAvailability.setRegion(Constants.ALL_REGIONS); @@ -193,7 +192,7 @@ public Product merge(PersistableProductDefinition source, Product destination, M defaultPrice = new ProductPrice(); defaultPrice.setDefaultPrice(true); - defaultPrice.setProductPriceAmount(new BigDecimal(0)); + defaultPrice.setProductPriceAmount(source.getPrice()); defaultPrice.setCode(ProductPriceEntity.DEFAULT_PRICE_CODE); defaultPrice.setProductAvailability(productAvailability); productAvailability.getPrices().add(defaultPrice); @@ -207,6 +206,36 @@ public Product merge(PersistableProductDefinition source, Product destination, M } } + if(source.getProductSpecifications()!=null) { + destination.setProductHeight(source.getProductSpecifications().getHeight()); + destination.setProductLength(source.getProductSpecifications().getLength()); + destination.setProductWeight(source.getProductSpecifications().getWeight()); + destination.setProductWidth(source.getProductSpecifications().getWidth()); + + + if(source.getProductSpecifications().getManufacturer()!=null) { + + Manufacturer manuf = null; + if(!StringUtils.isBlank(source.getProductSpecifications().getManufacturer())) { + manuf = manufacturerService.getByCode(store, source.getProductSpecifications().getManufacturer()); + } + + if(manuf==null) { + throw new ConversionException("Invalid manufacturer id"); + } + if(manuf!=null) { + if(manuf.getMerchantStore().getId().intValue()!=store.getId().intValue()) { + throw new ConversionException("Invalid manufacturer id"); + } + destination.setManufacturer(manuf); + } + } + + } + destination.setSortOrder(source.getSortOrder()); + destination.setProductVirtual(source.isVirtual()); + destination.setProductShipeable(source.isShipeable()); + //attributes if(source.getProperties()!=null) { diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java index fe29129f68..cb3e6a9325 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java @@ -12,19 +12,27 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; +import com.salesmanager.core.business.exception.ServiceException; +import com.salesmanager.core.business.services.catalog.product.PricingService; import com.salesmanager.core.model.catalog.category.Category; import com.salesmanager.core.model.catalog.product.Product; +import com.salesmanager.core.model.catalog.product.availability.ProductAvailability; import com.salesmanager.core.model.catalog.product.description.ProductDescription; import com.salesmanager.core.model.catalog.product.image.ProductImage; +import com.salesmanager.core.model.catalog.product.price.FinalPrice; import com.salesmanager.core.model.merchant.MerchantStore; import com.salesmanager.core.model.reference.language.Language; import com.salesmanager.shop.mapper.Mapper; import com.salesmanager.shop.model.catalog.category.ReadableCategory; import com.salesmanager.shop.model.catalog.manufacturer.ReadableManufacturer; +import com.salesmanager.shop.model.catalog.product.ProductSpecification; import com.salesmanager.shop.model.catalog.product.ReadableImage; import com.salesmanager.shop.model.catalog.product.product.definition.ReadableProductDefinition; import com.salesmanager.shop.model.catalog.product.product.definition.ReadableProductDefinitionFull; import com.salesmanager.shop.model.catalog.product.type.ReadableProductType; +import com.salesmanager.shop.model.references.DimensionUnitOfMeasure; +import com.salesmanager.shop.model.references.WeightUnitOfMeasure; +import com.salesmanager.shop.store.api.exception.ConversionRuntimeException; import com.salesmanager.shop.utils.DateUtil; import com.salesmanager.shop.utils.ImageFilePath; @@ -40,6 +48,9 @@ public class ReadableProductDefinitionMapper implements Mapper images = source.getImages(); if(CollectionUtils.isNotEmpty(images)) { @@ -125,12 +153,33 @@ public ReadableProductDefinition merge(Product source, ReadableProductDefinition List imageList = images.stream().map(i -> this.convertImage(source, i, store)).collect(Collectors.toList()); returnDestination.setImages(imageList); } + + //quantity + ProductAvailability availability = null; + for(ProductAvailability a : source.getAvailabilities()) { + availability = a; + returnDestination.setQuantity(availability.getProductQuantity() == null ? 1:availability.getProductQuantity()); + } + + FinalPrice price = null; + try { + price = pricingService.calculateProductPrice(source); + } catch (ServiceException e) { + throw new ConversionRuntimeException("Unable to get product price", e); + } + + if(price != null) { + + returnDestination.setPrice(price.getStringPrice()); + } if (returnDestination instanceof ReadableProductDefinitionFull) { ((ReadableProductDefinitionFull) returnDestination).setDescriptions(fulldescriptions); } + + return returnDestination; } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java index 70bdcfacbc..525dd118f4 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java @@ -41,7 +41,6 @@ import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductAttribute; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductAttributeValue; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductOption; -import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductOptionValue; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductProperty; import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductPropertyValue; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity; @@ -166,15 +165,15 @@ public ReadableProduct populate(Product source, target.setCreationDate(DateUtil.formatDate(source.getAuditSection().getDateCreated())); } - if(source.getProductReviewAvg()!=null) { +/* if(source.getProductReviewAvg()!=null) { double avg = source.getProductReviewAvg().doubleValue(); double rating = Math.round(avg * 2) / 2.0f; target.setRating(rating); - } + }*/ target.setProductVirtual(source.getProductVirtual()); - if(source.getProductReviewCount()!=null) { +/* if(source.getProductReviewCount()!=null) { target.setRatingCount(source.getProductReviewCount().intValue()); - } + }*/ if(description!=null) { com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = populateDescription(description); target.setDescription(tragetDescription); diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java index 309534de84..8538cba574 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java @@ -236,6 +236,8 @@ public void update(PersistableMerchantStore store) { private void updateMerchantStore(MerchantStore mStore) { try { merchantStoreService.update(mStore); + MerchantStore refreshed = merchantStoreService.getByCode(mStore.getCode()); + System.out.println("Done"); } catch (ServiceException e) { throw new ServiceRuntimeException(e); } From f8e10266faaf37df34e8d8cfe1ac2e3746bf6e24 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Sun, 25 Jul 2021 23:05:04 -0400 Subject: [PATCH 10/34] ProductAttribute --- .../availability/ProductAvailability.java | 3 +-- .../product/definition/ProductDefinition.java | 7 +++++++ sm-shop/SALESMANAGER.h2.db | Bin 1765376 -> 1777664 bytes sm-shop/files/store/DownlaodRepository.dat | Bin 580794 -> 351113 bytes .../PersistableProductAttributeMapper.java | 15 ++++++++++++--- .../PersistableProductDefinitionMapper.java | 4 ++++ .../ReadableProductDefinitionMapper.java | 1 + .../store/facade/StoreFacadeImpl.java | 2 -- 8 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/availability/ProductAvailability.java b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/availability/ProductAvailability.java index dcf6ddc6eb..feac6d4037 100755 --- a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/availability/ProductAvailability.java +++ b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/availability/ProductAvailability.java @@ -29,7 +29,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.salesmanager.core.constants.SchemaConstant; -import com.salesmanager.core.model.catalog.category.Category; import com.salesmanager.core.model.catalog.product.Product; import com.salesmanager.core.model.catalog.product.ProductDimensions; import com.salesmanager.core.model.catalog.product.price.ProductPrice; @@ -93,7 +92,7 @@ public class ProductAvailability extends SalesManagerEntitykwey6CcwqMK>4z|a!KndFPmdM2y= z;8=_Bq_4GDr10_MVlx&^j7g84G;Z;P35%Dc$E1&6@^Vai%%Z488Iv+%BOq$>KksPs zhh*#IJ5;n=a@h!I0)~Jk;0Wvl4pVaR-BT42{f2yK3tEn5p%)M>|1LMk+vJt<977u; zn=5zm3DmG=`oC+?eY<%~R(paT5$X3(2Wm$*iTo?*B5Fk~hISZPn`!+*EkEji<1~Fo zc^pMW>%uL5A&qiSmZ1$o>~Y)ZBHL(pUJp+o5Qt`8k5qD&;&r1zRuo2>2Qyu%2{RZ|@Mluu6%0~hyK^I%)5yTbwhM^sjRlh5b`(5d8EsQ%`(xD&f2{5D$2vEV=-KLzW##_3-2g*tl=3`5d7fae=NX}n z8cfbw$YOhu&HC+eoAq5o>!MiZxQ(dL)8>VY2sC>Ovsk8BEka*kPfrR7W{PY~Wq(R} zZ>4=Hef{1PGZaEPZu)JA4<$CtKnaHSv#h_77#e3M1cZ{YyWNSQraMu|4CluskOE(~ z&=#vHELWOX!}W;c=ngtOQrf3y=PHr9^K>YqJ7ac#t+siK6v{cRW^#Xt@@IfjDnMRc3DTLpAhuS4ICUQg zY1P1=+Yh|u060<(f_-%ja4ogKS?YiV1DLlBEt28ra)z*7e5$B(1%&eb0@cl!nYoIG z_SX4{>xT>wmjFuELC!1%>GC#^0=I*hvjYTg83@5Ufsfe*j-9)~e$oT>k)HzR+5>ED zIWSFzR>+uYfpUeh(lvTrvih94yiyrXdz%z0YFcUB!20U}t;z?vwg6;x14uJAf_StL zgsx2>EZ7YEhehDH{4qGtCt%-P3|!L|;1ah2yV=lYu^e6H-$tKb*f2dME;z#cqgn|g zg3J20_jV&2roZZAU()kWDuYcpsqC;uJTt1ME}5&|mf2R7m+Moa&~@|HF%2exBr z&Mhn+xs8Qu9au=ZgZb>c*m3tBcD#5W+e;o`?nEc%!n!aUYiRcw)5WWGjQQ&-C4^20 z*yR87{0Ccph|znGuw4Hb%W5~4UVB3H^i-b_X7OBLa=fZhIF^x@rcf3DLHncD^GXk{YU5%=%@_o7*w861mg$NSwuHzUj> z33vrB;yFBxZ{RT;!q;#=?lyD-)9x*nN9>G9B#-3*L$8%+|Ff2yIVQ_5d*V&8rjRMl zl+_e(%0^|6u(BmZ#6!3dAH(H1AK!y-1-@E95bx@uc82!|vi`v-&MO ziz9f-BpAn|IBe)Gn1nwS?*IQhw6R6-W;0ntoDrTk^tIUUiwdShQxf$><*F`*Cq}cP zsz}^c_=Kk<&s$VdxD`sC-ny-*q*%{KA}#1rnjDNkq_DEl(0dh%A__|TFFJpC9j4)R zcB2^`89#C9B6&4rPoj0h_Vo-pTJzb>k(lE_U&!tYIeejnVCWv%K-=Tum{T;NGI4=% z2HLx>ryj_d#zI-wWm}UsgEX#B^}j&Hw4x*VX&$rz~vjdjkB=z zr1qeiPF$ZLo7r3*1fF=z6Lu6rV$jl+L(m7F+Xr`nMn8T~Gn8O>4 zO?3ltE%6*ttWKHK)~V@K5RwK1~eQ4$|Oe?G{;{oHS^k2C}`Ih_lA?+zgZl20lydp22hUAKV`ECKIW2J2&YfNNR-G;ipiBRYLZO<=9;2gpPo{pSNx N^8=noA606le*kU2!5aVo diff --git a/sm-shop/files/store/DownlaodRepository.dat b/sm-shop/files/store/DownlaodRepository.dat index 006c6d98b00a59407297a82dc5ed71c4ec437870..22e4d9b66caae77d27426fc759788d7f385b4132 100644 GIT binary patch delta 45 zcmdnBQ@L}y=!Ul}o0q-c_-gXJ_Z*wwvTS_CSkm4Z%?iY9K+L|qGn&Jok+B>ADt{Gg delta 73 zcmeC&F1l-{@`kr8o0q-c_-gXJ_Z*wwvTS_CS;WBHXvhEr?FqLSftU%1nYSn0V$o=1 WENzbfibVj$B7kBMw^$4s8Os3fdmpL* diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java index 3551b99e8e..3be79d39ec 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java @@ -58,10 +58,12 @@ public ProductAttribute merge(PersistableProductAttribute source, ProductAttribu if(!StringUtils.isBlank(source.getOptionValue().getCode())) { productOptionValue = productOptionValueService.getByCode(store, source.getOptionValue().getCode()); } else { - productOptionValue = productOptionValueService.getById(source.getOptionValue().getId()); + if(source.getProductId() != null && source.getId().longValue()>0) { + productOptionValue = productOptionValueService.getById(source.getOptionValue().getId()); + } } - if(productOptionValue==null) { + if(productOptionValue==null && ! source.isAttributeDisplayOnly()) { throw new ConversionRuntimeException("Product option value id " + source.getOptionValue().getId() + " does not exist"); } @@ -69,7 +71,7 @@ public ProductAttribute merge(PersistableProductAttribute source, ProductAttribu throw new ConversionRuntimeException("Invalid product option id "); } - if(productOptionValue.getMerchantStore().getId().intValue()!=store.getId().intValue()) { + if(productOptionValue!=null && productOptionValue.getMerchantStore().getId().intValue()!=store.getId().intValue()) { throw new ConversionRuntimeException("Invalid product option value id "); } @@ -87,6 +89,13 @@ public ProductAttribute merge(PersistableProductAttribute source, ProductAttribu } else { destination.setId(null); } + + if(productOptionValue==null && ! source.isAttributeDisplayOnly()) { + productOptionValue = new ProductOptionValue(); + //productOptionValue.getDescriptions().stream(). + } + + destination.setProductOption(productOption); destination.setProductOptionValue(productOptionValue); destination.setProductAttributePrice(source.getProductAttributePrice()); diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java index 9e692d6fcc..11a9b59ae3 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java @@ -166,6 +166,9 @@ public Product merge(PersistableProductDefinition source, Product destination, M if(productAvailability == null) { productAvailability = avail; defaultPrice = p; + productAvailability.setProductQuantity(source.getQuantity()); + productAvailability.setProductStatus(source.isCanBePurchased()); + p.setProductPriceAmount(source.getPrice()); break; } //p.setDefaultPrice(false); @@ -183,6 +186,7 @@ public Product merge(PersistableProductDefinition source, Product destination, M productAvailability.setProductQuantityOrderMax(1); productAvailability.setRegion(Constants.ALL_REGIONS); productAvailability.setAvailable(Boolean.valueOf(destination.isAvailable())); + productAvailability.setProductStatus(source.isCanBePurchased()); } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java index cb3e6a9325..265e1ac962 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductDefinitionMapper.java @@ -158,6 +158,7 @@ public ReadableProductDefinition merge(Product source, ReadableProductDefinition ProductAvailability availability = null; for(ProductAvailability a : source.getAvailabilities()) { availability = a; + returnDestination.setCanBePurchased(availability.getProductStatus()); returnDestination.setQuantity(availability.getProductQuantity() == null ? 1:availability.getProductQuantity()); } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java index 8538cba574..309534de84 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java @@ -236,8 +236,6 @@ public void update(PersistableMerchantStore store) { private void updateMerchantStore(MerchantStore mStore) { try { merchantStoreService.update(mStore); - MerchantStore refreshed = merchantStoreService.getByCode(mStore.getCode()); - System.out.println("Done"); } catch (ServiceException e) { throw new ServiceRuntimeException(e); } From b19095bb8650540c3c8f4e3d8cfc73b44002af92 Mon Sep 17 00:00:00 2001 From: clfoong1128 <72720324+clfoong1128@users.noreply.github.com> Date: Mon, 26 Jul 2021 13:09:13 +0800 Subject: [PATCH 11/34] Update README.md Update how to contribute --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index 9bfe318d53..6186c8a7c1 100755 --- a/README.md +++ b/README.md @@ -119,4 +119,38 @@ If you have interest in giving feedback or for participating to Shopizer project Feel to use the contact form and share your email address so we can send an invite to our Slack channel +### How to Contribute: +------------------- +Fork the repository to your GitHub account + +Clone from fork repository +------------------- + + $ git clone https://github.com/yourusername/shopizer.git + +Build application according to steps provided above + +Synchronize lastest version with the upstream +------------------- + + $ git remote add upstream https://github.com/yourusername/shopizer.git + $ git pull upstream 2.17.0 + +Create new branch in your repository +------------------- + + $ git checkout -b branch-name + + +Check your branch status before commit to the branch +------------------- + + $ git status + $ git commit + +Push changes to GitHub +------------------- + + $ git push -u origin HEAD +Create Pull request and Wait for review From 4b860d121e5fdc1933dac30401b6899baa2c1810 Mon Sep 17 00:00:00 2001 From: Ywei0522 Date: Mon, 26 Jul 2021 20:59:26 +0800 Subject: [PATCH 12/34] Translation: Add message properties written in Chinese(messages_cn.properties) --- .../resources/bundles/messages_cn.properties | 219 ++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 sm-shop/src/main/resources/bundles/messages_cn.properties diff --git a/sm-shop/src/main/resources/bundles/messages_cn.properties b/sm-shop/src/main/resources/bundles/messages_cn.properties new file mode 100644 index 0000000000..c2dcf07a74 --- /dev/null +++ b/sm-shop/src/main/resources/bundles/messages_cn.properties @@ -0,0 +1,219 @@ +message.success=请求已成功完成 +message.error=请求中出现失误 +message.email.success=您的消息已发送 +message.productreview.created=您已成功创建了一个产品评论 +message.email.error=发送消息时出错,请稍后重试 +message.access.denied=访问已被拒绝 +message.error.shoppingcart.update=更新购物车时出错 +message.username.password=登录失败。用户名或密码不正确。 +message.resource.notfound=请求的页面不存在。 +message.fielderror=字段中存在错误 +message.timeout=会话超时。 +message.error.shipping=估算运费时出错 +NotEmpty=必填字段 +currentpassword.not.empty=当前密码不能为空 +password.notequal=新密码和检查密码应该相等 +newpassword.not.empty=新密码不应为空,长度应为 6 个字符 +repeatpassword.not.empty=检查密码不应为空,长度应为 6 个字符 + +NotEmpty.store.storename=商店名称不能为空 +NotEmpty.store.storeEmailAddress=商店电子邮件地址不能为空 +Email.store.storeEmailAddress=商店电子邮件地址无效 +NotEmpty.product.productPrice=必须指定产品价格 +NotEmpty.product.manufacturer=必须指出产品制造商 +NotEmpty.price.code=价格代码为必填项 +Pattern.price.code=价格代码必须是字母数字 +Pattern.product.sku=sku 必须是字母数字 +Pattern.merchant.code=商家商店代码必须是字母数字 +Pattern.optionValue.code=代码必须是字母数字 +NotEmpty.optionValue.code=代码不能为空 +Pattern.option.code=代码必须是字母数字 +NotEmpty.option.code=代码不能为空 +NotEmpty.keyword.keyword=关键字不能为空 +NotEmpty.review.description=您的意见为必填项 +NotEmpty.review.rating=产品评级为必填项 +NotEmpty.group.groupType=组类型为必填项 +NotEmpty.group.groupName=组名是必填项 + +NotEmpty.customer.userName=用户名是必填项 +NotEmpty.customer.firstName=名字为必填项 +NotEmpty.customer.lastName=姓氏为必填项 +NotEmpty.customer.address=街道地址为必填项 +NotEmpty.customer.address2=街道地址为必填项 +NotEmpty.customer.postalCode=邮政编码为必填项 +NotEmpty.customer.stateProvince=州/省为必填项 +NotEmpty.customer.phone=电话号码为必填项 +NotEmpty.customer.city=城市为必填项 +NotEmpty.customer.agreement=请同意我们的条款和条件 + +NotEmpty.origin.address=街道地址为必填项 +NotEmpty.origin.postalCode=邮政编码为必填项 +NotEmpty.origin.city=城市为必填项 +NotEmpty.origin.country=国家为必填项 + +NotEmpty.customer.emailAddress=电子邮件地址为必填项 +Email.customer.emailAddress=电子邮箱地址无效 +NotEmpty.customer.billing.phone=电话号码为必填项 +NotEmpty.customer.billing.address=街道地址为必填项 +NotEmpty.customer.billing.city=城市为必填项 +NotEmpty.customer.billing.postalCode=邮政编码为必填项 +NotEmpty.customer.billing.country=国家为必填项 +NotEmpty.customer.billing.stateProvince=州/省为必填项 + +NotEmpty.customer.shipping.firstName=配送者名不能为空 +NotEmpty.customer.shipping.lastName=配送者姓氏不能为空 +NotEmpty.customer.shipping.address=配送街道地址不能为空 +NotEmpty.customer.shipping.city=发货城市不能为空 +NotEmpty.customer.shipping.postalCode=配送邮政编码不能为空 +NotEmpty.customer.shipping.phone=配送者电话不应为空 +NotEmpty.customer.shipping.stateProvince=配送州/省为必填项 + +NotEmpty.order.creditcard.number=需要有效的信用卡号 +NotEmpty.order.creditcard.name=需要信用卡持有人的姓名 +NotEmpty.order.creditcard.cvv=需要信用卡验证码 +NotEmpty.contact.name=联系人姓名为必填项 +NotEmpty.contact.subject=联系主题为必填项 +NotEmpty.contact.comment=评论为必填项 +Email.contact.email=电子邮件格式无效 +NotEmpty.contact.captchaResponseField=验证码答案是必需的 +NotEmpty.contact.captchaChallengeField=验证码挑战问题是必需的 + +message.creditcard.invalid=需要信用卡详细信息 +message.order.canprocess=订单能被完成 +message.name.required=对象名称为必填项 + +message.code.exist=此代码已存在 +message.name.exist=此名称已存在 +message.invalid.amount=数额无效 +message.region.exists=地区已存在 +message.region.null=地区不能为空 +message.invalid.price=价格格式无效 +message.invalid.rate=费率格式无效 +message.invalid.date=日期格式无效 +message.maximumWeight.null=最大重量不能为空 +message.maximumWeight.invalid=最大重量需要大于 0 +message.unauthorized=此交易无法完成 +message.code.available=此代码可用 +message.image.height=图片高度过大 +message.image.width=图片宽度过大 +message.image.size=图片太大 +message.number.invalid=必须是有效数字(例如 5) +message.productoption.required=需要产品属性/选项 +message.productoptionvalue.required=需要产品属性/选项值 +message.product.language=产品尚未由此语言配置。编辑产品并使用此语言对其进行配置。 + +message.password.required=密码为必填项 +message.password.repeat.required=此处需要重复密码 +message.username.required=用户名为必填项 +message.username.notfound=未找到用户名 +message.price.cents=请输入最多 99 分钱 +message.security.cannotrevoke.superadmin=无法撤销超级管理员组 +message.cannot.empty=不能为空 +message.password.different=新密码和重复密码必须相同 +message.password.invalid=密码无效 +message.password.length=密码必须至少6个字符 +message.password.reset=密码已重置 +message.password.checkpassword.identical=两个密码必须匹配 +message.credentials.reset=凭据已更改 +message.address.enter=输入您的地址 + +message.security.caanotremovesuperadmin=无法移除超级管理员用户 + +message.group.alerady.exists= {0} 组已存在 +message.group.required=组为必填项 + +message.product.association=此实体附加到一个或多个产品,在尝试删除之前请先移除关联。 +message.notexist.customer=客户不存在 +message.optionset.optionassociationexists=选项关联已存在 +message.optionset.noassociation=选择一个选项和一个选项值 + +messages.error.creditcard=信用卡数据无效 +messages.error.creditcard.number=信用卡号无效 +messages.error.creditcard.dateformat=信用卡截止日无效 +messages.error.creditcard.cvc=信用卡验证数字无效 + + +message.payment.declined=付款交易已被拒绝 +message.payment.error=处理付款时出错,请使用其他付款方式 + +message.content.missing.agreement=带有代码“协议”的内容不存在 + +merchant.storeId.invalid=请提供商家店铺 +merchant.files.invalid=请提供要上传的文件。 +merchant.zone.invalid=需要商店的州/省地理位置 + +NotEmpty.order.customerFirstName=客户名字不能为空 +NotEmpty.order.customerLastName=客户姓氏不能为空 +NotEmpty.order.customerStreetAddress=客户街道地址不能为空 +NotEmpty.order.customerCity=客户城市不能为空 +NotEmpty.order.customerPostCode=客户邮政编码不能为空 +NotEmpty.order.customerTelephone=客户电话不应为空 +Email.order.customerEmailAddress=客户电子邮件地址无效 +NotEmpty.order.customerEmailAddress=客户电子邮件地址不能为空 + + +NotEmpty.order.billingName=帐单名称不应为空 +NotEmpty.order.billingStreetAddress=帐单地址不能为空 +NotEmpty.order.billingCity=账单城市不能为空 +NotEmpty.order.billingState=帐单状态不应为空 +NotEmpty.order.billingPostCode=帐单邮政编码不能为空 + + +NotEmpty.customer.FirstName=客户名字不能为空 +NotEmpty.customer.LastName=客户姓氏不能为空 +NotEmpty.customer.StreetAddress=客户街道地址不能为空 +NotEmpty.customer.City=客户城市不能为空 +NotEmpty.customer.Country=客户国家不应为空 +NotEmpty.customer.PostCode=客户邮政编码不能为空 +NotEmpty.customer.Telephone=客户电话不应为空 +Email.customer.EmailAddress=客户电子邮件地址无效 +NotEmpty.customer.EmailAddress=客户电子邮件地址不能为空 + +NotEmpty.customer.billingCompany=帐单公司名称不能为空 +NotEmpty.customer.billingFirstName=帐单名字不能为空 +NotEmpty.customer.billingLastName=帐单姓氏不能为空 +NotEmpty.customer.billingStreetAddress=帐单地址不能为空 +NotEmpty.customer.billingCity=账单城市不能为空 +NotEmpty.customer.billingState=帐单状态不能为空 +NotEmpty.customer.billingCountry=帐单国家不能为空 +NotEmpty.customer.billingPostCode=帐单邮政编码不能为空 + +NotEmpty.customer.shippingCountry=运输国家不能为空 + +NotEmpty.taxClass.code=税种代码为必填项 +NotEmpty.taxClass.title=税种名称为必填项 +message.taxclass.alreadyexist=税种代码已存在 +NotEmpty.taxRate.code=税率代码不能为空 +NotEmpty.taxRate.unique.code=税率代码必须独特,无重复的 +NotEmpty.taxRate.rateText=税率不能为空 +NotEmpty.taxRateDescription.name=税率名称不能为空 +NotNull.taxRate.parent=必须选择父税率 + +message.noshipping.configured=未配置送货方式 +message.noshipping=无可用的送货服务 +message.noshippingerror=无可用的送货服务,请检查您的送货国家、州/省和邮政编码 + +message.login.duallogin=未在同一浏览器上授权双重登录 + +User.resetPassword.resetSuccess=密码修改成功,请查看邮箱 +User.resetPassword.wrongSecurityQtn=输入了错误的安全问题/答案 +User.resetPassword.userNotFound=未找到指定用户 +User.resetPassword.Error=出现错误,请联系管理员 + +validaion.recaptcha.not.matched=Recaptcha 与用户输入不匹配 +registration.username.not.empty=请提供用户名 +registration.username.length.invalid=用户名长度必须至少为 6 个字符 +registration.password.not.empty=请提供有效密码 +registration.firstName.invalid=请提供名字 +registration.lastName.invalid=请提供姓氏 +messages.invalid.email=请提供一个有效的电子邮件地址。 +registration.username.already.exists = 此商店已存在具有用户名的用户。 +registration.failed=无法完成注册,请稍后重试 +currentpassword.not.empty=请提供您当前的密码 +newpassword.not.empty=请提供新密码 +repeatpassword.not.empty=请提供重复密码 +message.invalidpassword=密码无效 +message.cookie.policy=本网站使用 cookie 来保证您在我们的网站上获得最佳体验。 + +error.code.99=尝试处理付款时发生错误 +message.sku.exists= 此 sku 已在其他产品中存在 \ No newline at end of file From a513801535132e1db4c479344da633ab8ccce7c5 Mon Sep 17 00:00:00 2001 From: addsalttt Date: Mon, 26 Jul 2021 23:07:30 +0800 Subject: [PATCH 13/34] Modified French Version in readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d506afe0f6..a1a53a5c55 100755 --- a/README.md +++ b/README.md @@ -191,9 +191,9 @@ exécuter en tant qu'application Java ### Accédez à l'application: ------------------- -Accédez à l'application Web déployée à l'adresse: http: // localhost: 8080 / +Accédez à l'application Web déployée à l'adresse: http: //localhost:8080/ -Accédez à la section d'administration à l'adresse: http: // localhost: 8080 / admin +Accédez à la section d'administration à l'adresse: http://localhost: 8080/admin nom d'utilisateur: admin@shopizer.com @@ -220,3 +220,4 @@ N'hésitez pas à utiliser le formulaire de contact Date: Mon, 26 Jul 2021 23:31:54 -0400 Subject: [PATCH 14/34] Persist product property --- .../PersistableProductAttribute.java | 16 ++++--- .../product/facade/ProductOptionFacade.java | 4 +- .../PersistableProductAttributeMapper.java | 44 +++++++++++++++---- .../PersistableProductOptionValueMapper.java | 13 ++++-- .../api/v1/product/ProductOptionApi.java | 5 ++- .../product/ProductOptionFacadeImpl.java | 3 +- 6 files changed, 61 insertions(+), 24 deletions(-) diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java index c67442270d..f0ec49196e 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/PersistableProductAttribute.java @@ -13,13 +13,9 @@ public class PersistableProductAttribute extends ProductAttributeEntity private Long productId; private ProductPropertyOption option; - private ProductOptionValue optionValue; - public void setOptionValue(ProductOptionValue optionValue) { - this.optionValue = optionValue; - } - public ProductOptionValue getOptionValue() { - return optionValue; - } + private PersistableProductOptionValue optionValue; + + public void setOption(ProductPropertyOption option) { this.option = option; } @@ -49,5 +45,11 @@ public Long getProductId() { public void setProductId(Long productId) { this.productId = productId; } + public PersistableProductOptionValue getOptionValue() { + return optionValue; + } + public void setOptionValue(PersistableProductOptionValue optionValue) { + this.optionValue = optionValue; + } } diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java index db0098bc8e..0aabd10ede 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/product/facade/ProductOptionFacade.java @@ -7,8 +7,8 @@ import com.salesmanager.core.model.merchant.MerchantStore; import com.salesmanager.core.model.reference.language.Language; import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute; +import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionEntity; -import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeList; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionEntity; @@ -29,7 +29,7 @@ public interface ProductOptionFacade { ReadableProductOptionEntity saveOption(PersistableProductOptionEntity option, MerchantStore store, Language language); - ReadableProductOptionValueEntity saveOptionValue(PersistableProductOptionValueEntity optionValue, MerchantStore store, Language language); + ReadableProductOptionValueEntity saveOptionValue(PersistableProductOptionValue optionValue, MerchantStore store, Language language); List createAttributes(List attributes, Long productId, MerchantStore store); void updateAttributes(List attributes, Long productId, MerchantStore store); diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java index 3be79d39ec..f10da43f01 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java @@ -1,11 +1,17 @@ package com.salesmanager.shop.mapper.catalog; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + import javax.inject.Inject; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.springframework.stereotype.Component; +import com.salesmanager.core.business.exception.ServiceException; import com.salesmanager.core.business.services.catalog.product.ProductService; import com.salesmanager.core.business.services.catalog.product.attribute.ProductOptionService; import com.salesmanager.core.business.services.catalog.product.attribute.ProductOptionValueService; @@ -17,6 +23,8 @@ import com.salesmanager.core.model.reference.language.Language; import com.salesmanager.shop.mapper.Mapper; import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute; +import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue; +import com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription; import com.salesmanager.shop.store.api.exception.ConversionRuntimeException; @Component @@ -28,6 +36,8 @@ public class PersistableProductAttributeMapper implements Mapper0) { + productOptionValue = productOptionValueService.getById(source.getOptionValue().getId()); } else { - if(source.getProductId() != null && source.getId().longValue()>0) { - productOptionValue = productOptionValueService.getById(source.getOptionValue().getId()); + //ProductOption value is text + productOptionValue = new ProductOptionValue(); + productOptionValue.setProductOptionDisplayOnly(true); + productOptionValue.setCode(UUID.randomUUID().toString()); + productOptionValue.setMerchantStore(store); + } + + if(!CollectionUtils.isEmpty((source.getOptionValue().getDescriptions()))) { + productOptionValue = persistableProductOptionValueMapper.merge(source.getOptionValue(),productOptionValue, store, language); + try { + productOptionValueService.saveOrUpdate(productOptionValue); + } catch (ServiceException e) { + throw new ConversionRuntimeException("Error converting ProductOptionValue",e); } } @@ -67,6 +90,15 @@ public ProductAttribute merge(PersistableProductAttribute source, ProductAttribu throw new ConversionRuntimeException("Product option value id " + source.getOptionValue().getId() + " does not exist"); } + + + /** + productOptionValue + .getDescriptions().stream() + .map(val -> this.persistableProductOptionValueMapper.convert(val, store, language)).collect(Collectors.toList()); + + }**/ + if(productOption.getMerchantStore().getId().intValue()!=store.getId().intValue()) { throw new ConversionRuntimeException("Invalid product option id "); } @@ -89,13 +121,7 @@ public ProductAttribute merge(PersistableProductAttribute source, ProductAttribu } else { destination.setId(null); } - - if(productOptionValue==null && ! source.isAttributeDisplayOnly()) { - productOptionValue = new ProductOptionValue(); - //productOptionValue.getDescriptions().stream(). - } - - + destination.setProductOption(productOption); destination.setProductOptionValue(productOptionValue); destination.setProductAttributePrice(source.getProductAttributePrice()); diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java index 2041e2d5cb..67f151d971 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java @@ -12,12 +12,13 @@ import com.salesmanager.core.model.merchant.MerchantStore; import com.salesmanager.core.model.reference.language.Language; import com.salesmanager.shop.mapper.Mapper; +import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionValueEntity; import com.salesmanager.shop.store.api.exception.ServiceRuntimeException; @Component public class PersistableProductOptionValueMapper - implements Mapper { + implements Mapper { @Autowired private LanguageService languageService; @@ -39,13 +40,19 @@ ProductOptionValueDescription description( } @Override - public ProductOptionValue merge(PersistableProductOptionValueEntity source, ProductOptionValue destination, + public ProductOptionValue merge(PersistableProductOptionValue source, ProductOptionValue destination, MerchantStore store, Language language) { if (destination == null) { destination = new ProductOptionValue(); } try { + + if(StringUtils.isBlank(source.getCode())) { + if(!StringUtils.isBlank(destination.getCode())) { + source.setCode(destination.getCode()); + } + } if (!CollectionUtils.isEmpty(source.getDescriptions())) { for (com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription desc : source @@ -89,7 +96,7 @@ public ProductOptionValue merge(PersistableProductOptionValueEntity source, Prod } @Override - public ProductOptionValue convert(PersistableProductOptionValueEntity source, MerchantStore store, + public ProductOptionValue convert(PersistableProductOptionValue source, MerchantStore store, Language language) { ProductOptionValue destination = new ProductOptionValue(); return merge(source, destination, store, language); diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java index 967b24b24c..e22a7f2db7 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java @@ -24,6 +24,7 @@ import com.salesmanager.core.model.merchant.MerchantStore; import com.salesmanager.core.model.reference.language.Language; import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute; +import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeEntity; @@ -96,7 +97,7 @@ public ResponseEntity optionValueExists(@RequestParam(value = "cod @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) public @ResponseBody ReadableProductOptionValueEntity createOptionValue( - @Valid @RequestBody PersistableProductOptionValueEntity optionValue, + @Valid @RequestBody PersistableProductOptionValue optionValue, //@RequestParam(name = "file", required = false) MultipartFile file, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language, @@ -194,7 +195,7 @@ public void deleteOption(@PathVariable Long optionId, @ApiIgnore MerchantStore m @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") }) public void updateOptionValue( @PathVariable Long id, - @Valid @RequestBody PersistableProductOptionValueEntity optionValue, + @Valid @RequestBody PersistableProductOptionValue optionValue, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language, HttpServletRequest request, HttpServletResponse response) { diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java index 69e1a506e0..58fda17929 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java @@ -31,6 +31,7 @@ import com.salesmanager.shop.mapper.catalog.ReadableProductOptionMapper; import com.salesmanager.shop.mapper.catalog.ReadableProductOptionValueMapper; import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute; +import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeEntity; @@ -216,7 +217,7 @@ public boolean optionValueExists(String code, MerchantStore store) { } @Override - public ReadableProductOptionValueEntity saveOptionValue(PersistableProductOptionValueEntity optionValue, + public ReadableProductOptionValueEntity saveOptionValue(PersistableProductOptionValue optionValue, MerchantStore store, Language language) { Validate.notNull(optionValue, "Option value code must not be null"); Validate.notNull(store, "Store code must not be null"); From 260b9c86e7525f095efff56060979547016a7869 Mon Sep 17 00:00:00 2001 From: addsalttt Date: Fri, 30 Jul 2021 04:43:55 +0800 Subject: [PATCH 15/34] Added Chinese Version in readme --- README.md | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a1a53a5c55..4c3b955d39 100755 --- a/README.md +++ b/README.md @@ -220,4 +220,117 @@ N'hésitez pas à utiliser le formulaire de contact 获得的文档 + +ChatOps - 加入我们的 Slack 频道 https://shopizer-slackin.herokuapp.com/ + +更多信息可在此处的购物者网站上获得 + +### 参与: +------------------- + +如果您有兴趣提供反馈或以任何方式参与 Shopizer 项目 +请使用联系表 并分享您的电子邮件地址 +这样我们就可以邀请您进入我们的 Slack 频道 + + + + + + From b938dd53112d602d40afe8e7de246515ce42353d Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Thu, 29 Jul 2021 21:59:52 -0400 Subject: [PATCH 16/34] Fixed product property values --- .../product/attribute/ProductAttributeRepository.java | 3 +++ .../product/attribute/ProductAttributeService.java | 3 +++ .../product/attribute/ProductAttributeServiceImpl.java | 5 +++++ .../attribute/api/ReadableProductAttributeEntity.java | 7 +++++++ .../catalog/PersistableProductAttributeMapper.java | 2 +- .../mapper/catalog/ReadableProductAttributeMapper.java | 1 + ...ductOptionApi.java => ProductAttributeOptionApi.java} | 7 +++---- .../store/facade/product/ProductOptionFacadeImpl.java | 9 ++++++++- 8 files changed, 31 insertions(+), 6 deletions(-) rename sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/{ProductOptionApi.java => ProductAttributeOptionApi.java} (97%) diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java index 8c9c6d53ef..f7942148ac 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java @@ -24,6 +24,9 @@ public interface ProductAttributeRepository extends JpaRepository findByProductId(Integer storeId, Long productId, Integer languageId); + @Query("select distinct p from ProductAttribute p join fetch p.product pr left join fetch p.productOption po left join fetch p.productOptionValue pov left join fetch po.descriptions pod left join fetch pov.descriptions povd left join fetch po.merchantStore pom where pom.id = ?1") + List findByProductId(Integer storeId, Long productId); + @Query(value="select distinct p from ProductAttribute p join fetch p.product pr left join fetch pr.categories prc left join fetch p.productOption po left join fetch p.productOptionValue pov left join fetch po.descriptions pod left join fetch pov.descriptions povd left join fetch po.merchantStore pom where pom.id = ?1 and prc.id IN (select c.id from Category c where c.lineage like ?2% and povd.language.id = ?3)") List findOptionsByCategoryLineage(Integer storeId, String lineage, Integer languageId); } diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java index 477ba191b0..dfbf654656 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java @@ -23,6 +23,9 @@ List getByOptionValueId(MerchantStore store, List getByProductId(MerchantStore store, Product product, Language language) throws ServiceException; + + List getByProductId(MerchantStore store, Product product) + throws ServiceException; List getByAttributeIds(MerchantStore store, Product product, List ids) throws ServiceException; diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java index f009ab1bc5..8cfff44ce7 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java @@ -91,4 +91,9 @@ public List getProductAttributesByCategoryLineage(MerchantStor return productAttributeRepository.findOptionsByCategoryLineage(store.getId(), lineage, language.getId()); } +@Override +public List getByProductId(MerchantStore store, Product product) throws ServiceException { + return productAttributeRepository.findByProductId(store.getId(), product.getId()); +} + } diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/api/ReadableProductAttributeEntity.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/api/ReadableProductAttributeEntity.java index a2d0c647c3..8f34dbaaaf 100644 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/api/ReadableProductAttributeEntity.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/api/ReadableProductAttributeEntity.java @@ -9,6 +9,7 @@ public class ReadableProductAttributeEntity extends ProductAttributeEntity { private String productAttributeWeight; private String productAttributePrice; + private String productAttributeUnformattedPrice; private ReadableProductOptionEntity option; private ReadableProductOptionValueEntity optionValue; @@ -36,6 +37,12 @@ public ReadableProductOptionValueEntity getOptionValue() { public void setOptionValue(ReadableProductOptionValueEntity optionValue) { this.optionValue = optionValue; } + public String getProductAttributeUnformattedPrice() { + return productAttributeUnformattedPrice; + } + public void setProductAttributeUnformattedPrice(String productAttributeUnformattedPrice) { + this.productAttributeUnformattedPrice = productAttributeUnformattedPrice; + } } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java index f10da43f01..3e6740d57d 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java @@ -67,7 +67,7 @@ public ProductAttribute merge(PersistableProductAttribute source, ProductAttribu if(!StringUtils.isBlank(source.getOptionValue().getCode())) { productOptionValue = productOptionValueService.getByCode(store, source.getOptionValue().getCode()); - } else if(source.getProductId() != null && source.getId().longValue()>0) { + } else if(source.getProductId() != null && source.getOptionValue().getId().longValue()>0) { productOptionValue = productOptionValueService.getById(source.getOptionValue().getId()); } else { //ProductOption value is text diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductAttributeMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductAttributeMapper.java index 1c17b8eb20..d7d89bf602 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductAttributeMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableProductAttributeMapper.java @@ -48,6 +48,7 @@ public ReadableProductAttributeEntity merge(ProductAttribute source, ReadablePro String formatedPrice; formatedPrice = pricingService.getDisplayAmount(source.getProductAttributePrice(), store); attr.setProductAttributePrice(formatedPrice); + attr.setProductAttributeUnformattedPrice(pricingService.getStringAmount(source.getProductAttributePrice(), store)); } attr.setProductAttributeWeight(source.getAttributeAdditionalWeight()); diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductAttributeOptionApi.java similarity index 97% rename from sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java rename to sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductAttributeOptionApi.java index e22a7f2db7..b49af1d8c5 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductOptionApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductAttributeOptionApi.java @@ -26,7 +26,6 @@ import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute; import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionEntity; -import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeList; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionEntity; @@ -48,10 +47,10 @@ @Controller @RequestMapping("/api/v1") -@Api(tags = { "Product attributes /options / options values management resource (Product Option Management Api)" }) +@Api(tags = { "Product attributes and (options / options) values management resource (Product Option Management Api)" }) @SwaggerDefinition(tags = { - @Tag(name = "Product attributes /options / options values management resource", description = "Edit product attributes / options and product option values") }) -public class ProductOptionApi { + @Tag(name = "Product attributes and (options / options) values management resource", description = "Edit product attributes / options and product option values") }) +public class ProductAttributeOptionApi { @Autowired private ProductOptionFacade productOptionFacade; diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java index 58fda17929..0d8428e50a 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java @@ -270,6 +270,8 @@ public ReadableProductAttributeEntity saveAttribute(Long productId, PersistableP MerchantStore store, Language language) { Validate.notNull(productId, "Product id cannot be null"); Validate.notNull(attribute, "ProductAttribute cannot be null"); + Validate.notNull(attribute.getOption(), "ProductAttribute option cannot be null"); + Validate.notNull(attribute.getOptionValue(), "ProductAttribute option value cannot be null"); Validate.notNull(store, "Store cannot be null"); attribute.setProductId(productId); @@ -349,7 +351,12 @@ public ReadableProductAttributeList getAttributesList(Long productId, MerchantSt Product product = this.product(productId, store); - List attributes = productAttributeService.getByProductId(store, product, language); + List attributes = null; + if(language != null) { + attributes = productAttributeService.getByProductId(store, product, language); + } else { + attributes = productAttributeService.getByProductId(store, product); + } ReadableProductAttributeList attrList = new ReadableProductAttributeList(); attrList.setRecordsTotal(attributes.size()); attrList.setNumber(attributes.size()); From 8fdbd19c21bf548c33d3d7f1923fabdb2d676833 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Sun, 1 Aug 2021 10:34:57 -0400 Subject: [PATCH 17/34] definition mapper --- .../shop/mapper/catalog/PersistableProductDefinitionMapper.java | 1 - 1 file changed, 1 deletion(-) diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java index 11a9b59ae3..36b2130b17 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductDefinitionMapper.java @@ -171,7 +171,6 @@ public Product merge(PersistableProductDefinition source, Product destination, M p.setProductPriceAmount(source.getPrice()); break; } - //p.setDefaultPrice(false); } } } From fdc5b3831667a4d5186fa2d73b7805016755df92 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Thu, 5 Aug 2021 20:47:46 -0400 Subject: [PATCH 18/34] SL4J / Logback error at startup --- pom.xml | 49 +++++++-------------- sm-shop/files/store/DownlaodRepository.dat | Bin 351113 -> 580794 bytes 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/pom.xml b/pom.xml index 0c8610b4c2..4ec2998769 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ 2.3.6.RELEASE - + sm-core-model sm-core-modules sm-core @@ -92,6 +92,12 @@ org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + org.springframework.boot @@ -419,13 +425,13 @@ - + com.shopizer sm-search - + javax.inject javax.inject @@ -612,36 +618,13 @@ - - + + diff --git a/sm-shop/files/store/DownlaodRepository.dat b/sm-shop/files/store/DownlaodRepository.dat index 22e4d9b66caae77d27426fc759788d7f385b4132..7e6e0f11eafbb3f1156fe2b620afbcb774673a38 100644 GIT binary patch delta 66 zcmeC&F1l-{@`icu8A~_Mf4}1uV_AE|Ek+<_0%GRv5w}UflfS^4AD3<_~ PO909x++xvaWUK%H@}nDH delta 46 zcmdnBQ@L}y=!SXk8H+d1f4}1uX9)vyqagzWgMRzOXjUL*17h~=6Qema8X3z0-6Rqi From a6e48476cb8525745b15b6cd94249a696173d615 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Thu, 12 Aug 2021 16:27:33 -0400 Subject: [PATCH 19/34] Removed store cache --- .../merchant/MerchantStoreServiceImpl.java | 7 +++++-- sm-shop/files/store/DownlaodRepository.dat | Bin 580794 -> 580794 bytes .../store/api/v1/store/MerchantStoreApi.java | 1 + .../store/facade/StoreFacadeImpl.java | 12 ++---------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java index 063e779b19..8c2fb86073 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java @@ -42,13 +42,16 @@ public MerchantStoreServiceImpl(MerchantRepository merchantRepository) { } @Override - @CacheEvict(value="store", key="#store.code") + //@CacheEvict(value="store", key="#store.code") public void saveOrUpdate(MerchantStore store) throws ServiceException { super.save(store); } @Override - @Cacheable(value = "store") + /** + * cache moved in facades + */ + //@Cacheable(value = "store") public MerchantStore getByCode(String code) throws ServiceException { return merchantRepository.findByCode(code); } diff --git a/sm-shop/files/store/DownlaodRepository.dat b/sm-shop/files/store/DownlaodRepository.dat index 7e6e0f11eafbb3f1156fe2b620afbcb774673a38..a77380d430172fada1afb1a2765f76ab657cea24 100644 GIT binary patch delta 93 zcmdnBQ+d};@s(gX155TR1|%@~0h8$DdPeEZ_un_XYM&6z3dC$c%)Wg> iG>2v*XC(u3qajeee)~kA+(e+yV diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/store/MerchantStoreApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/store/MerchantStoreApi.java index aadc65528f..5bf5934139 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/store/MerchantStoreApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/store/MerchantStoreApi.java @@ -280,6 +280,7 @@ public ReadableMerchantStoreList children(@PathVariable String code, @ApiIgnore } + @Deprecated @ResponseStatus(HttpStatus.CREATED) @PostMapping(value = { "/private/store/{code}/marketing" }, produces = MediaType.APPLICATION_JSON_VALUE) @ApiOperation(httpMethod = "POST", value = "Create or save store branding and marketing details", notes = "", response = ReadableBrand.class) diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java index 309534de84..d7b8763b61 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/store/facade/StoreFacadeImpl.java @@ -92,7 +92,8 @@ public MerchantStore getByCode(HttpServletRequest request) { @Override public MerchantStore get(String code) { try { - return merchantStoreService.getByCode(code); + MerchantStore store = merchantStoreService.getByCode(code); + return store; } catch (ServiceException e) { LOG.error("Error while getting MerchantStore", e); throw new ServiceRuntimeException(e); @@ -140,11 +141,6 @@ public boolean existByCode(String code) { private ReadableMerchantStore convertMerchantStoreToReadableMerchantStore(Language language, MerchantStore store) { ReadableMerchantStore readable = new ReadableMerchantStore(); -/* ReadableMerchantStorePopulator populator = new ReadableMerchantStorePopulator(); - populator.setCountryService(countryService); - populator.setZoneService(zoneService); - populator.setFilePath(imageUtils);*/ - /** * Language is not important for this conversion using default language */ @@ -159,10 +155,6 @@ private ReadableMerchantStore convertMerchantStoreToReadableMerchantStore(Langua private ReadableMerchantStore convertMerchantStoreToReadableMerchantStoreWithFullDetails(Language language, MerchantStore store) { ReadableMerchantStore readable = new ReadableMerchantStore(); -/* ReadableMerchantStorePopulatorWithDetails populator = new ReadableMerchantStorePopulatorWithDetails(); - populator.setCountryService(countryService); - populator.setZoneService(zoneService); - populator.setFilePath(imageUtils);*/ /** * Language is not important for this conversion using default language From dd2963420feede93f3dfb1a9ae1917d04dac5270 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Sun, 15 Aug 2021 13:35:30 -0400 Subject: [PATCH 20/34] ProductOptionSet --- .../attribute/ProductOptionSetRepository.java | 7 ++++++- sm-shop/files/store/DownlaodRepository.dat | Bin 580794 -> 580794 bytes .../product/ProductOptionFacadeImpl.java | 1 - .../product/ProductOptionSetFacadeImpl.java | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionSetRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionSetRepository.java index 50671ce0d7..a2f7c4f0ec 100644 --- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionSetRepository.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionSetRepository.java @@ -15,7 +15,12 @@ public interface ProductOptionSetRepository extends JpaRepository findByStore(Integer storeId, Integer language); - @Query("select distinct p from ProductOptionSet p join fetch p.store pm left join fetch p.productTypes pt left join fetch p.option po left join fetch po.descriptions pod left join fetch p.values pv left join fetch pv.descriptions pvd where pt.id= ?1 and pm.id = ?2 and pod.language.id = ?3") + @Query("select distinct p from ProductOptionSet p " + + "join fetch p.store pm left join fetch p.productTypes pt " + + "left join fetch p.option po " + + "left join fetch po.descriptions pod " + + "left join fetch p.values pv " + + "left join fetch pv.descriptions pvd where pt.id= ?1 and pm.id = ?2 and pod.language.id = ?3") List findByProductType(Long typeId, Integer storeId, Integer language); @Query("select p from ProductOptionSet p join fetch p.store pm left join fetch p.option po left join fetch po.descriptions pod left join fetch p.values pv left join fetch pv.descriptions pvd where pm.id = ?1 and p.code = ?2") diff --git a/sm-shop/files/store/DownlaodRepository.dat b/sm-shop/files/store/DownlaodRepository.dat index a77380d430172fada1afb1a2765f76ab657cea24..459450ecf86ddcd8f026de734f917227e65176a3 100644 GIT binary patch delta 69 zcmdnBQ+d};8w|7Q!7&LNLGcY$AG5|sQ SM4;S6pxi{D+{9=O%|-wUI~r&J delta 93 zcmdnBQ+d};@s(gX155TR1|%@~0h8$DdPeEZ_up5%Vk~R#jAjL5HXvr- i-Wknd(8yWIz}#pE)S=%#5hyniC^r!(H!+$+vk?GRNg#0m diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java index 0d8428e50a..59608ae380 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionFacadeImpl.java @@ -33,7 +33,6 @@ import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute; import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue; import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionEntity; -import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionValueEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeEntity; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeList; import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionEntity; diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java index 287fab9922..014a140edd 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductOptionSetFacadeImpl.java @@ -154,6 +154,10 @@ public List list(MerchantStore store, Language languag // find product type by id ReadableProductType readable = productTypeFacade.get(store, type, language); + + if(readable == null) { + throw new ResourceNotFoundException("Can't fing product type [" + type + "] fpr merchand [" + store.getCode() +"]"); + } List optionSets = productOptionSetService.getByProductType(readable.getId(), store, language); return optionSets.stream().map(opt -> this.convert(opt, store, language)).collect(Collectors.toList()); From 83fd1ee277db0bf7783b610d91c48ff1c2eb7c87 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Sun, 22 Aug 2021 20:34:46 -0400 Subject: [PATCH 21/34] ProductOptionValue --- sm-shop/files/store/DownlaodRepository.dat | Bin 580794 -> 351113 bytes .../PersistableProductOptionValueMapper.java | 6 ++++++ .../shop/store/api/v1/product/ProductApi.java | 4 ++-- .../facade/product/ProductFacadeImpl.java | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sm-shop/files/store/DownlaodRepository.dat b/sm-shop/files/store/DownlaodRepository.dat index 459450ecf86ddcd8f026de734f917227e65176a3..f38be735729367df2bc17e408e42f77c1356a476 100644 GIT binary patch delta 19 acmdnBQ@L}yXhREQ3sVbo3(FSP&S(HnM+YMS delta 48 zcmeC&F1l-{azhJa3sVbo3(FSP&S(w>=0-yXAZSmx#R$YqK+L>7;TDTVBV!c+j|UJ! diff --git a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java index 67f151d971..0cf8ae097e 100644 --- a/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java @@ -31,6 +31,9 @@ ProductOptionValueDescription description( desc.setId(null); desc.setDescription(description.getDescription()); desc.setName(description.getName()); + if(StringUtils.isBlank(desc.getName())) { + desc.setName(description.getDescription()); + } if (description.getId() != null && description.getId().longValue() > 0) { desc.setId(description.getId()); } @@ -66,6 +69,9 @@ public ProductOptionValue merge(PersistableProductOptionValue source, ProductOpt d.setDescription(desc.getDescription()); d.setName(desc.getName()); d.setTitle(desc.getTitle()); + if(StringUtils.isBlank(d.getName())) { + d.setName(d.getDescription()); + } description = d; break; diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java index 33c6dafd69..27a252e7e9 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/product/ProductApi.java @@ -191,14 +191,14 @@ public ReadableProductList list(@RequestParam(value = "lang", required = false) @RequestParam(value = "optionValues", required = false) List optionValueIds, @RequestParam(value = "status", required = false) String status, @RequestParam(value = "owner", required = false) Long owner, - @RequestParam(value = "page", required = false) Integer page, // current + @RequestParam(value = "page", required = false, defaultValue = "0") Integer page, // current // page // 0 // .. // n // allowing // navigation - @RequestParam(value = "count", required = false) Integer count, // count + @RequestParam(value = "count", required = false, defaultValue = "100") Integer count, // count // per // page @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language, HttpServletRequest request, diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductFacadeImpl.java index 45d36abb79..23aef1c543 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/product/ProductFacadeImpl.java @@ -292,7 +292,7 @@ public ReadableProductList getProductListsByCriterias(MerchantStore store, Langu .getById(criterias.getCategoryIds().get(0)); if (category != null) { - String lineage = new StringBuilder().append(category.getLineage()).append(Constants.SLASH) + String lineage = new StringBuilder().append(category.getLineage()) .toString(); List categories = categoryService From d94b0031b4e16b4580768d89d8642cb4138618ee Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 1 Sep 2021 13:16:24 +1200 Subject: [PATCH 22/34] Updates to compile with spring-boot-starter-parent 2.5.4 --- pom.xml | 2 +- .../business/services/catalog/product/ProductServiceImpl.java | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 4ec2998769..7e06cff886 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-starter-parent - 2.3.6.RELEASE + 2.5.4 diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/ProductServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/ProductServiceImpl.java index 440b8e6772..128d3e9df5 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/ProductServiceImpl.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/ProductServiceImpl.java @@ -128,10 +128,6 @@ public List getProductsByIds(List productIds) throws ServiceExcep return productRepository.getProductsListByIds(idSet); } - public Product getById(Long productId) { - return productRepository.getById(productId); - } - @Override public Product getProductWithOnlyMerchantStoreById(Long productId) { return productRepository.getProductWithOnlyMerchantStoreById(productId); From 0358d4564a0fb061ec22b28cb64fb699e263319d Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Thu, 9 Sep 2021 14:28:29 +0200 Subject: [PATCH 23/34] - Added possibility to add and retreive external product images via ProductApi --- .../catalog/PersistableProductPopulator.java | 86 +++---- .../catalog/ReadableProductPopulator.java | 220 +++++++++--------- 2 files changed, 158 insertions(+), 148 deletions(-) diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java index a4b9e43184..76843b9a0c 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java @@ -50,7 +50,7 @@ @Component public class PersistableProductPopulator extends AbstractDataPopulator { - + @Inject private CategoryService categoryService; @Inject @@ -67,11 +67,11 @@ public class PersistableProductPopulator extends private CustomerService customerService; @Autowired private PersistableProductAttributeMapper persistableProductAttributeMapper; - + @Autowired private ProductTypeService productTypeService; - + @@ -79,7 +79,7 @@ public class PersistableProductPopulator extends public Product populate(PersistableProduct source, Product target, MerchantStore store, Language language) throws ConversionException { - + Validate.notNull(target,"Product must not be null"); try { @@ -94,7 +94,7 @@ public Product populate(PersistableProduct source, target.setId(source.getId()); } - + //PRODUCT TYPE if(!StringUtils.isBlank(source.getType())) { ProductType type = productTypeService.getByCode(source.getType(), store, language); @@ -104,27 +104,27 @@ public Product populate(PersistableProduct source, target.setType(type); } - - - + + + if(source.getOwner()!=null && source.getOwner().getId()!=null) { com.salesmanager.core.model.customer.Customer owner = customerService.getById(source.getOwner().getId()); target.setOwner(owner); } - + if(!StringUtils.isBlank(source.getDateAvailable())) { target.setDateAvailable(DateUtil.getDate(source.getDateAvailable())); } - + target.setMerchantStore(store); - + List languages = new ArrayList(); Set descriptions = new HashSet(); if(!CollectionUtils.isEmpty(source.getDescriptions())) { for(com.salesmanager.shop.model.catalog.product.ProductDescription description : source.getDescriptions()) { - + ProductDescription productDescription = new ProductDescription(); Language lang = languageService.getByCode(description.getLanguage()); if(lang==null) { @@ -149,13 +149,13 @@ public Product populate(PersistableProduct source, productDescription.setMetatagKeywords(description.getKeyWords()); productDescription.setMetatagDescription(description.getMetaDescription()); productDescription.setTitle(description.getTitle()); - + languages.add(lang); productDescription.setLanguage(lang); descriptions.add(productDescription); } } - + if(descriptions.size()>0) { target.setDescriptions(descriptions); } @@ -165,15 +165,15 @@ public Product populate(PersistableProduct source, target.setProductLength(source.getProductSpecifications().getLength()); target.setProductWeight(source.getProductSpecifications().getWeight()); target.setProductWidth(source.getProductSpecifications().getWidth()); - - + + if(source.getProductSpecifications().getManufacturer()!=null) { - + Manufacturer manuf = null; if(!StringUtils.isBlank(source.getProductSpecifications().getManufacturer())) { manuf = manufacturerService.getByCode(store, source.getProductSpecifications().getManufacturer()); - } - + } + if(manuf==null) { throw new ConversionException("Invalid manufacturer id"); } @@ -184,7 +184,7 @@ public Product populate(PersistableProduct source, target.setManufacturer(manuf); } } - + } target.setSortOrder(source.getSortOrder()); target.setProductVirtual(source.isProductVirtual()); @@ -193,11 +193,11 @@ public Product populate(PersistableProduct source, target.setProductReviewAvg(new BigDecimal(source.getRating())); } target.setProductReviewCount(source.getRatingCount()); - + if(CollectionUtils.isNotEmpty(source.getProductPrices())) { //get product availability - + //create new ProductAvailability ProductAvailability productAvailability = new ProductAvailability(target, store); @@ -208,9 +208,9 @@ public Product populate(PersistableProduct source, productAvailability.setProductQuantityOrderMin(1); productAvailability.setProductQuantityOrderMax(1); productAvailability.setAvailable(Boolean.valueOf(target.isAvailable())); - + for(com.salesmanager.shop.model.catalog.product.PersistableProductPrice priceEntity : source.getProductPrices()) { - + ProductPrice price = new ProductPrice(); price.setProductAvailability(productAvailability); price.setDefaultPrice(priceEntity.isDefaultPrice()); @@ -232,7 +232,7 @@ public Product populate(PersistableProduct source, ppd.setProductPrice(price); ppd.setLanguage(lang); ppd.setName(ProductPriceDescription.DEFAULT_PRICE_DESCRIPTION); - + //price appender Optional description = priceEntity.getDescriptions().stream().filter(d -> d.getLanguage()!= null && d.getLanguage().equals(lang.getCode())).findFirst(); if(description.isPresent()) { @@ -242,8 +242,8 @@ public Product populate(PersistableProduct source, } } - } else { //create - + } else { //create + ProductAvailability productAvailability = null; ProductPrice defaultPrice = null; if(!CollectionUtils.isEmpty(target.getAvailabilities())) { @@ -261,7 +261,7 @@ public Product populate(PersistableProduct source, } } } - + if(productAvailability == null) { productAvailability = new ProductAvailability(target, store); target.getAvailabilities().add(productAvailability); @@ -284,7 +284,7 @@ public Product populate(PersistableProduct source, defaultPrice.setProductAvailability(productAvailability); productAvailability.getPrices().add(defaultPrice); for(Language lang : languages) { - + ProductPriceDescription ppd = new ProductPriceDescription(); ppd.setProductPrice(defaultPrice); ppd.setLanguage(lang); @@ -293,38 +293,46 @@ public Product populate(PersistableProduct source, } } - - + + } //image if(source.getImages()!=null) { for(PersistableImage img : source.getImages()) { - ByteArrayInputStream in = new ByteArrayInputStream(img.getBytes()); ProductImage productImage = new ProductImage(); + productImage.setImageType(img.getImageType()); + productImage.setDefaultImage(img.isDefaultImage()); + if (img.getImageType() == 1) { + productImage.setProductImageUrl(img.getImageUrl()); + productImage.setImage(new ByteArrayInputStream(new byte[0])); + } else { + ByteArrayInputStream in = new ByteArrayInputStream(img.getBytes()); + productImage.setImage(in); + } productImage.setProduct(target); productImage.setProductImage(img.getName()); - productImage.setImage(in); + target.getImages().add(productImage); } } - + //attributes if(source.getAttributes()!=null) { for(com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute attr : source.getAttributes()) { ProductAttribute attribute = persistableProductAttributeMapper.convert(attr, store, language); - + attribute.setProduct(target); target.getAttributes().add(attribute); } } - + //categories if(!CollectionUtils.isEmpty(source.getCategories())) { for(com.salesmanager.shop.model.catalog.category.Category categ : source.getCategories()) { - + Category c = null; if(!StringUtils.isBlank(categ.getCode())) { c = categoryService.getByCode(store, categ.getCode()); @@ -332,7 +340,7 @@ public Product populate(PersistableProduct source, Validate.notNull(categ.getId(), "Category id nust not be null"); c = categoryService.getById(categ.getId(), store.getId()); } - + if(c==null) { throw new ConversionException("Category id " + categ.getId() + " does not exist"); } @@ -343,7 +351,7 @@ public Product populate(PersistableProduct source, } } return target; - + } catch (Exception e) { throw new ConversionException(e); } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java index 525dd118f4..2194746180 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java @@ -53,9 +53,9 @@ public class ReadableProductPopulator extends AbstractDataPopulator { - + private PricingService pricingService; - + private ImageFilePath imageUtils; public ImageFilePath getimageUtils() { @@ -81,9 +81,9 @@ public ReadableProduct populate(Product source, Validate.notNull(pricingService, "Requires to set PricingService"); Validate.notNull(imageUtils, "Requires to set imageUtils"); - + try { - + List fulldescriptions = new ArrayList(); if(language == null) { target = new ReadableProductFull(); @@ -94,7 +94,7 @@ public ReadableProduct populate(Product source, } ProductDescription description = source.getProductDescription(); - + if(source.getDescriptions()!=null && source.getDescriptions().size()>0) { for(ProductDescription desc : source.getDescriptions()) { if(language != null && desc.getLanguage()!=null && desc.getLanguage().getId().intValue() == language.getId().intValue()) { @@ -105,28 +105,28 @@ public ReadableProduct populate(Product source, } } } - + if(target instanceof ReadableProductFull) { ((ReadableProductFull)target).setDescriptions(fulldescriptions); } - + if(language == null) { language = store.getDefaultLanguage(); } final Language lang = language; - + target.setId(source.getId()); target.setAvailable(source.isAvailable()); target.setProductShipeable(source.isProductShipeable()); - + ProductSpecification specifications = new ProductSpecification(); specifications.setHeight(source.getProductHeight()); specifications.setLength(source.getProductLength()); specifications.setWeight(source.getProductWeight()); specifications.setWidth(source.getProductWidth()); target.setProductSpecifications(specifications); - + target.setPreOrder(source.isPreOrder()); target.setRefSku(source.getRefSku()); target.setSortOrder(source.getSortOrder()); @@ -155,16 +155,16 @@ public ReadableProduct populate(Product source, owner.setAddress(address); target.setOwner(owner); } - - + + if(source.getDateAvailable() != null) { target.setDateAvailable(DateUtil.formatDate(source.getDateAvailable())); } - + if(source.getAuditSection()!=null) { target.setCreationDate(DateUtil.formatDate(source.getAuditSection().getDateCreated())); } - + /* if(source.getProductReviewAvg()!=null) { double avg = source.getProductReviewAvg().doubleValue(); double rating = Math.round(avg * 2) / 2.0f; @@ -177,13 +177,13 @@ public ReadableProduct populate(Product source, if(description!=null) { com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = populateDescription(description); target.setDescription(tragetDescription); - + } - + if(source.getManufacturer()!=null) { - ManufacturerDescription manufacturer = source.getManufacturer().getDescriptions().iterator().next(); + ManufacturerDescription manufacturer = source.getManufacturer().getDescriptions().iterator().next(); ReadableManufacturer manufacturerEntity = new ReadableManufacturer(); - com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription d = new com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription(); + com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription d = new com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription(); d.setName(manufacturer.getName()); manufacturerEntity.setDescription(d); manufacturerEntity.setId(source.getManufacturer().getId()); @@ -191,7 +191,7 @@ public ReadableProduct populate(Product source, manufacturerEntity.setCode(source.getManufacturer().getCode()); target.setManufacturer(manufacturerEntity); } - + /* if(source.getType() != null) { ReadableProductType type = new ReadableProductType(); type.setId(source.getType().getId()); @@ -199,22 +199,24 @@ public ReadableProduct populate(Product source, type.setName(source.getType().getCode());//need name target.setType(type); }*/ - + Set images = source.getImages(); if(images!=null && images.size()>0) { List imageList = new ArrayList(); - + String contextPath = imageUtils.getContextPath(); - + for(ProductImage img : images) { ReadableImage prdImage = new ReadableImage(); prdImage.setImageName(img.getProductImage()); prdImage.setDefaultImage(img.isDefaultImage()); + if (img.getImageType() == 0) { StringBuilder imgPath = new StringBuilder(); imgPath.append(contextPath).append(imageUtils.buildProductImageUtils(store, source.getSku(), img.getProductImage())); prdImage.setImageUrl(imgPath.toString()); + } prdImage.setId(img.getId()); prdImage.setImageType(img.getImageType()); if(img.getProductImageUrl()!=null){ @@ -223,46 +225,46 @@ public ReadableProduct populate(Product source, if(img.getImageType()==1 && img.getProductImageUrl()!=null) {//video prdImage.setVideoUrl(img.getProductImageUrl()); } - + if(prdImage.isDefaultImage()) { target.setImage(prdImage); } - + imageList.add(prdImage); } target .setImages(imageList); } - + if(!CollectionUtils.isEmpty(source.getCategories())) { - + ReadableCategoryPopulator categoryPopulator = new ReadableCategoryPopulator(); List categoryList = new ArrayList(); - + for(Category category : source.getCategories()) { - + ReadableCategory readableCategory = new ReadableCategory(); categoryPopulator.populate(category, readableCategory, store, language); categoryList.add(readableCategory); - + } - + target.setCategories(categoryList); - + } - + if(!CollectionUtils.isEmpty(source.getAttributes())) { - + Set attributes = source.getAttributes(); - + //split read only and options //Map readOnlyAttributes = null; Map properties = null; Map selectableOptions = null; - + if(!CollectionUtils.isEmpty(attributes)) { - + for(ProductAttribute attribute : attributes) { ReadableProductOption opt = null; ReadableProductAttribute attr = null; @@ -270,9 +272,9 @@ public ReadableProduct populate(Product source, ReadableProductPropertyValue propertyValue = null; ReadableProductOptionValueEntity optValue = new ReadableProductOptionValueEntity(); ReadableProductAttributeValue attrValue = new ReadableProductAttributeValue(); - + ProductOptionValue optionValue = attribute.getProductOptionValue(); - + if(attribute.getAttributeDisplayOnly()) {//read only attribute = property /* if(readOnlyAttributes==null) { @@ -285,8 +287,8 @@ public ReadableProduct populate(Product source, if(attr!=null) { readOnlyAttributes.put(attribute.getProductOption().getId(), attr); } - - + + attrValue.setDefaultValue(attribute.getAttributeDefault()); if(attribute.getProductOptionValue()!=null) { attrValue.setId(attribute.getProductOptionValue().getId());//id of the option value @@ -300,7 +302,7 @@ public ReadableProduct populate(Product source, if(attribute.getProductOptionSortOrder()!=null) { attrValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); ProductOptionValueDescription podescription = null; if(podescriptions!=null && podescriptions.size()>0) { @@ -316,12 +318,12 @@ public ReadableProduct populate(Product source, } attrValue.setName(podescription.getName()); attrValue.setDescription(podescription.getDescription()); - + if(attr!=null) { attr.getAttributeValues().add(attrValue); } -*/ - +*/ + //if(properties==null) { // properties = new TreeMap(); @@ -329,13 +331,13 @@ public ReadableProduct populate(Product source, //property = properties.get(attribute.getProductOption().getId()); //if(property==null) { property = createProperty(attribute, language); - + ReadableProductOption readableOption = new ReadableProductOption(); //that is the property ReadableProductPropertyValue readableOptionValue = new ReadableProductPropertyValue(); - + readableOption.setCode(attribute.getProductOption().getCode()); readableOption.setId(attribute.getProductOption().getId()); - + Set podescriptions = attribute.getProductOption().getDescriptions(); if(podescriptions!=null && podescriptions.size()>0) { for(ProductOptionDescription optionDescription : podescriptions) { @@ -344,9 +346,9 @@ public ReadableProduct populate(Product source, } } } - + property.setProperty(readableOption); - + Set povdescriptions = attribute.getProductOptionValue().getDescriptions(); readableOptionValue.setId(attribute.getProductOptionValue().getId()); if(povdescriptions!=null && povdescriptions.size()>0) { @@ -356,23 +358,23 @@ public ReadableProduct populate(Product source, } } } - + property.setPropertyValue(readableOptionValue); - - + + //} else{ // properties.put(attribute.getProductOption().getId(), property); //} - + /* propertyValue.setCode(attribute.getProductOptionValue().getCode()); propertyValue.setId(attribute.getProductOptionValue().getId()); - + propertyValue.setSortOrder(0); if(attribute.getProductOptionSortOrder()!=null) { propertyValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); if(podescriptions!=null && podescriptions.size()>0) { for(ProductOptionValueDescription optionValueDescription : podescriptions) { @@ -382,17 +384,17 @@ public ReadableProduct populate(Product source, propertyValue.getValues().add(desc); } } - + property.setPropertyValue(propertyValue);*/ - + //if(attr!=null) { // attr.getAttributeValues().add(attrValue); //} target.getProperties().add(property); - + } else {//selectable option - + if(selectableOptions==null) { selectableOptions = new TreeMap(); } @@ -403,7 +405,7 @@ public ReadableProduct populate(Product source, if(opt!=null) { selectableOptions.put(attribute.getProductOption().getId(), opt); } - + optValue.setDefaultValue(attribute.getAttributeDefault()); //optValue.setId(attribute.getProductOptionValue().getId()); optValue.setId(attribute.getId()); @@ -415,7 +417,7 @@ public ReadableProduct populate(Product source, String formatedPrice = pricingService.getDisplayAmount(attribute.getProductAttributePrice(), store); optValue.setPrice(formatedPrice); } - + if(!StringUtils.isBlank(attribute.getProductOptionValue().getProductOptionValueImage())) { optValue.setImage(imageUtils.buildProductPropertyImageUtils(store, attribute.getProductOptionValue().getProductOptionValueImage())); } @@ -423,7 +425,7 @@ public ReadableProduct populate(Product source, if(attribute.getProductOptionSortOrder()!=null) { optValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); ProductOptionValueDescription podescription = null; if(podescriptions!=null && podescriptions.size()>0) { @@ -440,26 +442,26 @@ public ReadableProduct populate(Product source, valueDescription.setName(podescription.getName()); valueDescription.setDescription(podescription.getDescription()); optValue.setDescription(valueDescription); - + if(opt!=null) { opt.getOptionValues().add(optValue); } } } - + } - + if(selectableOptions != null) { List options = new ArrayList(selectableOptions.values()); target.setOptions(options); } - + } - - + + //remove products from invisible category -> set visible = false /* Set categories = source.getCategories(); boolean isVisible = true; @@ -473,9 +475,9 @@ public ReadableProduct populate(Product source, } } }*/ - + //target.setVisible(isVisible); - + //availability ProductAvailability availability = null; for(ProductAvailability a : source.getAvailabilities()) { @@ -490,22 +492,22 @@ public ReadableProduct populate(Product source, } //} } - - + + target.setSku(source.getSku()); - + FinalPrice price = pricingService.calculateProductPrice(source); - + if(price != null) { target.setFinalPrice(pricingService.getDisplayAmount(price.getFinalPrice(), store)); target.setPrice(price.getFinalPrice()); target.setOriginalPrice(pricingService.getDisplayAmount(price.getOriginalPrice(), store)); - + if(price.isDiscounted()) { target.setDiscounted(true); } - + //price appender if(availability != null) { Set prices = availability.getPrices(); @@ -514,12 +516,12 @@ public ReadableProduct populate(Product source, readableProductPrice.setDiscounted(target.isDiscounted()); readableProductPrice.setFinalPrice(target.getFinalPrice()); readableProductPrice.setOriginalPrice(target.getOriginalPrice()); - + Optional pr = prices.stream().filter(p -> p.getCode().equals(ProductPrice.DEFAULT_PRICE_CODE)) .findFirst(); - + target.setProductPrice(readableProductPrice); - + if(pr.isPresent()) { readableProductPrice.setId(pr.get().getId()); Optional d = pr.get().getDescriptions().stream().filter(desc -> desc.getLanguage().getCode().equals(lang.getCode())).findFirst(); @@ -534,9 +536,9 @@ public ReadableProduct populate(Product source, } } - + } - + @@ -544,18 +546,18 @@ public ReadableProduct populate(Product source, ((ReadableProductFull)target).setDescriptions(fulldescriptions); } - + return target; - + } catch (Exception e) { throw new ConversionException(e); } } - - + + private ReadableProductOption createOption(ProductAttribute productAttribute, Language language) { - + ReadableProductOption option = new ReadableProductOption(); option.setId(productAttribute.getProductOption().getId());//attribute of the option @@ -574,7 +576,7 @@ private ReadableProductOption createOption(ProductAttribute productAttribute, La } } } - + if(description==null) { return null; } @@ -583,11 +585,11 @@ private ReadableProductOption createOption(ProductAttribute productAttribute, La option.setName(description.getName()); option.setCode(productAttribute.getProductOption().getCode()); - + return option; - + } - + private ReadableProductType type (ProductType type, Language language) { ReadableProductType readableType = new ReadableProductType(); readableType.setCode(type.getCode()); @@ -600,10 +602,10 @@ private ReadableProductType type (ProductType type, Language language) { readableType.setDescription(desc.get()); } } - + return readableType; } - + private ProductTypeDescription typeDescription(com.salesmanager.core.model.catalog.product.type.ProductTypeDescription description) { ProductTypeDescription desc = new ProductTypeDescription(); desc.setId(description.getId()); @@ -612,9 +614,9 @@ private ProductTypeDescription typeDescription(com.salesmanager.core.model.catal desc.setLanguage(description.getLanguage().getCode()); return desc; } - + private ReadableProductAttribute createAttribute(ProductAttribute productAttribute, Language language) { - + ReadableProductAttribute attr = new ReadableProductAttribute(); attr.setId(productAttribute.getProductOption().getId());//attribute of the option @@ -632,7 +634,7 @@ private ReadableProductAttribute createAttribute(ProductAttribute productAttribu } } } - + if(description==null) { return null; } @@ -641,26 +643,26 @@ private ReadableProductAttribute createAttribute(ProductAttribute productAttribu attr.setName(description.getName()); attr.setCode(productAttribute.getProductOption().getCode()); - + return attr; - + } - + private ReadableProductProperty createProperty(ProductAttribute productAttribute, Language language) { - + ReadableProductProperty attr = new ReadableProductProperty(); attr.setId(productAttribute.getProductOption().getId());//attribute of the option attr.setType(productAttribute.getProductOption().getProductOptionType()); - - - - + + + + List descriptions = productAttribute.getProductOption().getDescriptionsSettoList(); - + ReadableProductPropertyValue propertyValue = new ReadableProductPropertyValue(); - - + + if(descriptions!=null && descriptions.size()>0) { for(ProductOptionDescription optionDescription : descriptions) { com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription productOptionValueDescription = new com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription(); @@ -674,7 +676,7 @@ private ReadableProductProperty createProperty(ProductAttribute productAttribute attr.setCode(productAttribute.getProductOption().getCode()); return attr; - + } @@ -685,12 +687,12 @@ protected ReadableProduct createTarget() { // TODO Auto-generated method stub return null; } - + com.salesmanager.shop.model.catalog.product.ProductDescription populateDescription(ProductDescription description) { if(description == null) { return null; } - + com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = new com.salesmanager.shop.model.catalog.product.ProductDescription(); tragetDescription.setFriendlyUrl(description.getSeUrl()); tragetDescription.setName(description.getName()); From 9446b7ce51bfeb133f9e2e1835ce74899fc73f6a Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Mon, 13 Sep 2021 14:25:56 +0200 Subject: [PATCH 24/34] - Update to work with different locales, failed on order on non default language --- .../services/order/OrderServiceImpl.java | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/order/OrderServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/order/OrderServiceImpl.java index c52b905dd3..afcdc48c46 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/order/OrderServiceImpl.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/order/OrderServiceImpl.java @@ -76,25 +76,25 @@ public class OrderServiceImpl extends SalesManagerEntityServiceImpl items, OrderTotalSummary summary, Payment payment, MerchantStore store) throws ServiceException { - + return process(order, customer, items, summary, payment, null, store); } - + @Override public Order processOrder(Order order, Customer customer, List items, OrderTotalSummary summary, Payment payment, Transaction transaction, MerchantStore store) throws ServiceException { - + return process(order, customer, items, summary, payment, transaction, store); } - + private Order process(Order order, Customer customer, List items, OrderTotalSummary summary, Payment payment, Transaction transaction, MerchantStore store) throws ServiceException { - - + + Validate.notNull(order, "Order cannot be null"); Validate.notNull(customer, "Customer cannot be null (even if anonymous order)"); Validate.notEmpty(items, "ShoppingCart items cannot be null"); Validate.notNull(payment, "Payment cannot be null"); Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(summary, "Order total Summary cannot be null"); - + UserContext context = UserContext.getCurrentInstance(); if(context != null) { String ipAddress = context.getIpAddress(); @@ -143,10 +143,10 @@ private Order process(Order order, Customer customer, List ite } } - + //first process payment Transaction processTransaction = paymentService.processPayment(customer, store, payment, items, order); - + if(order.getOrderHistory()==null || order.getOrderHistory().size()==0 || order.getStatus()==null) { OrderStatus status = order.getStatus(); if(status==null) { @@ -160,13 +160,13 @@ private Order process(Order order, Customer customer, List ite statusHistory.setOrder(order); statusHistorySet.add(statusHistory); order.setOrderHistory(statusHistorySet); - + } - + if(customer.getId()==null || customer.getId()==0) { customerService.create(customer); } - + order.setCustomerId(customer.getId()); this.create(order); @@ -178,7 +178,7 @@ private Order process(Order order, Customer customer, List ite transactionService.update(transaction); } } - + if(processTransaction!=null) { processTransaction.setOrder(order); if(processTransaction.getId()==null || processTransaction.getId()==0) { @@ -195,8 +195,8 @@ private Order process(Order order, Customer customer, List ite Set products = order.getOrderProducts(); for(OrderProduct orderProduct : products) { orderProduct.getProductQuantity(); - Product p = productService.getByCode(orderProduct.getSku(), store.getDefaultLanguage()); - if(p == null) + Product p = productService.getById(orderProduct.getId()); + if(p == null) throw new ServiceException(ServiceException.EXCEPTION_INVENTORY_MISMATCH); for(ProductAvailability availability : p.getAvailabilities()) { int qty = availability.getProductQuantity(); @@ -211,7 +211,7 @@ private Order process(Order order, Customer customer, List ite } - + return order; } @@ -273,20 +273,20 @@ private OrderTotalSummary caculateOrder(OrderSummary summary, Customer customer, } } } - + //only in order page, otherwise invokes too many processing if( OrderSummaryType.ORDERTOTAL.name().equals(summary.getOrderSummaryType().name()) || OrderSummaryType.SHOPPINGCART.name().equals(summary.getOrderSummaryType().name()) - + ) { //Post processing order total variation modules for sub total calculation - drools, custom modules //may affect the sub total OrderTotalVariation orderTotalVariation = orderTotalService.findOrderTotalVariation(summary, customer, store, language); - + int currentCount = 10; - + if(CollectionUtils.isNotEmpty(orderTotalVariation.getVariations())) { for(OrderTotal variation : orderTotalVariation.getVariations()) { variation.setSortOrder(currentCount++); @@ -294,7 +294,7 @@ private OrderTotalSummary caculateOrder(OrderSummary summary, Customer customer, subTotal = subTotal.subtract(variation.getValue()); } } - + } @@ -308,7 +308,7 @@ private OrderTotalSummary caculateOrder(OrderSummary summary, Customer customer, orderTotalSubTotal.setTitle(Constants.OT_SUBTOTAL_MODULE_CODE); orderTotalSubTotal.setSortOrder(5); orderTotalSubTotal.setValue(subTotal); - + orderTotals.add(orderTotalSubTotal); @@ -322,7 +322,7 @@ private OrderTotalSummary caculateOrder(OrderSummary summary, Customer customer, shippingSubTotal.setOrderTotalCode("order.total.shipping"); shippingSubTotal.setTitle(Constants.OT_SHIPPING_MODULE_CODE); shippingSubTotal.setSortOrder(100); - + orderTotals.add(shippingSubTotal); if(!summary.getShippingSummary().isFreeShipping()) { @@ -433,7 +433,7 @@ private OrderTotalSummary caculateShoppingCart( ShoppingCart shoppingCart, final OrderSummary orderSummary = new OrderSummary(); orderSummary.setOrderSummaryType(OrderSummaryType.SHOPPINGCART); - + if(!StringUtils.isBlank(shoppingCart.getPromoCode())) { Date promoDateAdded = shoppingCart.getPromoAdded();//promo valid 1 day if(promoDateAdded == null) { @@ -451,14 +451,14 @@ private OrderTotalSummary caculateShoppingCart( ShoppingCart shoppingCart, final shoppingCart.setPromoCode(null); shoppingCartService.saveOrUpdate(shoppingCart); } - } - + } + List itemList = new ArrayList(shoppingCart.getLineItems()); //filter out unavailable itemList = itemList.stream().filter(p -> p.getProduct().isAvailable()).collect(Collectors.toList()); orderSummary.setProducts(itemList); - - + + return caculateOrder(orderSummary, customer, store, language); } @@ -474,7 +474,7 @@ private OrderTotalSummary caculateShoppingCart( ShoppingCart shoppingCart, final * @param language * @return {@link OrderTotalSummary} * @throws ServiceException - * + * */ @Override public OrderTotalSummary calculateShoppingCartTotal( @@ -504,7 +504,7 @@ public OrderTotalSummary calculateShoppingCartTotal( * @param language * @return {@link OrderTotalSummary} * @throws ServiceException - * + * */ @Override public OrderTotalSummary calculateShoppingCartTotal( @@ -581,45 +581,45 @@ public void saveOrUpdate(final Order order) throws ServiceException { @Override public boolean hasDownloadFiles(Order order) throws ServiceException { - + Validate.notNull(order,"Order cannot be null"); Validate.notNull(order.getOrderProducts(),"Order products cannot be null"); Validate.notEmpty(order.getOrderProducts(),"Order products cannot be empty"); - + boolean hasDownloads = false; for(OrderProduct orderProduct : order.getOrderProducts()) { - + if(CollectionUtils.isNotEmpty(orderProduct.getDownloads())) { hasDownloads = true; break; } } - + return hasDownloads; } @Override public List getCapturableOrders(MerchantStore store, Date startDate, Date endDate) throws ServiceException { - + List transactions = transactionService.listTransactions(startDate, endDate); - + List returnOrders = null; if(!CollectionUtils.isEmpty(transactions)) { - + returnOrders = new ArrayList(); - + //order id Map preAuthOrders = new HashMap (); //order id Map> processingTransactions = new HashMap> (); - + for(Transaction trx : transactions) { Order order = trx.getOrder(); if(TransactionType.AUTHORIZE.name().equals(trx.getTransactionType().name())) { preAuthOrders.put(order.getId(), order); } - + //put transaction List listTransactions = null; if(processingTransactions.containsKey(order.getId())) { @@ -630,28 +630,28 @@ public List getCapturableOrders(MerchantStore store, Date startDate, Date } listTransactions.add(trx); } - + //should have when captured /** * Order id Transaction type * 1 AUTHORIZE - * 1 CAPTURE + * 1 CAPTURE */ - + //should have when not captured /** * Order id Transaction type * 2 AUTHORIZE */ - + for(Long orderId : processingTransactions.keySet()) { - + List trx = processingTransactions.get(orderId); if(CollectionUtils.isNotEmpty(trx)) { - + boolean capturable = true; for(Transaction t : trx) { - + if(TransactionType.CAPTURE.name().equals(t.getTransactionType().name())) { capturable = false; } else if(TransactionType.AUTHORIZECAPTURE.name().equals(t.getTransactionType().name())) { @@ -659,17 +659,17 @@ public List getCapturableOrders(MerchantStore store, Date startDate, Date } else if(TransactionType.REFUND.name().equals(t.getTransactionType().name())) { capturable = false; } - + } - + if(capturable) { Order o = preAuthOrders.get(orderId); returnOrders.add(o); } - + } - - + + } } From 23e5a075d09962427f477c600b27aec766086cdf Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Mon, 13 Sep 2021 14:31:40 +0200 Subject: [PATCH 25/34] - Update to work with images smaller than large definition, otherwise import fail --- .../shop/model/catalog/product/LightPersistableProduct.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java index 7aeb5e21aa..d86f7e8472 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java @@ -10,11 +10,12 @@ public class LightPersistableProduct implements Serializable { /** - * + * */ private static final long serialVersionUID = 1L; private String price; private boolean available; + private boolean productShipeable; private int quantity; public String getPrice() { return price; @@ -35,5 +36,7 @@ public boolean isAvailable() { public void setAvailable(boolean available) { this.available = available; } + public boolean isProductShipeable() { return productShipeable; } + public void setProductShipeable(Boolean productShipeable) { this.productShipeable = productShipeable; } } From dde8f88dc1686f7b8f86c93479be25ed1baffe32 Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Mon, 13 Sep 2021 14:32:15 +0200 Subject: [PATCH 26/34] - Update to work with images smaller than large definition, otherwise import fail --- .../cms/product/ProductFileManagerImpl.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sm-core/src/main/java/com/salesmanager/core/business/modules/cms/product/ProductFileManagerImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/modules/cms/product/ProductFileManagerImpl.java index 85acb8e5bf..70d0a2c08f 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/modules/cms/product/ProductFileManagerImpl.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/modules/cms/product/ProductFileManagerImpl.java @@ -108,8 +108,8 @@ public void addProductImage(ProductImage productImage, ImageContentFile contentI * largeContentImage.setDefaultImage(productImage.isDefaultImage()); * largeContentImage.setImageName(new * StringBuilder().append("L-").append(productImage.getProductImage()).toString()); - * - * + * + * * uploadImage.uploadProductImage(configuration, productImage, largeContentImage); */ @@ -120,7 +120,7 @@ public void addProductImage(ProductImage productImage, ImageContentFile contentI * smallContentImage.setDefaultImage(productImage.isDefaultImage()); * smallContentImage.setImageName(new * StringBuilder().append("S-").append(productImage.getProductImage()).toString()); - * + * * uploadImage.uploadProductImage(configuration, productImage, smallContentImage); */ @@ -179,8 +179,12 @@ public void addProductImage(ProductImage productImage, ImageContentFile contentI // resize large // ByteArrayOutputStream output = new ByteArrayOutputStream(); - BufferedImage largeResizedImage = - ProductImageSizeUtils.resizeWithRatio(bufferedImage, largeImageWidth, largeImageHeight); + BufferedImage largeResizedImage; + if(bufferedImage.getWidth() > largeImageWidth ||bufferedImage.getHeight() > largeImageHeight) { + largeResizedImage = ProductImageSizeUtils.resizeWithRatio(bufferedImage, largeImageWidth, largeImageHeight); + } else { + largeResizedImage = bufferedImage; + } File tempLarge = @@ -294,12 +298,12 @@ public void removeProductImage(ProductImage productImage) throws ServiceExceptio /* * ProductImage large = new ProductImage(); large.setProduct(productImage.getProduct()); * large.setProductImage("L" + productImage.getProductImage()); - * + * * this.removeImage.removeProductImage(large); - * + * * ProductImage small = new ProductImage(); small.setProduct(productImage.getProduct()); * small.setProductImage("S" + productImage.getProductImage()); - * + * * this.removeImage.removeProductImage(small); */ From 70179fcd7c37ef4c692f6ce1a3ddbbfe51099b8f Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Mon, 13 Sep 2021 14:43:57 +0200 Subject: [PATCH 27/34] Revert "- Added possibility to add and retreive external product images via ProductApi" This reverts commit 0358d4564a0fb061ec22b28cb64fb699e263319d. --- .../catalog/PersistableProductPopulator.java | 86 ++++--- .../catalog/ReadableProductPopulator.java | 220 +++++++++--------- 2 files changed, 148 insertions(+), 158 deletions(-) diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java index 76843b9a0c..a4b9e43184 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java @@ -50,7 +50,7 @@ @Component public class PersistableProductPopulator extends AbstractDataPopulator { - + @Inject private CategoryService categoryService; @Inject @@ -67,11 +67,11 @@ public class PersistableProductPopulator extends private CustomerService customerService; @Autowired private PersistableProductAttributeMapper persistableProductAttributeMapper; - + @Autowired private ProductTypeService productTypeService; - + @@ -79,7 +79,7 @@ public class PersistableProductPopulator extends public Product populate(PersistableProduct source, Product target, MerchantStore store, Language language) throws ConversionException { - + Validate.notNull(target,"Product must not be null"); try { @@ -94,7 +94,7 @@ public Product populate(PersistableProduct source, target.setId(source.getId()); } - + //PRODUCT TYPE if(!StringUtils.isBlank(source.getType())) { ProductType type = productTypeService.getByCode(source.getType(), store, language); @@ -104,27 +104,27 @@ public Product populate(PersistableProduct source, target.setType(type); } - - - + + + if(source.getOwner()!=null && source.getOwner().getId()!=null) { com.salesmanager.core.model.customer.Customer owner = customerService.getById(source.getOwner().getId()); target.setOwner(owner); } - + if(!StringUtils.isBlank(source.getDateAvailable())) { target.setDateAvailable(DateUtil.getDate(source.getDateAvailable())); } - + target.setMerchantStore(store); - + List languages = new ArrayList(); Set descriptions = new HashSet(); if(!CollectionUtils.isEmpty(source.getDescriptions())) { for(com.salesmanager.shop.model.catalog.product.ProductDescription description : source.getDescriptions()) { - + ProductDescription productDescription = new ProductDescription(); Language lang = languageService.getByCode(description.getLanguage()); if(lang==null) { @@ -149,13 +149,13 @@ public Product populate(PersistableProduct source, productDescription.setMetatagKeywords(description.getKeyWords()); productDescription.setMetatagDescription(description.getMetaDescription()); productDescription.setTitle(description.getTitle()); - + languages.add(lang); productDescription.setLanguage(lang); descriptions.add(productDescription); } } - + if(descriptions.size()>0) { target.setDescriptions(descriptions); } @@ -165,15 +165,15 @@ public Product populate(PersistableProduct source, target.setProductLength(source.getProductSpecifications().getLength()); target.setProductWeight(source.getProductSpecifications().getWeight()); target.setProductWidth(source.getProductSpecifications().getWidth()); - - + + if(source.getProductSpecifications().getManufacturer()!=null) { - + Manufacturer manuf = null; if(!StringUtils.isBlank(source.getProductSpecifications().getManufacturer())) { manuf = manufacturerService.getByCode(store, source.getProductSpecifications().getManufacturer()); - } - + } + if(manuf==null) { throw new ConversionException("Invalid manufacturer id"); } @@ -184,7 +184,7 @@ public Product populate(PersistableProduct source, target.setManufacturer(manuf); } } - + } target.setSortOrder(source.getSortOrder()); target.setProductVirtual(source.isProductVirtual()); @@ -193,11 +193,11 @@ public Product populate(PersistableProduct source, target.setProductReviewAvg(new BigDecimal(source.getRating())); } target.setProductReviewCount(source.getRatingCount()); - + if(CollectionUtils.isNotEmpty(source.getProductPrices())) { //get product availability - + //create new ProductAvailability ProductAvailability productAvailability = new ProductAvailability(target, store); @@ -208,9 +208,9 @@ public Product populate(PersistableProduct source, productAvailability.setProductQuantityOrderMin(1); productAvailability.setProductQuantityOrderMax(1); productAvailability.setAvailable(Boolean.valueOf(target.isAvailable())); - + for(com.salesmanager.shop.model.catalog.product.PersistableProductPrice priceEntity : source.getProductPrices()) { - + ProductPrice price = new ProductPrice(); price.setProductAvailability(productAvailability); price.setDefaultPrice(priceEntity.isDefaultPrice()); @@ -232,7 +232,7 @@ public Product populate(PersistableProduct source, ppd.setProductPrice(price); ppd.setLanguage(lang); ppd.setName(ProductPriceDescription.DEFAULT_PRICE_DESCRIPTION); - + //price appender Optional description = priceEntity.getDescriptions().stream().filter(d -> d.getLanguage()!= null && d.getLanguage().equals(lang.getCode())).findFirst(); if(description.isPresent()) { @@ -242,8 +242,8 @@ public Product populate(PersistableProduct source, } } - } else { //create - + } else { //create + ProductAvailability productAvailability = null; ProductPrice defaultPrice = null; if(!CollectionUtils.isEmpty(target.getAvailabilities())) { @@ -261,7 +261,7 @@ public Product populate(PersistableProduct source, } } } - + if(productAvailability == null) { productAvailability = new ProductAvailability(target, store); target.getAvailabilities().add(productAvailability); @@ -284,7 +284,7 @@ public Product populate(PersistableProduct source, defaultPrice.setProductAvailability(productAvailability); productAvailability.getPrices().add(defaultPrice); for(Language lang : languages) { - + ProductPriceDescription ppd = new ProductPriceDescription(); ppd.setProductPrice(defaultPrice); ppd.setLanguage(lang); @@ -293,46 +293,38 @@ public Product populate(PersistableProduct source, } } - - + + } //image if(source.getImages()!=null) { for(PersistableImage img : source.getImages()) { + ByteArrayInputStream in = new ByteArrayInputStream(img.getBytes()); ProductImage productImage = new ProductImage(); - productImage.setImageType(img.getImageType()); - productImage.setDefaultImage(img.isDefaultImage()); - if (img.getImageType() == 1) { - productImage.setProductImageUrl(img.getImageUrl()); - productImage.setImage(new ByteArrayInputStream(new byte[0])); - } else { - ByteArrayInputStream in = new ByteArrayInputStream(img.getBytes()); - productImage.setImage(in); - } productImage.setProduct(target); productImage.setProductImage(img.getName()); - + productImage.setImage(in); target.getImages().add(productImage); } } - + //attributes if(source.getAttributes()!=null) { for(com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute attr : source.getAttributes()) { ProductAttribute attribute = persistableProductAttributeMapper.convert(attr, store, language); - + attribute.setProduct(target); target.getAttributes().add(attribute); } } - + //categories if(!CollectionUtils.isEmpty(source.getCategories())) { for(com.salesmanager.shop.model.catalog.category.Category categ : source.getCategories()) { - + Category c = null; if(!StringUtils.isBlank(categ.getCode())) { c = categoryService.getByCode(store, categ.getCode()); @@ -340,7 +332,7 @@ public Product populate(PersistableProduct source, Validate.notNull(categ.getId(), "Category id nust not be null"); c = categoryService.getById(categ.getId(), store.getId()); } - + if(c==null) { throw new ConversionException("Category id " + categ.getId() + " does not exist"); } @@ -351,7 +343,7 @@ public Product populate(PersistableProduct source, } } return target; - + } catch (Exception e) { throw new ConversionException(e); } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java index 2194746180..525dd118f4 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java @@ -53,9 +53,9 @@ public class ReadableProductPopulator extends AbstractDataPopulator { - + private PricingService pricingService; - + private ImageFilePath imageUtils; public ImageFilePath getimageUtils() { @@ -81,9 +81,9 @@ public ReadableProduct populate(Product source, Validate.notNull(pricingService, "Requires to set PricingService"); Validate.notNull(imageUtils, "Requires to set imageUtils"); - + try { - + List fulldescriptions = new ArrayList(); if(language == null) { target = new ReadableProductFull(); @@ -94,7 +94,7 @@ public ReadableProduct populate(Product source, } ProductDescription description = source.getProductDescription(); - + if(source.getDescriptions()!=null && source.getDescriptions().size()>0) { for(ProductDescription desc : source.getDescriptions()) { if(language != null && desc.getLanguage()!=null && desc.getLanguage().getId().intValue() == language.getId().intValue()) { @@ -105,28 +105,28 @@ public ReadableProduct populate(Product source, } } } - + if(target instanceof ReadableProductFull) { ((ReadableProductFull)target).setDescriptions(fulldescriptions); } - + if(language == null) { language = store.getDefaultLanguage(); } final Language lang = language; - + target.setId(source.getId()); target.setAvailable(source.isAvailable()); target.setProductShipeable(source.isProductShipeable()); - + ProductSpecification specifications = new ProductSpecification(); specifications.setHeight(source.getProductHeight()); specifications.setLength(source.getProductLength()); specifications.setWeight(source.getProductWeight()); specifications.setWidth(source.getProductWidth()); target.setProductSpecifications(specifications); - + target.setPreOrder(source.isPreOrder()); target.setRefSku(source.getRefSku()); target.setSortOrder(source.getSortOrder()); @@ -155,16 +155,16 @@ public ReadableProduct populate(Product source, owner.setAddress(address); target.setOwner(owner); } - - + + if(source.getDateAvailable() != null) { target.setDateAvailable(DateUtil.formatDate(source.getDateAvailable())); } - + if(source.getAuditSection()!=null) { target.setCreationDate(DateUtil.formatDate(source.getAuditSection().getDateCreated())); } - + /* if(source.getProductReviewAvg()!=null) { double avg = source.getProductReviewAvg().doubleValue(); double rating = Math.round(avg * 2) / 2.0f; @@ -177,13 +177,13 @@ public ReadableProduct populate(Product source, if(description!=null) { com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = populateDescription(description); target.setDescription(tragetDescription); - + } - + if(source.getManufacturer()!=null) { - ManufacturerDescription manufacturer = source.getManufacturer().getDescriptions().iterator().next(); + ManufacturerDescription manufacturer = source.getManufacturer().getDescriptions().iterator().next(); ReadableManufacturer manufacturerEntity = new ReadableManufacturer(); - com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription d = new com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription(); + com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription d = new com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription(); d.setName(manufacturer.getName()); manufacturerEntity.setDescription(d); manufacturerEntity.setId(source.getManufacturer().getId()); @@ -191,7 +191,7 @@ public ReadableProduct populate(Product source, manufacturerEntity.setCode(source.getManufacturer().getCode()); target.setManufacturer(manufacturerEntity); } - + /* if(source.getType() != null) { ReadableProductType type = new ReadableProductType(); type.setId(source.getType().getId()); @@ -199,24 +199,22 @@ public ReadableProduct populate(Product source, type.setName(source.getType().getCode());//need name target.setType(type); }*/ - + Set images = source.getImages(); if(images!=null && images.size()>0) { List imageList = new ArrayList(); - + String contextPath = imageUtils.getContextPath(); - + for(ProductImage img : images) { ReadableImage prdImage = new ReadableImage(); prdImage.setImageName(img.getProductImage()); prdImage.setDefaultImage(img.isDefaultImage()); - if (img.getImageType() == 0) { StringBuilder imgPath = new StringBuilder(); imgPath.append(contextPath).append(imageUtils.buildProductImageUtils(store, source.getSku(), img.getProductImage())); prdImage.setImageUrl(imgPath.toString()); - } prdImage.setId(img.getId()); prdImage.setImageType(img.getImageType()); if(img.getProductImageUrl()!=null){ @@ -225,46 +223,46 @@ public ReadableProduct populate(Product source, if(img.getImageType()==1 && img.getProductImageUrl()!=null) {//video prdImage.setVideoUrl(img.getProductImageUrl()); } - + if(prdImage.isDefaultImage()) { target.setImage(prdImage); } - + imageList.add(prdImage); } target .setImages(imageList); } - + if(!CollectionUtils.isEmpty(source.getCategories())) { - + ReadableCategoryPopulator categoryPopulator = new ReadableCategoryPopulator(); List categoryList = new ArrayList(); - + for(Category category : source.getCategories()) { - + ReadableCategory readableCategory = new ReadableCategory(); categoryPopulator.populate(category, readableCategory, store, language); categoryList.add(readableCategory); - + } - + target.setCategories(categoryList); - + } - + if(!CollectionUtils.isEmpty(source.getAttributes())) { - + Set attributes = source.getAttributes(); - + //split read only and options //Map readOnlyAttributes = null; Map properties = null; Map selectableOptions = null; - + if(!CollectionUtils.isEmpty(attributes)) { - + for(ProductAttribute attribute : attributes) { ReadableProductOption opt = null; ReadableProductAttribute attr = null; @@ -272,9 +270,9 @@ public ReadableProduct populate(Product source, ReadableProductPropertyValue propertyValue = null; ReadableProductOptionValueEntity optValue = new ReadableProductOptionValueEntity(); ReadableProductAttributeValue attrValue = new ReadableProductAttributeValue(); - + ProductOptionValue optionValue = attribute.getProductOptionValue(); - + if(attribute.getAttributeDisplayOnly()) {//read only attribute = property /* if(readOnlyAttributes==null) { @@ -287,8 +285,8 @@ public ReadableProduct populate(Product source, if(attr!=null) { readOnlyAttributes.put(attribute.getProductOption().getId(), attr); } - - + + attrValue.setDefaultValue(attribute.getAttributeDefault()); if(attribute.getProductOptionValue()!=null) { attrValue.setId(attribute.getProductOptionValue().getId());//id of the option value @@ -302,7 +300,7 @@ public ReadableProduct populate(Product source, if(attribute.getProductOptionSortOrder()!=null) { attrValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); ProductOptionValueDescription podescription = null; if(podescriptions!=null && podescriptions.size()>0) { @@ -318,12 +316,12 @@ public ReadableProduct populate(Product source, } attrValue.setName(podescription.getName()); attrValue.setDescription(podescription.getDescription()); - + if(attr!=null) { attr.getAttributeValues().add(attrValue); } -*/ - +*/ + //if(properties==null) { // properties = new TreeMap(); @@ -331,13 +329,13 @@ public ReadableProduct populate(Product source, //property = properties.get(attribute.getProductOption().getId()); //if(property==null) { property = createProperty(attribute, language); - + ReadableProductOption readableOption = new ReadableProductOption(); //that is the property ReadableProductPropertyValue readableOptionValue = new ReadableProductPropertyValue(); - + readableOption.setCode(attribute.getProductOption().getCode()); readableOption.setId(attribute.getProductOption().getId()); - + Set podescriptions = attribute.getProductOption().getDescriptions(); if(podescriptions!=null && podescriptions.size()>0) { for(ProductOptionDescription optionDescription : podescriptions) { @@ -346,9 +344,9 @@ public ReadableProduct populate(Product source, } } } - + property.setProperty(readableOption); - + Set povdescriptions = attribute.getProductOptionValue().getDescriptions(); readableOptionValue.setId(attribute.getProductOptionValue().getId()); if(povdescriptions!=null && povdescriptions.size()>0) { @@ -358,23 +356,23 @@ public ReadableProduct populate(Product source, } } } - + property.setPropertyValue(readableOptionValue); - - + + //} else{ // properties.put(attribute.getProductOption().getId(), property); //} - + /* propertyValue.setCode(attribute.getProductOptionValue().getCode()); propertyValue.setId(attribute.getProductOptionValue().getId()); - + propertyValue.setSortOrder(0); if(attribute.getProductOptionSortOrder()!=null) { propertyValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); if(podescriptions!=null && podescriptions.size()>0) { for(ProductOptionValueDescription optionValueDescription : podescriptions) { @@ -384,17 +382,17 @@ public ReadableProduct populate(Product source, propertyValue.getValues().add(desc); } } - + property.setPropertyValue(propertyValue);*/ - + //if(attr!=null) { // attr.getAttributeValues().add(attrValue); //} target.getProperties().add(property); - + } else {//selectable option - + if(selectableOptions==null) { selectableOptions = new TreeMap(); } @@ -405,7 +403,7 @@ public ReadableProduct populate(Product source, if(opt!=null) { selectableOptions.put(attribute.getProductOption().getId(), opt); } - + optValue.setDefaultValue(attribute.getAttributeDefault()); //optValue.setId(attribute.getProductOptionValue().getId()); optValue.setId(attribute.getId()); @@ -417,7 +415,7 @@ public ReadableProduct populate(Product source, String formatedPrice = pricingService.getDisplayAmount(attribute.getProductAttributePrice(), store); optValue.setPrice(formatedPrice); } - + if(!StringUtils.isBlank(attribute.getProductOptionValue().getProductOptionValueImage())) { optValue.setImage(imageUtils.buildProductPropertyImageUtils(store, attribute.getProductOptionValue().getProductOptionValueImage())); } @@ -425,7 +423,7 @@ public ReadableProduct populate(Product source, if(attribute.getProductOptionSortOrder()!=null) { optValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); ProductOptionValueDescription podescription = null; if(podescriptions!=null && podescriptions.size()>0) { @@ -442,26 +440,26 @@ public ReadableProduct populate(Product source, valueDescription.setName(podescription.getName()); valueDescription.setDescription(podescription.getDescription()); optValue.setDescription(valueDescription); - + if(opt!=null) { opt.getOptionValues().add(optValue); } } } - + } - + if(selectableOptions != null) { List options = new ArrayList(selectableOptions.values()); target.setOptions(options); } - + } + - - + //remove products from invisible category -> set visible = false /* Set categories = source.getCategories(); boolean isVisible = true; @@ -475,9 +473,9 @@ public ReadableProduct populate(Product source, } } }*/ - + //target.setVisible(isVisible); - + //availability ProductAvailability availability = null; for(ProductAvailability a : source.getAvailabilities()) { @@ -492,22 +490,22 @@ public ReadableProduct populate(Product source, } //} } - - + + target.setSku(source.getSku()); - + FinalPrice price = pricingService.calculateProductPrice(source); - + if(price != null) { target.setFinalPrice(pricingService.getDisplayAmount(price.getFinalPrice(), store)); target.setPrice(price.getFinalPrice()); target.setOriginalPrice(pricingService.getDisplayAmount(price.getOriginalPrice(), store)); - + if(price.isDiscounted()) { target.setDiscounted(true); } - + //price appender if(availability != null) { Set prices = availability.getPrices(); @@ -516,12 +514,12 @@ public ReadableProduct populate(Product source, readableProductPrice.setDiscounted(target.isDiscounted()); readableProductPrice.setFinalPrice(target.getFinalPrice()); readableProductPrice.setOriginalPrice(target.getOriginalPrice()); - + Optional pr = prices.stream().filter(p -> p.getCode().equals(ProductPrice.DEFAULT_PRICE_CODE)) .findFirst(); - + target.setProductPrice(readableProductPrice); - + if(pr.isPresent()) { readableProductPrice.setId(pr.get().getId()); Optional d = pr.get().getDescriptions().stream().filter(desc -> desc.getLanguage().getCode().equals(lang.getCode())).findFirst(); @@ -536,9 +534,9 @@ public ReadableProduct populate(Product source, } } - + } - + @@ -546,18 +544,18 @@ public ReadableProduct populate(Product source, ((ReadableProductFull)target).setDescriptions(fulldescriptions); } - + return target; - + } catch (Exception e) { throw new ConversionException(e); } } + - - + private ReadableProductOption createOption(ProductAttribute productAttribute, Language language) { - + ReadableProductOption option = new ReadableProductOption(); option.setId(productAttribute.getProductOption().getId());//attribute of the option @@ -576,7 +574,7 @@ private ReadableProductOption createOption(ProductAttribute productAttribute, La } } } - + if(description==null) { return null; } @@ -585,11 +583,11 @@ private ReadableProductOption createOption(ProductAttribute productAttribute, La option.setName(description.getName()); option.setCode(productAttribute.getProductOption().getCode()); - + return option; - + } - + private ReadableProductType type (ProductType type, Language language) { ReadableProductType readableType = new ReadableProductType(); readableType.setCode(type.getCode()); @@ -602,10 +600,10 @@ private ReadableProductType type (ProductType type, Language language) { readableType.setDescription(desc.get()); } } - + return readableType; } - + private ProductTypeDescription typeDescription(com.salesmanager.core.model.catalog.product.type.ProductTypeDescription description) { ProductTypeDescription desc = new ProductTypeDescription(); desc.setId(description.getId()); @@ -614,9 +612,9 @@ private ProductTypeDescription typeDescription(com.salesmanager.core.model.catal desc.setLanguage(description.getLanguage().getCode()); return desc; } - + private ReadableProductAttribute createAttribute(ProductAttribute productAttribute, Language language) { - + ReadableProductAttribute attr = new ReadableProductAttribute(); attr.setId(productAttribute.getProductOption().getId());//attribute of the option @@ -634,7 +632,7 @@ private ReadableProductAttribute createAttribute(ProductAttribute productAttribu } } } - + if(description==null) { return null; } @@ -643,26 +641,26 @@ private ReadableProductAttribute createAttribute(ProductAttribute productAttribu attr.setName(description.getName()); attr.setCode(productAttribute.getProductOption().getCode()); - + return attr; - + } - + private ReadableProductProperty createProperty(ProductAttribute productAttribute, Language language) { - + ReadableProductProperty attr = new ReadableProductProperty(); attr.setId(productAttribute.getProductOption().getId());//attribute of the option attr.setType(productAttribute.getProductOption().getProductOptionType()); - - - - + + + + List descriptions = productAttribute.getProductOption().getDescriptionsSettoList(); - + ReadableProductPropertyValue propertyValue = new ReadableProductPropertyValue(); - - + + if(descriptions!=null && descriptions.size()>0) { for(ProductOptionDescription optionDescription : descriptions) { com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription productOptionValueDescription = new com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription(); @@ -676,7 +674,7 @@ private ReadableProductProperty createProperty(ProductAttribute productAttribute attr.setCode(productAttribute.getProductOption().getCode()); return attr; - + } @@ -687,12 +685,12 @@ protected ReadableProduct createTarget() { // TODO Auto-generated method stub return null; } - + com.salesmanager.shop.model.catalog.product.ProductDescription populateDescription(ProductDescription description) { if(description == null) { return null; } - + com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = new com.salesmanager.shop.model.catalog.product.ProductDescription(); tragetDescription.setFriendlyUrl(description.getSeUrl()); tragetDescription.setName(description.getName()); From fc0860f9618ac73569931cce8a0cf48699270cb6 Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Mon, 13 Sep 2021 14:54:28 +0200 Subject: [PATCH 28/34] - Added possibility to ass and retreive external product images via ProductApi as Image Type 1 --- .../image/ProductImageServiceImpl.java | 105 ++++---- .../catalog/PersistableProductPopulator.java | 86 ++++--- .../catalog/ReadableProductPopulator.java | 228 +++++++++--------- 3 files changed, 214 insertions(+), 205 deletions(-) diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/image/ProductImageServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/image/ProductImageServiceImpl.java index 8ef4978c50..de15a2d549 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/image/ProductImageServiceImpl.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/image/ProductImageServiceImpl.java @@ -27,9 +27,9 @@ import com.salesmanager.core.model.merchant.MerchantStore; @Service("productImage") -public class ProductImageServiceImpl extends SalesManagerEntityServiceImpl +public class ProductImageServiceImpl extends SalesManagerEntityServiceImpl implements ProductImageService { - + private ProductImageRepository productImageRepository; @Inject @@ -37,65 +37,62 @@ public ProductImageServiceImpl(ProductImageRepository productImageRepository) { super(productImageRepository); this.productImageRepository = productImageRepository; } - + @Inject private ProductFileManager productFileManager; - - - + + + public ProductImage getById(Long id) { - + return productImageRepository.findOne(id); } - - + + @Override public void addProductImages(Product product, List productImages) throws ServiceException { - + try { for(ProductImage productImage : productImages) { - + Assert.notNull(productImage.getImage()); - + InputStream inputStream = productImage.getImage(); ImageContentFile cmsContentImage = new ImageContentFile(); cmsContentImage.setFileName( productImage.getProductImage() ); cmsContentImage.setFile( inputStream ); cmsContentImage.setFileContentType(FileContentType.PRODUCT); - - - - addProductImage(product,productImage,cmsContentImage); + + + + addProductImage(product,productImage,cmsContentImage); } - + } catch (Exception e) { throw new ServiceException(e); } } - - + + @Override public void addProductImage(Product product, ProductImage productImage, ImageContentFile inputImage) throws ServiceException { - - - - + productImage.setProduct(product); try { - - Assert.notNull(inputImage.getFile(),"ImageContentFile.file cannot be null"); + if (productImage.getImageType() == 0 ) { + Assert.notNull(inputImage.getFile(), "ImageContentFile.file cannot be null"); + productFileManager.addProductImage(productImage, inputImage); + } - productFileManager.addProductImage(productImage, inputImage); - //insert ProductImage this.saveOrUpdate(productImage); - - + + } catch (Exception e) { throw new ServiceException(e); } finally { @@ -106,71 +103,71 @@ public void addProductImage(Product product, ProductImage productImage, ImageCon } } catch(Exception ignore) { - + } } - - + + } - + @Override public void saveOrUpdate(ProductImage productImage) throws ServiceException { - - + + super.save(productImage); - + } - + public void addProductImageDescription(ProductImage productImage, ProductImageDescription description) throws ServiceException { - + if(productImage.getDescriptions()==null) { productImage.setDescriptions(new ArrayList()); } - + productImage.getDescriptions().add(description); description.setProductImage(productImage); update(productImage); } - + //TODO get default product image - + @Override public OutputContentFile getProductImage(ProductImage productImage, ProductImageSize size) throws ServiceException { - + ProductImage pi = new ProductImage(); String imageName = productImage.getProductImage(); if(size == ProductImageSize.LARGE) { imageName = "L-" + imageName; } - + if(size == ProductImageSize.SMALL) { imageName = "S-" + imageName; } - + pi.setProductImage(imageName); pi.setProduct(productImage.getProduct()); return productFileManager.getProductImage(pi); - + } - + @Override public OutputContentFile getProductImage(final String storeCode, final String productCode, final String fileName, final ProductImageSize size) throws ServiceException { return productFileManager.getProductImage(storeCode, productCode, fileName, size); - + } - + @Override public List getProductImages(Product product) throws ServiceException { return productFileManager.getImages(product); } - + @Override public void removeProductImage(ProductImage productImage) throws ServiceException { @@ -179,21 +176,21 @@ public void removeProductImage(ProductImage productImage) throws ServiceExceptio } ProductImage p = this.getById(productImage.getId()); this.delete(p); - + } @Override public Optional getProductImage(Long imageId, Long productId, MerchantStore store) { - - + + Optional image = Optional.empty(); - + ProductImage img = productImageRepository.finById(imageId, productId, store.getCode()); if(img!=null) { image = Optional.of(img); } - + return image; } } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java index a4b9e43184..76843b9a0c 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/PersistableProductPopulator.java @@ -50,7 +50,7 @@ @Component public class PersistableProductPopulator extends AbstractDataPopulator { - + @Inject private CategoryService categoryService; @Inject @@ -67,11 +67,11 @@ public class PersistableProductPopulator extends private CustomerService customerService; @Autowired private PersistableProductAttributeMapper persistableProductAttributeMapper; - + @Autowired private ProductTypeService productTypeService; - + @@ -79,7 +79,7 @@ public class PersistableProductPopulator extends public Product populate(PersistableProduct source, Product target, MerchantStore store, Language language) throws ConversionException { - + Validate.notNull(target,"Product must not be null"); try { @@ -94,7 +94,7 @@ public Product populate(PersistableProduct source, target.setId(source.getId()); } - + //PRODUCT TYPE if(!StringUtils.isBlank(source.getType())) { ProductType type = productTypeService.getByCode(source.getType(), store, language); @@ -104,27 +104,27 @@ public Product populate(PersistableProduct source, target.setType(type); } - - - + + + if(source.getOwner()!=null && source.getOwner().getId()!=null) { com.salesmanager.core.model.customer.Customer owner = customerService.getById(source.getOwner().getId()); target.setOwner(owner); } - + if(!StringUtils.isBlank(source.getDateAvailable())) { target.setDateAvailable(DateUtil.getDate(source.getDateAvailable())); } - + target.setMerchantStore(store); - + List languages = new ArrayList(); Set descriptions = new HashSet(); if(!CollectionUtils.isEmpty(source.getDescriptions())) { for(com.salesmanager.shop.model.catalog.product.ProductDescription description : source.getDescriptions()) { - + ProductDescription productDescription = new ProductDescription(); Language lang = languageService.getByCode(description.getLanguage()); if(lang==null) { @@ -149,13 +149,13 @@ public Product populate(PersistableProduct source, productDescription.setMetatagKeywords(description.getKeyWords()); productDescription.setMetatagDescription(description.getMetaDescription()); productDescription.setTitle(description.getTitle()); - + languages.add(lang); productDescription.setLanguage(lang); descriptions.add(productDescription); } } - + if(descriptions.size()>0) { target.setDescriptions(descriptions); } @@ -165,15 +165,15 @@ public Product populate(PersistableProduct source, target.setProductLength(source.getProductSpecifications().getLength()); target.setProductWeight(source.getProductSpecifications().getWeight()); target.setProductWidth(source.getProductSpecifications().getWidth()); - - + + if(source.getProductSpecifications().getManufacturer()!=null) { - + Manufacturer manuf = null; if(!StringUtils.isBlank(source.getProductSpecifications().getManufacturer())) { manuf = manufacturerService.getByCode(store, source.getProductSpecifications().getManufacturer()); - } - + } + if(manuf==null) { throw new ConversionException("Invalid manufacturer id"); } @@ -184,7 +184,7 @@ public Product populate(PersistableProduct source, target.setManufacturer(manuf); } } - + } target.setSortOrder(source.getSortOrder()); target.setProductVirtual(source.isProductVirtual()); @@ -193,11 +193,11 @@ public Product populate(PersistableProduct source, target.setProductReviewAvg(new BigDecimal(source.getRating())); } target.setProductReviewCount(source.getRatingCount()); - + if(CollectionUtils.isNotEmpty(source.getProductPrices())) { //get product availability - + //create new ProductAvailability ProductAvailability productAvailability = new ProductAvailability(target, store); @@ -208,9 +208,9 @@ public Product populate(PersistableProduct source, productAvailability.setProductQuantityOrderMin(1); productAvailability.setProductQuantityOrderMax(1); productAvailability.setAvailable(Boolean.valueOf(target.isAvailable())); - + for(com.salesmanager.shop.model.catalog.product.PersistableProductPrice priceEntity : source.getProductPrices()) { - + ProductPrice price = new ProductPrice(); price.setProductAvailability(productAvailability); price.setDefaultPrice(priceEntity.isDefaultPrice()); @@ -232,7 +232,7 @@ public Product populate(PersistableProduct source, ppd.setProductPrice(price); ppd.setLanguage(lang); ppd.setName(ProductPriceDescription.DEFAULT_PRICE_DESCRIPTION); - + //price appender Optional description = priceEntity.getDescriptions().stream().filter(d -> d.getLanguage()!= null && d.getLanguage().equals(lang.getCode())).findFirst(); if(description.isPresent()) { @@ -242,8 +242,8 @@ public Product populate(PersistableProduct source, } } - } else { //create - + } else { //create + ProductAvailability productAvailability = null; ProductPrice defaultPrice = null; if(!CollectionUtils.isEmpty(target.getAvailabilities())) { @@ -261,7 +261,7 @@ public Product populate(PersistableProduct source, } } } - + if(productAvailability == null) { productAvailability = new ProductAvailability(target, store); target.getAvailabilities().add(productAvailability); @@ -284,7 +284,7 @@ public Product populate(PersistableProduct source, defaultPrice.setProductAvailability(productAvailability); productAvailability.getPrices().add(defaultPrice); for(Language lang : languages) { - + ProductPriceDescription ppd = new ProductPriceDescription(); ppd.setProductPrice(defaultPrice); ppd.setLanguage(lang); @@ -293,38 +293,46 @@ public Product populate(PersistableProduct source, } } - - + + } //image if(source.getImages()!=null) { for(PersistableImage img : source.getImages()) { - ByteArrayInputStream in = new ByteArrayInputStream(img.getBytes()); ProductImage productImage = new ProductImage(); + productImage.setImageType(img.getImageType()); + productImage.setDefaultImage(img.isDefaultImage()); + if (img.getImageType() == 1) { + productImage.setProductImageUrl(img.getImageUrl()); + productImage.setImage(new ByteArrayInputStream(new byte[0])); + } else { + ByteArrayInputStream in = new ByteArrayInputStream(img.getBytes()); + productImage.setImage(in); + } productImage.setProduct(target); productImage.setProductImage(img.getName()); - productImage.setImage(in); + target.getImages().add(productImage); } } - + //attributes if(source.getAttributes()!=null) { for(com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute attr : source.getAttributes()) { ProductAttribute attribute = persistableProductAttributeMapper.convert(attr, store, language); - + attribute.setProduct(target); target.getAttributes().add(attribute); } } - + //categories if(!CollectionUtils.isEmpty(source.getCategories())) { for(com.salesmanager.shop.model.catalog.category.Category categ : source.getCategories()) { - + Category c = null; if(!StringUtils.isBlank(categ.getCode())) { c = categoryService.getByCode(store, categ.getCode()); @@ -332,7 +340,7 @@ public Product populate(PersistableProduct source, Validate.notNull(categ.getId(), "Category id nust not be null"); c = categoryService.getById(categ.getId(), store.getId()); } - + if(c==null) { throw new ConversionException("Category id " + categ.getId() + " does not exist"); } @@ -343,7 +351,7 @@ public Product populate(PersistableProduct source, } } return target; - + } catch (Exception e) { throw new ConversionException(e); } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java index 525dd118f4..213310b9ff 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java @@ -53,9 +53,9 @@ public class ReadableProductPopulator extends AbstractDataPopulator { - + private PricingService pricingService; - + private ImageFilePath imageUtils; public ImageFilePath getimageUtils() { @@ -81,9 +81,9 @@ public ReadableProduct populate(Product source, Validate.notNull(pricingService, "Requires to set PricingService"); Validate.notNull(imageUtils, "Requires to set imageUtils"); - + try { - + List fulldescriptions = new ArrayList(); if(language == null) { target = new ReadableProductFull(); @@ -94,7 +94,7 @@ public ReadableProduct populate(Product source, } ProductDescription description = source.getProductDescription(); - + if(source.getDescriptions()!=null && source.getDescriptions().size()>0) { for(ProductDescription desc : source.getDescriptions()) { if(language != null && desc.getLanguage()!=null && desc.getLanguage().getId().intValue() == language.getId().intValue()) { @@ -105,28 +105,28 @@ public ReadableProduct populate(Product source, } } } - + if(target instanceof ReadableProductFull) { ((ReadableProductFull)target).setDescriptions(fulldescriptions); } - + if(language == null) { language = store.getDefaultLanguage(); } final Language lang = language; - + target.setId(source.getId()); target.setAvailable(source.isAvailable()); target.setProductShipeable(source.isProductShipeable()); - + ProductSpecification specifications = new ProductSpecification(); specifications.setHeight(source.getProductHeight()); specifications.setLength(source.getProductLength()); specifications.setWeight(source.getProductWeight()); specifications.setWidth(source.getProductWidth()); target.setProductSpecifications(specifications); - + target.setPreOrder(source.isPreOrder()); target.setRefSku(source.getRefSku()); target.setSortOrder(source.getSortOrder()); @@ -155,16 +155,16 @@ public ReadableProduct populate(Product source, owner.setAddress(address); target.setOwner(owner); } - - + + if(source.getDateAvailable() != null) { target.setDateAvailable(DateUtil.formatDate(source.getDateAvailable())); } - + if(source.getAuditSection()!=null) { target.setCreationDate(DateUtil.formatDate(source.getAuditSection().getDateCreated())); } - + /* if(source.getProductReviewAvg()!=null) { double avg = source.getProductReviewAvg().doubleValue(); double rating = Math.round(avg * 2) / 2.0f; @@ -177,13 +177,13 @@ public ReadableProduct populate(Product source, if(description!=null) { com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = populateDescription(description); target.setDescription(tragetDescription); - + } - + if(source.getManufacturer()!=null) { - ManufacturerDescription manufacturer = source.getManufacturer().getDescriptions().iterator().next(); + ManufacturerDescription manufacturer = source.getManufacturer().getDescriptions().iterator().next(); ReadableManufacturer manufacturerEntity = new ReadableManufacturer(); - com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription d = new com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription(); + com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription d = new com.salesmanager.shop.model.catalog.manufacturer.ManufacturerDescription(); d.setName(manufacturer.getName()); manufacturerEntity.setDescription(d); manufacturerEntity.setId(source.getManufacturer().getId()); @@ -191,7 +191,7 @@ public ReadableProduct populate(Product source, manufacturerEntity.setCode(source.getManufacturer().getCode()); target.setManufacturer(manufacturerEntity); } - + /* if(source.getType() != null) { ReadableProductType type = new ReadableProductType(); type.setId(source.getType().getId()); @@ -199,22 +199,26 @@ public ReadableProduct populate(Product source, type.setName(source.getType().getCode());//need name target.setType(type); }*/ - + Set images = source.getImages(); if(images!=null && images.size()>0) { List imageList = new ArrayList(); - + String contextPath = imageUtils.getContextPath(); - + for(ProductImage img : images) { ReadableImage prdImage = new ReadableImage(); prdImage.setImageName(img.getProductImage()); prdImage.setDefaultImage(img.isDefaultImage()); - StringBuilder imgPath = new StringBuilder(); - imgPath.append(contextPath).append(imageUtils.buildProductImageUtils(store, source.getSku(), img.getProductImage())); + if (img.getImageType() == 1 && img.getProductImageUrl()!=null) { + prdImage.setImageUrl(img.getProductImageUrl()); + } else { + StringBuilder imgPath = new StringBuilder(); + imgPath.append(contextPath).append(imageUtils.buildProductImageUtils(store, source.getSku(), img.getProductImage())); - prdImage.setImageUrl(imgPath.toString()); + prdImage.setImageUrl(imgPath.toString()); + } prdImage.setId(img.getId()); prdImage.setImageType(img.getImageType()); if(img.getProductImageUrl()!=null){ @@ -223,46 +227,46 @@ public ReadableProduct populate(Product source, if(img.getImageType()==1 && img.getProductImageUrl()!=null) {//video prdImage.setVideoUrl(img.getProductImageUrl()); } - + if(prdImage.isDefaultImage()) { target.setImage(prdImage); } - + imageList.add(prdImage); } target .setImages(imageList); } - + if(!CollectionUtils.isEmpty(source.getCategories())) { - + ReadableCategoryPopulator categoryPopulator = new ReadableCategoryPopulator(); List categoryList = new ArrayList(); - + for(Category category : source.getCategories()) { - + ReadableCategory readableCategory = new ReadableCategory(); categoryPopulator.populate(category, readableCategory, store, language); categoryList.add(readableCategory); - + } - + target.setCategories(categoryList); - + } - + if(!CollectionUtils.isEmpty(source.getAttributes())) { - + Set attributes = source.getAttributes(); - + //split read only and options //Map readOnlyAttributes = null; Map properties = null; Map selectableOptions = null; - + if(!CollectionUtils.isEmpty(attributes)) { - + for(ProductAttribute attribute : attributes) { ReadableProductOption opt = null; ReadableProductAttribute attr = null; @@ -270,9 +274,9 @@ public ReadableProduct populate(Product source, ReadableProductPropertyValue propertyValue = null; ReadableProductOptionValueEntity optValue = new ReadableProductOptionValueEntity(); ReadableProductAttributeValue attrValue = new ReadableProductAttributeValue(); - + ProductOptionValue optionValue = attribute.getProductOptionValue(); - + if(attribute.getAttributeDisplayOnly()) {//read only attribute = property /* if(readOnlyAttributes==null) { @@ -285,8 +289,8 @@ public ReadableProduct populate(Product source, if(attr!=null) { readOnlyAttributes.put(attribute.getProductOption().getId(), attr); } - - + + attrValue.setDefaultValue(attribute.getAttributeDefault()); if(attribute.getProductOptionValue()!=null) { attrValue.setId(attribute.getProductOptionValue().getId());//id of the option value @@ -300,7 +304,7 @@ public ReadableProduct populate(Product source, if(attribute.getProductOptionSortOrder()!=null) { attrValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); ProductOptionValueDescription podescription = null; if(podescriptions!=null && podescriptions.size()>0) { @@ -316,12 +320,12 @@ public ReadableProduct populate(Product source, } attrValue.setName(podescription.getName()); attrValue.setDescription(podescription.getDescription()); - + if(attr!=null) { attr.getAttributeValues().add(attrValue); } -*/ - +*/ + //if(properties==null) { // properties = new TreeMap(); @@ -329,13 +333,13 @@ public ReadableProduct populate(Product source, //property = properties.get(attribute.getProductOption().getId()); //if(property==null) { property = createProperty(attribute, language); - + ReadableProductOption readableOption = new ReadableProductOption(); //that is the property ReadableProductPropertyValue readableOptionValue = new ReadableProductPropertyValue(); - + readableOption.setCode(attribute.getProductOption().getCode()); readableOption.setId(attribute.getProductOption().getId()); - + Set podescriptions = attribute.getProductOption().getDescriptions(); if(podescriptions!=null && podescriptions.size()>0) { for(ProductOptionDescription optionDescription : podescriptions) { @@ -344,9 +348,9 @@ public ReadableProduct populate(Product source, } } } - + property.setProperty(readableOption); - + Set povdescriptions = attribute.getProductOptionValue().getDescriptions(); readableOptionValue.setId(attribute.getProductOptionValue().getId()); if(povdescriptions!=null && povdescriptions.size()>0) { @@ -356,23 +360,23 @@ public ReadableProduct populate(Product source, } } } - + property.setPropertyValue(readableOptionValue); - - + + //} else{ // properties.put(attribute.getProductOption().getId(), property); //} - + /* propertyValue.setCode(attribute.getProductOptionValue().getCode()); propertyValue.setId(attribute.getProductOptionValue().getId()); - + propertyValue.setSortOrder(0); if(attribute.getProductOptionSortOrder()!=null) { propertyValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); if(podescriptions!=null && podescriptions.size()>0) { for(ProductOptionValueDescription optionValueDescription : podescriptions) { @@ -382,17 +386,17 @@ public ReadableProduct populate(Product source, propertyValue.getValues().add(desc); } } - + property.setPropertyValue(propertyValue);*/ - + //if(attr!=null) { // attr.getAttributeValues().add(attrValue); //} target.getProperties().add(property); - + } else {//selectable option - + if(selectableOptions==null) { selectableOptions = new TreeMap(); } @@ -403,7 +407,7 @@ public ReadableProduct populate(Product source, if(opt!=null) { selectableOptions.put(attribute.getProductOption().getId(), opt); } - + optValue.setDefaultValue(attribute.getAttributeDefault()); //optValue.setId(attribute.getProductOptionValue().getId()); optValue.setId(attribute.getId()); @@ -415,7 +419,7 @@ public ReadableProduct populate(Product source, String formatedPrice = pricingService.getDisplayAmount(attribute.getProductAttributePrice(), store); optValue.setPrice(formatedPrice); } - + if(!StringUtils.isBlank(attribute.getProductOptionValue().getProductOptionValueImage())) { optValue.setImage(imageUtils.buildProductPropertyImageUtils(store, attribute.getProductOptionValue().getProductOptionValueImage())); } @@ -423,7 +427,7 @@ public ReadableProduct populate(Product source, if(attribute.getProductOptionSortOrder()!=null) { optValue.setSortOrder(attribute.getProductOptionSortOrder().intValue()); } - + List podescriptions = optionValue.getDescriptionsSettoList(); ProductOptionValueDescription podescription = null; if(podescriptions!=null && podescriptions.size()>0) { @@ -440,26 +444,26 @@ public ReadableProduct populate(Product source, valueDescription.setName(podescription.getName()); valueDescription.setDescription(podescription.getDescription()); optValue.setDescription(valueDescription); - + if(opt!=null) { opt.getOptionValues().add(optValue); } } } - + } - + if(selectableOptions != null) { List options = new ArrayList(selectableOptions.values()); target.setOptions(options); } - + } - - + + //remove products from invisible category -> set visible = false /* Set categories = source.getCategories(); boolean isVisible = true; @@ -473,9 +477,9 @@ public ReadableProduct populate(Product source, } } }*/ - + //target.setVisible(isVisible); - + //availability ProductAvailability availability = null; for(ProductAvailability a : source.getAvailabilities()) { @@ -490,22 +494,22 @@ public ReadableProduct populate(Product source, } //} } - - + + target.setSku(source.getSku()); - + FinalPrice price = pricingService.calculateProductPrice(source); - + if(price != null) { target.setFinalPrice(pricingService.getDisplayAmount(price.getFinalPrice(), store)); target.setPrice(price.getFinalPrice()); target.setOriginalPrice(pricingService.getDisplayAmount(price.getOriginalPrice(), store)); - + if(price.isDiscounted()) { target.setDiscounted(true); } - + //price appender if(availability != null) { Set prices = availability.getPrices(); @@ -514,12 +518,12 @@ public ReadableProduct populate(Product source, readableProductPrice.setDiscounted(target.isDiscounted()); readableProductPrice.setFinalPrice(target.getFinalPrice()); readableProductPrice.setOriginalPrice(target.getOriginalPrice()); - + Optional pr = prices.stream().filter(p -> p.getCode().equals(ProductPrice.DEFAULT_PRICE_CODE)) .findFirst(); - + target.setProductPrice(readableProductPrice); - + if(pr.isPresent()) { readableProductPrice.setId(pr.get().getId()); Optional d = pr.get().getDescriptions().stream().filter(desc -> desc.getLanguage().getCode().equals(lang.getCode())).findFirst(); @@ -534,9 +538,9 @@ public ReadableProduct populate(Product source, } } - + } - + @@ -544,18 +548,18 @@ public ReadableProduct populate(Product source, ((ReadableProductFull)target).setDescriptions(fulldescriptions); } - + return target; - + } catch (Exception e) { throw new ConversionException(e); } } - - + + private ReadableProductOption createOption(ProductAttribute productAttribute, Language language) { - + ReadableProductOption option = new ReadableProductOption(); option.setId(productAttribute.getProductOption().getId());//attribute of the option @@ -574,7 +578,7 @@ private ReadableProductOption createOption(ProductAttribute productAttribute, La } } } - + if(description==null) { return null; } @@ -583,11 +587,11 @@ private ReadableProductOption createOption(ProductAttribute productAttribute, La option.setName(description.getName()); option.setCode(productAttribute.getProductOption().getCode()); - + return option; - + } - + private ReadableProductType type (ProductType type, Language language) { ReadableProductType readableType = new ReadableProductType(); readableType.setCode(type.getCode()); @@ -600,10 +604,10 @@ private ReadableProductType type (ProductType type, Language language) { readableType.setDescription(desc.get()); } } - + return readableType; } - + private ProductTypeDescription typeDescription(com.salesmanager.core.model.catalog.product.type.ProductTypeDescription description) { ProductTypeDescription desc = new ProductTypeDescription(); desc.setId(description.getId()); @@ -612,9 +616,9 @@ private ProductTypeDescription typeDescription(com.salesmanager.core.model.catal desc.setLanguage(description.getLanguage().getCode()); return desc; } - + private ReadableProductAttribute createAttribute(ProductAttribute productAttribute, Language language) { - + ReadableProductAttribute attr = new ReadableProductAttribute(); attr.setId(productAttribute.getProductOption().getId());//attribute of the option @@ -632,7 +636,7 @@ private ReadableProductAttribute createAttribute(ProductAttribute productAttribu } } } - + if(description==null) { return null; } @@ -641,26 +645,26 @@ private ReadableProductAttribute createAttribute(ProductAttribute productAttribu attr.setName(description.getName()); attr.setCode(productAttribute.getProductOption().getCode()); - + return attr; - + } - + private ReadableProductProperty createProperty(ProductAttribute productAttribute, Language language) { - + ReadableProductProperty attr = new ReadableProductProperty(); attr.setId(productAttribute.getProductOption().getId());//attribute of the option attr.setType(productAttribute.getProductOption().getProductOptionType()); - - - - + + + + List descriptions = productAttribute.getProductOption().getDescriptionsSettoList(); - + ReadableProductPropertyValue propertyValue = new ReadableProductPropertyValue(); - - + + if(descriptions!=null && descriptions.size()>0) { for(ProductOptionDescription optionDescription : descriptions) { com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription productOptionValueDescription = new com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription(); @@ -674,7 +678,7 @@ private ReadableProductProperty createProperty(ProductAttribute productAttribute attr.setCode(productAttribute.getProductOption().getCode()); return attr; - + } @@ -685,12 +689,12 @@ protected ReadableProduct createTarget() { // TODO Auto-generated method stub return null; } - + com.salesmanager.shop.model.catalog.product.ProductDescription populateDescription(ProductDescription description) { if(description == null) { return null; } - + com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = new com.salesmanager.shop.model.catalog.product.ProductDescription(); tragetDescription.setFriendlyUrl(description.getSeUrl()); tragetDescription.setName(description.getName()); From ab26dc1735466a44dac1dbce5f568624a8055ed1 Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Mon, 13 Sep 2021 15:52:08 +0200 Subject: [PATCH 29/34] Revert "- Update to work with images smaller than large definition, otherwise import fail" This reverts commit 23e5a075d09962427f477c600b27aec766086cdf. --- .../shop/model/catalog/product/LightPersistableProduct.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java index d86f7e8472..7aeb5e21aa 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java @@ -10,12 +10,11 @@ public class LightPersistableProduct implements Serializable { /** - * + * */ private static final long serialVersionUID = 1L; private String price; private boolean available; - private boolean productShipeable; private int quantity; public String getPrice() { return price; @@ -36,7 +35,5 @@ public boolean isAvailable() { public void setAvailable(boolean available) { this.available = available; } - public boolean isProductShipeable() { return productShipeable; } - public void setProductShipeable(Boolean productShipeable) { this.productShipeable = productShipeable; } } From d38c279589cc82ed57e267c912a617d75489b0e4 Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Mon, 13 Sep 2021 15:53:54 +0200 Subject: [PATCH 30/34] - Fix for calculation to get desired sizes --- .../business/utils/ProductImageSizeUtils.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductImageSizeUtils.java b/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductImageSizeUtils.java index 49cf6c1e78..83249e46c0 100755 --- a/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductImageSizeUtils.java +++ b/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductImageSizeUtils.java @@ -12,12 +12,12 @@ * */ public class ProductImageSizeUtils { - + private ProductImageSizeUtils() { } - + /** * Simple resize, does not maintain aspect ratio @@ -26,7 +26,7 @@ private ProductImageSizeUtils() { * @param height * @return */ - + public static BufferedImage resize(BufferedImage image, int width, int height) { int type = image.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : image .getType(); @@ -43,9 +43,9 @@ public static BufferedImage resize(BufferedImage image, int width, int height) { g.dispose(); return resizedImage; } - + /** - * + * * @param img * @param targetWidth * @param targetHeight @@ -102,8 +102,8 @@ public static BufferedImage resizeWithHint(BufferedImage img, return ret; } - - + + public static BufferedImage resizeWithRatio(BufferedImage image, int destinationWidth, int destinationHeight) { int type = image.getType() == 0? BufferedImage.TYPE_INT_ARGB : image.getType(); @@ -121,17 +121,17 @@ public static BufferedImage resizeWithRatio(BufferedImage image, int destination //Work out the resized width/height if (image.getHeight() > destinationHeight || image.getWidth() > destinationWidth) { - fHeight = destinationHeight; - int wid = destinationWidth; - float sum = (float)image.getWidth() / (float)image.getHeight(); - fWidth = Math.round(fHeight * sum); - - if (fWidth > wid) { - //rezise again for the width this time - fHeight = Math.round(wid/sum); - fWidth = wid; - } - } + if (image.getHeight() > image.getWidth()) { + fHeight = destinationHeight; + float sum = (float) image.getWidth() / (float) image.getHeight(); + fWidth = Math.round(destinationWidth * sum); + } else if (image.getWidth() > image.getHeight()) { + fWidth = destinationWidth; + float sum = (float) image.getHeight() / (float) image.getWidth(); + fHeight = Math.round(destinationHeight * sum); + } + // else sides are equal and is set to destination size at initialization of + } BufferedImage resizedImage = new BufferedImage(fWidth, fHeight, type); Graphics2D g = resizedImage.createGraphics(); @@ -146,6 +146,6 @@ public static BufferedImage resizeWithRatio(BufferedImage image, int destination return resizedImage; } - + } From b5b6150fb7cdca58f5603bbb9dae879fd228c489 Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Tue, 14 Sep 2021 15:31:43 +0200 Subject: [PATCH 31/34] - Added function to update Order status and add record in Order history --- .../shop/store/api/v1/order/OrderApi.java | 77 +++++++++++++------ .../controller/order/facade/OrderFacade.java | 48 +++++++----- .../order/facade/OrderFacadeImpl.java | 24 ++++++ 3 files changed, 105 insertions(+), 44 deletions(-) diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/order/OrderApi.java b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/order/OrderApi.java index ee9382c1f5..b0ca074572 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/order/OrderApi.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/order/OrderApi.java @@ -11,6 +11,8 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import com.salesmanager.core.business.services.order.OrderService; +import com.salesmanager.core.model.order.orderstatus.OrderStatus; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.jsoup.helper.Validate; @@ -74,25 +76,28 @@ public class OrderApi { @Inject private OrderFacade orderFacade; - + + @Inject + private OrderService orderService; + @Inject - private com.salesmanager.shop.store.controller.order.facade.v1.OrderFacade orderFacadeV1; + private com.salesmanager.shop.store.controller.order.facade.v1.OrderFacade orderFacadeV1; @Inject private ShoppingCartService shoppingCartService; @Autowired private CustomerFacade customerFacade; - + @Autowired private CustomerFacade customerFacadev1; //v1 version @Inject private AuthorizationUtils authorizationUtils; - + @Inject private CredentialsService credentialsService; - + private static final String DEFAULT_ORDER_LIST_COUNT = "25"; /** @@ -243,7 +248,7 @@ public ReadableOrderList list( ReadableOrderList orders = orderFacade.getReadableOrderList(orderCriteria, merchantStore); - + return orders; } @@ -261,10 +266,10 @@ public ReadableOrderList list( @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "string", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "string", defaultValue = "en") }) public ReadableOrder get( - @PathVariable final Long id, + @PathVariable final Long id, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) { - + String user = authorizationUtils.authenticatedUser(); authorizationUtils.authorizeUser(user, Stream.of(Constants.GROUP_SUPERADMIN, Constants.GROUP_ADMIN, Constants.GROUP_ADMIN_ORDER, Constants.GROUP_ADMIN_RETAIL).collect(Collectors.toList()), merchantStore); @@ -344,7 +349,7 @@ public ReadableOrderConfirmation checkout( @PathVariable final String code, //shopping cart @Valid @RequestBody PersistableOrder order, // order @ApiIgnore MerchantStore merchantStore, - @ApiIgnore Language language, + @ApiIgnore Language language, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception { @@ -371,9 +376,9 @@ public ReadableOrderConfirmation checkout( Long orderId = modelOrder.getId(); modelOrder.setId(orderId); - + return orderFacadeV1.orderConfirmation(modelOrder, customer, merchantStore, language); - + } catch (Exception e) { @@ -401,7 +406,7 @@ public ReadableOrderConfirmation checkout( @ApiImplicitParam(name = "lang", dataType = "string", defaultValue = "en") }) public ReadableOrderConfirmation checkout( @PathVariable final String code,//shopping cart - @Valid @RequestBody PersistableAnonymousOrder order,//order + @Valid @RequestBody PersistableAnonymousOrder order,//order @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) { @@ -415,7 +420,7 @@ public ReadableOrderConfirmation checkout( if (cart == null) { throw new ResourceNotFoundException("Cart code " + code + " does not exist"); } - + //security password validation PersistableCustomer presistableCustomer = order.getCustomer(); if(!StringUtils.isBlank(presistableCustomer.getPassword())) { //validate customer password @@ -425,7 +430,7 @@ public ReadableOrderConfirmation checkout( Customer customer = new Customer(); customer = customerFacade.populateCustomerModel(customer, order.getCustomer(), merchantStore, language); - if(!StringUtils.isBlank(presistableCustomer.getPassword())) { + if(!StringUtils.isBlank(presistableCustomer.getPassword())) { //check if customer already exist customer.setAnonymous(false); customer.setNick(customer.getEmailAddress()); //username @@ -434,8 +439,8 @@ public ReadableOrderConfirmation checkout( throw new GenericRuntimeException("409", "Customer with email [" + customer.getEmailAddress() + "] is already registered"); } } - - + + order.setShoppingCartId(cart.getId()); Order modelOrder = orderFacade.processOrder(order, customer, merchantStore, language, @@ -447,7 +452,7 @@ public ReadableOrderConfirmation checkout( order.getCustomer().setId(modelOrder.getCustomerId()); return orderFacadeV1.orderConfirmation(modelOrder, customer, merchantStore, language); - + } catch (Exception e) { if(e instanceof CredentialsException) { @@ -464,26 +469,52 @@ public ReadableOrderConfirmation checkout( } } - + @RequestMapping(value = { "/private/orders/{id}/customer" }, method = RequestMethod.PATCH) @ResponseStatus(HttpStatus.OK) @ResponseBody - @ApiImplicitParams({ + @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "string", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "string", defaultValue = "en") }) public void updateOrderCustomer( @PathVariable final Long id, - @Valid @RequestBody PersistableCustomer orderCustomer, + @Valid @RequestBody PersistableCustomer orderCustomer, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) { - + String user = authorizationUtils.authenticatedUser(); authorizationUtils.authorizeUser(user, Stream.of(Constants.GROUP_SUPERADMIN, Constants.GROUP_ADMIN, Constants.GROUP_ADMIN_ORDER, Constants.GROUP_ADMIN_RETAIL).collect(Collectors.toList()), merchantStore); - + orderFacade.updateOrderCustomre(id, orderCustomer, merchantStore); return; - + } + + @RequestMapping(value = { "/private/orders/{id}/status" }, method = RequestMethod.PUT) + @ResponseStatus(HttpStatus.OK) + @ResponseBody + @ApiImplicitParams({ + @ApiImplicitParam(name = "store", dataType = "string", defaultValue = "DEFAULT"), + @ApiImplicitParam(name = "lang", dataType = "string", defaultValue = "en") }) + public void updateOrderStatus( + @PathVariable final Long id, + @Valid @RequestBody String status, + @ApiIgnore MerchantStore merchantStore, + @ApiIgnore Language language) { + + String user = authorizationUtils.authenticatedUser(); + authorizationUtils.authorizeUser(user, Stream.of(Constants.GROUP_SUPERADMIN, Constants.GROUP_ADMIN, + Constants.GROUP_ADMIN_ORDER, Constants.GROUP_ADMIN_RETAIL).collect(Collectors.toList()), merchantStore); + + Order order = orderService.getOrder(id, merchantStore); + if (order == null) { + throw new GenericRuntimeException("412", "Order not found [" + id + "]"); + } + + OrderStatus statusEnum = OrderStatus.valueOf(status); + + orderFacade.updateOrderStatus(order, statusEnum, merchantStore); + return; } } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacade.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacade.java index 4a9c8e7425..465a446a32 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacade.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacade.java @@ -5,6 +5,7 @@ import java.util.Locale; import java.util.Map; +import com.salesmanager.core.model.order.orderstatus.OrderStatus; import org.springframework.validation.BindingResult; import com.salesmanager.core.business.exception.ServiceException; @@ -28,7 +29,7 @@ public interface OrderFacade { - + ShopOrder initializeOrder(MerchantStore store, Customer customer, ShoppingCart shoppingCart, Language language) throws Exception; void refreshOrder(ShopOrder order, MerchantStore store, Customer customer, ShoppingCart shoppingCart, Language language) throws Exception; /** used in website **/ @@ -43,13 +44,13 @@ public interface OrderFacade { /** process a valid order submitted from the API **/ Order processOrder(com.salesmanager.shop.model.order.v1.PersistableOrder order, Customer customer, MerchantStore store, Language language, Locale locale) throws ServiceException; - - + + /** creates a working copy of customer when the user is anonymous **/ Customer initEmptyCustomer(MerchantStore store); List getShipToCountry(MerchantStore store, Language language) throws Exception; - + /** * Get a ShippingQuote based on merchant configuration and items to be shipped * @param cart @@ -61,13 +62,13 @@ List getShipToCountry(MerchantStore store, Language language) */ ShippingQuote getShippingQuote(PersistableCustomer customer, ShoppingCart cart, ShopOrder order, MerchantStore store, Language language) throws Exception; - + ShippingQuote getShippingQuote(Customer customer, ShoppingCart cart, com.salesmanager.shop.model.order.v0.PersistableOrder order, MerchantStore store, Language language) throws Exception; - + ShippingQuote getShippingQuote(Customer customer, ShoppingCart cart, MerchantStore store, Language language) throws Exception; - + /** * Creates a ShippingSummary object for OrderTotal calculation based on a ShippingQuote * @param quote @@ -76,7 +77,7 @@ ShippingQuote getShippingQuote(Customer customer, ShoppingCart cart, * @return */ ShippingSummary getShippingSummary(ShippingQuote quote, MerchantStore store, Language language); - + /** * Validates an order submitted from the web application * @param order @@ -89,7 +90,7 @@ ShippingQuote getShippingQuote(Customer customer, ShoppingCart cart, void validateOrder(ShopOrder order, BindingResult bindingResult, Map messagesResult, MerchantStore store, Locale locale) throws ServiceException; - + /** * Creates a ReadableOrder object from an orderId * @param orderId @@ -99,7 +100,7 @@ void validateOrder(ShopOrder order, BindingResult bindingResult, * @throws Exception */ com.salesmanager.shop.model.order.v0.ReadableOrder getReadableOrder(Long orderId, MerchantStore store, Language language); - + /** * List of orderstatus history * @param orderId @@ -108,19 +109,19 @@ void validateOrder(ShopOrder order, BindingResult bindingResult, * @return */ List getReadableOrderHistory(Long orderId, MerchantStore store, Language language); - + /** *

Method used to fetch all orders associated with customer customer. - * It will used current customer ID to fetch all orders which has been + * It will used current customer ID to fetch all orders which has been * placed by customer for current store.

- * - * @param customer currently logged in customer + * + * @param customer currently logged in customer * @param store store associated with current customer * @return ReadableOrderList * @throws Exception */ - + com.salesmanager.shop.model.order.v0.ReadableOrderList getReadableOrderList(MerchantStore store, Customer customer, int start, int maxCount, Language language) throws Exception; @@ -148,7 +149,7 @@ com.salesmanager.shop.model.order.v0.ReadableOrderList getReadableOrderList(Merc */ com.salesmanager.shop.model.order.v0.ReadableOrderList getCapturableOrderList(MerchantStore store, Date startDate, Date endDate, Language language) throws Exception; - + /** * Capture a pre-authorized transaction. Candidate order ids can be obtained from * getCapturableOrderList @@ -159,12 +160,12 @@ com.salesmanager.shop.model.order.v0.ReadableOrderList getCapturableOrderList(Me * @throws Exception */ ReadableTransaction captureOrder(MerchantStore store, Order order, Customer customer, Language language) throws Exception; - + /** * Returns next TransactionType expected if any. */ TransactionType nextTransaction(Long orderId, MerchantStore store); - + /** * Get orders for a given store * @param store @@ -176,7 +177,7 @@ com.salesmanager.shop.model.order.v0.ReadableOrderList getCapturableOrderList(Me */ com.salesmanager.shop.model.order.v0.ReadableOrderList getReadableOrderList(MerchantStore store, int start, int maxCount, Language language) throws Exception; - + /** * Adds a status to an order status history * @param status @@ -184,7 +185,7 @@ com.salesmanager.shop.model.order.v0.ReadableOrderList getReadableOrderList(Merc * @param store */ void createOrderStatus(PersistableOrderStatusHistory status, Long id, MerchantStore store); - + /** * Updates order customer * Only updates customer information from the order @@ -194,6 +195,11 @@ com.salesmanager.shop.model.order.v0.ReadableOrderList getReadableOrderList(Merc * @param store */ void updateOrderCustomre(Long orderId, PersistableCustomer customer, MerchantStore store); - + List listTransactions (Long orderId, MerchantStore store); + + /** + * Update Order status and create order_status_history record + */ + void updateOrderStatus(Order order, OrderStatus newStatus, MerchantStore store); } diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacadeImpl.java index 2b12dc5153..41d4502878 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacadeImpl.java @@ -1611,4 +1611,28 @@ public List listTransactions(Long orderId, MerchantStore st } + @Override + public void updateOrderStatus(Order order, OrderStatus newStatus, MerchantStore store) { + + // make sure we are changing to different that current status + if (order.getStatus().equals(newStatus)) { + return; // we have the same status, lets just return + } + OrderStatus oldStatus = order.getStatus(); + order.setStatus(newStatus); + OrderStatusHistory history = new OrderStatusHistory(); + + history.setComments( messages.getMessage("email.order.status.changed", new String[] {oldStatus.name(), + newStatus.name()}, LocaleUtils.getLocale(store))); + history.setCustomerNotified(0); + history.setStatus(newStatus); + history.setDateAdded(new Date() ); + + try { + orderService.addOrderStatusHistory(order, history); + } catch (ServiceException e) { + e.printStackTrace(); + } + + } } From cf994b77104d9c27a6b3dbcb5a9a02af863d3a3f Mon Sep 17 00:00:00 2001 From: Jimmy Nordh Date: Tue, 14 Sep 2021 15:41:23 +0200 Subject: [PATCH 32/34] - Added productShipeable in LightPersistableProduct as it may be interesting to change in such call --- .../shop/model/catalog/product/LightPersistableProduct.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java index 7aeb5e21aa..d86f7e8472 100755 --- a/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java +++ b/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/LightPersistableProduct.java @@ -10,11 +10,12 @@ public class LightPersistableProduct implements Serializable { /** - * + * */ private static final long serialVersionUID = 1L; private String price; private boolean available; + private boolean productShipeable; private int quantity; public String getPrice() { return price; @@ -35,5 +36,7 @@ public boolean isAvailable() { public void setAvailable(boolean available) { this.available = available; } + public boolean isProductShipeable() { return productShipeable; } + public void setProductShipeable(Boolean productShipeable) { this.productShipeable = productShipeable; } } From cf15e82cfca35f94a994bed644b710238fc1f08c Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Tue, 14 Sep 2021 21:40:12 -0400 Subject: [PATCH 33/34] Category api --- .../core/constants/SchemaConstant.java | 4 +- sm-shop/SALESMANAGER.h2.db | Bin 1777664 -> 5971968 bytes .../api/v0/search/SearchRESTController.java | 71 --------------- .../store/api/v1/category/CategoryApi.java | 4 +- .../shop/store/api/v1/system/ModulesApi.java | 4 +- .../store/api/v1/system/SearchToolsApi.java | 86 ++++++++++++++++++ .../store/facade/user/UserFacadeImpl.java | 1 + .../resources/shopizer-properties.properties | 2 +- 8 files changed, 95 insertions(+), 77 deletions(-) delete mode 100755 sm-shop/src/main/java/com/salesmanager/shop/store/api/v0/search/SearchRESTController.java create mode 100755 sm-shop/src/main/java/com/salesmanager/shop/store/api/v1/system/SearchToolsApi.java diff --git a/sm-core-model/src/main/java/com/salesmanager/core/constants/SchemaConstant.java b/sm-core-model/src/main/java/com/salesmanager/core/constants/SchemaConstant.java index fb281c3ebc..615fdbb36d 100755 --- a/sm-core-model/src/main/java/com/salesmanager/core/constants/SchemaConstant.java +++ b/sm-core-model/src/main/java/com/salesmanager/core/constants/SchemaConstant.java @@ -12,7 +12,9 @@ public class SchemaConstant { * */ //public static final String[] LANGUAGE_ISO_CODE = {"en", "fr", "ru", "es", "ar"}; - public static final String[] LANGUAGE_ISO_CODE = {"en", "fr", "es"}; + + @Deprecated + public static final String[] LANGUAGE_ISO_CODE = {"en", "fr", "es"}; //which descriptions will ve used for reference data public final static int DESCRIPTION_ID_ALLOCATION_SIZE = 1; public final static int DESCRIPTION_ID_START_VALUE = 2000; diff --git a/sm-shop/SALESMANAGER.h2.db b/sm-shop/SALESMANAGER.h2.db index 414a4647f213ef7d1bce2a56d64ab1198491117b..eb4d452c778cf6ae575b8f55dbab9d1bf93eb27c 100644 GIT binary patch delta 31850 zcmeI5cYG987x(AR+}YjiZn6mklHEWuJAj}>O(nsaO(BFp5<;>|HKB=_?vj52CLQum6NNMe>goRDsik775X0l?uXMXV57D`Y?ZG`XZ}5 z&!!9G=Z>-ly7hb0@J8ey%SmyGa34o2!78vCtO0AmI)Hp98^A`e32X*iz*evgl!NVH z2iOTd2fM&-um|h~`@nv103fYyatOj|uxC*X;Z^3uqd(O>~>kw{$o8SlVBe(^A0zZRaz-@2`+y%da zdw}KC1MnO89X#YX9@)qf0D%_(1tQP^Jum=2U<4*$c4OlY0)Pbsf*?=@R0YAH8mJCJ zKq#;R8wdk6Kur)1B7g+!KnAryZBPe11?qx&;A!v-s1Mwc*gOlK1J8pf5Dj8LEQkZ~ zpaDn#iJ&2P0lWxa0xyGCz^fn$I6yK;0jVGjGy>_MF~|T-KqktcZwjFq$O73Q2Q&w{ zpasYS`M?QWpe1MpT7x#AEocW`0|lTEva z-9ZoVE_e^T4|;+Rz=xn0_y~LqdV@aT6Ywec46x!X0>z*&=m+|P0iXm71cSg}Fa!)` zHw**A!3Z!Ci~^&<7%&!$1LMI2pn!>B5||98fT>^_m=0!uQcwnFf>~fTm;>g5d0;+R z02TuGB5W3eC15F729|>rU?o@uR)aNQEm#NEgAHIK*aS9%Enq9y2Fk&9umkJ_pMzas zH`oLAf_-2=EB^x!4uV7AFgOB^f-k@^a2$LIz5*w}*We^L1x|xA;4C-?z5(Zf3N%mw zE`W>R61WVmfUDpd_?DIbcM!e@*TD^N6Z`;v1h>FX;Aij)xDD=ryWm%F58MY2z;EDp z@Q~vK4iLZt90(MMKnL`|0Q`W_jg1MIfjVrt|EO-t)528Rchyk%64#a~7AOR$ThTsM8 zB6tbB3|;}Rf+XMo$sh%!f;7+wq=UvF1LZF?fshHBf@UBKWP=>g9OQx)AP?jNCvbt5 zpcQBh+JLs89e52CfI`q7bO0SeC(s$Z4!VFhz?&$4;VlSngRY<(cn5R`J;1x*J@7v0 z2|fTHf?nVw@Gf5-<=90)yFwL%>il3=9V&z(_C( zj0R)CSTGKZ2NQq-CW1*|GMECUf@xqnm;p*b8JG!Xf!SaVm<#5C`M|vZn}uKzSPYhc zrC=FY4pxAbU=>&m)_}EO9as-GfQ?`i*bKIStza7{2iw68uoHX^c7fes57^7fe;_@Fn;PoB&^gli(CM4bFhG;2ih{oChk_#RvbH^5Es1Naf#0zZMD!7t!8xC8EjU%@?aA3OlRf#1PHj-wnPfCmD= z4^#v?pa%vwHh#beOu!8MK>)CTKoA6~fT|!ER0GvP2nYpMU;|;G2B-- zs153Xr$Alcu7}Oj;2BUKM1p6*bKrRp1)@O=hy`&V9y9<6AQ3bKFMt=pOW>>azJyC3tE6YkPn=|1zLhupfzX%+JbiA zHBbNwL3_{vbOfD1XYe}cg7T+tKzI|p1>Oc-K{xOY=ni^-cfot$eb5tp06ql0z(?R? z&>QptpMX!nXMh!N5hwN zuo|oZYr#6O9&7*`!6vX7Yyn%rHc$?>gB@Te_#Es4yIJ|~fv^|s1N*@Na1a~ z15blzKz$Gio(0c==Rp*R1~DKO#DRFw03?7!&=9-;UIZ_Jm%%IGRgeT6AQ_~9RFH=9 z7aKuH2aQ1nXaX`pQ_u`#fozZinuA=>0_1^w-~=wv60`!XK^xE(v;(h!0#FFrgASl0 z=ma{W{KeNHbOCRGH^E!rZO|2T1Mh(Dpa*ytya(O~J;4XyL(mI+1U?46K_Bo5_!N8w zSTPrYV$c`#1O34OcA^9f1cSg}Fa!(*!@zJb0*nNsz-TZAj0NMscrXDdU?P|VCW9$p zDwqbQgBhR{l!2LG7MKmBIoQkv^T2$t04xNHz+#T$)-Jb_z~sZw$Lp4u>a@g8a|SG* z?)1Mg!|CrTb(;H@InCTmr|H#MPUFJaPQS0`IQ^36It|_DIrSCuo%)akPF?>M4u?)p z`|*<9f2b0@*IHKzziYFuJ9pPsOTVthFk2OV?NKX?A2b`u$2c4!Whn&WKhn;?Fk2w9R9d#NSeBsnjJLc5w zKJL^#v%+yjT=&dg>k0k5kvbc{c9e}2zHl9t%=1|Dm+;Pfa;{?&VZr{r~j-APV?=HPP6Hf)AZqGr*YO5r!n}d(=Yv+)3EJZr~cRPoca#mJ9Wda zJ9WYhr`YqRlg?Y=XiL{k9c1kUm(MH_E}siZ@nLHnC8=hZaozMe)@{Pvz_38GArNhr zpmK0W49r<}(=s|oG#i5c=2y4juKkZ|$y2Wi!7(3k5=Y93MAe7ffAQbD9Kmyh7X_VI z`=PpsBbNWCyKDMhalmu?1G3+!51NfOiOy8wA{0}(MIsSOeeW*QyL;Qa8|vLH^6n0J zci(w;rtKCfMI^d@D$zNf`}bssTnIf+?DQKVHP3F;C^9NCvQuQw_de*H7L`<05(IjQ zINRg zHJ7?MUN3&0&^^*i+-}wQlJ|}uRPiMh7R~3<3&Kt!xn@@F`z(!oy?xjBlfILzlEBkC z&eHG>F-0}G)++7muHX_0-67=&Cn&9}8e>RCf>e)>r{$7exJT(zs?jc{Cq%~4tx^QH zMKvDszUC)YJjCUzhJl1`l9ITMYT$A2(|;kV(XASra_gn0+&a}b+J3D>D(gK*w_1r z-&C=$W=!W6;KB1BJ@|JuG>MywpXNOJ=^@^w!ET?0htBlnBTtL@OKw_4Gxz06p~8$u zD)fa4Dy+Y0xO(cNT<_;Az{$9F(xYqpGj(+vIR&LK;ZZ3JKq+t;9kU~|c{?4e8sohB z4phZB;x8A*e?ICW=YN@NL{b0Z=x8Zd7)9tHyr6R;H%iKvY}{bgXyZmm@!ar=z;bUM zq*oZrxfar=sxXGop;87nL^U4sK6t2#fvTOVd*uoV#e<~A+(6aX*n4icDmEtmP1V4R zfgS8&RU@P0BcmHcMkho@Cq_mq&mFet+|uUYn8=ve$e6gunE1$;29Yrdkuiz1MCv4z z5IRB?JGD>a`b!GePc9(NW~ZNC^&2OCD$!5r7*(8j!AyiccG_F@dqs5jmS}HellaO7+DG`vPJ5|-4a8m& z?M26&)ohIP@(#3%aWj zm^O)G5xSfE?@5$@pb|;sHw_Xbku+N=+5WZPaR2MU-^*F757P+`@z1iIkW!(7j|lpQ zQ7+{FGR*y@^9=jH^~M9xO=3J`-Q@4XZPM#{SHs-2hEbUXh0$VxLzc3$R6{~QiX+d_ zG&{W@Eh{g#m0T~$VoXcV&TUnYkt#<@Ndbl7l7H2w>2`uKWdm_E%}dLb@*K%c(^N~A zMV1_?sZvUIR*Sq`M@CkjYN#8gv>s^-bIYYy{p!ih(sEN8JF@bUK1~`*vs2ULr`5oR zYG6+3LmDU3a$?Ws`e-$?RBM)2CClDeHEt&I(_|mNj0$|FKUc)*;ah|ON0y@%zZ@V@ z@`??chPAPYi^1l(By8$sVN z;?G;Lxw#*kYbUX}a2cDkx06KvcnL2(P4-W~ars~7@osEpp1@|(MQldj!i9s2 z1nGHFJOanPr(*NoLTuh#k4^jCZfsk9iB0ngY#RT7P15hUCvg~+UL?^>m#61rBe92v zevVDxmy#%uP7@4LE&i?Pfs#nx*nywlK8Q_M_Tp_SyP*BuDo8?hNmX3Xgq_Pfjm=wE z@$7CFt4Sez*P`k;<$fE=@B_xzluUf@DdAEJ;#`I6^0#2qdJlWhXZ<3i5OQxQo<@q- z;o^Qr?UIS~x(D&YK{CYdvvKjT<=DKByyC}=s)ZYRT*S@Xh|*+9B%@eb$1>$d9>oR0 zC!6AeiW?H1=$`ZdKQAtI?Bo|*&5?rm77Lo=4u!pF&fr`;eT4!M3uF+dF2F5VAY(U9 z+=ct*AIE0dc}e{H*7Vo zWTmFHRBN^1&@KZDqGfuV8OQ@kN^Y7XFRk=VH71+)wAF!{!K?=D#8+dGhJ7?jTOT0YPBy2J?MCw+p5)gTeIB_RbC!uwZ5W>1wslMyyKS&fnEq| zq6X%bwXM~JJK$)`6=~sZ*(0j9Ez42OI|$wHXm+vM499FCrKzLEg|PHcW!P}5)vb{% zO-Qblu5#^)O0}RoHL!JAo{%cjeU7|~5i{5$EP2IdHFO`LdmU}K0~Nsw0$Q|ck(bu2 zAS*jBqfthR<5KwVp;!Ain$<|pUC@HNm~wKnQ}a{u3Y?DI z3@xH_h!Q>58k#MK?&(yaJ5b)4%kHvg&d5@;;B++2?>w_2NK*rQXv9sXiFJ#)Ia;{e z^JsVZ=NfrNeeMcR7t*>jxUaMt3ZK_1=dwtzS%na#V4gKJrOq$grBADsONRX!VO>ubQ#k4}_^vSoyAJDL!gMPT%=^BDbO#sAId zFA}c%>4VPP!!YWx+Q*wh(LTo4_iQsmrDr2l>YrCZ{o^lEf5Yk8=;=Lklj>Kg`Odf0 zeDZs0-f)AOC*PvxPa?(-_1w3}vpwM1eite|ZCN84>Z}tDx(%ZK$|h02*Bd! zo_qD7Qa5gWQ8=tPb2#6Cu7x;@iScx`6fT^ibT&JRr7LkXN2GJvQ50Q@qxmA8r<%fP zqv&|Ls3?M4sG1^#w1#v+VL0sM(yzHrs&JBvl3H>Svp5&2rkASw$9ZN6BAX@DR7P(w z)o|0fQV;1cw?sAN!eW0(s^PtSsTwG8vx^+u6xAdNY0-3=6mDO{jlmnajKcYZPLX6` zoJdEhCRzH0n*_Z_Gu@);MCewV-r_5aCVfUM46lZCykwUOxbdnfsqg|fPP!mTur2ZY zv692hoseTV7}=e~^ahdfbPSYTO6XnHG(dij8->UI>dlT}cZ zgx*(8uLx;z^u82M?$HX%PhRV9q-tuz<;$fN;w?gdm6{4?2tBNt-$pv`O5uD{dQ~;o z#Cz{ZHTi1vh8j?l`$eiLY$Wt3Q#+CVgcN+i#02`I6waMh121vcadBJvm1=sCHgd-# z(C?&h8To+nliG0CaKqQ^h6eNs#IxSiUqJ3p=N_Je}G(xMpRWSkCv>g|Q zunQCDHazniLaizd!IiOeOHn9iQ+1(u-6n`(OpK-*Al6`F6kP|grbR&fdkq6U7x6DXCM(9{z`Hi7x;{3uS!z~Bw8#35_gTLY$~~NObCOEzQUL7S$;@}M z^G|keVD8`8x%C3`GaESL5*^OinB1lr3C;5xN-Oj&l4D~Wxp{Kwby823rckf(`b`)NCC>l{5EjY+&qA-qNnx+f$DjA?GIrXh8*R^eUjqGQCgi1>A5gynu}j z<^s)FMGeN#byo}P!e`~B$vw0>T|%>>T=BUHDS62`iHW&!xz5Z4N2|=H*^QcMLYJbJ zTCFbZab4s++#M$4LH=EeHfTZ>N0*{Es;Ndi@3x~0x1pl?k-}Fh!gl&aJ7b!rMm5WI zIqUGo=GpnV&6~#M=O;&Lq|F8WYdlPWimF>wOHNt7&_JfYIP$qZmumL*82))M{LPyQ z{n?Ss9nz{LKNUjKvoF@G8mip<-DXYDNH()WjAt(e_GG4rQ^5H5lf%i4ycizrNuo@Lu06&4Wzf6n2@u%*GP8slk+f++7GuKYKCF;4Cy8W$8Y2$&h#U}0^hHe z>y`@3DJkG@2CctZx{rQI=E9Uy+x%;UC7E>8-nc{iF7J~~WWT>Y$aH~wfJ5!?hbf&-+6bY72f;2yG-odmcD|R(_au1O9W9GB!~ukuS$jACC}0Rs*d$G{R%_40ZeQ_i}8DX3^2M7A(1}hlR_}Qc&_;k zC!T>j0|!y`K5iHS(Tz^%SDdIzhq4nG0&rp&6JzNw5Qj4{hW;dl(Aspm;8ca1MvvdB zbE8;{1%=^o(D<`n{wBm}OpK@3F?4^!tLCt7KToHtdX|!}l0u*-#29*9YK$>~mZENp>4}l<1o{QWYK#SC z@bkz~+z~01jRglaQ#ZTF9l{ue{(ZI@*pfSd>(HamfhD1992XglaRH+QM$);e3EsHa z$Y?nIB-TC8Q_T`hgc-04#|H_Wuj)1q%%t+hk)xZ>g~jC+Fo zlcFM{BV!_CBjY0DBO62}L`qrqOnqdu*Oh9Ix3>=ZS3gt3NOw$BWQ-JR@Hv|32C0t# zvuL>*Fcq&}hnLMEbOq8QwI(p@ByOdq`v3*78flqH=qlCRkT#4=gkdL<8N?o@8c!Ft z=2qasHL9UC+=ZcJDzSg4ni?jx=9b`b@Jy}8Ys3z@^()pd6(L zm?ae#%m6vBnp>8rYp30y|%JGk^0$&My<3U!%lEWghi z&d&a0))0s0FQJW{_LNiVQXz)^NS-TqKt*25*(GrWrpY{x3_fsK&1LvGx|V4_>ZjAhbgIh|@G< zRi=pafl3!?`aBYu=rfjX5sWX>m_K7W8)S@Lf5t5We@2t7CW(zJKRf$lT={00tsgu3 z#fdhnU=?kL8>7r=(oP88e4mpz|DOn!j~`g>T7I_tVEJAOtn9WQ4JQ9VXu(zOuaA?r ziE;L=Vyu0O7-QcoM%#T_{>-$T!L%%`916`plUh3Z6R}g2h0=VhDY#ljG`gJ_XnET? zkx-n2hhwC736Kr)%JPS{91Bk0ah|~GpP94q5Q|w3R}Me41$)AknKjUxCG8aHDg=Mr z6iM^@g&_5^G@X&IX71#C^hT9cxl+kchE$e}D-x z_EnW_3p`u5XFJ2Q-R9YzXIn+z-kg+HoUz0a62{XiY@&+cYC$z1+j!A0?Z6mK?5=O1o@+u~+B(#;hf=SB>Z7DBf z66VJ)c?l%9eKDai%A%Jn#*NODkU^W zp24K)gl5arm^78pEO`o(CKK9Bp2Q@ykEXK1BxHN0Jf2D82yG&dZO23`-ekz5nFJHF zu{@GVBM42Ghcjsyp^fCBOv31tCJ$!PAVO2+flR_`Oo}{!N$5C|<$g@+OQ=IGmS}`h z;~h`-zvSJu_3l3L?xuQoo4vcU-rWQ5u10t7ecoML@9q=tZmM^;ne9T9v)%neBc+Q5 zLALXDnb_^Vw)KEj$vLb_&i$iGKD1yWq*In`F-b<$x(BQd()-HR2ewGhBuJTZ-})Aq2wVWNn>;g02o<oS|Y^Ln!*Y z6UBsc==ltV_5T>N26#KckA6ib_~JcVBi6(oI$?|XW}>W#)lrtd;AdBk{%Q+TM*nK- z$P)SmbI$Gh2ni*Kr}$r1x@Cc2^%bG%DYvA)T8U`l?AylgnD3%t%txt_`e>05YLqU54bJ}tFC z<(`p3Fi#)DK5IGor+Io%n=mD3qpk*34e?=0pkG*x{4#;f!&ms`;X|caDmPhrGwF3* z0dr2X>3DrLuzgv5Azr4V9eudTT6iBer3~&Pt>>FLd)@-@=)V%32ctM_B>-}l*6c!=YDZj=`OK6{?+efvAA^%z!v9o^u|w|CRR zx`w92HOgw0AC=>5*)lITIWs#tDz{m5ljf~l8cFF&)0#Olnx=M1d%n~A7lT}CU=~-f z$Dh!Fj&>Ye{BUbzYoYBNZB^qALQ5RYxO1A+EG@sIjpSx@?p$Hp8>&pbZL_AsLvTqr zTG)QT7Z+&fD}h;RU_n_|0e*}Dj;`DcExapxP)OIp9jUKwudUX^ET_L?C`{LyL-mfl zyxffB{Jg7S$3i`!M6ntvPX6-g+Qq#ztbW5Q(n}4@FY86(*<^iTW#7`Dx9i{|vQwC; zp3$xT^NIu@H@77Oviq%%h0ie z>3ELm__Q+OjxES*LLtNZGDVLtMbCH?9r##^4q}QfVTvxTRCEwibRZPP1i@=dq(^%c z?e7{4)dnit&FIDTmN2Wb%@XEd{rdpd9-JAZ{4mriD}~=03`!6GFj0AHvrbk-OW6CJ zq4Xi9^eKF>E!fpL>~( zXFWQOek>iwFdf%09oJUsIEK~F(Wsx84f|R@+$2zFm}?dk!W-@Wlf8NTxnEdMrs{BX zdDJ)PcvX%178!ff5H^pE#(S8)$36OveJp*)F@4uL$wZ+Di`4@U{xKT=?T4TkjqxRD z?0@(a6fW{-|1uh{$4b~pgG~xDw`k_b!VD)@eooHMluXr?9tK-T5Q`3p`@=t;os*ZL zXd|uFlu^Ii#1~6>3rg$opT=E7lFB7kK@bR5QuA{ic^TPR-nbB{itbTdNP{qCyPqwr zglC+_Yc;xuDrb#0Yh#V?t_tn?8hk$Sj?5@X0~Ddn(uzW)UzV+6!RN*60j&g#nFik zYn?o!Q71=B)r4VfGKRGST5vO6dRlht?5s46&bw%h3suVeJ#PBEa)dKo(gIr}jT&jq zO>(qmj``M}1hy{UP$6zC_d3%j!kNB}tt&UmXqr~gI0JT2ZY#}JSRLyN@mN)G#$~l^ zp6HCuiq6e!ncpZw{-NZvT1_iWbyXwd9ty5gN%dw+ktqbRD z7uBGhgidheaA&mO9Fmf6&$LsW&&1N`k_u~iXtdMOuz6HgCv zHP%R>sxP#+tvmWs%|TqWYIzM~GaUHiF*Z;0jm@TRs(yQgcvRKbRE_5e9p@Ox9n)&% z57caZLSvd`H_L0B+$c9MJtHMMrd6wKpXI0d_2F8SjxWC8wdz(&ODclCWyaWNBvwWv zSYO#*$FcT07VQptTy2k3Vq@_r7iNLV6kXUH)@_V-!S4GHpI|Ha1iP4NyNhZ2 zg-2WEv9z7YwB5wC-CU{dM5e6*ZQ&>Mb$AJp@z8IKYbf-?8}0smy&Yb@#b#G_S!^$| z93AW0i^MDoud|r1W9c}V>9~dIxV2Kp$xO#d&=HPJkB%0fbu-Szrhb!n zW!nSzQW^)?y0Dxb@4~c?PG)1r0ma^0tf_n!07sGA-!>%|y6z;!L&ii zYAQ?AHkPRJ%0x|NiJF2$Wz(I$Y6AZ))StjCA!VD{*4<kw#l{mbxj-R#Ys0 zwiB$Nwz4L((9>jQJyw&M&2-%5B=dz6n5F;2mkqEB@M%NrfB3cmcEK}$u?yB9^YF0) z%e<+35UQY0Y?hmoneXx}m?!!Sg5W;_pO|5go#h#bF;CZ5`%_@sJ4tLUeHCk+NB(3h zRB!V)Yw6F0$FVr%=+1o&3xQ-bbIft<$Go%s3C-3!G%KN1K9;Px6{MbmdyDVE|F!g@HZ)#zgQV?vx(VcQj&9hK4`rBTb2Mrlo4jT|wF z2?^v2r(fjSJk?qY{7?<-QuZN>e_P=AkejO22>;Nd<%b%v zt98(5=fnT7UJDz*#&zYK&Srg4BYiIGUgKM2=4(|ts)5;M9qYiF);CODfl!C7d6 zST*x?o(Mcg8=LAXMjL|(Tf|!2G*>x}j_PgOSc}_CMxsC25sdyMWFF5MvFz~!`bE`p z5`D^EOSxseW%-}OxBt0^@#hS@JtHeKIwsywq$hFuB)t&TFkUFs^N9@!wh7S`+t`G7 z9ZtuJkYf^!5M%rb^(6X_@R#|l4ew$7%-+gG&gX0ElwUWRYO$nDcflL0Wb19k>}ZB- zJ4>d{R{jnWwvlxuOFdo5g2(Dg7BV&VF*WvAs?+S?(j0^Mwmh3jvkc;!@=PX`8N@ea#E?UrVGv)Jr!#4qLF_C~m8j7^ z#UOT)Cu8%+0>N^YEk{_k9Iecjs;}3AFDKsABlik=YVQ=35bb*Ek_BF1KY9k1gTw z*%ELGEU?x{QuQ_dWITM}F&?(EvfA@!u(Pl+J2MluINs$3YvJ#*an1U!y|Y^N08bAIh?j$%P(X8XGg2^z->zBT@^6&e z!j+gB7u}*|%j|TgMD?vw6SG{7mhhv$wY_!GYxY9>I~7#W0=qLqp?f0562d`2)|jQx z-7{`>FWOe&uNEQH1h&G)B#|9Kp<4yBbv5RIc2~`#?v07i!{NTy&tQuEn zfy33nj%CB;-?$CQzj5=l@Zp|^4Oi)I&3~LqWz`6;*?PwmgqqfyqS;1@2GjATz7$p-dyj**ul99q;%D6 zMIp^HQ<^1av}o0;RrBN~snM-kC4241y5)lgT_)DDlNXFLF9r@{s}H?NqKw-2Wo7GF z!&=8`v<|f5RYb|%YN~2ZN4yRi#6r&`ABL%ClE26^$b?zwM84trk9fL$KQ-+`XI7+U)Ll1TBTIQ0W7zDT{@a zB_I}EqB{wKWK>gkTs;eqK`>-JRdgZPt*j`7dq#ER&ICFGa((uY26P%8f~c=Zc9ck` z;KZ{`Oh8al2n+vujvY0m3Qiz~nO!p;ClK!x#g5|XSe%GqB0gM%7|X<1I!X%RitPcK z`FRRgEFFo6D-6vS5PdFrLh42!BB+2~W1(hSxuFP`hGV&bDt?H^560uM{*i#NIc^}H z*pNLjfrTBikgylLZ|#R8RIL};QA1jc%U*)$hrmO@(<8s^y$qp;0@mbT@m_Wxm$_eM zaw3a86fp5~u%iZuKM!F6V#(|%1`$ai_B1ZV8$pdAq@qwRmBmWOA_hH_eVUnuaA_ee zir&Nn8?k$$=?y$#IH5x{^B_DAA?YlfEJLLYklbi`4UcHz3AYZTS0HEN0ro2VWdZqu zk9<|r8zKG!i09*i^nd*XIWk(#`?tV3Z`@qXzxhBDp9)0AMn%R(N5)FIHI>V!X}DW@ z*Ay2S7atkdATlliaZH<8Oj}cxZl;a!Mdt;mlEu_YpcP12ZQ573Xspg^g1(e(y|Q_r7r*4m!{-?4SW%gM+s8q-J_MIhR{i7|xwi-3UO9qbnev z_Qs+vgLsCCF|3jEt!Ot@9D}zl!o4l&JM2MGbOF8>=+4AwL?Kp39AOW3kcjxh>WCwJ z7b>N?xmi%@eHLsNMavMomyHi%X^1?On}Lfm=m*|A+|%%=51E{Rpu_5jE9|A}t8>!p7$3^%Cp*qqt z6d4{ziwJ4}*RWQ3QV7>qts{nzv_B%?MpKLtUokW4MCCv+n!@ON;Ux8hSubWrpR#PX z74{^SA(@S*;4dqjXD0ayW+=_^7)t9N%TQX+45hD`8Ye5&SkG+F(;G}4HI}+&ZHYRB^F-e<+Nm?l;X=Rm@v_k?CbB3kpY-NfL2}sdvXT9aS(o?>#F7}r1 zDo^@u`+fm%h+>Fjc+Q|*vc}thA(4RyT%|Zk1Vu~W*NK2brj1f z3#~_(IlhExvB9Iow#U+NQZLo^a*(@PWPhh=a`X1jPZ#xnh=?Sv; z+5tXy`C4yf#9tX<%C7TP#`)gLcz~Hp1s-#0!T)A1`CO(8S<}>*wiT7yE@Vy9__ep_ z)-wmNa&Dd#^E)h`FrV*)dDe4mo;5~*79}1nriuTP(dN@)It#(Nz_hqnsl{{=v;1j@ zz&eZdTICCUD1uKtA?8qHqiZSVR(Pr1e~x#OSUv}n#L085ud}JwCfD~kJ?r28dWwR- zp0bANJ&%?3DoLG55{|{ zGw1i0HIDsE@heR6tCfoHXNvEG;+PT4^;A;Dxz%J*3fG$`b69NkI4t)092V@$UL|LQ zwK1y}+nB>bd1<)y5bG-Eu>4)&$=?HymA?m>n%9_`-&U%55Nj2ReZ5I$o|1A;Aj$!6 zAPW0nS-C&V>R>8uXNxY%jiJ`vOr_aOrR5%#4n3AihnY&>F_pfrROv8sZo+!6|6+#= zai0_~c@!7TKEhU}54C#YqIbGZ;Phcu+K0T$U4_G~SU?(T4Pt9vGW%q^cPP(#)a#xX zaG!gY_NKGSjHSJL0clF=5bG-}PPde-s3rvO_IT`$^W-DNqzVYs9beaoiO=|S&$f$a zJJ7S8=h^P@Y_G7bq9>kRUGFX(yJsWJv&_@Ylg#7HBh5q11I$I{KIRY2?;375|6@vG z?rQF0?qF_bZW*Br^xiqoyW8X4UGeVpy!YYWUAlMI#k(8m-Ocmv_F(6(YUp8j%h1X2 znxUm3*U;3^$dF`sLB9R(mEFYYwo!2lk@2St^!6=O#9x}&%*0Jp+(hJ!Ox!@ljYMA0 z#C25MKxF)J2EBa^71tAaH4|4+aUGHI*CX`y6;xbHhR93V&r7Jdn#hZp zxQL3Yh`f-A3#hn~$n%*vkBTdZjK3?Px6h&Caw5-W;w&mIBl1ipmQisjkxQ94gNjRt zJe`TtsJNKOQ<*r0ii?OmnTeCA=w3+ViA+|gxPZtLm^hw_^NBo;iDRiakH}+~IGT!c zi9CvlBdIut$oRt*di!uH&L%ScK!)Bvl!~*6JcNmZsW_9!gP1swie*GDVd4NPmJ+!? z6Z=td29f(FiEh2Un2OVhT*Q8UD2UUD{5unW6U3=Re!#^0f;ff9_n7#rAWkOoT_)ZU z#7RWH&BR{>aUzj_X5vqRs1W%U6Mq!M2}J&Zi8lptJdtlO@wy<6Bl7o5{7w+Zx{3TP zldlQl7$RR~;uS$0P2|f=yd;RDh*}3E~JMt4usEh{K8e4HM4^;xHng zW#Sn@97^QVOgtrsLx_BmiC+uiU?QJj;#Yz=h{#_;blZ;$;y@xFV?Tc(h$Tcm%ETjr zIDp89nRrML`x6;|t3z);Ac*~lyq}5t1hFrX_cC#hAQlsOHxqXWViA!)PZD+Zor36= zcQC_hyC8lhmosUbAbu)uWzrTw{6yZ2KXjtAZxX~l@<#UK20`pCuV>OaLHw9~0id(5 z5yX$=)l6C?h`r>MOj;p`A9`)JWrFyD&xtFDJ$+7GL405KIB^#U;(PLZcE>zHeAnmB z72x*ux^o4%ecdzJ=`sO+-%=*c5X5dicdh^rFxF-#gQz$rY6Nh1X~g-0-HxB#c{FeVKZ#E$Y1CJh$cVh4E;69)=n zd%1*30|c>9?$4xtf>c%N6W5jTf`n3Wv^qo)??R-!SPMFE*9WGU*I2 zX3D3Tbcz?7$S0ZfH7{n!C*U8^*}vk&#`2d;I?jvf@-ZfT!HbRLqf9!&i)r#*5D$cyfm zSS>^)(`e3g(F8~7?AFUI>SAuq=HDj_e%`YIuh zk6FBxkQbwUm5>*syp_;Bix;2wEh_NhbG}N*i_iKhAumSyDj_e{_f1QH_$UiaZ z77?qrDEdh*jn9nDi|XtH{@wbd`uf@)agsCSss`iAfiU zXkjaCCVK@D1MC_R{e6{?h-P0UB%;Yz2?^$W-bzR?=kr!V1Hq*4glE!cF-j?+_CpBY zI!I#e2S|*(pTyYrk!X1@d9*V3B{PI>Fhl5Or6KesGa-+|gv6A!^pWk$!l`z7jK||X z<53xGZO@Ff-5$FUe{AOv&kNo^W4KN#C#vPi_DK#r$$=+1@FWMGlN|W}GY3}WSZK;W{UIXH-y!-B re})Kug=mGNx3~`9hF`}25vha)PW<~{Ls^HvhH{Vmb@^a)PV@f*qa@Ya delta 872 zcmZvaUu;Zy6vyXI=l=cO`@1uvJ(s2d1k{lW_~7W)5q)5w$=!uEX4fLTiz5f}+GQp8Av5s?vz z5t$K%5tR{*5yXhjh`|VE#AGDONQ{voNlzD6|wU(|LcPP26II_;4Nt|Zgqfu zzZ3LdPXnqt1KRDgpoO|XU2zVSE$2bL+YNH42PE)7T;nCn!~p5eyCOMqJ)D?ev~n+F z{lrtIWASzU&hn1*2V3%cEFoInTUwab4CZnUcykLF*~4JOkAS|T6_DQssN^VU(~g09 z^f)LtT~H>S0C~Ylkh)KSIOrwoL^;wPNt79Pc+GyhjHk|sh`-E?O9aEic2SrwY<3dd z#SZ4F5!>S9yPUZg{}4zGUUHt4uD8R%FU;B?`%zo?W0FxghV+n{+y14v?-9k5 zA5&xH6RO{PO7+qQ6jf!Z*5oB$p&)n5iii1+OPz+G58D-j-)IX}v4P-Edss$Y9W(c{+?EqX(>nzvMa`;MwVzo$y`2P)tANagWERGQ%>--{eqJK11Q zuCiL-xkZIt^lWk_@=qD7geUeo3ZF8pX#DO*r!*KlVBL`_V)gl7%YPI8M9u2Y6!(6i z*dC_FZ(pgN9-%0c0+gr$ZF()J%{xHxcY contact(@ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language, HttpServletRequest request) { + + // superadmin, admin and admin_catalogue + String authenticatedUser = userFacade.authenticatedUser(); + if (authenticatedUser == null) { + throw new UnauthorizedException(); + } + + Principal principal = request.getUserPrincipal(); + String userName = principal.getName(); + ReadableUser user = userFacade.findByUserName(userName, null, language); + + if(user== null) { + throw new UnauthorizedException(); + } + + userFacade.authorizedGroup(authenticatedUser, Stream.of(Constants.GROUP_SUPERADMIN, Constants.GROUP_ADMIN, + Constants.GROUP_ADMIN_CATALOGUE, Constants.GROUP_ADMIN_RETAIL) + .collect(Collectors.toList())); + + if(!user.getMerchant().equals(merchantStore.getCode())) { + throw new UnauthorizedException(); + } + try { + searchFacade.indexAllData(merchantStore); + } catch (Exception e) { + throw new RestApiException("Exception while indexing store data", e); + } + return new ResponseEntity(HttpStatus.CREATED); + } + +} diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java index 2e2e739fa5..e27018cc2b 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java @@ -648,6 +648,7 @@ public boolean authorizeStore(MerchantStore store, String path) { Validate.notNull(store, "MerchantStore cannot be null"); Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + Validate.notNull(authentication, "Don't call ths method if a user is not authenticated"); if (!StringUtils.isBlank(path) && path.contains(PRIVATE_PATH)) { diff --git a/sm-shop/src/main/resources/shopizer-properties.properties b/sm-shop/src/main/resources/shopizer-properties.properties index 0f92a3c03b..39c8c783d1 100755 --- a/sm-shop/src/main/resources/shopizer-properties.properties +++ b/sm-shop/src/main/resources/shopizer-properties.properties @@ -1,5 +1,5 @@ MULTIPLE_PRICE_AVAILABILITY=false -INDEX_PRODUCTS=false +INDEX_PRODUCTS=true PRODUCT_IMAGE_WIDTH_SIZE=1000 PRODUCT_IMAGE_HEIGHT_SIZE=1100 CROP_UPLOADED_IMAGES=false From 5c56ea49c76f747bd754864dd5ae21840a723905 Mon Sep 17 00:00:00 2001 From: shopizer-ecommerce Date: Sat, 2 Oct 2021 21:22:59 -0400 Subject: [PATCH 34/34] Fixed validate authenticated even for public access --- .../catalog/product/image/ProductImage.java | 12 +++++++ .../store/facade/user/UserFacadeImpl.java | 5 ++- .../cart/ShoppingCartAPIIntegrationTest.java | 31 +++++++++---------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/image/ProductImage.java b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/image/ProductImage.java index 8c582ca67f..7ed07b7779 100755 --- a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/image/ProductImage.java +++ b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/image/ProductImage.java @@ -62,6 +62,10 @@ public class ProductImage extends SalesManagerEntity { @JoinColumn(name = "PRODUCT_ID", nullable = false) private Product product; + @Column(name = "SORT_ORDER") + private Integer sortOrder = new Integer(0); + + @Transient private InputStream image = null; @@ -85,6 +89,14 @@ public boolean isDefaultImage() { public void setDefaultImage(boolean defaultImage) { this.defaultImage = defaultImage; } + + public Integer getSortOrder() { + return sortOrder; + } + + public void setSortOrder(Integer sortOrder) { + this.sortOrder = sortOrder; + } public int getImageType() { return imageType; diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java index e27018cc2b..bc0d5f0486 100755 --- a/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java +++ b/sm-shop/src/main/java/com/salesmanager/shop/store/facade/user/UserFacadeImpl.java @@ -648,11 +648,14 @@ public boolean authorizeStore(MerchantStore store, String path) { Validate.notNull(store, "MerchantStore cannot be null"); Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - Validate.notNull(authentication, "Don't call ths method if a user is not authenticated"); + if (!StringUtils.isBlank(path) && path.contains(PRIVATE_PATH)) { + + Validate.notNull(authentication, "Don't call ths method if a user is not authenticated"); try { + String currentPrincipalName = authentication.getName(); diff --git a/sm-shop/src/test/java/com/salesmanager/test/shop/integration/cart/ShoppingCartAPIIntegrationTest.java b/sm-shop/src/test/java/com/salesmanager/test/shop/integration/cart/ShoppingCartAPIIntegrationTest.java index f099628a8d..e2ed6b5cc8 100755 --- a/sm-shop/src/test/java/com/salesmanager/test/shop/integration/cart/ShoppingCartAPIIntegrationTest.java +++ b/sm-shop/src/test/java/com/salesmanager/test/shop/integration/cart/ShoppingCartAPIIntegrationTest.java @@ -1,16 +1,20 @@ package com.salesmanager.test.shop.integration.cart; -import com.salesmanager.shop.application.ShopApplication; -import com.salesmanager.shop.model.catalog.product.ReadableProduct; -import com.salesmanager.shop.model.shoppingcart.PersistableShoppingCartItem; -import com.salesmanager.shop.model.shoppingcart.ReadableShoppingCart; -import com.salesmanager.test.shop.common.ServicesTestSupport; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.springframework.http.HttpStatus.CREATED; +import static org.springframework.http.HttpStatus.NOT_FOUND; +import static org.springframework.http.HttpStatus.NO_CONTENT; +import static org.springframework.http.HttpStatus.OK; + import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; @@ -19,17 +23,12 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.junit4.SpringRunner; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.NO_CONTENT; -import static org.springframework.http.HttpStatus.OK; +import com.salesmanager.shop.application.ShopApplication; +import com.salesmanager.shop.model.catalog.product.ReadableProduct; +import com.salesmanager.shop.model.shoppingcart.PersistableShoppingCartItem; +import com.salesmanager.shop.model.shoppingcart.ReadableShoppingCart; +import com.salesmanager.test.shop.common.ServicesTestSupport; @SpringBootTest(classes = ShopApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @ExtendWith(SpringExtension.class)