package com.madeu.service.web.webstatistics.impl;

import com.madeu.constants.Constants;
import com.madeu.dao.web.webStatistics.WebStatisticsSqlMapDAO;
import com.madeu.dao.web.webattendance.WebAttendanceSqlMapDAO;
import com.madeu.dao.web.webauthmenurelation.WebAuthMenuRelationSqlMapDAO;
import com.madeu.dao.web.webcategory.WebCategorySqlMapDAO;
import com.madeu.dao.web.webmember.WebMemberSqlMapDAO;
import com.madeu.dao.web.webreserve.WebReserveSqlMapDAO;
import com.madeu.dao.web.webtreatment.WebTreatmentSqlMapDAO;
import com.madeu.service.web.webstatistics.WebStatisticsService;
import com.madeu.util.ValidationCheckUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Service("WebStatisticsService")
public class WebStatisticsServiceImpl implements WebStatisticsService {

    @Autowired
    private WebStatisticsSqlMapDAO webStatisticsSqlMapDAO;
    @Autowired
    private WebMemberSqlMapDAO webMemberSqlMapDAO;
    @Autowired
    private WebAuthMenuRelationSqlMapDAO webAuthMenuRelationSqlMapDAO;

    @Autowired
    private WebTreatmentSqlMapDAO webTreatmentSqlMapDAO;

    /**
     * 통계 - 대시보드 화면으로 이동.
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectStatisticsIntro(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectStatisticsIntro START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
        log.debug("menuClass           :"+paramMap.get("menuClass"));

        try{
            boolean check  = true;

            String menuClass    = String.valueOf(paramMap.get("menuClass"));

            if(true != ValidationCheckUtil.emptyCheck(menuClass)){
                check = false;
                map.put("msgCode", Constants.FAIL);
                map.put("msgDesc","메뉴 정보가 없습니다.");
            }

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){
                    map.put("msgCode", Constants.OK);
                    map.put("success","true");

                    map.put("selectUseYn", authMenuRelationlistMap.get(0).get("selectUseYn"));
                    map.put("insertUseYn", authMenuRelationlistMap.get(0).get("insertUseYn"));
                    map.put("updateUseYn", authMenuRelationlistMap.get(0).get("updateUseYn"));
                    map.put("deleteUseYn", authMenuRelationlistMap.get(0).get("deleteUseYn"));
                    map.put("downloadUseYn", authMenuRelationlistMap.get(0).get("downloadUseYn"));
                }
                else {
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl selectStatisticsIntro END");
        return map;
    }
    /**
     * 대시보드 매출조회 (List, option)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectStatistics(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectStatistics START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId         :"+paramMap.get("loginMemberId"));

        log.debug("menuClass             :"+paramMap.get("menuClass"));

        log.debug("statisticsSearchDate  :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }
            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("selectUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "조회 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }

            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);

                // 매출 금액
                List<Map<String, Object>> totalPayment = webStatisticsSqlMapDAO.selectTotalPaymentAmount(selectMap);
                // 진료
                List<Map<String, Object>> totalTreatment = webStatisticsSqlMapDAO.selectTotalTreatmentCount(selectMap);
                // 진료 카테고리별 건수 %, 결제금액
                List<Map<String, Object>> totalTreatmentCategory = webStatisticsSqlMapDAO.selectTotalTreatmentCountAmount(selectMap);
                // 방문고객
                List<Map<String, Object>> totalVisitor = webStatisticsSqlMapDAO.selectTotalVisitorCount(selectMap);
                // 방문고객 성별
                List<Map<String, Object>> totalVisitorGender = webStatisticsSqlMapDAO.selectTotalVisitorGenderCount(selectMap);
                // 전월 매출 금액
                List<Map<String, Object>> prevDailyPayment = webStatisticsSqlMapDAO.selectStatisticsPrevPayment(selectMap);
                // 당월 매출 금액
                List<Map<String, Object>> thisDailyPayment = webStatisticsSqlMapDAO.selectStatisticsThisPayment(selectMap);

                map.put("msgCode", Constants.OK);
                map.put("success","true");
                map.put("totalPayment",totalPayment);
                map.put("totalTreatment",totalTreatment);
                map.put("totalTreatmentCategory",totalTreatmentCategory);
                map.put("totalVisitor",totalVisitor);
                map.put("totalVisitorGender",totalVisitorGender);
                map.put("prevDailyPayment",prevDailyPayment);
                map.put("thisDailyPayment",thisDailyPayment);
            }

        }
        catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebReserveServiceImpl selectListReserveUserOption END");
        return map;
    }
    /**
     * 통계 - 매출통계 화면으로 이동.
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectPaymentStatisticsIntro(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectPaymentStatisticsIntro START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
        log.debug("menuClass           :"+paramMap.get("menuClass"));

        try{
            boolean check  = true;

            String menuClass    = String.valueOf(paramMap.get("menuClass"));

            if(true != ValidationCheckUtil.emptyCheck(menuClass)){
                check = false;
                map.put("msgCode", Constants.FAIL);
                map.put("msgDesc","메뉴 정보가 없습니다.");
            }

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){
                    map.put("msgCode", Constants.OK);
                    map.put("success","true");

                    map.put("selectUseYn", authMenuRelationlistMap.get(0).get("selectUseYn"));
                    map.put("insertUseYn", authMenuRelationlistMap.get(0).get("insertUseYn"));
                    map.put("updateUseYn", authMenuRelationlistMap.get(0).get("updateUseYn"));
                    map.put("deleteUseYn", authMenuRelationlistMap.get(0).get("deleteUseYn"));
                    map.put("downloadUseYn", authMenuRelationlistMap.get(0).get("downloadUseYn"));
                }
                else {
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl selectPaymentStatisticsIntro END");
        return map;
    }

    /**
     * 결제통계 조회 (List, option)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectStatisticsPayment(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectStatisticsPayment START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId         :"+paramMap.get("loginMemberId"));

        log.debug("menuClass             :"+paramMap.get("menuClass"));

        log.debug("statisticsSearchDate  :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }
            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("selectUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "조회 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);


                // 결제 상태별 금액
                List<Map<String, Object>> totalPayment = webStatisticsSqlMapDAO.selectTotalPaymentAmountStatus(selectMap);
                // 당월 결제 금액
                List<Map<String, Object>> thisDailyPayment = webStatisticsSqlMapDAO.selectStatisticsThisPayment(selectMap);
                // 결제 수단별 금액
                List<Map<String, Object>> totalPaymentCategory = webStatisticsSqlMapDAO.selectTotalPaymentAmountCategory(selectMap);
                // 상세 내역
                List<Map<String, Object>> paymentListMap = webStatisticsSqlMapDAO.selectListStatisticsPayment(selectMap);

                map.put("msgCode", Constants.OK);
                map.put("success","true");
                map.put("totalPayment",totalPayment);
                map.put("thisDailyPayment",thisDailyPayment);
                map.put("totalPaymentCategory",totalPaymentCategory);
                map.put("paymentListMap",paymentListMap);
            }

        }
        catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebReserveServiceImpl selectStatisticsPayment END");
        return map;
    }

    /**
     * 결제통계 상세내역 리스트 조회 (List, Excel)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> selectListStatisticsPaymentExcel(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectListStatisticsPaymentExcel START");

        HashMap<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> listMap = null;

        log.debug("loginMemberId            :"+paramMap.get("loginMemberId"));
        log.debug("menuClass                :"+paramMap.get("menuClass"));
        log.debug("statisticsSearchDate     :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("downloadUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "내려받기 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }

            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);

                listMap = webStatisticsSqlMapDAO.selectListStatisticsPayment(selectMap);
            }

        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl selectListStatisticsPaymentExcel END");
        return listMap;
    }

    /**
     * 통계 - 진료통계 화면으로 이동.
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectClinicStatisticsIntro(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectClinicStatisticsIntro START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
        log.debug("menuClass           :"+paramMap.get("menuClass"));

        try{
            boolean check  = true;

            String menuClass    = String.valueOf(paramMap.get("menuClass"));

            if(true != ValidationCheckUtil.emptyCheck(menuClass)){
                check = false;
                map.put("msgCode", Constants.FAIL);
                map.put("msgDesc","메뉴 정보가 없습니다.");
            }

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){
                    map.put("msgCode", Constants.OK);
                    map.put("success","true");

                    map.put("selectUseYn", authMenuRelationlistMap.get(0).get("selectUseYn"));
                    map.put("insertUseYn", authMenuRelationlistMap.get(0).get("insertUseYn"));
                    map.put("updateUseYn", authMenuRelationlistMap.get(0).get("updateUseYn"));
                    map.put("deleteUseYn", authMenuRelationlistMap.get(0).get("deleteUseYn"));
                    map.put("downloadUseYn", authMenuRelationlistMap.get(0).get("downloadUseYn"));
                }
                else {
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl selectClinicStatisticsIntro END");
        return map;
    }
    /**
     * 진료통계 조회 (List, option)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectStatisticsClinic(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectStatisticsClinic START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId         :"+paramMap.get("loginMemberId"));

        log.debug("menuClass             :"+paramMap.get("menuClass"));

        log.debug("statisticsSearchDate  :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }
            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("selectUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "조회 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);


                // 진료별 건수, 결제금액
                List<Map<String, Object>> totalPayment = webStatisticsSqlMapDAO.selectTotalPaymentAmountTreatment(selectMap);
                // 당월 일별 진료별 금액 (진료 매출 트렌드)
                // 진료 카테고리 리스트 조회
                List<Map<String, Object>> treatmentListMap = webTreatmentSqlMapDAO.selectListTreatmentOption2(paramMap);
                int treatmentListMapSize = treatmentListMap.size();
                if(0<treatmentListMapSize){
                    for(int i=0; i<treatmentListMapSize; i++){
                        selectMap.put("treatmentName", treatmentListMap.get(i).get("treatmentName"));
                        List<Map<String, Object>> thisDailyPayment = webStatisticsSqlMapDAO.selectStatisticsThisPaymentTreatment(selectMap);

                        map.put("thisDailyPayment"+i, thisDailyPayment);
                    }
                }
                // 닥터/상담 매출 비중
                List<Map<String, Object>> clinicMemberListMap = webStatisticsSqlMapDAO.selectListStatisticsClinicMember(selectMap);
                // 매출 TOP 10 시술
                List<Map<String, Object>> topPaymentListMap = webStatisticsSqlMapDAO.selectListStatisticsPaymentTreatmentTop(selectMap);
                // 상세내역
                List<Map<String, Object>> paymentListMap = webStatisticsSqlMapDAO.selectListStatisticsPaymentClinic(selectMap);

                map.put("msgCode", Constants.OK);
                map.put("success","true");
                map.put("totalPayment",totalPayment);
                map.put("clinicMemberList",clinicMemberListMap);
                map.put("topPaymentList",topPaymentListMap);
                map.put("paymentListMap",paymentListMap);
            }

        }
        catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebReserveServiceImpl selectStatisticsClinic END");
        return map;
    }

    /**
     * 진료통계 상세내역 리스트 조회 (List, Excel)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> downloadStatisticsClinicExcel(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl downloadStatisticsClinicExcel START");

        HashMap<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> listMap = null;

        log.debug("loginMemberId            :"+paramMap.get("loginMemberId"));
        log.debug("menuClass                :"+paramMap.get("menuClass"));
        log.debug("statisticsSearchDate     :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("downloadUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "내려받기 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }

            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);

                listMap = webStatisticsSqlMapDAO.selectListStatisticsPaymentClinic(selectMap);
            }

        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl downloadStatisticsClinicExcel END");
        return listMap;
    }

    /**
     * 통계 - 고객통계 화면으로 이동.
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectUserStatisticsIntro(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectUserStatisticsIntro START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
        log.debug("menuClass           :"+paramMap.get("menuClass"));

        try{
            boolean check  = true;

            String menuClass    = String.valueOf(paramMap.get("menuClass"));

            if(true != ValidationCheckUtil.emptyCheck(menuClass)){
                check = false;
                map.put("msgCode", Constants.FAIL);
                map.put("msgDesc","메뉴 정보가 없습니다.");
            }

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){
                    map.put("msgCode", Constants.OK);
                    map.put("success","true");

                    map.put("selectUseYn", authMenuRelationlistMap.get(0).get("selectUseYn"));
                    map.put("insertUseYn", authMenuRelationlistMap.get(0).get("insertUseYn"));
                    map.put("updateUseYn", authMenuRelationlistMap.get(0).get("updateUseYn"));
                    map.put("deleteUseYn", authMenuRelationlistMap.get(0).get("deleteUseYn"));
                    map.put("downloadUseYn", authMenuRelationlistMap.get(0).get("downloadUseYn"));
                }
                else {
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl selectUserStatisticsIntro END");
        return map;
    }
    /**
     * 고객통계 조회 (List, option)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectStatisticsUser(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectStatisticsUser START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId         :"+paramMap.get("loginMemberId"));

        log.debug("menuClass             :"+paramMap.get("menuClass"));

        log.debug("statisticsSearchDate  :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }
            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("selectUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "조회 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);


                // 방문고객 전체
                List<Map<String, Object>> totalVisitor = webStatisticsSqlMapDAO.selectTotalVisitorCount(selectMap);
                // 고객유형(초진/재진) == 초진/재진 비율
                List<Map<String, Object>> firstYnVisitor = webStatisticsSqlMapDAO.selectStatisticsVisitorFirstYn(selectMap);
                // 방문고객 성별
                List<Map<String, Object>> genderVisitor = webStatisticsSqlMapDAO.selectTotalVisitorGenderCount(selectMap);
                // 멤버십 회원 = 멤버십
                List<Map<String, Object>> membershipVisitor = webStatisticsSqlMapDAO.selectTotalVisitorMembership(selectMap);
                // 방문고객 트렌드
                // 초진
                selectMap.put("firstYn", "Y");
                List<Map<String, Object>> thisDailyVisitorFirstY = webStatisticsSqlMapDAO.selectStatisticsThisVisitorFirstYn(selectMap);
                // 재진
                selectMap.put("firstYn", "N");
                List<Map<String, Object>> thisDailyVisitorFirstN = webStatisticsSqlMapDAO.selectStatisticsThisVisitorFirstYn(selectMap);
                // 예약유형
                List<Map<String, Object>> categoryVisitor = webStatisticsSqlMapDAO.selectStatisticsVisitorCategory(selectMap);
                // 성별/연령
                // 여성
                selectMap.put("gender", "F");
                List<Map<String, Object>> genderAgeVisitorF = webStatisticsSqlMapDAO.selectStatisticsVisitorGenderAge(selectMap);
                //남성
                selectMap.put("gender", "M");
                List<Map<String, Object>> genderAgeVisitorM = webStatisticsSqlMapDAO.selectStatisticsVisitorGenderAge(selectMap);
                // 국적
                List<Map<String, Object>> nationalityVisitor = webStatisticsSqlMapDAO.selectStatisticsVisitorNationality(selectMap);
                // 고객구분
                List<Map<String, Object>> userTypeVisitor = webStatisticsSqlMapDAO.selectStatisticsVisitorUserType(selectMap);
                // 상세내역
                List<Map<String, Object>> userListMap = webStatisticsSqlMapDAO.selectListStatisticsUser(selectMap);

                map.put("msgCode", Constants.OK);
                map.put("success","true");
                map.put("totalVisitor",totalVisitor);
                map.put("firstYnVisitor",firstYnVisitor);
                map.put("genderVisitor",genderVisitor);
                map.put("membershipVisitor",membershipVisitor);
                map.put("thisDailyVisitorFirstY",thisDailyVisitorFirstY);
                map.put("thisDailyVisitorFirstN",thisDailyVisitorFirstN);
                map.put("categoryVisitor",categoryVisitor);
                map.put("genderAgeVisitorF",genderAgeVisitorF);
                map.put("genderAgeVisitorM",genderAgeVisitorM);
                map.put("nationalityVisitor",nationalityVisitor);
                map.put("userTypeVisitor",userTypeVisitor);
                map.put("userListMap",userListMap);
            }

        }
        catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebReserveServiceImpl selectStatisticsUser END");
        return map;
    }

    /**
     * 고객통계 상세내역 리스트 조회 (List, Excel)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> downloadStatisticsUserExcel(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl downloadStatisticsUserExcel START");

        HashMap<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> listMap = null;

        log.debug("loginMemberId            :"+paramMap.get("loginMemberId"));
        log.debug("menuClass                :"+paramMap.get("menuClass"));
        log.debug("statisticsSearchDate     :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("downloadUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "내려받기 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }

            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);

                listMap = webStatisticsSqlMapDAO.selectListStatisticsUser(selectMap);
            }

        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl downloadStatisticsUserExcel END");
        return listMap;
    }

    /**
     * 통계 - 푸시통계 화면으로 이동.
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectPushStatisticsIntro(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectPushStatisticsIntro START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
        log.debug("menuClass           :"+paramMap.get("menuClass"));

        try{
            boolean check  = true;

            String menuClass    = String.valueOf(paramMap.get("menuClass"));

            if(true != ValidationCheckUtil.emptyCheck(menuClass)){
                check = false;
                map.put("msgCode", Constants.FAIL);
                map.put("msgDesc","메뉴 정보가 없습니다.");
            }

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){
                    map.put("msgCode", Constants.OK);
                    map.put("success","true");

                    map.put("selectUseYn", authMenuRelationlistMap.get(0).get("selectUseYn"));
                    map.put("insertUseYn", authMenuRelationlistMap.get(0).get("insertUseYn"));
                    map.put("updateUseYn", authMenuRelationlistMap.get(0).get("updateUseYn"));
                    map.put("deleteUseYn", authMenuRelationlistMap.get(0).get("deleteUseYn"));
                    map.put("downloadUseYn", authMenuRelationlistMap.get(0).get("downloadUseYn"));
                }
                else {
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl selectPushStatisticsIntro END");
        return map;
    }

    /**
     * 푸시통계 조회 (List, option)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public HashMap<String, Object> selectStatisticsPush(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl selectStatisticsPush START");

        HashMap<String, Object> map = new HashMap<String, Object>();

        log.debug("loginMemberId         :"+paramMap.get("loginMemberId"));

        log.debug("menuClass             :"+paramMap.get("menuClass"));

        log.debug("statisticsSearchDate  :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }
            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("selectUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "조회 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }
            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);



                // 앱푸시, SMS, 알림톡 건수 / 비용
                List<Map<String, Object>> totalCountAmount = webStatisticsSqlMapDAO.selectTotalCountAmountPush(selectMap);
                // 당월 일별 앱푸시, SMS, 알림톡 건수 (푸시 트렌드)
                List<Map<String, Object>> thisDailyAppPush = webStatisticsSqlMapDAO.selectStatisticsThisAppPush(selectMap);
                List<Map<String, Object>> thisDailySms = webStatisticsSqlMapDAO.selectStatisticsThisSms(selectMap);
                List<Map<String, Object>> thisDailyKakao = webStatisticsSqlMapDAO.selectStatisticsThisKakao(selectMap);
                // 당월 일별 비용
                List<Map<String, Object>> thisDailyTotalAmount = webStatisticsSqlMapDAO.selectStatisticsThisTotalAmount(selectMap);
                // 전송상태 비율
                List<Map<String, Object>> pushState = webStatisticsSqlMapDAO.selectStatisticsPushState(selectMap);
                // 알림톡 전송통계
                List<Map<String, Object>> kakaoTemplateCountYn = webStatisticsSqlMapDAO.selectStatisticsKakaoTemplateCountYn(selectMap);
                // 상세내역
                List<Map<String, Object>> pushListMap = webStatisticsSqlMapDAO.selectListStatisticsPush(selectMap);

                map.put("msgCode", Constants.OK);
                map.put("success","true");
                map.put("totalCountAmount",totalCountAmount);
                map.put("thisDailyAppPush",thisDailyAppPush);
                map.put("thisDailySms",thisDailySms);
                map.put("thisDailyKakao",thisDailyKakao);
                map.put("thisDailyTotalAmount",thisDailyTotalAmount);
                map.put("pushState",pushState);
                map.put("kakaoTemplateCountYn",kakaoTemplateCountYn);
                map.put("pushListMap",pushListMap);
            }

        }
        catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebReserveServiceImpl selectStatisticsPush END");
        return map;
    }

    /**
     * 푸시통계 상세내역 리스트 조회 (List, Excel)
     *
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> downloadStatisticsPushExcel(
            HashMap<String, Object> paramMap) throws Exception {
        log.debug("WebStatisticServiceImpl downloadStatisticsPushExcel START");

        HashMap<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> listMap = null;

        log.debug("loginMemberId            :"+paramMap.get("loginMemberId"));
        log.debug("menuClass                :"+paramMap.get("menuClass"));
        log.debug("statisticsSearchDate     :"+paramMap.get("statisticsSearchDate"));

        try{
            boolean check  = true;

            String statisticsSearchDate = String.valueOf(paramMap.get("statisticsSearchDate"));

            if(true == check){
                // 사용자 확인
                List<Map<String, Object>> userListMap = webMemberSqlMapDAO.checkMember(paramMap);
                int userListMapSize = userListMap.size();

                if(1==userListMapSize){
                    paramMap.put("menuClassAuthId", userListMap.get(0).get("muAuthId"));
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "사용자 정보가 올바르지 않습니다.");
                }
            }

            if(true == check){
                // 권한 조회
                HashMap<String, Object> authCheckParamMap = new HashMap<String, Object>();
                authCheckParamMap.put("menuClass",paramMap.get("menuClass"));
                authCheckParamMap.put("muAuthId",paramMap.get("menuClassAuthId"));
                List<Map<String, Object>> authMenuRelationlistMap = webAuthMenuRelationSqlMapDAO.selectAuthMenuRelation(authCheckParamMap);

                if(1==authMenuRelationlistMap.size()){

                    if(("Y").equals(authMenuRelationlistMap.get(0).get("downloadUseYn"))) {

                    }
                    else {
                        check = false;
                        map.put("msgCode", Constants.FAIL);
                        map.put("msgDesc", "내려받기 권한 정보가 없습니다.");
                    }
                }
                else {
                    check = false;
                    map.put("msgCode", Constants.FAIL);
                    map.put("msgDesc", "권한 정보가 없습니다.");
                }
            }

            if(true == check){
                // 전월, 당월 구하기
                HashMap<String, Object> selectMap = new HashMap<String, Object>();

                LocalDate thisYearMonth = LocalDate.parse(statisticsSearchDate+"-01");
                LocalDate prevYearMonth = thisYearMonth.minusMonths(1).withDayOfMonth(1);

                selectMap.put("thisYearMonth", thisYearMonth);
                selectMap.put("prevYearMonth", prevYearMonth);

                listMap = webStatisticsSqlMapDAO.selectListStatisticsPush(selectMap);
            }

        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }

        log.debug("WebStatisticServiceImpl downloadStatisticsPushExcel END");
        return listMap;
    }

}
