Merge remote-tracking branch 'origin/master' into feature/listedArticles

This commit is contained in:
Jannik 2020-05-15 19:04:02 +02:00
commit c73435b2a0
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
26 changed files with 139 additions and 133 deletions

1
.gitignore vendored
View File

@ -92,3 +92,4 @@ prototype/*.db
prototype/images prototype/images
prototype/data prototype/data

View File

@ -3,7 +3,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE") classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE")
} }
} }
@ -27,7 +27,7 @@ dependencies {
// implementation 'org.springframework.session:spring-session-jdbc' // implementation 'org.springframework.session:spring-session-jdbc'
implementation 'com.github.gwenn:sqlite-dialect:0.1.0' implementation 'com.github.gwenn:sqlite-dialect:0.1.0'
implementation 'org.springframework.boot:spring-boot-devtools' implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'org.xerial:sqlite-jdbc:3.28.0' implementation 'org.xerial:sqlite-jdbc:3.31.1'
testCompile("org.springframework.boot:spring-boot-starter-test") testCompile("org.springframework.boot:spring-boot-starter-test")
} }

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

22
prototype/gradlew vendored
View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh #!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## ##
## Gradle start up script for UN*X ## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS="" DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`

18
prototype/gradlew.bat vendored
View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome

View File

@ -1,5 +1,5 @@
INSERT INTO article_offers ("manufacturer", "article_number", "vat_percent") INSERT INTO article_offers ("manufacturer", "article_number", "vat_percent", "should_be_advertised")
VALUES ("McDonalds", "1", 7); VALUES ("McDonalds", "1", 7, 1);
INSERT INTO articles ("related_id", "shop_price_per_unit_net_cent", "warehouse_units_per_slot", "should_reorder", "reorder_max_price", "title", "description", "image_id") INSERT INTO articles ("related_id", "shop_price_per_unit_net_cent", "warehouse_units_per_slot", "should_reorder", "reorder_max_price", "title", "description", "image_id")
VALUES (1, 19.99, 10, 1, 15, "Huge Hamburger", "This huge Hamburger is awesome!", NULL); VALUES (1, 19.99, 10, 1, 15, "Huge Hamburger", "This huge Hamburger is awesome!", NULL);

View File

@ -68,7 +68,8 @@ public class CreateOrderAction {
totalVatCent += article.getVat() * quantity; totalVatCent += article.getVat() * quantity;
} }
public Result finish() {
public Result finish() throws ArticleNotInStockException {
CustomerOrder order = createOrder(); CustomerOrder order = createOrder();
CustomerPayment payment = createPayment(); CustomerPayment payment = createPayment();
@ -86,7 +87,7 @@ public class CreateOrderAction {
); );
} }
private WarehouseBooking createWarehouseBooking(CustomerOrder order) { private WarehouseBooking createWarehouseBooking(CustomerOrder order) throws ArticleNotInStockException {
WarehouseBooking booking = new WarehouseBooking(); WarehouseBooking booking = new WarehouseBooking();
booking.created = new Timestamp(new Date().getTime()); booking.created = new Timestamp(new Date().getTime());
booking.reason = new BookingReason(order); booking.reason = new BookingReason(order);
@ -111,6 +112,10 @@ public class CreateOrderAction {
break; break;
} }
} }
if (needed > 0) {
throw new ArticleNotInStockException(item.article);
}
} }
return booking; return booking;
@ -174,4 +179,17 @@ public class CreateOrderAction {
this.quantity = quantity; this.quantity = quantity;
} }
} }
public static class ArticleNotInStockException extends Exception {
private Article article;
public ArticleNotInStockException(Article article) {
super("The quantity of article '" + article.title + "' is not in stock.");
this.article = article;
}
public Article getArticle() {
return article;
}
}
} }

View File

@ -9,7 +9,7 @@ public class GetRandomArticlesAction {
public static List<Article> getRandomArticles(int quantity, List<Article> advertisedArticles) { public static List<Article> getRandomArticles(int quantity, List<Article> advertisedArticles) {
List<Article> randomisedArticles = new ArrayList<Article>(); List<Article> randomisedArticles = new ArrayList<Article>();
int loopcount = quantity > advertisedArticles.size() ? advertisedArticles.size() : quantity; int loopcount = Math.min(quantity, advertisedArticles.size());
for (int i = 0; i < loopcount; i++) { for (int i = 0; i < loopcount; i++) {
int index = (int) (Math.random() * advertisedArticles.size()); int index = (int) (Math.random() * advertisedArticles.size());
randomisedArticles.add(advertisedArticles.remove(index)); randomisedArticles.add(advertisedArticles.remove(index));

View File

@ -1,10 +1,12 @@
package org.hso.ecommerce.app; package org.hso.ecommerce.app;
import org.hso.ecommerce.repos.user.UserRepository;
import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.entities.user.User;
import org.hso.ecommerce.repos.user.UserRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -22,11 +24,6 @@ public class RequestController {
static int notSoRandom = 0; static int notSoRandom = 0;
// @GetMapping("/")
// public String home() {
// return "redirect:/shop/";
// }
@GetMapping("/login") @GetMapping("/login")
public String login() { public String login() {
return "login"; return "login";
@ -88,71 +85,11 @@ public class RequestController {
return "redirect:/"; return "redirect:/";
} }
// @GetMapping("/shop/")
// public String shop() {
// return "shop/index";
// }
@GetMapping("/shop/search") @GetMapping("/shop/search")
public String shopSearch() { public String shopSearch() {
return "shop/search"; return "shop/search";
} }
/* @GetMapping("/shop/checkout")
public String shopCheckout(HttpSession session, HttpServletRequest request) {
session.setAttribute("afterLogin", request.getRequestURI());
return "shop/checkout";
}
@PostMapping("/shop/checkoutFinish")
public String shopCheckoutFinish() {
return "shop/checkoutFinish";
}
@GetMapping("/shop/checkoutFinish")
public String shopCheckoutFinishGET() {
return "shop/checkoutFinish";
}*/
// @GetMapping("/shop/articles/{id}")
// public String shopArticlesById() {
// return "shop/articles/id";
// }
//
// @PostMapping("/shop/articles/{id}")
// public String shopArticlesByIdBuy(HttpSession session,
// @RequestAttribute(value = "user", required = false) User customer,
// @PathVariable("id") Integer id,
// @RequestParam("fastcheckout") Boolean fastcheckout
// ) {
// if (customer != null) {
// if (!fastcheckout) {
// return "shop/articles/post_add";
// } else {
// return "shop/checkout";
// }
// } else {
// session.setAttribute("afterLogin", "/shop/articles/" + id);
// return "redirect:/login";
// }
// }
// @GetMapping("/about")
// public String about() {
// return "about";
// }
//
// @GetMapping("/terms")
// public String terms() {
// return "terms";
// }
//
// @GetMapping("/privacy")
// public String privacy() {
// return "privacy";
// }
@GetMapping("/intern/") @GetMapping("/intern/")
public String intern() { public String intern() {
return "intern/index"; return "intern/index";
@ -221,6 +158,15 @@ public class RequestController {
public String internSupplierOrdersId() { public String internSupplierOrdersId() {
return "intern/supplierOrders/id"; return "intern/supplierOrders/id";
} }
/*
@GetMapping("/intern/suppliersOffers")
public String internSuppliersOffers() {
return "intern/offeredArticles/index";
}
*/
@GetMapping("/intern/accounting/") @GetMapping("/intern/accounting/")
public String accounting() { public String accounting() {

View File

@ -1,8 +1,23 @@
package org.hso.ecommerce.controller.intern.suppliers; package org.hso.ecommerce.controller.intern.suppliers;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller @Controller
//@RequestMapping("...") @RequestMapping("/intern/")
public class SupplierOfferController { public class SupplierOfferController {
@GetMapping("suppliersOffers")
public String internListedArticles(Model model, HttpSession session) {
System.out.println("\nhier\n");
return "intern/offeredArticles/index";
}
} }

View File

@ -4,7 +4,6 @@ import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.hso.ecommerce.action.shop.GetRandomArticlesAction; import org.hso.ecommerce.action.shop.GetRandomArticlesAction;
import org.hso.ecommerce.entities.shop.Article; import org.hso.ecommerce.entities.shop.Article;
import org.hso.ecommerce.entities.shop.ShoppingCart; import org.hso.ecommerce.entities.shop.ShoppingCart;
import org.hso.ecommerce.entities.warehouse.WarehouseBookingPositionSlotEntry;
import org.hso.ecommerce.repos.shop.ArticleRepository; import org.hso.ecommerce.repos.shop.ArticleRepository;
import org.hso.ecommerce.repos.warehouse.WarehouseBookingPositionSlotEntryRepository; import org.hso.ecommerce.repos.warehouse.WarehouseBookingPositionSlotEntryRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -19,7 +18,6 @@ import javax.servlet.http.HttpSession;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Controller @Controller
@ -38,22 +36,16 @@ public class ShopArticleController {
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response HttpServletResponse response
) { ) {
Article article = articleRepository.findArticleById(id); Article article = articleRepository.findArticleById(id);
if (article == null) { if (article == null) {
request.setAttribute("error", "Der Artikel wurde nicht gefunden."); request.setAttribute("error", "Der Artikel wurde nicht gefunden.");
response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return "error/404"; return "error/404";
} }
model.addAttribute("article", article); model.addAttribute("article", article);
if (warehouseBookingPositionSlotEntryRepository.getByArticle(id).get(0).newSumSlot > 0) {
//if (warehouseBookingPositionSlotEntryRepository.getByArticle(id).get(0).newSumSlot > 0) { //TODO: use this as soon as warehouse works
if (true) {
model.addAttribute("inStock", true); model.addAttribute("inStock", true);
} else { } else {
model.addAttribute("inStock", false); model.addAttribute("inStock", false);
@ -62,7 +54,6 @@ public class ShopArticleController {
List<Article> commercialArticles = GetRandomArticlesAction.getRandomArticles(3, articleRepository.getAdvertisedArticles()); List<Article> commercialArticles = GetRandomArticlesAction.getRandomArticles(3, articleRepository.getAdvertisedArticles());
model.addAttribute("commercialArticles", commercialArticles); model.addAttribute("commercialArticles", commercialArticles);
return "shop/articles/id"; return "shop/articles/id";
} }
@ -76,8 +67,6 @@ public class ShopArticleController {
@RequestParam(value = "set_amount", required = false) Boolean setAmount, @RequestParam(value = "set_amount", required = false) Boolean setAmount,
@RequestParam("fastcheckout") Boolean fastcheckout @RequestParam("fastcheckout") Boolean fastcheckout
) { ) {
Article article = articleRepository.findArticleById(id); Article article = articleRepository.findArticleById(id);
if (article == null) { if (article == null) {
@ -104,14 +93,10 @@ public class ShopArticleController {
HttpServletResponse response, HttpServletResponse response,
@PathVariable("id") Long id @PathVariable("id") Long id
) throws IOException { ) throws IOException {
Article article = articleRepository.findArticleById(id); Article article = articleRepository.findArticleById(id);
InputStream in = new FileInputStream(article.image.path); InputStream in = new FileInputStream(article.image.path);
response.setContentType(MediaType.IMAGE_JPEG_VALUE); response.setContentType(MediaType.IMAGE_JPEG_VALUE);
IOUtils.copy(in, response.getOutputStream()); IOUtils.copy(in, response.getOutputStream());
} }
} }

View File

@ -98,6 +98,7 @@ public class ShopCheckoutController {
@PostMapping("/checkoutFinish") @PostMapping("/checkoutFinish")
public String shopCheckoutFinish( public String shopCheckoutFinish(
HttpSession session,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response, HttpServletResponse response,
@RequestAttribute(value = "user") User user, @RequestAttribute(value = "user") User user,
@ -132,15 +133,22 @@ public class ShopCheckoutController {
action.addArticle(article, item.getAmount(), wbeseRepo.getByArticle(article.id)); action.addArticle(article, item.getAmount(), wbeseRepo.getByArticle(article.id));
} }
CreateOrderAction.Result result = action.finish(); CreateOrderAction.Result result = null;
try {
result = action.finish();
EnableTrackingAction.addTrackingInfo(result.customerOrder);
EnableTrackingAction.addTrackingInfo(result.customerOrder); customerOderRepository.save(result.customerOrder);
bookingRepository.saveAll(result.bookings);
warehouseBookingRepository.save(result.warehouseBooking);
customerOderRepository.save(result.customerOrder); shoppingCart.clear();
bookingRepository.saveAll(result.bookings);
warehouseBookingRepository.save(result.warehouseBooking); } catch (CreateOrderAction.ArticleNotInStockException e) {
request.setAttribute("error", "Der Artikel '" + e.getArticle().title + "' ist leider nicht mehr in ausreichender Menge verfügbar. Bitte passen Sie die Artikelmenge an.");
return shopCheckout(session, request, shoppingCart);
}
shoppingCart.clear();
return "shop/checkoutFinish"; return "shop/checkoutFinish";
} }

View File

@ -2,7 +2,6 @@ package org.hso.ecommerce.controller.shop;
import org.hso.ecommerce.action.shop.GetRandomArticlesAction; import org.hso.ecommerce.action.shop.GetRandomArticlesAction;
import org.hso.ecommerce.entities.shop.Article; import org.hso.ecommerce.entities.shop.Article;
import org.hso.ecommerce.entities.user.User;
import org.hso.ecommerce.repos.shop.ArticleRepository; import org.hso.ecommerce.repos.shop.ArticleRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -11,7 +10,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Controller @Controller
@ -34,14 +32,13 @@ public class ShopIndexController {
boolean isLoggedIn = false; boolean isLoggedIn = false;
boolean hasOrders = false; boolean hasOrders = false;
if (session != null && session.getAttribute("id") != null) {
long userId = (long) session.getAttribute("id");
isLoggedIn = true;
}
if (isLoggedIn) { if (session != null && session.getAttribute("userId") != null) {
List<Article> suggestedArticles = articleRepository.getOrderedArticles(); long userId = (long) session.getAttribute("userId");
suggestedArticles = suggestedArticles.size() > 3 ? suggestedArticles.subList(0,4) : suggestedArticles; //only latest 4 articles isLoggedIn = true;
List<Article> suggestedArticles = articleRepository.getOrderedArticles(userId);
suggestedArticles = suggestedArticles.size() > 3 ? suggestedArticles.subList(0, 4) : suggestedArticles; //only latest 4 articles
if (suggestedArticles.size() > 0) { if (suggestedArticles.size() > 0) {
model.addAttribute("suggestedArticles", suggestedArticles); model.addAttribute("suggestedArticles", suggestedArticles);
hasOrders = true; hasOrders = true;

View File

@ -28,11 +28,10 @@ public class BookingReason {
@ManyToOne(optional = true) @ManyToOne(optional = true)
public SupplierOrder supplierOrder; public SupplierOrder supplierOrder;
// Default Constructor is needed for construction by ORM
public BookingReason() { public BookingReason() {
} }
;
public BookingReason(CustomerOrder order) { public BookingReason(CustomerOrder order) {
this.customerOrder = order; this.customerOrder = order;
} }

View File

@ -12,5 +12,4 @@ public class Image {
public long id; public long id;
public String path; public String path;
} }

View File

@ -20,5 +20,5 @@ public class ArticleOffer {
public int vatPercent; public int vatPercent;
public boolean should_be_advertised; public boolean shouldBeAdvertised;
} }

View File

@ -27,6 +27,7 @@ public class WarehouseBooking {
) )
public List<WarehouseBookingPosition> positions = new ArrayList<>(); public List<WarehouseBookingPosition> positions = new ArrayList<>();
// TODO FIX ME
@OneToOne(optional = false, cascade = CascadeType.ALL) @OneToOne(optional = false, cascade = CascadeType.ALL)
public BookingReason reason; public BookingReason reason;
} }

View File

@ -18,8 +18,7 @@ public class WarehouseBookingPositionSlotEntry {
@ManyToOne @ManyToOne
public Article article; public Article article;
// Can;t do, does not work when created in action. @NotNull
//public int newSumArticles;
public int newSumSlot; public int newSumSlot;
@NotNull @NotNull

View File

@ -24,6 +24,7 @@ public class WarehouseBookingReason {
public boolean isManuel; public boolean isManuel;
// Default Constructor is needed for construction by ORM
public WarehouseBookingReason() { public WarehouseBookingReason() {
} }

View File

@ -17,10 +17,14 @@ public interface ArticleRepository extends JpaRepository<Article, Long> {
@Query("SELECT a FROM Article a") @Query("SELECT a FROM Article a")
List<Article> findAll(); List<Article> findAll();
@Query("SELECT a FROM Article a JOIN a.related ao WHERE ao.should_be_advertised = true") @Query("SELECT a FROM Article a JOIN a.related ao WHERE ao.shouldBeAdvertised = true")
List<Article> getAdvertisedArticles(); List<Article> getAdvertisedArticles();
@Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a ORDER BY co.id DESC") @Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a ORDER BY co.id DESC")
List<Article> getOrderedArticles(); List<Article> getOrderedArticles();
@Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a WHERE c.id = :customerId ORDER BY co.id DESC")
List<Article> getOrderedArticles(long customerId);
} }

View File

@ -11,8 +11,6 @@ import java.util.Optional;
@Repository @Repository
public interface WarehouseBookingPositionSlotEntryRepository extends JpaRepository<WarehouseBookingPositionSlotEntry, Long> { public interface WarehouseBookingPositionSlotEntryRepository extends JpaRepository<WarehouseBookingPositionSlotEntry, Long> {
// TODO this is wrong. revisit.
// @Query("SELECT e FROM WarehouseBookingPositionSlotEntry e, Slot s WHERE e.slot = s AND e.article = :article GROUP BY e.slot.slotNum HAVING max(e.id)")
@Query(value = "Select e.id, e.article_id, e.new_sum_slot, e.slot_id from warehouse_booking_position_entries as e, warehouse_slots as s where e.slot_id = s.id AND e.article_id = :article GROUP BY s.slot_num HAVING max(e.id)", nativeQuery = true) @Query(value = "Select e.id, e.article_id, e.new_sum_slot, e.slot_id from warehouse_booking_position_entries as e, warehouse_slots as s where e.slot_id = s.id AND e.article_id = :article GROUP BY s.slot_num HAVING max(e.id)", nativeQuery = true)
List<WarehouseBookingPositionSlotEntry> getByArticle(long article); List<WarehouseBookingPositionSlotEntry> getByArticle(long article);

View File

@ -23,7 +23,7 @@
<script th:src="@{/js/back.js}"></script> <script th:src="@{/js/back.js}"></script>
<div class="back" data-group="shop" data-insert="true"></div> <div class="back" data-group="shop" data-insert="true"></div>
<h2 th:text="${article.shopPricePerUnitNetCent}"></h2> <h2><span th:text="${#numbers.formatDecimal(article.getPriceGross() * 0.01, 1, 'POINT', 2, 'COMMA')}"></span><span> EUR</span></h2>
<p th:text="${article.description}"></p> <p th:text="${article.description}"></p>
</div> </div>
<div class="s"> <div class="s">
@ -32,7 +32,7 @@
<div class="s"></div> <div class="s"></div>
<form class="s" method="POST"> <form class="s" method="POST">
<div class="detailgrid m"> <div class="detailgrid m">
<h2 th:text="${article.shopPricePerUnitNetCent}"></h2> <h2><span th:text="${#numbers.formatDecimal(article.getPriceGross() * 0.01, 1, 'POINT', 2, 'COMMA')}"></span><span> EUR</span></h2>
<div> <div>
<label class="nolinebreak">Menge:</label> <label class="nolinebreak">Menge:</label>
<select name="quantity" size="1"> <select name="quantity" size="1">
@ -58,7 +58,7 @@
<section th:each="article: ${commercialArticles}"><a th:href="@{/shop/articles/{id}(id = ${article.id})}" class="section"> <section th:each="article: ${commercialArticles}"><a th:href="@{/shop/articles/{id}(id = ${article.id})}" class="section">
<img th:src="@{/shop/articles/{id}/image.jpg(id=${article.id})}"/> <img th:src="@{/shop/articles/{id}/image.jpg(id=${article.id})}"/>
<h2 th:text="${article.title}"></h2> <h2 th:text="${article.title}"></h2>
<p class='price' th:text="${article.shopPricePerUnitNetCent}"></p> <p class='price'><span th:text="${#numbers.formatDecimal(article.getPriceGross() * 0.01, 1, 'POINT', 2, 'COMMA')}"></span><span> EUR</span></p>
<p th:text="${article.description}"></p> <p th:text="${article.description}"></p>
</a> </a>
</section> </section>

View File

@ -49,7 +49,7 @@
<td><a th:href="@{/shop/articles/{id}(id = ${item.article.id})}" <td><a th:href="@{/shop/articles/{id}(id = ${item.article.id})}"
th:text="${item.article.title}"></a></td> th:text="${item.article.title}"></a></td>
<td><span <td><span
th:text="${#numbers.formatDecimal(item.article.getPriceGross(), 1, 'POINT', 2, 'COMMA')}"></span> th:text="${#numbers.formatDecimal(item.article.getPriceGross() * 0.01, 1, 'POINT', 2, 'COMMA')}"></span>
EUR <b>x</b></td> EUR <b>x</b></td>
<td> <td>
<form method="POST" th:action="@{/shop/articles/{id}(id = ${item.article.id})}"> <form method="POST" th:action="@{/shop/articles/{id}(id = ${item.article.id})}">
@ -106,7 +106,7 @@ Musterstraße 4
<tr> <tr>
<th>Artikel (Netto)</th> <th>Artikel (Netto)</th>
<th><span <th><span
th:text="${#numbers.formatDecimal(checkoutTotals.net, 1, 'POINT', 2, 'COMMA')}"></span> th:text="${#numbers.formatDecimal(checkoutTotals.net * 0.01, 1, 'POINT', 2, 'COMMA')}"></span>
EUR EUR
</th> </th>
</tr> </tr>
@ -114,7 +114,7 @@ Musterstraße 4
<tr> <tr>
<th>Umsatzsteuer (<span th:text="${item.getKey()}"></span>%)</th> <th>Umsatzsteuer (<span th:text="${item.getKey()}"></span>%)</th>
<th><span <th><span
th:text="${#numbers.formatDecimal(item.getValue(), 1, 'POINT', 2, 'COMMA')}"></span> th:text="${#numbers.formatDecimal(item.getValue() * 0.01, 1, 'POINT', 2, 'COMMA')}"></span>
EUR EUR
</th> </th>
</tr> </tr>
@ -122,7 +122,7 @@ Musterstraße 4
<tr class="secondary"> <tr class="secondary">
<th>Gesamt:</th> <th>Gesamt:</th>
<th><span <th><span
th:text="${#numbers.formatDecimal(checkoutTotals.total, 1, 'POINT', 2, 'COMMA')}"></span> th:text="${#numbers.formatDecimal(checkoutTotals.total * 0.01, 1, 'POINT', 2, 'COMMA')}"></span>
EUR EUR
</th> </th>
</tr> </tr>

View File

@ -17,13 +17,16 @@
<h1>Angebote</h1> <h1>Angebote</h1>
<script th:src="@{/js/back.js}"></script> <script th:src="@{/js/back.js}"></script>
<div class="back" data-group="shop" data-name="Zurück zur Startseite." data-insert="false"></div> <div class="back" data-group="shop" data-name="Zurück zur Startseite." data-insert="false"></div>
<div class='grid m base shadow'> <div th:if="${commercialArticles.size() == 0}">
<h1>Momentan gibt es keine Angebote</h1>
</div>
<div class='grid m base shadow' th:if="${commercialArticles.size() != 0}">
<section th:each="article: ${commercialArticles}"> <section th:each="article: ${commercialArticles}">
<a th:href="@{/shop/articles/{id}(id=${article.id})}" class="section"> <a th:href="@{/shop/articles/{id}(id=${article.id})}" class="section">
<img th:src="@{/shop/articles/{id}/image.jpg(id=${article.id})}"/> <img th:src="@{/shop/articles/{id}/image.jpg(id=${article.id})}"/>
<h2 th:text="${article.title}" /> <h2 th:text="${article.title}" />
<p class='price' th:text="${article.shopPricePerUnitNetCent}" /> <p class='price'><span th:text="${#numbers.formatDecimal(article.getPriceGross() * 0.01, 1, 'POINT', 2, 'COMMA')}"></span><span> EUR</span></p>
<p th:text="${article.description}" /> <p th:text="${article.description}" />
</a> </a>
</section> </section>
@ -65,7 +68,7 @@
<img th:src="@{/shop/articles/{id}/image.jpg(id=${article.id})}"/> <img th:src="@{/shop/articles/{id}/image.jpg(id=${article.id})}"/>
<h2 th:text="${article.title}" /> <h2 th:text="${article.title}" />
<p class='price' th:text="${article.shopPricePerUnitNetCent}" /> <p class='price'><span th:text="${#numbers.formatDecimal(article.getPriceGross() * 0.01, 1, 'POINT', 2, 'COMMA')}"></span><span> EUR</span></p>
<p th:text="${article.description}" /> <p th:text="${article.description}" />
</a> </a>
</section> </section>