diff --git a/.gitignore b/.gitignore index f766c77..c52eb76 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,4 @@ prototype/*.db prototype/images prototype/data + diff --git a/prototype/build.gradle b/prototype/build.gradle index c7defd9..c8e14cb 100644 --- a/prototype/build.gradle +++ b/prototype/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() } 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 'com.github.gwenn:sqlite-dialect:0.1.0' 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") } diff --git a/prototype/gradle/wrapper/gradle-wrapper.jar b/prototype/gradle/wrapper/gradle-wrapper.jar index f6b961f..5c2d1cf 100644 Binary files a/prototype/gradle/wrapper/gradle-wrapper.jar and b/prototype/gradle/wrapper/gradle-wrapper.jar differ diff --git a/prototype/gradle/wrapper/gradle-wrapper.properties b/prototype/gradle/wrapper/gradle-wrapper.properties index 7c4388a..4c5803d 100644 --- a/prototype/gradle/wrapper/gradle-wrapper.properties +++ b/prototype/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME 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 zipStorePath=wrapper/dists diff --git a/prototype/gradlew b/prototype/gradlew index cccdd3d..83f2acf 100755 --- a/prototype/gradlew +++ b/prototype/gradlew @@ -1,5 +1,21 @@ #!/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 @@ -28,7 +44,7 @@ APP_NAME="Gradle" 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. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. 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\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/prototype/gradlew.bat b/prototype/gradlew.bat index e95643d..24467a1 100644 --- a/prototype/gradlew.bat +++ b/prototype/gradlew.bat @@ -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 @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 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. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/prototype/scripts/addarticles.sql b/prototype/scripts/addarticles.sql index 8f976a7..f7e5f5b 100644 --- a/prototype/scripts/addarticles.sql +++ b/prototype/scripts/addarticles.sql @@ -1,5 +1,5 @@ -INSERT INTO article_offers ("manufacturer", "article_number", "vat_percent") -VALUES ("McDonalds", "1", 7); +INSERT INTO article_offers ("manufacturer", "article_number", "vat_percent", "should_be_advertised") +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") VALUES (1, 19.99, 10, 1, 15, "Huge Hamburger", "This huge Hamburger is awesome!", NULL); diff --git a/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java b/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java index ed1066c..8b35be8 100644 --- a/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java +++ b/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java @@ -68,7 +68,8 @@ public class CreateOrderAction { totalVatCent += article.getVat() * quantity; } - public Result finish() { + + public Result finish() throws ArticleNotInStockException { CustomerOrder order = createOrder(); 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(); booking.created = new Timestamp(new Date().getTime()); booking.reason = new BookingReason(order); @@ -111,6 +112,10 @@ public class CreateOrderAction { break; } } + + if (needed > 0) { + throw new ArticleNotInStockException(item.article); + } } return booking; @@ -174,4 +179,17 @@ public class CreateOrderAction { 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; + } + } } diff --git a/prototype/src/main/java/org/hso/ecommerce/action/shop/GetRandomArticlesAction.java b/prototype/src/main/java/org/hso/ecommerce/action/shop/GetRandomArticlesAction.java index c299b92..62c70c7 100644 --- a/prototype/src/main/java/org/hso/ecommerce/action/shop/GetRandomArticlesAction.java +++ b/prototype/src/main/java/org/hso/ecommerce/action/shop/GetRandomArticlesAction.java @@ -9,7 +9,7 @@ public class GetRandomArticlesAction { public static List
getRandomArticles(int quantity, List
advertisedArticles) { List
randomisedArticles = new ArrayList
(); - int loopcount = quantity > advertisedArticles.size() ? advertisedArticles.size() : quantity; + int loopcount = Math.min(quantity, advertisedArticles.size()); for (int i = 0; i < loopcount; i++) { int index = (int) (Math.random() * advertisedArticles.size()); randomisedArticles.add(advertisedArticles.remove(index)); diff --git a/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java b/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java index 7644044..30b559a 100644 --- a/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java +++ b/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java @@ -1,10 +1,12 @@ package org.hso.ecommerce.app; -import org.hso.ecommerce.repos.user.UserRepository; import org.hso.ecommerce.entities.user.User; +import org.hso.ecommerce.repos.user.UserRepository; import org.springframework.beans.factory.annotation.Autowired; 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.HttpServletResponse; @@ -22,11 +24,6 @@ public class RequestController { static int notSoRandom = 0; -// @GetMapping("/") -// public String home() { -// return "redirect:/shop/"; -// } - @GetMapping("/login") public String login() { return "login"; @@ -88,71 +85,11 @@ public class RequestController { return "redirect:/"; } -// @GetMapping("/shop/") -// public String shop() { -// return "shop/index"; -// } - @GetMapping("/shop/search") public String shopSearch() { 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/") public String intern() { return "intern/index"; @@ -221,6 +158,15 @@ public class RequestController { public String internSupplierOrdersId() { return "intern/supplierOrders/id"; } + + /* + + @GetMapping("/intern/suppliersOffers") + public String internSuppliersOffers() { + return "intern/offeredArticles/index"; + } + */ + @GetMapping("/intern/accounting/") public String accounting() { diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierOfferController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierOfferController.java index ec6dfbf..8b5da0a 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierOfferController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierOfferController.java @@ -1,8 +1,23 @@ package org.hso.ecommerce.controller.intern.suppliers; +import javax.servlet.http.HttpSession; + 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 -//@RequestMapping("...") +@RequestMapping("/intern/") public class SupplierOfferController { + + @GetMapping("suppliersOffers") + public String internListedArticles(Model model, HttpSession session) { + + System.out.println("\nhier\n"); + + return "intern/offeredArticles/index"; + + } + } diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java index 03da5b7..869b237 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java @@ -4,7 +4,6 @@ import org.apache.tomcat.util.http.fileupload.IOUtils; import org.hso.ecommerce.action.shop.GetRandomArticlesAction; import org.hso.ecommerce.entities.shop.Article; 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.warehouse.WarehouseBookingPositionSlotEntryRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -19,7 +18,6 @@ import javax.servlet.http.HttpSession; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; import java.util.List; @Controller @@ -38,22 +36,16 @@ public class ShopArticleController { HttpServletRequest request, HttpServletResponse response ) { - - Article article = articleRepository.findArticleById(id); - if (article == null) { request.setAttribute("error", "Der Artikel wurde nicht gefunden."); response.setStatus(HttpServletResponse.SC_NOT_FOUND); return "error/404"; } - model.addAttribute("article", article); - - //if (warehouseBookingPositionSlotEntryRepository.getByArticle(id).get(0).newSumSlot > 0) { //TODO: use this as soon as warehouse works - if (true) { + if (warehouseBookingPositionSlotEntryRepository.getByArticle(id).get(0).newSumSlot > 0) { model.addAttribute("inStock", true); } else { model.addAttribute("inStock", false); @@ -62,7 +54,6 @@ public class ShopArticleController { List
commercialArticles = GetRandomArticlesAction.getRandomArticles(3, articleRepository.getAdvertisedArticles()); model.addAttribute("commercialArticles", commercialArticles); - return "shop/articles/id"; } @@ -76,8 +67,6 @@ public class ShopArticleController { @RequestParam(value = "set_amount", required = false) Boolean setAmount, @RequestParam("fastcheckout") Boolean fastcheckout ) { - - Article article = articleRepository.findArticleById(id); if (article == null) { @@ -104,14 +93,10 @@ public class ShopArticleController { HttpServletResponse response, @PathVariable("id") Long id ) throws IOException { - Article article = articleRepository.findArticleById(id); - InputStream in = new FileInputStream(article.image.path); response.setContentType(MediaType.IMAGE_JPEG_VALUE); IOUtils.copy(in, response.getOutputStream()); } - - } diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java index ab4827f..c2c1c3a 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java @@ -98,6 +98,7 @@ public class ShopCheckoutController { @PostMapping("/checkoutFinish") public String shopCheckoutFinish( + HttpSession session, HttpServletRequest request, HttpServletResponse response, @RequestAttribute(value = "user") User user, @@ -132,15 +133,22 @@ public class ShopCheckoutController { 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); - bookingRepository.saveAll(result.bookings); - warehouseBookingRepository.save(result.warehouseBooking); + shoppingCart.clear(); + + } 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"; } diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java index e660eb0..15b6067 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java @@ -2,7 +2,6 @@ package org.hso.ecommerce.controller.shop; import org.hso.ecommerce.action.shop.GetRandomArticlesAction; import org.hso.ecommerce.entities.shop.Article; -import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.repos.shop.ArticleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -11,7 +10,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpSession; -import java.util.ArrayList; import java.util.List; @Controller @@ -34,14 +32,13 @@ public class ShopIndexController { boolean isLoggedIn = false; boolean hasOrders = false; - if (session != null && session.getAttribute("id") != null) { - long userId = (long) session.getAttribute("id"); - isLoggedIn = true; - } - if (isLoggedIn) { - List
suggestedArticles = articleRepository.getOrderedArticles(); - suggestedArticles = suggestedArticles.size() > 3 ? suggestedArticles.subList(0,4) : suggestedArticles; //only latest 4 articles + if (session != null && session.getAttribute("userId") != null) { + long userId = (long) session.getAttribute("userId"); + isLoggedIn = true; + + List
suggestedArticles = articleRepository.getOrderedArticles(userId); + suggestedArticles = suggestedArticles.size() > 3 ? suggestedArticles.subList(0, 4) : suggestedArticles; //only latest 4 articles if (suggestedArticles.size() > 0) { model.addAttribute("suggestedArticles", suggestedArticles); hasOrders = true; diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingReason.java b/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingReason.java index f973d26..78e8ab5 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingReason.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingReason.java @@ -28,11 +28,10 @@ public class BookingReason { @ManyToOne(optional = true) public SupplierOrder supplierOrder; + // Default Constructor is needed for construction by ORM public BookingReason() { } - ; - public BookingReason(CustomerOrder order) { this.customerOrder = order; } diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java index d27d415..6609853 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java @@ -12,5 +12,4 @@ public class Image { public long id; public String path; -} - +} \ No newline at end of file diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/supplier/ArticleOffer.java b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/ArticleOffer.java index ce02d13..ae86659 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/supplier/ArticleOffer.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/ArticleOffer.java @@ -20,5 +20,5 @@ public class ArticleOffer { public int vatPercent; - public boolean should_be_advertised; + public boolean shouldBeAdvertised; } diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBooking.java b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBooking.java index cf60734..08eaa40 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBooking.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBooking.java @@ -27,6 +27,7 @@ public class WarehouseBooking { ) public List positions = new ArrayList<>(); + // TODO FIX ME @OneToOne(optional = false, cascade = CascadeType.ALL) public BookingReason reason; } diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPositionSlotEntry.java b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPositionSlotEntry.java index 766398f..444b921 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPositionSlotEntry.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPositionSlotEntry.java @@ -18,8 +18,7 @@ public class WarehouseBookingPositionSlotEntry { @ManyToOne public Article article; - // Can;t do, does not work when created in action. - //public int newSumArticles; + @NotNull public int newSumSlot; @NotNull diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingReason.java b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingReason.java index 08ee80a..e287141 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingReason.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingReason.java @@ -24,6 +24,7 @@ public class WarehouseBookingReason { public boolean isManuel; + // Default Constructor is needed for construction by ORM public WarehouseBookingReason() { } diff --git a/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java b/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java index 47f1d7c..6f79487 100644 --- a/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java +++ b/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java @@ -17,10 +17,14 @@ public interface ArticleRepository extends JpaRepository { @Query("SELECT a FROM Article a") List
findAll(); - @Query("SELECT a FROM Article a JOIN a.related ao WHERE ao.should_be_advertised = true") - List
getAdvertisedArticles(); + @Query("SELECT a FROM Article a JOIN a.related ao WHERE ao.shouldBeAdvertised = true") + List
getAdvertisedArticles(); @Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a ORDER BY co.id DESC") List
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
getOrderedArticles(long customerId); + + } diff --git a/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java b/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java index e1327ce..b342a06 100644 --- a/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java +++ b/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java @@ -11,8 +11,6 @@ import java.util.Optional; @Repository public interface WarehouseBookingPositionSlotEntryRepository extends JpaRepository { - // 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) List getByArticle(long article); diff --git a/prototype/src/main/resources/templates/intern/articles/index.html b/prototype/src/main/resources/templates/intern/offeredArticles/index.html similarity index 100% rename from prototype/src/main/resources/templates/intern/articles/index.html rename to prototype/src/main/resources/templates/intern/offeredArticles/index.html diff --git a/prototype/src/main/resources/templates/shop/articles/id.html b/prototype/src/main/resources/templates/shop/articles/id.html index 73de367..588b5be 100644 --- a/prototype/src/main/resources/templates/shop/articles/id.html +++ b/prototype/src/main/resources/templates/shop/articles/id.html @@ -23,7 +23,7 @@
-

+

EUR

@@ -32,7 +32,7 @@
-

+

EUR