patch translate et retrait article non enchérie
This commit is contained in:
@@ -91,7 +91,7 @@ public class EnchereController {
|
|||||||
@PostMapping("/enchereDone")
|
@PostMapping("/enchereDone")
|
||||||
public String enchereDone(@RequestParam("id") int id) {
|
public String enchereDone(@RequestParam("id") int id) {
|
||||||
List<Enchere> listEncheres = this.enchereService.enchereByArticle(id);
|
List<Enchere> listEncheres = this.enchereService.enchereByArticle(id);
|
||||||
|
if (!listEncheres.isEmpty()){
|
||||||
List<Enchere> encheres = listEncheres.stream()
|
List<Enchere> encheres = listEncheres.stream()
|
||||||
.sorted(Comparator.comparing(Enchere::getMontantEnchere).reversed())
|
.sorted(Comparator.comparing(Enchere::getMontantEnchere).reversed())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -110,18 +110,22 @@ public class EnchereController {
|
|||||||
float newCredit = user.getCredit() - maxMontantEnchere.get();
|
float newCredit = user.getCredit() - maxMontantEnchere.get();
|
||||||
this.userService.setCredit(newCredit, user.getId());
|
this.userService.setCredit(newCredit, user.getId());
|
||||||
|
|
||||||
//Delete enchere
|
//set sell price
|
||||||
for (Enchere ench : listEncheres) {
|
|
||||||
this.enchereService.deleteEnchere(ench.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
//Delete article
|
|
||||||
this.articleService.setSellPrice(id, maxMontantEnchere.get());
|
this.articleService.setSellPrice(id, maxMontantEnchere.get());
|
||||||
|
|
||||||
//Crédit selleur
|
//Crédit selleur
|
||||||
float sellerCredit = userSeller.getCredit() + maxMontantEnchere.get();
|
float sellerCredit = userSeller.getCredit() + maxMontantEnchere.get();
|
||||||
this.userService.setCredit(sellerCredit, userSeller.getId());
|
this.userService.setCredit(sellerCredit, userSeller.getId());
|
||||||
|
|
||||||
|
//Delete enchere
|
||||||
|
for (Enchere ench : listEncheres) {
|
||||||
|
this.enchereService.deleteEnchere(ench.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Delete Article
|
||||||
|
this.articleService.deleteArticle(id);
|
||||||
|
|
||||||
return "redirect:/enchere";
|
return "redirect:/enchere";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSellPrice(int id, float price) {
|
public void setSellPrice(int id, float price) {
|
||||||
String sql = "UPDATE ARTICLES_VENDUS SET prix_vente = ?, isDelete = 1 WHERE no_article = ?";
|
String sql = "UPDATE ARTICLES_VENDUS SET prix_vente = ? WHERE no_article = ?";
|
||||||
jdbcTemplate.update(sql, price, id);
|
jdbcTemplate.update(sql, price, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,9 @@ article.details.ench = Bidders
|
|||||||
article.details.lastof = Last Bid
|
article.details.lastof = Last Bid
|
||||||
article.details.label.last_price = Current sale price
|
article.details.label.last_price = Current sale price
|
||||||
article.details.label.start_date = Start date
|
article.details.label.start_date = Start date
|
||||||
|
article.details.noWin = Article - No one has made an offer
|
||||||
|
article.details.winBy = Article - offer won by
|
||||||
|
article.details.winByYou = you
|
||||||
|
|
||||||
edit.article.title = Edit my article
|
edit.article.title = Edit my article
|
||||||
edit.article.update = Edit
|
edit.article.update = Edit
|
||||||
|
|||||||
@@ -135,7 +135,9 @@ article.details.ench = Ench\u00E9risseurs
|
|||||||
article.details.lastof = Derni\u00E9re offre
|
article.details.lastof = Derni\u00E9re offre
|
||||||
article.details.label.last_price = Prix de vente actuel
|
article.details.label.last_price = Prix de vente actuel
|
||||||
article.details.label.start_date = Date de debut
|
article.details.label.start_date = Date de debut
|
||||||
|
article.details.noWin = Article - Personne n'a fait d'offre
|
||||||
|
article.details.winBy = Article - offre remport\u00E9 par
|
||||||
|
article.details.winByYou = vous
|
||||||
|
|
||||||
|
|
||||||
edit.article.title = Modifier mon article
|
edit.article.title = Modifier mon article
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
<h4 th:text="'Article - offre en cours'"></h4>
|
<h4 th:text="'Article - offre en cours'"></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-header" th:unless="${#dates.format(article.dateFinEnch, 'yyyy-MM-dd')} > ${#dates.format(#dates.createNow(), 'yyyy-MM-dd')}">
|
<div class="card-header" th:unless="${#dates.format(article.dateFinEnch, 'yyyy-MM-dd')} > ${#dates.format(#dates.createNow(), 'yyyy-MM-dd')}">
|
||||||
<h4 th:if="${maxEncherePseudo} != null" th:text="'Article - offre remporté par ' + (${#authentication.getName() == maxEncherePseudo ? 'vous' : maxEncherePseudo})"></h4>
|
<h4 th:if="${maxEncherePseudo} != null" th:text="#{article.details.winBy} + ' ' + (${#authentication.getName() == maxEncherePseudo ? #{article.details.winByYou} : maxEncherePseudo})"></h4>
|
||||||
<h4 th:unless="${maxEncherePseudo} != null" th:text="'Article - Personne n\'a fait d\'offre'"></h4>
|
<h4 th:unless="${maxEncherePseudo} != null" th:text="#{article.details.noWin}"></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in New Issue
Block a user