Revert "split RequestController acording to mapping"
This reverts commit 41eb4d0b8f
.
This commit is contained in:
parent
41eb4d0b8f
commit
6ab3b63923
@ -20,6 +20,8 @@ public class RequestController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private final UserRepository userRepository = null;
|
private final UserRepository userRepository = null;
|
||||||
|
|
||||||
|
static int notSoRandom = 0;
|
||||||
|
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public String home() {
|
public String home() {
|
||||||
return "redirect:/shop/";
|
return "redirect:/shop/";
|
||||||
@ -86,6 +88,55 @@ public class RequestController {
|
|||||||
return "redirect:/";
|
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")
|
@GetMapping("/about")
|
||||||
public String about() {
|
public String about() {
|
||||||
return "about";
|
return "about";
|
||||||
@ -101,4 +152,125 @@ public class RequestController {
|
|||||||
return "privacy";
|
return "privacy";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/intern/")
|
||||||
|
public String intern() {
|
||||||
|
return "intern/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/listedArticles/")
|
||||||
|
public String internListedArticles() {
|
||||||
|
return "intern/listedArticles/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/listedArticles/{id}")
|
||||||
|
public String internListedArticlesId() {
|
||||||
|
return "intern/listedArticles/id";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/intern/articles/")
|
||||||
|
public String internArticles() {
|
||||||
|
return "intern/articles/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/articles/{id}")
|
||||||
|
public String internArticlesId() {
|
||||||
|
return "intern/articles/id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/customers/")
|
||||||
|
public String internCustomers() {
|
||||||
|
return "intern/customers/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/customers/{id}")
|
||||||
|
public String internCustomersId() {
|
||||||
|
return "intern/customers/id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/customerOrders/")
|
||||||
|
public String internCustomerOrder() {
|
||||||
|
return "intern/customerOrders/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/customerOrders/{id}")
|
||||||
|
public String internCustomerOrdersId() {
|
||||||
|
return "intern/customerOrders/id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/suppliers/")
|
||||||
|
public String internSuppliers() {
|
||||||
|
return "intern/suppliers/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/suppliers/{id}")
|
||||||
|
public String internSuppliersId() {
|
||||||
|
return "intern/suppliers/id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/supplierOrders/")
|
||||||
|
public String internSupplierOrders() {
|
||||||
|
return "intern/supplierOrders/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/supplierOrders/{id}")
|
||||||
|
public String internSupplierOrdersId() {
|
||||||
|
return "intern/supplierOrders/id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/accounting/")
|
||||||
|
public String accounting() {
|
||||||
|
return "intern/accounting/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/accounting/vat")
|
||||||
|
public String accountingVat() {
|
||||||
|
return "intern/accounting/vat";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/accounting/main")
|
||||||
|
public String accountingIntern() {
|
||||||
|
return "intern/accounting/main";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/accounting/addManual")
|
||||||
|
public String accountingAddManual() {
|
||||||
|
return "intern/accounting/addManual";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/warehouse/")
|
||||||
|
public String accountingWarehouse() {
|
||||||
|
return "intern/warehouse/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/warehouse/todo")
|
||||||
|
public String accountingWarehouseTodo() {
|
||||||
|
return "intern/warehouse/todo";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/warehouse/addManual")
|
||||||
|
public String accountingWarehouseAddManual() {
|
||||||
|
return "intern/warehouse/addManual";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/intern/warehouse/progress/{id}")
|
||||||
|
public String accountingWarehouseProgressIdPost(HttpServletResponse response) {
|
||||||
|
if ((notSoRandom++) % 2 == 1) {
|
||||||
|
return "redirect:/intern/warehouse/progress/450";
|
||||||
|
} else {
|
||||||
|
response.setStatus(409);
|
||||||
|
return "intern/warehouse/error_progress_failed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/warehouse/progress/{id}")
|
||||||
|
public String accountingWarehouseProgressId() {
|
||||||
|
return "intern/warehouse/id_progress";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/intern/warehouse/slots/")
|
||||||
|
public String accountingWarehouseSlots() {
|
||||||
|
return "intern/warehouse/slots/index";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.hso.ecommerce.controller.user;
|
package org.hso.ecommerce.app;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
@ -1,137 +0,0 @@
|
|||||||
package org.hso.ecommerce.controller.intern;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("intern")
|
|
||||||
public class InternRequestController {
|
|
||||||
|
|
||||||
static int notSoRandom = 0;
|
|
||||||
|
|
||||||
@GetMapping("/")
|
|
||||||
public String intern() {
|
|
||||||
return "intern/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/listedArticles/")
|
|
||||||
public String internListedArticles() {
|
|
||||||
return "intern/listedArticles/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/listedArticles/{id}")
|
|
||||||
public String internListedArticlesId() {
|
|
||||||
return "intern/listedArticles/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/articles/")
|
|
||||||
public String internArticles() {
|
|
||||||
return "intern/articles/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/articles/{id}")
|
|
||||||
public String internArticlesId() {
|
|
||||||
return "intern/articles/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/customers/")
|
|
||||||
public String internCustomers() {
|
|
||||||
return "intern/customers/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/customers/{id}")
|
|
||||||
public String internCustomersId() {
|
|
||||||
return "intern/customers/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/customerOrders/")
|
|
||||||
public String internCustomerOrder() {
|
|
||||||
return "intern/customerOrders/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/customerOrders/{id}")
|
|
||||||
public String internCustomerOrdersId() {
|
|
||||||
return "intern/customerOrders/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/suppliers/")
|
|
||||||
public String internSuppliers() {
|
|
||||||
return "intern/suppliers/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/suppliers/{id}")
|
|
||||||
public String internSuppliersId() {
|
|
||||||
return "intern/suppliers/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/supplierOrders/")
|
|
||||||
public String internSupplierOrders() {
|
|
||||||
return "intern/supplierOrders/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/supplierOrders/{id}")
|
|
||||||
public String internSupplierOrdersId() {
|
|
||||||
return "intern/supplierOrders/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/accounting/")
|
|
||||||
public String accounting() {
|
|
||||||
return "intern/accounting/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/accounting/vat")
|
|
||||||
public String accountingVat() {
|
|
||||||
return "intern/accounting/vat";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/accounting/main")
|
|
||||||
public String accountingIntern() {
|
|
||||||
return "intern/accounting/main";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/accounting/addManual")
|
|
||||||
public String accountingAddManual() {
|
|
||||||
return "intern/accounting/addManual";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/warehouse/")
|
|
||||||
public String accountingWarehouse() {
|
|
||||||
return "intern/warehouse/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/warehouse/todo")
|
|
||||||
public String accountingWarehouseTodo() {
|
|
||||||
return "intern/warehouse/todo";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/warehouse/addManual")
|
|
||||||
public String accountingWarehouseAddManual() {
|
|
||||||
return "intern/warehouse/addManual";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/warehouse/progress/{id}")
|
|
||||||
public String accountingWarehouseProgressIdPost(HttpServletResponse response) {
|
|
||||||
if ((notSoRandom++) % 2 == 1) {
|
|
||||||
return "redirect:/intern/warehouse/progress/450";
|
|
||||||
} else {
|
|
||||||
response.setStatus(409);
|
|
||||||
return "intern/warehouse/error_progress_failed";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/warehouse/progress/{id}")
|
|
||||||
public String accountingWarehouseProgressId() {
|
|
||||||
return "intern/warehouse/id_progress";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/warehouse/slots/")
|
|
||||||
public String accountingWarehouseSlots() {
|
|
||||||
return "intern/warehouse/slots/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
package org.hso.ecommerce.controller.shop;
|
|
||||||
|
|
||||||
import org.hso.ecommerce.entities.user.User;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("shop")
|
|
||||||
public class ShopRequestController {
|
|
||||||
|
|
||||||
@GetMapping("/")
|
|
||||||
public String shop() {
|
|
||||||
return "shop/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/search")
|
|
||||||
public String shopSearch() {
|
|
||||||
return "shop/search";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/checkout")
|
|
||||||
public String shopCheckout(HttpSession session, HttpServletRequest request) {
|
|
||||||
session.setAttribute("afterLogin", request.getRequestURI());
|
|
||||||
return "shop/checkout";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/checkoutFinish")
|
|
||||||
public String shopCheckoutFinish() {
|
|
||||||
return "shop/checkoutFinish";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/checkoutFinish")
|
|
||||||
public String shopCheckoutFinishGET() {
|
|
||||||
return "shop/checkoutFinish";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/articles/{id}")
|
|
||||||
public String shopArticlesById() {
|
|
||||||
return "shop/articles/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Reference in New Issue
Block a user