package im.zksy.yjmqserver.system.controller;

import im.zksy.yjmqserver.common.util.DateUtils;
import im.zksy.yjmqserver.system.model.Menu;
import im.zksy.yjmqserver.system.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Controller
@Slf4j
public class IndexController {

    @Resource
    private MenuService menuService;


    @Autowired
    private RestTemplate restTemplate;


    @GetMapping(value = { "/main"})
    public String index(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "main";
    }
    @GetMapping(value = { "/qxindex"})
    public String qxindex(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "index";
    }

    @GetMapping(value = { "/sjcx"})
    public String pagesjcx(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/sjcx";
    }
    @GetMapping(value = { "/jkgl"})
    public String pagejkgl(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/jkgl";
    }

    @GetMapping(value = { "/jgsbgl"})
    public String pagejgsbgl(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/jgsbgl";
    }

    @GetMapping(value = { "/xtgl"})
    public String pagextgl(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/xtgl";
    }
    @GetMapping(value = { "/index"})
    public String pageindex(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/index";
    }

    @GetMapping(value = { "/pub_index"})
    public String pub_index(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/pub_index";
    }
    @GetMapping(value = { "/sjcxjs"})
    public String sjcxjs(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/sjcxjs";
    }
    @GetMapping(value = { "/sjcxzw"})
    public String sjcxzw(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/sjcxzw";
    }
    @GetMapping(value = { "/sjcxsccj"})
    public String sjcxsccj(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/sjcxsccj";
    }
    @GetMapping(value = { "/sjzdbz"})
    public String pagesjzdbz(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/sjzdbz";
    }

    @GetMapping(value = { "/mainpage"})
    public String mainpage(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/main";
    }

    @GetMapping(value = { "/sjdj"})
    public String sjdj(Model model) {
        List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
        model.addAttribute("menus", menuTreeVOS);
        return "page/sjdj";
    }



}
