javax.servlet
Index: development-project/project-standard/standard-server/src/main/java/egovframework/com/cop/cmy/web/EgovCommunityManageController.java
===================================================================
diff -u
--- development-project/project-standard/standard-server/src/main/java/egovframework/com/cop/cmy/web/EgovCommunityManageController.java (revision 0)
+++ development-project/project-standard/standard-server/src/main/java/egovframework/com/cop/cmy/web/EgovCommunityManageController.java (revision 45440e06665841c816c5998756a7cb2fc3a4e252)
@@ -0,0 +1,700 @@
+package egovframework.com.cop.cmy.web;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import egovframework.com.cmm.LoginVO;
+import egovframework.com.cmm.annotation.IncludedInfo;
+import egovframework.com.cmm.util.EgovUserDetailsHelper;
+import egovframework.com.cop.bbs.service.BoardMasterVO;
+import egovframework.com.cop.bbs.service.BoardVO;
+import egovframework.com.cop.bbs.service.EgovBBSAttributeManageService;
+import egovframework.com.cop.bbs.service.EgovBBSManageService;
+import egovframework.com.cop.clb.service.Club;
+import egovframework.com.cop.clb.service.ClubVO;
+import egovframework.com.cop.clb.service.EgovClubManageService;
+import egovframework.com.cop.cmy.service.Community;
+import egovframework.com.cop.cmy.service.CommunityUser;
+import egovframework.com.cop.cmy.service.CommunityVO;
+import egovframework.com.cop.cmy.service.ConfirmHistory;
+import egovframework.com.cop.cmy.service.EgovCommunityManageService;
+import egovframework.com.cop.cmy.service.EgovConfirmManageService;
+import egovframework.com.utl.fcc.service.EgovDateUtil;
+
+import egovframework.rte.fdl.property.EgovPropertyService;
+import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+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.support.SessionStatus;
+import org.springmodules.validation.commons.DefaultBeanValidator;
+
+/**
+ * 커뮤니티 정보를 관리하기 위한 컨트롤러 클래스
+ *
+ * @author 공통서비스개발팀 이삼섭
+ * @version 1.0
+ * @see
+ * << 개정이력(Modification Information) >>
+ *
+ * 수정일 수정자 수정내용
+ * ------- -------- ---------------------------
+ * 2009.4.2 이삼섭 최초 생성
+ * 2011.8.26 정진오 IncludedInfo annotation 추가
+ * 2011.9.7 정진오 커뮤니티 탈퇴 요청이 정상적으로 이뤄지지 않은 사항 수정함
+ * 커뮤니티 탈퇴 요청시 승인자를 선택하므로 탈퇴 승인자가 자신이 될 수 없음에도
+ * 세션에서 가져온 값(탈퇴신청자)을 탈퇴승인자로 설정하도록 되어 있었음
+ *
+ *
+ * @since 2009.06.01
+ */
+
+@Controller
+public class EgovCommunityManageController {
+
+ @Resource(name = "EgovCommunityManageService")
+ private EgovCommunityManageService cmmntyService;
+
+ @Resource(name = "EgovBBSAttributeManageService")
+ private EgovBBSAttributeManageService bbsAttrbService;
+
+ @Resource(name = "EgovClubManageService")
+ private EgovClubManageService clubService;
+
+ @Resource(name = "EgovConfirmManageService")
+ private EgovConfirmManageService confmService;
+
+ @Resource(name = "propertiesService")
+ protected EgovPropertyService propertyService;
+
+ @Resource(name = "EgovBBSManageService")
+ private EgovBBSManageService bbsMngService;
+
+ @Autowired
+ private DefaultBeanValidator beanValidator;
+
+ //Logger log = Logger.getLogger(this.getClass());
+
+ /**
+ * 커뮤니티에 대한 목록을 조회한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @IncludedInfo(name = "커뮤니티관리", order = 270, gid = 40)
+ @RequestMapping("/cop/cmy/selectCmmntyInfs.do")
+ public String selectCmmntyInfs(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception {
+ cmmntyVO.setPageUnit(propertyService.getInt("pageUnit"));
+ cmmntyVO.setPageSize(propertyService.getInt("pageSize"));
+
+ PaginationInfo paginationInfo = new PaginationInfo();
+
+ paginationInfo.setCurrentPageNo(cmmntyVO.getPageIndex());
+ paginationInfo.setRecordCountPerPage(cmmntyVO.getPageUnit());
+ paginationInfo.setPageSize(cmmntyVO.getPageSize());
+
+ cmmntyVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
+ cmmntyVO.setLastIndex(paginationInfo.getLastRecordIndex());
+ cmmntyVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
+
+ Map map = cmmntyService.selectCommunityInfs(cmmntyVO);
+ int totCnt = Integer.parseInt((String) map.get("resultCnt"));
+
+ paginationInfo.setTotalRecordCount(totCnt);
+
+ model.addAttribute("resultList", map.get("resultList"));
+ model.addAttribute("resultCnt", map.get("resultCnt"));
+ model.addAttribute("paginationInfo", paginationInfo);
+
+ return "egovframework/com/cop/cmy/EgovCmmntyList";
+ }
+
+ /**
+ * 커뮤니티 등록을 위한 등록페이지로 이동한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cmy/addCmmntyInf.do")
+ public String addCmmntyInf(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception {
+ return "egovframework/com/cop/cmy/EgovCmmntyRegist";
+ }
+
+ /**
+ * 커뮤니티 정보를 등록한다.
+ *
+ * @param cmmntyVO
+ * @param cmmnty
+ * @param sessionVO
+ * @param status
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cmy/insertCmmntyInf.do")
+ public String insertCmmntyInf(@ModelAttribute("searchVO") CommunityVO cmmntyVO, @ModelAttribute("community") Community community,
+ BindingResult bindingResult, SessionStatus status, ModelMap model) throws Exception {
+
+ LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
+ Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
+
+ beanValidator.validate(community, bindingResult);
+
+ if (bindingResult.hasErrors()) {
+ return "egovframework/com/cop/cmy/EgovCmmntyRegist";
+ }
+
+ community.setUseAt("Y");
+ community.setRegistSeCode("REGC02");
+ community.setFrstRegisterId(user.getUniqId());
+
+
+ if (isAuthenticated) {
+ cmmntyService.insertCommunityInf(community);
+ }
+
+ return "forward:/cop/cmy/selectCmmntyInfs.do";
+ }
+
+ /**
+ * 커뮤니티에 대한 상세정보를 조회한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cmy/selectCmmntyInf.do")
+ public String selectCmmntyInf(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model, HttpServletRequest request) throws Exception {
+ Map map = cmmntyService.selectCommunityInf(cmmntyVO);
+ CommunityVO vo = (CommunityVO) map.get("cmmntyVO");
+
+ //-----------------------
+ // 제공 URL
+ //-----------------------
+ vo.setProvdUrl(request.getContextPath() + "/cop/cmy/CmmntyMainPage.do?cmmntyId=" + vo.getCmmntyId());
+ ////---------------------
+
+ model.addAttribute("cmmntyVO", vo);
+ model.addAttribute("result", map.get("resultList"));
+
+ return "egovframework/com/cop/cmy/EgovCmmntyInqire";
+ }
+
+ /**
+ * 커뮤니티 정보 수정을 위한 수정페이지로 이동한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cmy/forUpdateCmmntyInf.do")
+ public String forUpdateCmmntyInf(@ModelAttribute("searchVO") CommunityVO cmmntyVO, @RequestParam Map commandMap, ModelMap model)
+ throws Exception {
+
+ String cmmntyId = (String) commandMap.get("param_cmmntyId");
+ cmmntyVO.setCmmntyId(cmmntyId);
+
+ Map map = cmmntyService.selectCommunityInf(cmmntyVO);
+
+ model.addAttribute("cmmntyVO", (CommunityVO) map.get("cmmntyVO"));
+ model.addAttribute("cmmntyUser", (CommunityUser) map.get("cmmntyUser"));
+ model.addAttribute("result", map.get("resultList"));
+
+ return "egovframework/com/cop/cmy/EgovCmmntyUpdt";
+ }
+
+ /**
+ * 커뮤니티 정보를 수정한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param status
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cmy/updtCmmntyInf.do")
+ public String updtCmmntyInf(@ModelAttribute("searchVO") CommunityVO cmmntyVO, @ModelAttribute("community") Community community,
+ BindingResult bindingResult, SessionStatus status, ModelMap model) throws Exception {
+
+ LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
+ Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
+
+ beanValidator.validate(community, bindingResult);
+ if (bindingResult.hasErrors()) {
+
+ Map map = cmmntyService.selectCommunityInf(cmmntyVO);
+ CommunityVO vo = (CommunityVO) map.get("cmmntyVO");
+
+ model.addAttribute("cmmntyVO", vo);
+ model.addAttribute("result", map.get("resultList"));
+
+ return "egovframework/com/cop/cmy/EgovCmmntyUpdt";
+ }
+
+ community.setLastUpdusrId(user.getUniqId());
+
+ if (isAuthenticated) {
+ if ("Y".equals(community.getUseAt())) {
+ cmmntyService.updateCommunityInf(community);
+ } else {
+ cmmntyService.deleteCommunityInf(community);
+ }
+
+ }
+
+ return "forward:/cop/cmy/selectCmmntyInfs.do";
+ }
+
+ /**
+ * 포트릿을 위한 커뮤니티 정보 목록 정보를 조회한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cus/CmmntyListPortlet.do")
+ public String selectCmmntyListPortlet(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception {
+ List result = cmmntyService.selectCmmntyListPortlet(cmmntyVO);
+
+ model.addAttribute("resultList", result);
+
+ return "egovframework/com/cop/cmy/EgovCmmntyListPortlet";
+ }
+
+ /**
+ * 커뮤니티 메인페이지를 조회한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cmy/CmmntyMainPage.do")
+ public String selectCmmntyMainPage(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception {
+
+ LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
+ Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
+
+ cmmntyVO.setEmplyrId(user.getUniqId());
+
+ String tmplatCours = cmmntyService.selectCmmntyTemplat(cmmntyVO);
+ if ("".equals(tmplatCours) || tmplatCours == null) {
+ tmplatCours = "egovframework/com/cop/tpl/EgovCmmntyBaseTmpl";
+ }
+ Map map = cmmntyService.selectCommunityInf(cmmntyVO);
+
+ //model.addAttribute("cmmntyVO", cmmntyVO);
+ model.addAttribute("cmmntyVO", (CommunityVO) map.get("cmmntyVO"));
+ model.addAttribute("cmmntyUser", (CommunityUser) map.get("cmmntyUser"));
+
+ //--------------------------------
+ // 게시판 목록 정보 처리
+ //--------------------------------
+ BoardMasterVO bbsVo = new BoardMasterVO();
+
+ bbsVo.setTrgetId(cmmntyVO.getCmmntyId());
+
+ List bbsResult = bbsAttrbService.selectAllBdMstrByTrget(bbsVo);
+
+ model.addAttribute("bbsList", bbsResult);
+ ////------------------------------
+
+ //--------------------------------
+ // 동호회 목록 정보
+ //--------------------------------
+ Club clubVo = new Club();
+
+ clubVo.setCmmntyId(cmmntyVO.getCmmntyId());
+
+ List clubResult = clubService.selectClubListPortletByTrget(clubVo);
+
+ model.addAttribute("clubList", clubResult);
+ ////------------------------------
+
+ if (isAuthenticated) {
+ model.addAttribute("isAuthenticated", "Y");
+ } else {
+ model.addAttribute("isAuthenticated", "N");
+ }
+
+ return tmplatCours;
+ }
+
+ /**
+ * 커뮤니티 메인페이지의 기본 내용(게시판 4개 표시) 조회한다.
+ *
+ * @param cmmntyVO
+ * @param sessionVO
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping("/cop/cmy/CmmntyMainContents.do")
+ public String selectCmmntyMainContents(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception {
+ LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
+ @SuppressWarnings("unused")
+ Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
+
+ cmmntyVO.setEmplyrId(user.getUniqId());
+
+ //--------------------------------
+ // 게시판 목록 정보 처리
+ //--------------------------------
+ BoardMasterVO bbsVo = new BoardMasterVO();
+
+ bbsVo.setTrgetId(cmmntyVO.getCmmntyId());
+
+ List bbsResult = bbsAttrbService.selectAllBdMstrByTrget(bbsVo);
+
+ // 방명록 제외 처리
+ for (int i = 0; i < bbsResult.size(); i++) {
+ if ("BBST04".equals(bbsResult.get(i).getBbsTyCode())) {
+ bbsResult.remove(i);
+ }
+ }
+
+ model.addAttribute("bbsList", bbsResult);
+
+ //--------------------------------
+ // 게시물 목록 정보 처리
+ //--------------------------------
+ BoardVO boardVo = null;
+ BoardMasterVO masterVo = null;
+
+ ArrayList