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

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.madeu.constants.Constants;
import com.madeu.dao.web.webauthmenurelation.WebAuthMenuRelationSqlMapDAO;
import com.madeu.dao.web.webmember.WebMemberSqlMapDAO;
import com.madeu.dao.web.webnotice.WebNoticeSqlMapDAO;
import com.madeu.service.web.webnotice.WebNoticeService;
import com.madeu.util.ValidationCheckUtil;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service("WebNoticeService")
public class WebNoticeServiceImpl implements WebNoticeService {
	
	@Autowired
	private WebNoticeSqlMapDAO webNoticeSqlMapDAO;
	
	@Autowired
	private WebMemberSqlMapDAO webMemberSqlMapDAO;
	
	@Autowired
	private WebAuthMenuRelationSqlMapDAO webAuthMenuRelationSqlMapDAO;
	
	/**
	 * 공지사항 리스트 화면으로 이동.
	 *
	 *
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	@Override
	public HashMap<String, Object> selectListNoticeIntro(
			HashMap<String, Object> paramMap) throws Exception {
		log.debug("WebNoticeServiceImpl selectListNoticeIntro 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);
				int authMenuRelationlistMapSize = authMenuRelationlistMap.size();
				
				if(1==authMenuRelationlistMapSize){
					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("WebNoticeServiceImpl selectListNoticeIntro END");
		return map;
	}
	
	/**
	 * 공지사항 리스트 조회
	 *
	 *
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	@Override
	public HashMap<String, Object> selectListNotice(
			HashMap<String, Object> paramMap) throws Exception {
		log.debug("WebNoticeServiceImpl selectListNotice START");

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

		log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
		
		log.debug("menuClass           :"+paramMap.get("menuClass"));
		
		log.debug("noticeSearchKeywordParam  :"+paramMap.get("noticeSearchKeywordParam"));
		log.debug("noticeSort                :"+paramMap.get("noticeSort"));
		log.debug("noticeStart               :"+paramMap.get("noticeStart"));
		log.debug("noticeLimit               :"+paramMap.get("noticeLimit"));
		log.debug("noticeSort                :"+paramMap.get("noticeSort"));
		log.debug("noticeDir                 :"+paramMap.get("noticeDir"));
		log.debug("noticeCurrentPage         :"+paramMap.get("noticeCurrentPage"));
		
		log.debug("noticeSearchStartDate     :"+paramMap.get("noticeSearchStartDate"));
		log.debug("noticeSearchEndDate       :"+paramMap.get("noticeSearchEndDate"));
		
		List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>();

		try{
			boolean check  = true;
			
			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){
				// 정렬 
				if(null==paramMap.get("noticeDir")||("").equals(paramMap.get("noticeDir"))){
					
				}
				else{
					String dir = String.valueOf(paramMap.get("noticeDir"));
					if(("A").equals(dir)){
						paramMap.put("noticeDir", "DESC");
					}
					else if(("B").equals(dir)){
						paramMap.put("noticeDir", "ASC");
					}
					else {
						paramMap.put("noticeDir", "DESC");
					}
				}
				
				paramMap.put("useYn", "Y");
				
				List<Map<String, Object>> totalCountListMap = webNoticeSqlMapDAO.selectTotalNoticeCount(paramMap);
				int totalCount = Integer.parseInt(String.valueOf(totalCountListMap.get(0).get("totalCount")));
				
				if(0 < totalCount) {
					// 리스트 조회
					listMap = webNoticeSqlMapDAO.selectListNotice(paramMap);
				}
				
				map.put("msgCode", Constants.OK);
				map.put("success","true");
				map.put("totalCount", totalCount);
				map.put("rows",listMap);
			}
		}
		catch(Exception e){
			e.printStackTrace();
			throw e;
		}
		log.debug("WebNoticeServiceImpl selectListNotice END");
		return map;
	}
	
	/**
	 * 공지사항 정보 상세 조회 (one)
	 *
	 *
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	@Override
	public HashMap<String, Object> selectNotice(
			HashMap<String, Object> paramMap) throws Exception {
		log.debug("WebNoticeServiceImpl selectNotice START");

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

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

		try{
			boolean check  = true;
			String muNoticeId    = String.valueOf(paramMap.get("muNoticeId"));
			
			// 정렬
			if(true != ValidationCheckUtil.emptyCheck(muNoticeId)){
				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()){

					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){
				List<Map<String, Object>> listMap = webNoticeSqlMapDAO.selectNotice(paramMap);
				
				map.put("msgCode", Constants.OK);
				map.put("success","true");
				map.put("rows",listMap);
			}
		}
		catch(Exception e){
			e.printStackTrace();
			throw e;
		}
		log.debug("WebNoticeServiceImpl selectNotice END");
		return map;
	}
	
	/**
	 * 금일 공지사항 리스트 조회 (List)
	 *
	 *
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	@Override
	public HashMap<String, Object> selectListTodayNotice(
			HashMap<String, Object> paramMap) throws Exception {
		log.debug("WebNoticeServiceImpl selectListTodayNotice 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;
			
			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){
				
				List<Map<String, Object>> listMap = webNoticeSqlMapDAO.selectListTodayNotice(paramMap);
				
				map.put("msgCode", Constants.OK);
				map.put("success","true");
				map.put("rows",listMap);
			}
		}
		catch(Exception e){
			e.printStackTrace();
			throw e;
		}
		log.debug("WebNoticeServiceImpl selectListTodayNotice END");
		return map;
	}
	
	/**
	 * 공지사항 정보 등록
	 * 
	 * @param paramMap
	 * @return
	 * @throws Exception 
	 */
	@Override
	@Transactional(rollbackFor={Exception.class}, propagation = Propagation.REQUIRES_NEW)
	public HashMap<String, Object> insertNotice(
			HashMap<String, Object> paramMap) throws Exception{
		log.debug("WebNoticeServiceImpl insertNotice START");
		
		HashMap<String, Object> map = new HashMap<String, Object>();

		log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
		
		log.debug("menuClass           :"+paramMap.get("menuClass"));
		
		log.debug("title               :"+paramMap.get("title"));
		log.debug("content             :"+paramMap.get("content"));
		log.debug("openDate            :"+paramMap.get("openDate"));
		log.debug("openTime            :"+paramMap.get("openTime"));

		try{
			boolean check  = true;
			String tId = String.valueOf(System.currentTimeMillis());
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			Calendar c1 = Calendar.getInstance();
			String tDate = sdf.format(c1.getTime());

			String title           = String.valueOf(paramMap.get("title"));
			String content         = String.valueOf(paramMap.get("content"));
			String openDate        = String.valueOf(paramMap.get("openDate"));
			String openTime        = String.valueOf(paramMap.get("openTime"));
			
			if(true != ValidationCheckUtil.emptyCheck(title)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","제목 정보가 없습니다.");
			}
			else{
				if(true != ValidationCheckUtil.lengthCheck(title,100)){
					check = false;
					map.put("msgCode", Constants.FAIL);
					map.put("msgDesc","제목 정보는 100자를 넘을 수 없습니다.");
				}
			}

			if(true != ValidationCheckUtil.emptyCheck(content)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","내용 정보가 없습니다.");
			}
			
			if(true != ValidationCheckUtil.emptyCheck(openDate)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","게시일 정보가 없습니다.");
			}
			else {
				if(true != ValidationCheckUtil.emptyCheck(openTime)){
					check = false;
					map.put("msgCode", Constants.FAIL);
					map.put("msgDesc","게시시간 정보가 없습니다.");
				}
				else{
					String openDateTime = openDate.concat(" ").concat(openTime);
					
					if(true != ValidationCheckUtil.dateTimeCheck(openDateTime)){
						check = false;
						map.put("msgCode", Constants.FAIL);
						map.put("msgDesc","게시일 정보가 YYYY-MM-DD HH:MM 형식에 맞지 않습니다.");
					}
					else {
						paramMap.put("openDate", openDateTime);
					}
				}
			}
			
			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);
				int authMenuRelationlistMapSize = authMenuRelationlistMap.size();
				
				if(1==authMenuRelationlistMapSize){
					
					if(("Y").equals(authMenuRelationlistMap.get(0).get("insertUseYn"))) {
						
					}
					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){
				paramMap.put("tDate", tDate);
				paramMap.put("tId", tId);
				
				String muNoticeId = ("N").concat(String.valueOf(System.currentTimeMillis()));
				paramMap.put("muNoticeId",muNoticeId);
				paramMap.put("muMemberId", paramMap.get("loginMemberId"));
				webNoticeSqlMapDAO.insertNotice(paramMap);
				log.debug("muNoticeId :"+paramMap.get("id"));
				paramMap.put("muNoticeId", paramMap.get("id"));
				map.put("muNoticeId", paramMap.get("muNoticeId"));

				map.put("msgCode", Constants.OK);
				map.put("msgDesc", "등록되었습니다.");
			}
		}
		catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		log.debug("WebNoticeServiceImpl insertNotice END");
		return map;
	}

	/**
	 * 공지사항 정보 수정
	 * 
	 * @param paramMap
	 * @return
	 * @throws Exception 
	 */
	@Override
	@Transactional(rollbackFor={Exception.class}, propagation = Propagation.REQUIRES_NEW)
	public HashMap<String, Object> updateNotice(
			HashMap<String, Object> paramMap) throws Exception{
		log.debug("WebNoticeServiceImpl updateNotice START");
		
		HashMap<String, Object> map = new HashMap<String, Object>();
		
		log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
		
		log.debug("menuClass           :"+paramMap.get("menuClass"));
		
		log.debug("muNoticeId          :"+paramMap.get("muNoticeId"));
		
		log.debug("title               :"+paramMap.get("title"));
		log.debug("content             :"+paramMap.get("content"));
		log.debug("openDate            :"+paramMap.get("openDate"));
		log.debug("openTime            :"+paramMap.get("openTime"));

		try{
			boolean check  = true;

			String muNoticeId       = String.valueOf(paramMap.get("muNoticeId"));
			String title            = String.valueOf(paramMap.get("title"));
			String content          = String.valueOf(paramMap.get("content"));
			String openDate         = String.valueOf(paramMap.get("openDate"));
			String openTime         = String.valueOf(paramMap.get("openTime"));

			if(true != ValidationCheckUtil.emptyCheck(muNoticeId)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","공지사항 식별자 정보가 없습니다.");
			}

			if(true != ValidationCheckUtil.emptyCheck(title)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","제목 정보가 없습니다.");
			}
			else{
				if(true != ValidationCheckUtil.lengthCheck(title,100)){
					check = false;
					map.put("msgCode", Constants.FAIL);
					map.put("msgDesc","제목 정보는 100자를 넘을 수 없습니다.");
				}
			}

			if(true != ValidationCheckUtil.emptyCheck(content)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","내용 정보가 없습니다.");
			}
			
			if(true != ValidationCheckUtil.emptyCheck(content)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","내용 정보가 없습니다.");
			}
			
			if(true != ValidationCheckUtil.emptyCheck(openDate)){
				check = false;
				map.put("msgCode", Constants.FAIL);
				map.put("msgDesc","게시일 정보가 없습니다.");
			}
			else {
				if(true != ValidationCheckUtil.emptyCheck(openTime)){
					check = false;
					map.put("msgCode", Constants.FAIL);
					map.put("msgDesc","게시시간 정보가 없습니다.");
				}
				else{
					String openDateTime = openDate.concat(" ").concat(openTime);
					
					if(true != ValidationCheckUtil.dateTimeCheck(openDateTime)){
						check = false;
						map.put("msgCode", Constants.FAIL);
						map.put("msgDesc","게시일 정보가 YYYY-MM-DD HH:MM 형식에 맞지 않습니다.");
					}
					else {
						paramMap.put("openDate", openDateTime);
					}
				}
			}

			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);
				int authMenuRelationlistMapSize = authMenuRelationlistMap.size();
				
				if(1==authMenuRelationlistMapSize){
					
					if(("Y").equals(authMenuRelationlistMap.get(0).get("updateUseYn"))) {
						
					}
					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){
				webNoticeSqlMapDAO.updateNotice(paramMap);
				map.put("muNoticeId", paramMap.get("muNoticeId"));
				
				map.put("msgCode", Constants.OK);
				map.put("msgDesc", "수정되었습니다.");
			}
		}
		catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		log.debug("WebNoticeServiceImpl updateNotice END");
		return map;
	}

	/**
	 * 공지사항 정보 삭제
	 * 
	 * @param paramMap
	 * @return
	 * @throws Exception 
	 */
	@Override
	@Transactional(rollbackFor={Exception.class}, propagation = Propagation.REQUIRES_NEW)
	public HashMap<String, Object> deleteNotice(
			HashMap<String, Object> paramMap) throws Exception{
		log.debug("WebNoticeServiceImpl deleteNotice START");
		
		HashMap<String, Object> map = new HashMap<String, Object>();

		log.debug("loginMemberId       :"+paramMap.get("loginMemberId"));
		
		log.debug("menuClass           :"+paramMap.get("menuClass"));
		
		// ,로 구분
		log.debug("selectId            :"+paramMap.get("selectId"));
		
		try{
			boolean check  = true;
			
			if(null== paramMap.get("selectId") || ("").equals(paramMap.get("selectId"))){
				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);
				int authMenuRelationlistMapSize = authMenuRelationlistMap.size();
				
				if(1==authMenuRelationlistMapSize){
					
					if(("Y").equals(authMenuRelationlistMap.get(0).get("deleteUseYn"))) {
						
					}
					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){
				String selectId = String.valueOf(paramMap.get("selectId"));
				StringTokenizer selectData = new StringTokenizer(selectId, ",");
				while(selectData.hasMoreTokens()){//토큰이 계속 있을때 까지
					String muNoticeId = selectData.nextToken();
					
					HashMap<String, Object> deleteParamMap = new HashMap<String, Object>();
					deleteParamMap.put("muNoticeId", muNoticeId);
					deleteParamMap.put("modId", paramMap.get("loginMemberId"));
					webNoticeSqlMapDAO.deleteNotice(deleteParamMap);
				}
				
				map.put("msgCode", Constants.OK);
				map.put("msgDesc", "삭제 되었습니다.");
			}
		}
		catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		
		log.debug("WebNoticeServiceImpl deleteNotice END");
		return map;
	}
}