split RequestController acording to mapping
This commit is contained in:
		@ -20,8 +20,6 @@ public class RequestController {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private final UserRepository userRepository = null;
 | 
			
		||||
 | 
			
		||||
    static int notSoRandom = 0;
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/")
 | 
			
		||||
    public String home() {
 | 
			
		||||
        return "redirect:/shop/";
 | 
			
		||||
@ -88,55 +86,6 @@ 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";
 | 
			
		||||
@ -152,125 +101,4 @@ public class RequestController {
 | 
			
		||||
        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";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,137 @@
 | 
			
		||||
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";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,63 @@
 | 
			
		||||
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";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
package org.hso.ecommerce.app;
 | 
			
		||||
package org.hso.ecommerce.controller.user;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
		Reference in New Issue
	
	Block a user