|
|
|
@ -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,20 +36,15 @@ 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) {
|
|
|
|
|
model.addAttribute("inStock", true);
|
|
|
|
@ -62,7 +55,6 @@ public class ShopArticleController {
|
|
|
|
|
List<Article> commercialArticles = GetRandomArticlesAction.getRandomArticles(3, articleRepository.getAdvertisedArticles());
|
|
|
|
|
model.addAttribute("commercialArticles", commercialArticles);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return "shop/articles/id";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -76,8 +68,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 +94,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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Unnötige Leerzeilen entfernen.
fixed