egovframework.oe1.cms.mrm.web.EgovOe1ResveMtgController.java Source code

Java tutorial

Introduction

Here is the source code for egovframework.oe1.cms.mrm.web.EgovOe1ResveMtgController.java

Source

/*
 * Copyright 2010 MOPAS(Ministry of Public Administration and Security).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package egovframework.oe1.cms.mrm.web;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Map.Entry;

import javax.annotation.Resource;

import org.apache.commons.fileupload.FileItem;
import org.apache.log4j.Logger;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springmodules.validation.commons.DefaultBeanValidator;

import egovframework.oe1.cms.com.service.EgovOe1CmmUseService;
import egovframework.oe1.cms.com.service.EgovOe1ComDefaultCodeVO;
import egovframework.oe1.cms.com.service.EgovOe1FileMngService;
import egovframework.oe1.cms.com.service.EgovOe1FileMngUtil;
import egovframework.oe1.cms.com.service.EgovOe1FileVO;
import egovframework.oe1.cms.com.service.EgovOe1MessageSource;
import egovframework.oe1.cms.mrm.service.EgovOe1MtgRmService;
import egovframework.oe1.cms.mrm.service.EgovOe1MtgRmVO;
import egovframework.oe1.cms.mrm.service.EgovOe1ResveMtgService;
import egovframework.oe1.cms.mrm.service.EgovOe1ResveMtgVO;
import egovframework.oe1.cms.com.service.EgovOe1LoginVO;
import egovframework.rte.fdl.property.EgovPropertyService;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import egovframework.rte.psl.dataaccess.util.EgovMap;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;

/**
 * 
 * - ??  controller ? ?.
 * 
 * ?
 * - ??  ?, , , ? .
 * - ?? ? ?, ? ?.
 * @author ?  
 * @since 2010.08.22
 * @version 1.0
 * @see
 *
 * <pre>
 *  == ?(Modification Information) ==
 *   
 *   ?      ?           
 *  -------    --------    ---------------------------
 *   2010.08.22             ?
 *
 * </pre>
 */
@Controller
public class EgovOe1ResveMtgController {
    /** EgovMessageSource */
    @Resource(name = "egovMessageSource")
    EgovOe1MessageSource egovMessageSource;

    /** EgovOe1ResveMtgService */
    @Resource(name = "egovOe1ResveMtgService")
    private EgovOe1ResveMtgService egovOe1ResveMtgService;

    /** EgovOe1MtgRmService */
    @Resource(name = "egovOe1MtgRmService")
    private EgovOe1MtgRmService egovOe1MtgRmService;

    /** EgovPropertyService */
    @Resource(name = "propertiesService")
    protected EgovPropertyService propertiesService;

    /** EgovCmmUseService */
    @Resource(name = "EgovCmmUseService")
    public EgovOe1CmmUseService egovCmmUseService;

    @Resource(name = "EgovFileMngService")
    private EgovOe1FileMngService fileMngService;

    @Resource(name = "EgovFileMngUtil")
    private EgovOe1FileMngUtil fileUtil;

    /** Validator */
    @Resource(name = "beanValidator")
    protected DefaultBeanValidator beanValidator;

    Logger log = Logger.getLogger(this.getClass());

    /**
     * ? ?
     * @param : EgovOe1ResveMtgVO
     * @param : ModelMap
     * @return : "/cms/mrm/EgovResveMtgListCarendar"
     * @exception Exception
     */
    @RequestMapping(value = "/cms/mrm/selectResveMtgList.do")
    public String selectResveMtgList(@ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO,
            ModelMap model) throws Exception {

        log.debug(this.getClass().getName() + " ==> ? ?  ");

        //       /** EgovPropertyService.egovOe1ResveMtgService */
        //       egovOe1ResveMtgVO.setPageUnit(propertiesService.getInt("pageUnit"));
        //       egovOe1ResveMtgVO.setPageSize(propertiesService.getInt("pageSize"));
        //
        //       /** pageing setting */
        //       PaginationInfo paginationInfo = new PaginationInfo();
        //      paginationInfo.setCurrentPageNo(egovOe1ResveMtgVO.getPageIndex());
        //      paginationInfo.setRecordCountPerPage(egovOe1ResveMtgVO.getPageUnit());
        //      paginationInfo.setPageSize(egovOe1ResveMtgVO.getPageSize());
        //      
        //      egovOe1ResveMtgVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
        //      egovOe1ResveMtgVO.setLastIndex(paginationInfo.getLastRecordIndex());
        //      egovOe1ResveMtgVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
        //
        java.util.Calendar cal = java.util.Calendar.getInstance();
        String year = cal.get(java.util.Calendar.YEAR) + "";
        String month = (cal.get(java.util.Calendar.MONTH) + 1) + "";

        if ("".equals(egovOe1ResveMtgVO.getSearchYear()) || egovOe1ResveMtgVO.getSearchYear() == null) {
            egovOe1ResveMtgVO.setSearchYear(year + "");
        }
        if ("".equals(egovOe1ResveMtgVO.getSearchMonth()) || egovOe1ResveMtgVO.getSearchMonth() == null) {
            if (month.length() == 1) {
                month = "0" + month;
            }
            egovOe1ResveMtgVO.setSearchMonth(month);
        }
        //viewType? ?? ? C 
        if ("".equals(egovOe1ResveMtgVO.getViewType()) || egovOe1ResveMtgVO.getViewType() == null) {
            egovOe1ResveMtgVO.setViewType("C");
        }

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        // ?
        EgovOe1ComDefaultCodeVO vo = new EgovOe1ComDefaultCodeVO();
        vo.setCodeId("OE1032");
        List schdulSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("schdulSeCode_result", schdulSeCode_result);

        // ?
        vo = new EgovOe1ComDefaultCodeVO();
        vo.setCodeId("OE1008");
        List year_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("year_result", year_result);

        // 
        vo = new EgovOe1ComDefaultCodeVO();
        vo.setCodeId("OE1013");
        List month_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("month_result", month_result);

        // ? 
        //        EgovOe1ResveMtgVO MtgRmList = new EgovOe1ResveMtgVO();
        //        List mtgPlaceId_result = egovOe1ResveMtgService.selectMtgPlaceIdList(MtgRmList);
        //        model.addAttribute("mtgPlaceId_result", mtgPlaceId_result);   //?        

        //?
        List ResveMtgList = egovOe1ResveMtgService.selectResveMtgList(egovOe1ResveMtgVO);
        model.addAttribute("resultList", ResveMtgList);

        //        int totCnt = egovOe1ResveMtgService.selectResveMtgListTot(egovOe1ResveMtgVO);
        //      paginationInfo.setTotalRecordCount(totCnt);
        //        model.addAttribute("paginationInfo", paginationInfo);

        if ("L".equals(egovOe1ResveMtgVO.getViewType())) {
            return "/cms/mrm/EgovResveMtgList";
        } else if ("C".equals(egovOe1ResveMtgVO.getViewType())) {
            return "/cms/mrm/EgovResveMtgListCarendar";
        } else {
            return "/cms/mrm/EgovResveMtgListCarendar";
        }

    }

    /**
    * ? ? ? .
    * @param EgovOe1ResveMtgVO - ?    VO
    * @param model
    * @return "/cms/mrm/EgovResveMtgRegist"
    * @exception Exception
    */
    @RequestMapping("/cms/mrm/addResveMtg.do")
    public String addResveMtg(@ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO, Model model)
            throws Exception {

        log.debug(this.getClass().getName() + " ==> ? ?  ");

        Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
        if (!isAuthenticated) {
            return "/cms/com/EgovLoginUsr"; //? ??
        }

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        // ?
        EgovOe1ComDefaultCodeVO vo = new EgovOe1ComDefaultCodeVO();
        vo.setCodeId("OE1032");
        List schdulSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("schdulSeCode_result", schdulSeCode_result);

        // 
        vo.setCodeId("OE1033");
        List jobSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("jobSeCode_result", jobSeCode_result);

        // 
        vo.setCodeId("OE1034");
        List reptitSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("reptitSeCode_result", reptitSeCode_result);

        // ? 
        EgovOe1ResveMtgVO MtgRmList = new EgovOe1ResveMtgVO();
        List mtgPlaceId_result = egovOe1ResveMtgService.selectMtgPlaceIdList(MtgRmList);
        model.addAttribute("mtgPlaceId_result", mtgPlaceId_result); //?        

        return "/cms/mrm/EgovResveMtgRegist";
    }

    /**
    * ? ?
    * @param egovOe1ResveMtgVO - ?   VO
    * @param status
    * @return "forward:/cms/mrm/selectResveMtgList.do"
    * @exception Exception
    */

    @RequestMapping("/cms/mrm/addResveMtgOK.do")
    public String addResveMtgOK(final MultipartHttpServletRequest multiRequest,
            @ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO, BindingResult bindingResult,
            Model model, SessionStatus status) throws Exception {

        log.debug(this.getClass().getName() + " ==> ? ? ");

        Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
        if (!isAuthenticated) {
            return "/cms/com/EgovLoginUsr"; //? ??
        }

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        // Server-Side Validation
        beanValidator.validate(egovOe1ResveMtgVO, bindingResult);
        if (bindingResult.hasErrors()) {
            model.addAttribute("egovOe1ResveMtgVO", egovOe1ResveMtgVO);
            return "/cms/mrm/addResveMtg";
        }

        //
        EgovOe1LoginVO user = (EgovOe1LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();

        //? 
        List<EgovOe1FileVO> result = null;
        String atchFileId = "";

        final Map<String, MultipartFile> files = multiRequest.getFileMap();
        if (!files.isEmpty()) {
            result = fileUtil.parseFileInf(files, "MTR_", 3, "", "");
            atchFileId = fileMngService.insertFileInfs(result);
        }
        egovOe1ResveMtgVO.setAtchFileId(atchFileId);
        //? 

        egovOe1ResveMtgVO.setRegisterId(user.getMberId()); //??ID

        String shh = egovOe1ResveMtgVO.getStartHh();
        String smm = egovOe1ResveMtgVO.getStartMm();
        String fhh = egovOe1ResveMtgVO.getFinishHh();
        String fmm = egovOe1ResveMtgVO.getFinishMm();
        if ("001".equals(egovOe1ResveMtgVO.getInsRepeat())) { //?
            egovOe1ResveMtgVO.setMtgStartDate(egovOe1ResveMtgVO.getInsRepeatDate()); //??? 
            egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getInsRepeatDate()); //???               
            egovOe1ResveMtgVO.setMtgBeginTime(shh + smm); //?
            egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm); //?
            egovOe1ResveMtgService.insertResveMtg(egovOe1ResveMtgVO);

            StringTokenizer st = new StringTokenizer(egovOe1ResveMtgVO.getAttendantId(), "|"); //????
            int n = st.countTokens();
            for (int j = 0; j < n; j++) {
                String token = st.nextToken();
                egovOe1ResveMtgVO.setMtgAttenId(token);
                egovOe1ResveMtgService.insertMtGattenInfo(egovOe1ResveMtgVO);
            }

        } else {//

            //System.out.println("====>"+egovOe1ResveMtgVO.getInsRepeatCnt());
            //System.out.println("  1====>"+egovOe1ResveMtgVO.getInsRepeatDate());   //20100101201001022010010320100204
            for (int i = 1; i <= Integer.parseInt(egovOe1ResveMtgVO.getInsRepeatCnt()); i++) { //
                //System.out.println(" =======>"+ i);
                //System.out.println(" =======>"+ ((i*8)-8));
                //System.out.println("?   =======>"+egovOe1ResveMtgVO.getInsRepeatDate().substring((i*8)-8, i*8));

                egovOe1ResveMtgVO
                        .setMtgStartDate(egovOe1ResveMtgVO.getInsRepeatDate().substring((i * 8) - 8, i * 8)); //??? 
                egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getInsRepeatDate().substring((i * 8) - 8, i * 8)); //??? 

                if ("003".equals(egovOe1ResveMtgVO.getReptitSeCode())) {
                    if (i == 1) {
                        egovOe1ResveMtgVO.setMtgBeginTime(shh + smm);
                    } else {
                        egovOe1ResveMtgVO.setMtgBeginTime("0600");
                    }
                    if (i == Integer.parseInt(egovOe1ResveMtgVO.getInsRepeatCnt())) {
                        egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm);
                    } else {
                        egovOe1ResveMtgVO.setMtgEndTime("2355");
                    }
                } else {
                    egovOe1ResveMtgVO.setMtgBeginTime(shh + smm);
                    egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm);
                }
                egovOe1ResveMtgVO.getInsRepeatDate().substring((i * 8) - 8, i * 8);
                egovOe1ResveMtgService.insertResveMtg(egovOe1ResveMtgVO);

                StringTokenizer st = new StringTokenizer(egovOe1ResveMtgVO.getAttendantId(), "|");
                int n = st.countTokens();
                for (int j = 0; j < n; j++) {
                    String token = st.nextToken();
                    egovOe1ResveMtgVO.setMtgAttenId(token);
                    egovOe1ResveMtgService.insertMtGattenInfo(egovOe1ResveMtgVO);
                }
            }
        }

        status.setComplete();

        if (status.isComplete()) {
            model.addAttribute("resultMsg", "? ? ");
        } else {
            model.addAttribute("resultMsg", "? ? ");
        }

        return "forward:/cms/mrm/selectResveMtgList.do";
    }

    /**
     * ? ? 
     * @param : EgovOe1ResveMtgVO
     * @return : "/cms/mrm/EgovResveMtgDetail"
     * @exception Exception
     */
    @RequestMapping("/cms/mrm/selectResveMtg.do")
    public String selectResveMtg(@RequestParam("selectedId") String selectedId,
            @ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO, Model model)
            throws Exception {

        log.debug(this.getClass().getName() + " ==> ? ? ");

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        //
        EgovOe1LoginVO user = (EgovOe1LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();

        egovOe1ResveMtgVO.setMtgRoomResId(selectedId);

        // ? 
        model.addAttribute("egovOe1ResveMtgVO", egovOe1ResveMtgService.selectResveMtg(egovOe1ResveMtgVO));

        // ??? 
        List ResveMtgList = egovOe1ResveMtgService.selectMtGattenInfoList(egovOe1ResveMtgVO);
        model.addAttribute("resultList", ResveMtgList);

        return "/cms/mrm/EgovResveMtgDetail";
    }

    /**
    * ? ? .
    * @param id -   id
    * @param egovOe1ResveMtgVO - ?    VO
    * @param model
    * @return "/cms/mrm/EgovResveMtgUpdt"
    * @exception Exception
    */
    @RequestMapping("/cms/mrm/updateResveMtg.do")
    public String updateResveMtg(@RequestParam("selectedId") String selectedId,
            @ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO, Model model)
            throws Exception {

        log.debug(this.getClass().getName() + " ==> ?   ");

        Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
        if (!isAuthenticated) {
            return "/cms/com/EgovLoginUsr"; //? ??
        }

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        // ?
        EgovOe1ComDefaultCodeVO vo = new EgovOe1ComDefaultCodeVO();
        vo.setCodeId("OE1032");
        List schdulSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("schdulSeCode_result", schdulSeCode_result);

        // 
        vo.setCodeId("OE1033");
        List jobSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("jobSeCode_result", jobSeCode_result);

        // 
        vo.setCodeId("OE1034");
        List reptitSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("reptitSeCode_result", reptitSeCode_result);

        // ? 
        EgovOe1ResveMtgVO MtgRmList = new EgovOe1ResveMtgVO();
        List mtgPlaceId_result = egovOe1ResveMtgService.selectMtgPlaceIdList(MtgRmList);
        model.addAttribute("mtgPlaceId_result", mtgPlaceId_result); //?        

        egovOe1ResveMtgVO.setMtgRoomResId(selectedId);

        // ??? 
        List ResveMtgList = egovOe1ResveMtgService.selectMtGattenInfoList(egovOe1ResveMtgVO);
        model.addAttribute("resultList", ResveMtgList);

        model.addAttribute("egovOe1ResveMtgVO", egovOe1ResveMtgService.selectResveMtgUpdate(egovOe1ResveMtgVO));
        return "/cms/mrm/EgovResveMtgUpdt";
    }

    /**
    * ? .
    * @param egovOe1ResveMtgVO    -    VO
    * @param status
    * @return "forward:/cms/mrm/selectResveMtgList.do"
    * @exception Exception
    */
    @RequestMapping("/cms/mrm/updateResveMtgOK.do")
    public String updateResveMtgOK(final MultipartHttpServletRequest multiRequest,
            @RequestParam("selectedId") String selectedId,
            @ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO, BindingResult bindingResult,
            Model model, SessionStatus status) throws Exception {

        log.debug(this.getClass().getName() + " ==> ?  ");

        Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
        if (!isAuthenticated) {
            return "/cms/com/EgovLoginUsr"; //? ??
        }

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        beanValidator.validate(egovOe1ResveMtgVO, bindingResult);
        if (bindingResult.hasErrors()) {
            model.addAttribute("egovOe1ResveMtgVO", egovOe1ResveMtgVO);
            return "/cms/mrm/EgovResveMtgUpdt";
        }

        //
        EgovOe1LoginVO user = (EgovOe1LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();

        String atchFileId = egovOe1ResveMtgVO.getAtchFileId();

        egovOe1ResveMtgVO.setMtgRoomResId(selectedId);

        final Map<String, MultipartFile> files = multiRequest.getFileMap();
        if (!files.isEmpty()) {
            if ("".equals(atchFileId)) {
                List<EgovOe1FileVO> result = fileUtil.parseFileInf(files, "MTR_", 0, atchFileId, "");
                atchFileId = fileMngService.insertFileInfs(result);
                egovOe1ResveMtgVO.setAtchFileId(atchFileId);
            } else {
                EgovOe1FileVO fvo = new EgovOe1FileVO();
                fvo.setAtchFileId(atchFileId);
                int cnt = fileMngService.getMaxFileSN(fvo);
                List<EgovOe1FileVO> _result = fileUtil.parseFileInf(files, "MTR_", cnt, atchFileId, "");
                fileMngService.updateFileInfs(_result);
            }
        }
        egovOe1ResveMtgVO.setAtchFileId(atchFileId); //? ?? ID  VO? .
        egovOe1ResveMtgVO.setRegisterId(user.getMberId()); //??? ID VO? .

        String shh = egovOe1ResveMtgVO.getStartHh();
        String smm = egovOe1ResveMtgVO.getStartMm();
        String fhh = egovOe1ResveMtgVO.getFinishHh();
        String fmm = egovOe1ResveMtgVO.getFinishMm();

        egovOe1ResveMtgVO.setMtgStartDate(egovOe1ResveMtgVO.getInsRepeatDate()); //??? 
        egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getInsRepeatDate()); //???               
        egovOe1ResveMtgVO.setMtgBeginTime(shh + smm); //?
        egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm); //?
        egovOe1ResveMtgService.updateResveMtg(egovOe1ResveMtgVO); //??? .

        egovOe1ResveMtgService.deleteMtGattenInfo(egovOe1ResveMtgVO); //???  . 

        StringTokenizer st = new StringTokenizer(egovOe1ResveMtgVO.getAttendantId(), "|"); //????
        int n = st.countTokens();
        for (int j = 0; j < n; j++) {
            String token = st.nextToken();
            egovOe1ResveMtgVO.setMtgAttenId(token);
            egovOe1ResveMtgService.insertMtGattenInfo(egovOe1ResveMtgVO);
        }

        status.setComplete();

        if (status.isComplete()) {
            model.addAttribute("resultMsg", "?  ");
        } else {
            model.addAttribute("resultMsg", "?  ");
        }

        return "forward:/cms/mrm/selectResveMtgList.do";
    }

    /**
    * ? .
    * @param egovOe1ResveMtgVO -    VO
    * @param status
    * @return "forward:/cms/mrm/selectResveMtgList.do"
    * @exception Exception
    */
    @RequestMapping("/cms/mrm/removeResveMtgOK.do")
    public String removeResveMtgOK(@RequestParam("selectedId") String selectedId,
            @ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO, SessionStatus status,
            Model model) throws Exception {

        log.debug(this.getClass().getName() + " ==> ?  ");

        Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
        if (!isAuthenticated) {
            return "/cms/com/EgovLoginUsr"; //? ??
        }

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        egovOe1ResveMtgVO.setMtgRoomResId(selectedId);

        if (!"".equals(egovOe1ResveMtgVO.getAtchFileId())) {
            EgovOe1FileVO fileVo = new EgovOe1FileVO();
            fileVo.setAtchFileId(egovOe1ResveMtgVO.getAtchFileId());// ? ID
            fileMngService.deleteAllFileInf(fileVo);
        }

        egovOe1ResveMtgService.deleteMtGattenInfo(egovOe1ResveMtgVO);

        egovOe1ResveMtgService.deleteResveMtg(egovOe1ResveMtgVO);

        status.setComplete();

        if (status.isComplete()) {
            model.addAttribute("resultMsg", "?  ");
        } else {
            model.addAttribute("resultMsg", "?  ");
        }

        return "forward:/cms/mrm/selectResveMtgList.do";
    }

    /**
     * ??  ?
     * @param mngrNm   ?? 
     * @param EgovOe1ResveMtgVO
     * @param model
     * @return "/cms/mrm/EgovUserListPopup2"
     * @throws Exception
     */
    @RequestMapping("/cms/mrm/inquiryGeneralMemberListPopup2.do")
    public String inquiryGeneralMemberList(@ModelAttribute("egovOe1MtgRmVO") EgovOe1MtgRmVO egovOe1MtgRmVO,
            ModelMap model) throws Exception {

        /** EgovPropertyService.egovOe1MtgRmService */

        egovOe1MtgRmVO.setPageUnit(propertiesService.getInt("pageUnit"));
        egovOe1MtgRmVO.setPageSize(propertiesService.getInt("pageSize"));

        /** pageing setting */
        PaginationInfo paginationInfo = new PaginationInfo();
        paginationInfo.setCurrentPageNo(egovOe1MtgRmVO.getPageIndex());
        paginationInfo.setRecordCountPerPage(egovOe1MtgRmVO.getPageUnit());
        paginationInfo.setPageSize(egovOe1MtgRmVO.getPageSize());

        egovOe1MtgRmVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
        egovOe1MtgRmVO.setLastIndex(paginationInfo.getLastRecordIndex());
        egovOe1MtgRmVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1MtgRmVO);

        List<EgovMap> memberList = egovOe1MtgRmService.selectGeneralMemberList(egovOe1MtgRmVO);

        model.addAttribute("memberList", memberList);

        int totCnt = egovOe1MtgRmService.selectUserListTotCnt(egovOe1MtgRmVO);
        paginationInfo.setTotalRecordCount(totCnt);
        model.addAttribute("paginationInfo", paginationInfo);
        model.addAttribute("resultCnt", totCnt);

        log.debug(this.getClass() + " inquirySanctionDispatchList() END");
        return "/cms/mrm/EgovUserListPopup2";
    }

    /**
     * ?? ? 
     * @param mngrNm   ?? ? 
     * @param model
     * @return "/cms/mrm/EgovUserMultySelectList"
     * @throws Exception
     */
    @RequestMapping("/cms/mrm/inquiryGeneralMemberMultiSelectListPopup.do")
    public String inquiryGeneralMemberMultiSelectList(EgovOe1ResveMtgVO egovOe1ResveMtgVO, Model model)
            throws Exception {

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        List<EgovMap> memberList = egovOe1ResveMtgService.selectGeneralMemberMultiSelectList(egovOe1ResveMtgVO);

        model.addAttribute("memberList", memberList);

        log.debug(this.getClass() + " inquirySanctionDispatchList() END");
        return "/cms/mrm/EgovUserMultySelectList";
    }

    /**
    * ? ?
    * @param egovOe1ResveMtgVO - ?    VO
    * @param status
    * @return "/cms/mrm/EgovResveMtgRegist"
    * @exception Exception
    */
    @RequestMapping("/cms/mrm/selectDupCheck.do")
    public String selectDupCheck(@ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO,
            BindingResult bindingResult, Model model) throws Exception {

        log.debug(this.getClass().getName() + " ==> ?  ? ");

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);
        String startDate = egovOe1ResveMtgVO.getMtgStartDate();

        // Server-Side Validation
        beanValidator.validate(egovOe1ResveMtgVO, bindingResult);
        if (bindingResult.hasErrors()) {
            model.addAttribute("egovOe1ResveMtgVO", egovOe1ResveMtgVO);
            return "/cms/mrm/EgovResveMtgRegist";
        }

        //int dup_count = 0;
        String shh = egovOe1ResveMtgVO.getStartHh();
        String smm = egovOe1ResveMtgVO.getStartMm();
        String fhh = egovOe1ResveMtgVO.getFinishHh();
        String fmm = egovOe1ResveMtgVO.getFinishMm();

        if ("001".equals(egovOe1ResveMtgVO.getInsRepeat())) { //?
            egovOe1ResveMtgVO.setMtgStartDate(egovOe1ResveMtgVO.getInsRepeatDate()); //??? 
            egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getInsRepeatDate()); //???               
            egovOe1ResveMtgVO.setMtgBeginTime(shh + smm); //?
            egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm); //?
            //?
            List ResveMtgList = egovOe1ResveMtgService.selectDupCheck(egovOe1ResveMtgVO);
            model.addAttribute("resultList", ResveMtgList);
            //dup_count = egovOe1ResveMtgService.selectDupCheck(egovOe1ResveMtgVO);
        } else {//
                //System.out.println("====>"+egovOe1ResveMtgVO.getInsRepeatCnt());
                //System.out.println("  1====>"+egovOe1ResveMtgVO.getInsRepeatDate());   //20100101201001022010010320100204
            for (int i = 1; i <= Integer.parseInt(egovOe1ResveMtgVO.getInsRepeatCnt()); i++) { //
                //System.out.println(" =======>"+ i);
                //System.out.println(" =======>"+ ((i*8)-8));
                //System.out.println("?   =======>"+egovOe1ResveMtgVO.getInsRepeatDate().substring((i*8)-8, i*8));
                egovOe1ResveMtgVO
                        .setMtgStartDate(egovOe1ResveMtgVO.getInsRepeatDate().substring((i * 8) - 8, i * 8)); //??? 
                egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getInsRepeatDate().substring((i * 8) - 8, i * 8)); //??? 
                if ("003".equals(egovOe1ResveMtgVO.getReptitSeCode())) {
                    if (i == 1) {
                        egovOe1ResveMtgVO.setMtgBeginTime(shh + smm);
                    } else {
                        egovOe1ResveMtgVO.setMtgBeginTime("0800");
                    }
                    if (i == Integer.parseInt(egovOe1ResveMtgVO.getInsRepeatCnt())) {
                        egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm);
                    } else {
                        egovOe1ResveMtgVO.setMtgEndTime("2330");
                    }
                } else {
                    egovOe1ResveMtgVO.setMtgBeginTime(shh + smm);
                    egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm);
                }
                egovOe1ResveMtgVO.getInsRepeatDate().substring((i * 8) - 8, i * 8);
                List ResveMtgList = egovOe1ResveMtgService.selectDupCheck(egovOe1ResveMtgVO);
                model.addAttribute("resultList", ResveMtgList);
                //dup_count = dup_count + egovOe1ResveMtgService.selectDupCheck(egovOe1ResveMtgVO);
            }
        }

        //       if(0<dup_count){
        //          model.addAttribute("resultMsg", "?? ?. ?   .");
        //          model.addAttribute("dupCheckNull", "Y");
        //       }else{
        //          model.addAttribute("resultMsg", "? ??? .");
        //       }

        //        // ?
        //        EgovOe1ComDefaultCodeVO vo = new EgovOe1ComDefaultCodeVO();
        //        vo.setCodeId("OE1032");
        //        List schdulSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        //        model.addAttribute("schdulSeCode_result", schdulSeCode_result);
        //
        //        // 
        //        vo.setCodeId("OE1033");
        //        List jobSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        //        model.addAttribute("jobSeCode_result", jobSeCode_result);        
        //        
        //        // 
        //        vo.setCodeId("OE1034");
        //        List reptitSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        //        model.addAttribute("reptitSeCode_result", reptitSeCode_result);   
        //        
        //        // ? 
        //        EgovOe1ResveMtgVO MtgRmList = new EgovOe1ResveMtgVO();
        //        List mtgPlaceId_result = egovOe1ResveMtgService.selectMtgPlaceIdList(MtgRmList);        
        //        model.addAttribute("mtgPlaceId_result", mtgPlaceId_result);   //? 
        //        
        //        egovOe1ResveMtgVO.setMtgStartDate(startDate);
        //        egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getMtgEndDate().substring(0, 4)+"-"+egovOe1ResveMtgVO.getMtgEndDate().substring(4, 6)+"-"+egovOe1ResveMtgVO.getMtgEndDate().substring(6, 8));
        //        
        //      StringTokenizer st = new StringTokenizer(egovOe1ResveMtgVO.getAttendantId(), "|");      
        //      int n = st.countTokens();
        //      String[] results;
        //      List<EgovOe1ResveMtgVO> list=new ArrayList();
        //      for(int j=0;j<n;j++){
        //         EgovOe1ResveMtgVO listVO = new EgovOe1ResveMtgVO();         
        //         String token = st.nextToken();
        //         results = token.split(":");
        //         listVO.setMtgAttenId(results[0]);
        //         listVO.setMtgAttenName(results[1]);
        //
        //         //System.out.println("?====>"+listVO.getMtgAttenId());
        //         //System.out.println("?====>"+listVO.getMtgAttenName());
        //         list.add(listVO);   
        //      }       
        //      
        //      model.addAttribute("resultList", list);   
        //      
        //      //System.out.println("?  ?=========>"+egovOe1ResveMtgVO.getDupCheck());
        //      //System.out.println("???=========>"+egovOe1ResveMtgVO.getMtgStartDate());
        //   
        //       model.addAttribute("egovOe1ResveMtgVO", egovOe1ResveMtgVO);

        //return "/cms/mrm/EgovResveMtgRegist";
        return "/cms/mrm/EgovResveMtgDuplCheckResult";
    }

    /**
    * ? ?()
    * @param egovOe1ResveMtgVO - ?    VO
    * @param status
    * @return "/cms/mrm/EgovResveMtgUpdt"
    * @throws Exception
    */
    @RequestMapping("/cms/mrm/selectDupCheckUpdate.do")
    public String selectDupCheckUpdate(@RequestParam("selectedId") String selectedId,
            @ModelAttribute("egovOe1ResveMtgVO") EgovOe1ResveMtgVO egovOe1ResveMtgVO, BindingResult bindingResult,
            Model model) throws Exception {

        log.debug(this.getClass().getName() + " ==> ?  ? ");

        //?   ?   ??.
        model.addAttribute("searchMode", egovOe1ResveMtgVO);

        String startDate = egovOe1ResveMtgVO.getMtgStartDate();

        egovOe1ResveMtgVO.setMtgRoomResId(selectedId);

        // Server-Side Validation
        beanValidator.validate(egovOe1ResveMtgVO, bindingResult);
        if (bindingResult.hasErrors()) {
            model.addAttribute("egovOe1ResveMtgVO", egovOe1ResveMtgVO);
            return "/cms/mrm/EgovResveMtgUpdt";
        }

        //int dup_count = 0;
        String shh = egovOe1ResveMtgVO.getStartHh();
        String smm = egovOe1ResveMtgVO.getStartMm();
        String fhh = egovOe1ResveMtgVO.getFinishHh();
        String fmm = egovOe1ResveMtgVO.getFinishMm();
        egovOe1ResveMtgVO.setMtgStartDate(egovOe1ResveMtgVO.getInsRepeatDate()); //??? 
        egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getInsRepeatDate()); //???               
        egovOe1ResveMtgVO.setMtgBeginTime(shh + smm); //?
        egovOe1ResveMtgVO.setMtgEndTime(fhh + fmm); //?

        //dup_count = egovOe1ResveMtgService.selectDupCheckUpdate(egovOe1ResveMtgVO);
        List ResveMtgList = egovOe1ResveMtgService.selectDupCheckUpdate(egovOe1ResveMtgVO);
        model.addAttribute("resultList", ResveMtgList);
        //       if(0<dup_count){
        //          model.addAttribute("resultMsg", "?? ?. ?   .");
        //          model.addAttribute("dupCheckNull", "Y");
        //       }else{
        //          model.addAttribute("resultMsg", "? ??? .");
        //       }
        //       
        //        // ?
        //        EgovOe1ComDefaultCodeVO vo = new EgovOe1ComDefaultCodeVO();
        //        vo.setCodeId("OE1032");
        //        List schdulSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        //        model.addAttribute("schdulSeCode_result", schdulSeCode_result);
        //
        //        // 
        //        vo.setCodeId("OE1033");
        //        List jobSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        //        model.addAttribute("jobSeCode_result", jobSeCode_result);        
        //        
        //        // 
        //        vo.setCodeId("OE1034");
        //        List reptitSeCode_result = egovCmmUseService.selectCmmCodeDetail(vo);
        //        model.addAttribute("reptitSeCode_result", reptitSeCode_result);   
        //        
        //        // ? 
        //        EgovOe1ResveMtgVO MtgRmList = new EgovOe1ResveMtgVO();
        //        List mtgPlaceId_result = egovOe1ResveMtgService.selectMtgPlaceIdList(MtgRmList);        
        //        model.addAttribute("mtgPlaceId_result", mtgPlaceId_result);   //?               
        //        
        //        egovOe1ResveMtgVO.setMtgStartDate(startDate);
        //        egovOe1ResveMtgVO.setMtgEndDate(egovOe1ResveMtgVO.getMtgEndDate().substring(0, 4)+"-"+egovOe1ResveMtgVO.getMtgEndDate().substring(4, 6)+"-"+egovOe1ResveMtgVO.getMtgEndDate().substring(6, 8));
        //        
        // ??? 
        //        List ResveMtgList = egovOe1ResveMtgService.selectMtGattenInfoList(egovOe1ResveMtgVO);
        //        model.addAttribute("resultList", ResveMtgList);              

        //       model.addAttribute("egovOe1ResveMtgVO",  egovOe1ResveMtgVO);

        //       return "/cms/mrm/EgovResveMtgUpdt";
        return "/cms/mrm/EgovResveMtgDuplCheckResult";
    }

}