package com.controller;

import com.config.BaseController;
import com.config.ControllerInterface;
import com.jfinal.aop.Before;
import com.model.Org;
import com.model.User;
import com.service.OrgService;
import com.service.UserService;
import com.tools.JwtUtils;
import com.validator.UserValidator;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

@ControllerInterface(path="/page")
public class PageController extends BaseController {

    OrgService orgService = OrgService.me;
    /**
     * 访问路径test/index
     * 跳转路径view/index/index.html
     */
    /*--------------------------教育局后台管理-------------------*/
//登录
    /*public void teachLogin() {
        render("/teachLogin.html");
    }
    public void schoolLogin() {
        render("/schoolLogin.html");
    }*/
//基本概况
    public void areaSum() {
        render("/view/base-state/areaSum.html");
    }
    public void schoolData() {
        render("/view/base-state/schoolData.html");
    }
    public void schoolRegister() {render("/view/base-state/schoolRegister.html");}
    //学校数据统计子菜单
    public void sumRegister() {
        render("/view/base-state/data-child/sumRegister.html");
    }
    public void flowRecord() {
        render("/view/base-state/data-child/flowRecord.html");
    }
    public void addBook() {
        render("/view/base-state/data-child/addBook.html");
    }
    public void removeBook() {render("/view/base-state/data-child/removeBook.html");}
    public void libBookDetail() {render("/view/base-state/data-child/libBookDetail.html");}
    public void libJournalDetail() {render("/view/base-state/data-child/libJournalDetail.html");}
//标准管理
    public void allNorm() {
    render("/view/norm-manage/allNorm.html");
}
    public void hideBookNorm() {
        render("/view/norm-manage/hideBookNorm.html");
    }
    public void hideSortNorm() {
        render("/view/norm-manage/hideSortNorm.html");
    }
    public void libNorm() {
        render("/view/norm-manage/libNorm.html");
    }
    public void nickNorm() {
        render("/view/norm-manage/nickNorm.html");
    }
//查询统计
    public void libQuery() {render("/view/query-stats/libQuery.html");}
    public void readerQueryState() {
        Integer orgid = this.getParaToInt("orgid");
        User user =getSessionAttr("userInfo");
        if (orgid==null){
            orgid=user.getOrgid();
        }
        Org org =orgService.findById(orgid);
        if (org.getOrgtypeid().equals(3)){
            render("/view/query-stats/readerQuerySchool.html");
        }else {
            render("/view/query-stats/readerQueryState.html");
        }
    }
    public void readerQueryCity() {render("/view/query-stats/readerQueryCity.html");}
    public void readerQuerySchool() {render("/view/query-stats/readerQuerySchool.html");}
    public void readerQuery() {render("/view/query-stats/readerQuery.html");}
    public void libNumberStats() {
        Integer orgid = this.getParaToInt("orgid");
        User user =getSessionAttr("userInfo");
        if (orgid==null){
            orgid=user.getOrgid();
        }
        Org org =orgService.findById(orgid);
        if (org.getOrgtypeid().equals(3)){
            render("/view/query-stats/libNumberStats.html");
        }else {
            render("/view/query-stats/libNumberStatsreport.html");
        }
    }
    public void libNumberStatsState() {render("/view/query-stats/libNumberStatsState.html");}
    public void libNumberStatsCity() {render("/view/query-stats/libNumberStatsCity.html");}
    public void libSortSort() {render("/view/query-stats/libSortSort.html");}
    public void libSortSortState() {
        Integer orgid = this.getParaToInt("orgid");
        User user =getSessionAttr("userInfo");
        if (orgid==null){
            orgid=user.getOrgid();
        }
        Org org =orgService.findById(orgid);
        if (org.getOrgtypeid().equals(3)){
            render("/view/query-stats/libSortSort.html");
        }else {
            render("/view/query-stats/libSortSortState.html");
        }
    }
    public void libSortSortCity() {render("/view/query-stats/libSortSortCity.html");}
    public void libSortDetail() {render("/view/query-stats/libSortDetail.html");}
    public void libFlowStats() {
        Integer orgid = this.getParaToInt("orgid");
        User user =getSessionAttr("userInfo");
        if (orgid==null){
            orgid=user.getOrgid();
        }
        Org org =orgService.findById(orgid);
        if (org.getOrgtypeid().equals(5)){
            render("/view/query-stats/libFlowStats.html");
        }else {
            render("/view/query-stats/libFlowStatsreport.html");
        }
    }
    public void libFlowStatsR() {render("/view/query-stats/libFlowStatsR.html");}

    public void libFlowStatsState() {render("/view/query-stats/libFlowStatsState.html");}
    public void libFlowStatsCity() {render("/view/query-stats/libFlowStatsCity.html");}

    public void libChange() {
        Integer orgid = this.getParaToInt("orgid");
        User user =getSessionAttr("userInfo");
        if (orgid==null){
            orgid=user.getOrgid();
        }
        Org org =orgService.findById(orgid);
        if (org.getOrgtypeid().equals(5)){
            render("/view/query-stats/libChangeStats.html");
        }else {
            render("/view/query-stats/libChange.html");
        }

    }

    public void libChangeCity() {render("/view/query-stats/libChangeCity.html");}
    public void libChangeStats() {render("/view/query-stats/libChangeStats.html");}
    public void addStats() {render("/view/query-stats/addStats.html");}
    public void addStatsState() {
        Integer orgid = this.getParaToInt("orgid");
        User user =getSessionAttr("userInfo");
        if (orgid==null){
            orgid=user.getOrgid();
        }
        Org org =orgService.findById(orgid);
        if (org.getOrgtypeid().equals(3)){
            render("/view/query-stats/addStats.html");
        }else {
            render("/view/query-stats/addStatsState.html");
        }

    }
    public void addStatsCity() {render("/view/query-stats/addStatsCity.html");}
    public void bookRecommendList() {render("/view/query-stats/bookRecommendList.html");}

    public void bookRecommendReviewList(){
        render("/view/query-stats/bookRecommendReviewList.html");
    }
    //子菜单
    public void readerDetail() {render("/view/query-stats/child/readerDetail.html");}
//网站管理
    public void newbookList() {
    render("/view/web-manage/newbookList.html");
}
    public void noticeTell() {
        render("/view/web-manage/noticeTell.html");
    }

    public void standardreport() {
        render("/view/query-stats/standardreport.html");
    }

    public void standardbooktypereport() {
        render("/view/query-stats/standardbooktypereport.html");
    }

    public void thisUnit(){
        render("/view/base-state/thisUnit.html");
    }
}
