critere de recherche
This commit is contained in:
@@ -13,6 +13,7 @@ public class Article {
|
||||
Date dateDebutEnch;
|
||||
Date dateFinEnch;
|
||||
float prixInitial;
|
||||
float prixMaxEnchere;
|
||||
float prixVente;
|
||||
int Utilisateur;
|
||||
String pseudoUtilisateur;
|
||||
@@ -131,4 +132,12 @@ public class Article {
|
||||
public void setIsDelete(boolean delete) {
|
||||
isDelete = delete;
|
||||
}
|
||||
|
||||
public float getPrixMaxEnchere() {
|
||||
return prixMaxEnchere;
|
||||
}
|
||||
|
||||
public void setPrixMaxEnchere(float prixMaxEnchere) {
|
||||
this.prixMaxEnchere = prixMaxEnchere;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package fr.eni.enchere.dal;
|
||||
|
||||
import fr.eni.enchere.bll.EnchereService;
|
||||
import fr.eni.enchere.bll.UserService;
|
||||
import fr.eni.enchere.bo.Article;
|
||||
import fr.eni.enchere.bo.Enchere;
|
||||
import fr.eni.enchere.bo.SearchArticleCritere;
|
||||
import fr.eni.enchere.bo.UserProfil;
|
||||
import fr.eni.enchere.controllers.AccueilController;
|
||||
@@ -30,6 +32,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
@Primary
|
||||
@@ -40,6 +43,7 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
private NamedParameterJdbcTemplate namedJdbcTemplate;
|
||||
private UserService userService;
|
||||
private EnchereService enchereService;
|
||||
|
||||
private class ArticleRowMapper implements RowMapper<Article> {
|
||||
@Override
|
||||
@@ -72,15 +76,23 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
article.setPrixVente(rs.getFloat("a.prix_vente"));
|
||||
article.setNoUtilisateur(rs.getInt("u.no_utilisateur"));
|
||||
article.setPseudoUtilisateur(rs.getString("u.pseudo"));
|
||||
List<Enchere> lastEnchere = enchereService.enchereByArticle(rs.getInt("a.no_article"));
|
||||
Optional<Float> maxMontantEnchere = lastEnchere.stream()
|
||||
.map(Enchere::getMontantEnchere)
|
||||
.max(Float::compareTo);
|
||||
if (maxMontantEnchere.isPresent()) {
|
||||
article.setPrixMaxEnchere(maxMontantEnchere.get());
|
||||
}
|
||||
article.setNumCategorie(rs.getInt("a.no_categorie"));
|
||||
return article;
|
||||
}
|
||||
}
|
||||
|
||||
public ArticleRepositoryImpl(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, UserService userService) {
|
||||
public ArticleRepositoryImpl(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, UserService userService, EnchereService enchereService) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.namedJdbcTemplate = namedJdbcTemplate;
|
||||
this.userService = userService;
|
||||
this.enchereService = enchereService;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -131,6 +131,8 @@ article.details.pseudo = Username
|
||||
article.details.mountench = Bidding Amount
|
||||
article.details.ench = Bidders
|
||||
article.details.lastof = Last Bid
|
||||
article.details.label.last_price = Current sale price
|
||||
article.details.label.start_date = Start date
|
||||
|
||||
edit.article.title = Edit my article
|
||||
edit.article.update = Edit
|
||||
|
||||
@@ -133,6 +133,8 @@ article.details.pseudo = Pseudo
|
||||
article.details.mountench = Montant Ench\u00E8re
|
||||
article.details.ench = Ench\u00E9risseurs
|
||||
article.details.lastof = Derni\u00E9re offre
|
||||
article.details.label.last_price = Prix de vente actuel
|
||||
article.details.label.start_date = Date de debut
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -124,21 +124,24 @@
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h5 class="text-dark card-title text" th:text="${article.nom}"></h5>
|
||||
<p class="text-dark card-text mb-auto" th:text="${article.desc}"></p>
|
||||
<h5 class="text-dark card-title" th:text="${article.nom}"></h5>
|
||||
<p class="text-dark card-text mb-3" th:text="${article.desc}" style="overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;"></p>
|
||||
<div class="mt-2 d-flex flex-row align-items-center justify-content-between">
|
||||
<strong><label class="col-form-label mr-2" th:text="#{article.details.label.sale_price}"></label></strong>
|
||||
<div class="col-form-label">
|
||||
<span class="text-dark" th:if="${article.prixInitial < article.prixVente}">
|
||||
<i class="fas fa-coins"></i> <!-- Assurez-vous de remplacer "fa-coins" par la classe de votre icône -->
|
||||
<span th:text="${article.prixVente}"></span>
|
||||
</span>
|
||||
<span class="text-dark" th:if="${article.prixVente < article.prixInitial}">
|
||||
<i class="fas fa-coins"></i> <!-- Assurez-vous de remplacer "fa-coins" par la classe de votre icône -->
|
||||
<span class="text-dark">
|
||||
<i class="fas fa-coins"></i>
|
||||
<span th:text="${article.prixInitial}"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 d-flex flex-row align-items-center justify-content-between">
|
||||
<strong><label class="col-form-label mr-2" th:text="#{article.details.label.last_price}"></label></strong>
|
||||
<div class="col-form-label">
|
||||
<i class="fas fa-coins"></i>
|
||||
<span class="text-dark" th:text="${article.prixMaxEnchere}"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 d-flex flex-row align-items-center justify-content-between">
|
||||
<strong><label class="col-form-label mr-2" th:text="#{article.details.label.seller}"></label></strong>
|
||||
<div class="col-form-label">
|
||||
@@ -146,14 +149,30 @@
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-muted"><strong><span th:text="#{article.details.label.start_date}"></span>: </strong></h6>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-muted"><span th:text="${#dates.format(article.dateDebutEnch, 'dd/MM/yyyy')}"></span></h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-muted"><strong><span th:text="#{article.details.label.end_date}"></span>: </strong></h6>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-muted"><span th:text="${#dates.format(article.dateFinEnch, 'dd/MM/yyyy')}"></span></h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<div class="row mt-4" th:if="${not #lists.isEmpty(articles)}">
|
||||
<div class="col-md-12">
|
||||
|
||||
Reference in New Issue
Block a user