Index: .idea/sonarIssues.xml =================================================================== diff -u -rbfa42730cc8fc4cfc184930b61c568fb1f6038d4 -r15a0036dafe83ac4910a17c4c0731607c17dbeba --- .idea/sonarIssues.xml (.../sonarIssues.xml) (revision bfa42730cc8fc4cfc184930b61c568fb1f6038d4) +++ .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 15a0036dafe83ac4910a17c4c0731607c17dbeba) @@ -1228,6 +1228,16 @@ + + + + + + + + + + Index: standard/project/web/src/main/java/egovframework/api/rivalWar/compareItem/controller/AnonymousCompareItemController.java =================================================================== diff -u -r399bdde680ce154c19752cafa8957922af5ad0fe -r15a0036dafe83ac4910a17c4c0731607c17dbeba --- standard/project/web/src/main/java/egovframework/api/rivalWar/compareItem/controller/AnonymousCompareItemController.java (.../AnonymousCompareItemController.java) (revision 399bdde680ce154c19752cafa8957922af5ad0fe) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/compareItem/controller/AnonymousCompareItemController.java (.../AnonymousCompareItemController.java) (revision 15a0036dafe83ac4910a17c4c0731607c17dbeba) @@ -37,7 +37,7 @@ @IncludedInfo(name = "RivalWar Admin CompareItem", listUrl = "/api/rivalWar/compareItem/getJsTreeView.do", order = 7005, gid = 7313) @RequestMapping("/getJsTreeView.do") - public String getRivalWarCompareSpecJstreeView() { + public String getRivalWarCompareItemJstreeView() { return "egovframework/api/rivalWar/compareItem/JsTreeView"; } Index: standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AnonymousDirectChatController.java =================================================================== diff -u -r8155383b5a954001eb91ba7151ecf51f036296f8 -r15a0036dafe83ac4910a17c4c0731607c17dbeba --- standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AnonymousDirectChatController.java (.../AnonymousDirectChatController.java) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AnonymousDirectChatController.java (.../AnonymousDirectChatController.java) (revision 15a0036dafe83ac4910a17c4c0731607c17dbeba) @@ -28,16 +28,16 @@ */ @Controller @RequestMapping(value = {"/api/rivalWar/directChat"}) -public class AnonymousDirectChatController extends GenericAbstractController { +public class AnonymousDirectChatController extends GenericAbstractController { @Autowired private DirectChatService directChatService; private final Logger logger = LoggerFactory.getLogger(this.getClass()); - @IncludedInfo(name = "RivalWar Admin DirectChat", listUrl = "/api/rivalWar/direcctChat/getJsTreeView.do", order = 7006, gid = 7313) + @IncludedInfo(name = "RivalWar Admin DirectChat", listUrl = "/api/rivalWar/directChat/getJsTreeView.do", order = 7006, gid = 7313) @RequestMapping("/getJsTreeView.do") - public String getRivalWarCompareSpecJstreeView() { + public String getRivalWarDirectChatJstreeView() { return "egovframework/api/rivalWar/directChat/JsTreeView"; } Index: standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/UserDirectChatController.java =================================================================== diff -u -r8155383b5a954001eb91ba7151ecf51f036296f8 -r15a0036dafe83ac4910a17c4c0731607c17dbeba --- standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/UserDirectChatController.java (.../UserDirectChatController.java) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/UserDirectChatController.java (.../UserDirectChatController.java) (revision 15a0036dafe83ac4910a17c4c0731607c17dbeba) @@ -14,7 +14,7 @@ */ @Controller @RequestMapping(value = {"/api/rivalWar/ROLE_USER/directChat"}) -public class UserDirectChatController extends GenericAbstractController { +public class UserDirectChatController extends GenericAbstractController { @Autowired private DirectChatService directChatService; Index: standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/AdminSpecHashTagController.java =================================================================== diff -u -r5b58dcdc464fb120bff3c7d4a19b7771ac8095d8 -r15a0036dafe83ac4910a17c4c0731607c17dbeba --- standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/AdminSpecHashTagController.java (.../AdminSpecHashTagController.java) (revision 5b58dcdc464fb120bff3c7d4a19b7771ac8095d8) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/AdminSpecHashTagController.java (.../AdminSpecHashTagController.java) (revision 15a0036dafe83ac4910a17c4c0731607c17dbeba) @@ -1,7 +1,174 @@ package egovframework.api.rivalWar.specHashTag.controller; +import com.fasterxml.jackson.core.JsonProcessingException; +import egovframework.api.rivalWar.specHashTag.service.SpecHashTagService; +import egovframework.api.rivalWar.specHashTag.vo.SpecHashTagDTO; +import egovframework.com.ext.jstree.springiBatis.core.util.Util_TitleChecker; +import egovframework.com.ext.jstree.springiBatis.core.validation.group.*; +import egovframework.com.ext.jstree.support.mvc.GenericAbstractController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; + /** * Created by Administrator on 2017-10-14. */ -public class AdminSpecHashTagController { +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_ADMIN/specHashTag"}) +public class AdminSpecHashTagController extends GenericAbstractController { + + @Autowired + private SpecHashTagService specHashTagService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 노드를 추가한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + * @throws IllegalAccessException + * @throws InstantiationException + */ + @ResponseBody + @RequestMapping(value = "/addNode.do", method = RequestMethod.POST) + public ModelAndView addNode(@Validated(value = AddNode.class) SpecHashTagDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", specHashTagService.addNode(jsTreeHibernateDTO)); + return modelAndView; + } + + /** + * 노드를 삭제한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/removeNode.do", method = RequestMethod.POST) + public ModelAndView removeNode(@Validated(value = RemoveNode.class) SpecHashTagDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setStatus(specHashTagService.removeNode(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + private void setJsonDefaultSetting(SpecHashTagDTO jsTreeHibernateDTO) { + long defaultSettingValue = 0; + jsTreeHibernateDTO.setC_parentid(defaultSettingValue); + jsTreeHibernateDTO.setC_position(defaultSettingValue); + jsTreeHibernateDTO.setC_left(defaultSettingValue); + jsTreeHibernateDTO.setC_right(defaultSettingValue); + jsTreeHibernateDTO.setC_level(defaultSettingValue); + jsTreeHibernateDTO.setRef(defaultSettingValue); + } + + /** + * 노드를 변경한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/alterNode.do", method = RequestMethod.POST) + public ModelAndView alterNode(@Validated(value = AlterNode.class) SpecHashTagDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setC_title(Util_TitleChecker.StringReplace(jsTreeHibernateDTO.getC_title())); + + jsTreeHibernateDTO.setStatus(specHashTagService.alterNode(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + + /** + * 노드의 타입을 변경한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/alterNodeType.do", method = RequestMethod.POST) + public ModelAndView alterNodeType(@Validated(value = AlterNodeType.class) SpecHashTagDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + specHashTagService.alterNodeType(jsTreeHibernateDTO); + setJsonDefaultSetting(jsTreeHibernateDTO); + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + /** + * 노드를 이동한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + * @throws ReflectiveOperationException + * @throws IllegalAccessException + * @throws InstantiationException + */ + @ResponseBody + @RequestMapping(value = "/moveMenu.do", method = RequestMethod.POST) + public ModelAndView moveNode(@Validated(value = MoveNode.class) SpecHashTagDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model, HttpServletRequest request) throws Exception { + if (bindingResult.hasErrors()) { + throw new RuntimeException(); + } + specHashTagService.moveNode(jsTreeHibernateDTO, request); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/analyzeNode.do", method = RequestMethod.GET) + public ModelAndView getChildNode(ModelMap model) { + model.addAttribute("analyzeResult", ""); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", "true"); + return modelAndView; + } } Index: standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/AnonymousSpecHashTagController.java =================================================================== diff -u -r5b58dcdc464fb120bff3c7d4a19b7771ac8095d8 -r15a0036dafe83ac4910a17c4c0731607c17dbeba --- standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/AnonymousSpecHashTagController.java (.../AnonymousSpecHashTagController.java) (revision 5b58dcdc464fb120bff3c7d4a19b7771ac8095d8) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/AnonymousSpecHashTagController.java (.../AnonymousSpecHashTagController.java) (revision 15a0036dafe83ac4910a17c4c0731607c17dbeba) @@ -1,7 +1,154 @@ package egovframework.api.rivalWar.specHashTag.controller; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.collect.Maps; +import egovframework.api.rivalWar.specHashTag.service.SpecHashTagService; +import egovframework.api.rivalWar.specHashTag.vo.SpecHashTagDTO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.ext.jstree.support.mvc.GenericAbstractController; +import egovframework.com.ext.jstree.support.util.ParameterParser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + /** * Created by Administrator on 2017-10-14. */ -public class AnonymousSpecHashTagController { -} +@Controller +@RequestMapping(value = {"/api/rivalWar/specHashTag"}) +public class AnonymousSpecHashTagController extends GenericAbstractController { + + @Autowired + private SpecHashTagService specHashTagService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @IncludedInfo(name = "RivalWar Admin SpecHashTag", listUrl = "/api/rivalWar/specHashTag/getJsTreeView.do", order = 7007, gid = 7313) + @RequestMapping("/getJsTreeView.do") + public String getRivalWarSpecHashTagJstreeView() { + return "egovframework/api/rivalWar/specHashTag/JsTreeView"; + } + + /** + * 노드를 검색한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/searchNode.do", method = RequestMethod.GET) + public ModelAndView searchNode(SpecHashTagDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) throws Exception { + + ParameterParser parser = new ParameterParser(request); + + if (!StringUtils.hasText(request.getParameter("searchString"))) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhereLike("c_title", parser.get("parser")); + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", specHashTagService.searchNode(jsTreeHibernateDTO)); + return modelAndView; + } + + + @ResponseBody + @RequestMapping(value = "/getPaginatedChildNode.do", method = RequestMethod.GET) + public ModelAndView getPaginatedChildNode(SpecHashTagDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) throws Exception { + + if (jsTreeHibernateDTO.getC_id() <= 0 || jsTreeHibernateDTO.getPageIndex() <= 0 + || jsTreeHibernateDTO.getPageUnit() <= 0 || jsTreeHibernateDTO.getPageSize() <= 0) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhere("c_parentid", jsTreeHibernateDTO.getC_id()); + List list = specHashTagService.getPaginatedChildNode(jsTreeHibernateDTO); + jsTreeHibernateDTO.getPaginationInfo().setTotalRecordCount(list.size()); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + HashMap resultMap = Maps.newHashMap(); + resultMap.put("paginationInfo", jsTreeHibernateDTO.getPaginationInfo()); + resultMap.put("result", list); + modelAndView.addObject("result", resultMap); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getNode.do", method = {RequestMethod.GET, RequestMethod.POST}) + public ModelAndView getNode(SpecHashTagDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) throws Exception { + + if(request.getMethod().equals("GET")){ + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0 ) { + throw new RuntimeException(); + } + }else{ + if(jsTreeHibernateDTO.getC_id() <= 0){ + throw new RuntimeException(); + } + } + + SpecHashTagDTO selectedJsTreeHibernateDTO = specHashTagService.getNode(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", selectedJsTreeHibernateDTO); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getNodeForDatatable.do", method = {RequestMethod.GET, RequestMethod.POST}) + public ModelAndView getNodeForDatatable(SpecHashTagDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) throws Exception { + + if(request.getMethod().equals("GET")){ + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0 ) { + throw new RuntimeException(); + } + }else{ + if(jsTreeHibernateDTO.getC_id() <= 0){ + throw new RuntimeException(); + } + } + List list = new ArrayList(); + list.add(specHashTagService.getNode(jsTreeHibernateDTO)); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getChildNode.do", method = RequestMethod.GET) + public ModelAndView getChildNode(SpecHashTagDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) throws Exception { + + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhere("c_parentid", new Long(parser.get("c_id"))); + List list = specHashTagService.getChildNode(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } +} \ No newline at end of file Index: standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/UserSpecHashTagController.java =================================================================== diff -u -r5b58dcdc464fb120bff3c7d4a19b7771ac8095d8 -r15a0036dafe83ac4910a17c4c0731607c17dbeba --- standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/UserSpecHashTagController.java (.../UserSpecHashTagController.java) (revision 5b58dcdc464fb120bff3c7d4a19b7771ac8095d8) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/specHashTag/controller/UserSpecHashTagController.java (.../UserSpecHashTagController.java) (revision 15a0036dafe83ac4910a17c4c0731607c17dbeba) @@ -1,7 +1,23 @@ package egovframework.api.rivalWar.specHashTag.controller; +import egovframework.api.rivalWar.directChat.service.DirectChatService; +import egovframework.api.rivalWar.specHashTag.service.SpecHashTagService; +import egovframework.com.ext.jstree.support.mvc.GenericAbstractController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + /** * Created by Administrator on 2017-10-14. */ -public class UserSpecHashTagController { +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_USER/specHashTag"}) +public class UserSpecHashTagController extends GenericAbstractController { + + @Autowired + private SpecHashTagService specHashTagService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); }