통합검색 요청사항 반영 작업중.

master
강석 최 2023-08-17 18:47:22 +09:00
parent 17e6613bd7
commit 574ab57567
9 changed files with 94 additions and 58 deletions

View File

@ -149,7 +149,7 @@ public class BaseController {
public void setSession(@AuthenticationPrincipal UserInfo loginUser, HttpSession session){ public void setSession(@AuthenticationPrincipal UserInfo loginUser, HttpSession session){
loginUser.setDownOrganCdList(organConfigService.selectDownOrganList(loginUser.getOgCd())); loginUser.setDownOrganCdList(organConfigService.selectDownOrganList(loginUser.getOgCd()));
loginUser.setUpOrganCdList(organConfigService.selectUpOrganList(loginUser.getOgCd())); loginUser.setUpOrganCdList(organConfigService.selectUpOrganList(loginUser.getOgCd()));
session.setAttribute("menuList", menuMgtService.selectAccessMenuListWhereUserSeq(loginUser.getUserSeq())); session.setAttribute("menuList", menuMgtService.selectSortedAccessMenuList(loginUser.getUserSeq()));
Map<String, List<CodeMgt>> codeMap = codeMgtService.getCommonCode(); Map<String, List<CodeMgt>> codeMap = codeMgtService.getCommonCode();
session.setAttribute("commonCode", codeMap); session.setAttribute("commonCode", codeMap);
session.setAttribute("userSeq", loginUser.getUserSeq()); session.setAttribute("userSeq", loginUser.getUserSeq());

View File

@ -100,7 +100,11 @@ public class MenuMgtService {
return menuList; return menuList;
} }
public List<MenuMgt> selectAccessMenuListWhereUserSeq(Integer userSeq) { public List<MenuMgt> selectAccessMenuList(Integer userSeq) {
return menuMgtMapper.selectAccessMenuListWhereUserSeq(userSeq);
}
public List<MenuMgt> selectSortedAccessMenuList(Integer userSeq) {
List<MenuMgt> accessMenuList =menuMgtMapper.selectAccessMenuListWhereUserSeq(userSeq); List<MenuMgt> accessMenuList =menuMgtMapper.selectAccessMenuListWhereUserSeq(userSeq);
Set<String> cat1Set = new HashSet<>(); Set<String> cat1Set = new HashSet<>();
Set<String> cat2Set = new HashSet<>(); Set<String> cat2Set = new HashSet<>();
@ -114,35 +118,29 @@ public class MenuMgtService {
} }
List<MenuMgt> firstMenuList = new ArrayList<>(); List<MenuMgt> firstMenuList = new ArrayList<>();
Iterator<String> cat1Itr = cat1Set.iterator(); for (String cat1Cd : cat1Set) {
while(cat1Itr.hasNext()){
String cat1Cd = cat1Itr.next();
MenuMgt firstMenu = new MenuMgt(); MenuMgt firstMenu = new MenuMgt();
List<MenuMgt> secondMenuList = new ArrayList<>(); List<MenuMgt> secondMenuList = new ArrayList<>();
firstMenu.setCat1Cd(cat1Cd); firstMenu.setCat1Cd(cat1Cd);
Iterator<String> cat2Itr = cat2Set.iterator(); for (String cat2Cd : cat2Set) {
while(cat2Itr.hasNext()){ if (cat2Cd.contains(cat1Cd)) {
String cat2Cd = cat2Itr.next();
if(cat2Cd.contains(cat1Cd)){
MenuMgt secondMenu = new MenuMgt(); MenuMgt secondMenu = new MenuMgt();
List<MenuMgt> thirdMenuList = new ArrayList<>(); List<MenuMgt> thirdMenuList = new ArrayList<>();
secondMenu.setCat1Cd(cat1Cd); secondMenu.setCat1Cd(cat1Cd);
secondMenu.setCat2Cd(cat2Cd.replace(cat1Cd, "")); secondMenu.setCat2Cd(cat2Cd.replace(cat1Cd, ""));
Iterator<String> cat3Itr = cat3Set.iterator(); for (String cat3Cd : cat3Set) {
while(cat3Itr.hasNext()){ if (cat3Cd.contains(cat2Cd)) {
String cat3Cd = cat3Itr.next();
if(cat3Cd.contains(cat2Cd)){
MenuMgt thirdMenu = new MenuMgt(); MenuMgt thirdMenu = new MenuMgt();
thirdMenu.setCat2Cd(secondMenu.getCat2Cd()); thirdMenu.setCat2Cd(secondMenu.getCat2Cd());
thirdMenu.setCat3Cd(cat3Cd.replace(cat2Cd, "")); thirdMenu.setCat3Cd(cat3Cd.replace(cat2Cd, ""));
for(MenuMgt accessMenu: accessMenuList){ for (MenuMgt accessMenu : accessMenuList) {
if(accessMenu.getCat1Cd().equals(cat1Cd) if (accessMenu.getCat1Cd().equals(cat1Cd)
&& accessMenu.getCat2Cd().equals(secondMenu.getCat2Cd()) && accessMenu.getCat2Cd().equals(secondMenu.getCat2Cd())
&& accessMenu.getCat3Cd().equals(thirdMenu.getCat3Cd())){ && accessMenu.getCat3Cd().equals(thirdMenu.getCat3Cd())) {
String orderStr = accessMenu.getOrderStr(); String orderStr = accessMenu.getOrderStr();
firstMenu.setOrderStr(orderStr.substring(0,1)); firstMenu.setOrderStr(orderStr.substring(0, 1));
secondMenu.setOrderStr(orderStr.substring(1,2)); secondMenu.setOrderStr(orderStr.substring(1, 2));
thirdMenu.setOrderStr(orderStr.substring(2,3)); thirdMenu.setOrderStr(orderStr.substring(2, 3));
thirdMenu.setMenuUrl(accessMenu.getMenuUrl()); thirdMenu.setMenuUrl(accessMenu.getMenuUrl());
thirdMenu.setMenuKey(accessMenu.getMenuKey()); thirdMenu.setMenuKey(accessMenu.getMenuKey());
break; break;
@ -151,20 +149,20 @@ public class MenuMgtService {
thirdMenuList.add(thirdMenu); thirdMenuList.add(thirdMenu);
} }
} }
if(thirdMenuList.size()>0){ if (thirdMenuList.size() > 0) {
thirdMenuList.sort((o1, o2) -> { thirdMenuList.sort((o1, o2) -> {
String orderStr_1 = o1.getOrderStr(); String orderStr_1 = o1.getOrderStr();
String orderStr_2 = o2.getOrderStr(); String orderStr_2 = o2.getOrderStr();
return orderStr_1.compareTo(orderStr_2); return orderStr_1.compareTo(orderStr_2);
}); });
secondMenu.setChildList(thirdMenuList); secondMenu.setChildList(thirdMenuList);
}else{ } else {
for(MenuMgt accessMenu: accessMenuList){ for (MenuMgt accessMenu : accessMenuList) {
if(accessMenu.getCat1Cd().equals(cat1Cd) if (accessMenu.getCat1Cd().equals(cat1Cd)
&& accessMenu.getCat2Cd().equals(secondMenu.getCat2Cd())){ && accessMenu.getCat2Cd().equals(secondMenu.getCat2Cd())) {
String orderStr = accessMenu.getOrderStr(); String orderStr = accessMenu.getOrderStr();
firstMenu.setOrderStr(orderStr.substring(0,1)); firstMenu.setOrderStr(orderStr.substring(0, 1));
secondMenu.setOrderStr(orderStr.substring(1,2)); secondMenu.setOrderStr(orderStr.substring(1, 2));
secondMenu.setMenuUrl(accessMenu.getMenuUrl()); secondMenu.setMenuUrl(accessMenu.getMenuUrl());
secondMenu.setMenuKey(accessMenu.getMenuKey()); secondMenu.setMenuKey(accessMenu.getMenuKey());
break; break;

View File

@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -26,6 +28,8 @@ public class SearchEngineController {
@GetMapping("/searchPage") @GetMapping("/searchPage")
public ModelAndView searchPage(@AuthenticationPrincipal UserInfo loginUser, SearchParams params) { public ModelAndView searchPage(@AuthenticationPrincipal UserInfo loginUser, SearchParams params) {
ModelAndView mav = new ModelAndView("searchEngine/searchPage"); ModelAndView mav = new ModelAndView("searchEngine/searchPage");
mav.addObject("accessMenuList", menuMgtService.selectAccessMenuList(loginUser.getUserSeq()));
mav.addObject("downOrganList", loginUser.getDownOrganCdList());
if(Utils.isEmpty(params.getKeyword())){ if(Utils.isEmpty(params.getKeyword())){
mav.setViewName("common/keywordRequest"); mav.setViewName("common/keywordRequest");
return mav; return mav;
@ -34,9 +38,6 @@ public class SearchEngineController {
params.setActiveTab("all"); params.setActiveTab("all");
params.setPageIndex(1); params.setPageIndex(1);
} }
if(Utils.isEmpty(params.getWrtUserSeq())){
params.setWrtUserSeq(loginUser.getUserSeq());
}
int totalCnt = 0; int totalCnt = 0;
SearchResult result = null; SearchResult result = null;
switch (params.getActiveTab()){ switch (params.getActiveTab()){

View File

@ -38,5 +38,6 @@ public class SearchBoardView {
private String wrt_user_nm; private String wrt_user_nm;
@JsonFormat(pattern = "yyyyMMddHHmmss") @JsonFormat(pattern = "yyyyMMddHHmmss")
private LocalDateTime wrt_dt; private LocalDateTime wrt_dt;
private String organ_cd;
private String readableuser; private String readableuser;
} }

View File

@ -119,9 +119,6 @@ public class SearchEngineService {
.append(params.getKeyword()) .append(params.getKeyword())
.append("' allword synonym"); .append("' allword synonym");
if(!params.getForm().equals("search_menu_view.search_menu_view")){ if(!params.getForm().equals("search_menu_view.search_menu_view")){
builder.append(" and wrt_user_seq='")
.append(params.getWrtUserSeq())
.append("'");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
if(!Utils.isEmpty(params.getStartDate())){ if(!Utils.isEmpty(params.getStartDate())){
builder.append(" and wrt_dt >= ") builder.append(" and wrt_dt >= ")
@ -149,7 +146,6 @@ public class SearchEngineService {
.encode() .encode()
.build() .build()
.toUri(); .toUri();
System.out.println("uri: " + uri);
ResponseEntity<String> response = requestRestTemplateExchange(uri); ResponseEntity<String> response = requestRestTemplateExchange(uri);
JSONObject jsonObj = null; JSONObject jsonObj = null;
try { try {
@ -183,7 +179,6 @@ public class SearchEngineService {
e.printStackTrace(); e.printStackTrace();
} }
result.setRowList(convertList); result.setRowList(convertList);
System.out.println("rowSize: "+result.getRowList().size());
return result; return result;
} }

View File

@ -56,7 +56,8 @@
ab.cat2_cd, ab.cat2_cd,
ab.cat3_cd, ab.cat3_cd,
ab.order_str, ab.order_str,
ab.menu_url ab.menu_url,
aa.access_auth
from access_config aa from access_config aa
inner join menu_mgt ab on aa.menu_key = ab.menu_key inner join menu_mgt ab on aa.menu_key = ab.menu_key
where aa.user_seq = #{userSeq} where aa.user_seq = #{userSeq}

View File

@ -90,12 +90,15 @@ input::-moz-placeholder { color: #aaa; }
.menuList ol li{display:inline-block; margin-right:3px; font-size:17px; line-height:30px;} .menuList ol li{display:inline-block; margin-right:3px; font-size:17px; line-height:30px;}
.menuList ol li:before{content:' 〉'; color:#aaa;} .menuList ol li:before{content:' 〉'; color:#aaa;}
.menuList ol li:first-of-type:before{content:'';} .menuList ol li:first-of-type:before{content:'';}
.menuLink > a:before{content:' · '; }
.menuList a{display:inline-block; margin-right:3px; font-size:17px; line-height:30px;}
/*메뉴*/ /*메뉴*/
.boardList li{margin-bottom:30px;} .boardList li{margin-bottom:30px;}
.boardList li dt{margin-bottom:15px;} .boardList li dt{margin-bottom:5px;}
.boardList li dt a{font-size:17px; font-weight:bold; line-height:24px;} .boardList li dt a{font-size:17px; font-weight:bold; line-height:24px;}
.boardList li dt .titleDate{color:#aaa; margin-left:8px; font-size:12px; line-height:24px; line-height:none;} .boardList li dt .titleDate{color:#aaa; margin-left:8px; font-size:12px; line-height:24px; float:right;}
.boardList li dd:first-of-type{ margin-bottom:12px; font-size:15px; text-overflow:ellipsis; overflow:hidden; white-space:nowrap; word-wrap:normal; color:#444;} .boardList li dd:first-of-type{ margin-bottom:12px; font-size:12px; text-overflow:ellipsis; overflow:hidden; white-space:nowrap; word-wrap:normal; color:#444;}
.boardList li dd:nth-of-type(1){color:#999; margin-bottom:5px; font-size:15px; }
.boardList li dd:nth-of-type(2){color:#999; margin-bottom:5px; font-size:15px; } .boardList li dd:nth-of-type(2){color:#999; margin-bottom:5px; font-size:15px; }
.boardList li dd:nth-of-type(2):before{color:#999; content:' ㄴ ';} .boardList li dd:nth-of-type(2):before{color:#999; content:' ㄴ ';}
.boardList li dd:nth-of-type(3) > b{display:inline-block; color:#999; padding-right:24px; margin-bottom:5px; font-size:14px; line-height:26px; cursor:pointer;} .boardList li dd:nth-of-type(3) > b{display:inline-block; color:#999; padding-right:24px; margin-bottom:5px; font-size:14px; line-height:26px; cursor:pointer;}

View File

@ -66,19 +66,31 @@ $(document).on('click', '.searchTabLink', function (){
$("#activeTabInput").val($(this).attr('data-activetab')) $("#activeTabInput").val($(this).attr('data-activetab'))
searchPageFormSubmit(1); searchPageFormSubmit(1);
}) })
$(document).on('click', '.menuLink', function (){
const menuUrlEl = $(this).find(".menuUrl");
if(menuUrlEl.length !== 0){
location.href = menuUrlEl.val()
}else{
alert("메뉴 접근 권한이 없습니다.")
}
})
$(document).on('click', '.boardLink', function (event){ $(document).on('click', '.boardLink', function (event){
if(!event.target.className.includes('fileLink')){ if(!event.target.className.includes('fileLink')){
let menuUrl = $(this).find(".menuUrl").val() const menuUrlEl = $(this).find(".menuUrl");
if(menuUrl === undefined){ if(menuUrlEl.length !== 0){
location.href= "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val() let menuUrl = menuUrlEl.val()
}else{ if(menuUrl === undefined){
if(menuUrl.includes("?")){ location.href = "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val()
menuUrl += "&refDocKey="
}else{ }else{
menuUrl += "?refDocKey=" if(menuUrl.includes("?")){
menuUrl += "&refDocKey="
}else{
menuUrl += "?refDocKey="
}
location.href = menuUrl+$(this).find(".refDocKey").val()
} }
location.href = menuUrl+$(this).find(".refDocKey").val() }else{
alert("메뉴 접근 권한이 없습니다.")
} }
} }
}) })

View File

@ -100,11 +100,21 @@
<section class="searchDataListBox" th:if="${searchParams.activeTab eq 'all' or searchParams.activeTab eq 'menu'}"> <section class="searchDataListBox" th:if="${searchParams.activeTab eq 'all' or searchParams.activeTab eq 'menu'}">
<h3>메뉴검색<span th:text="|${menuResult.totalCount}건|"></span></h3> <h3>메뉴검색<span th:text="|${menuResult.totalCount}건|"></span></h3>
<ul class="menuList"> <ul class="menuList">
<li th:each="menu:${menuResult.rowList}"> <th:block th:each="menu:${menuResult.rowList}">
<ol> <li class="menuLink">
<li><a th:href="${menu.menu_url}" th:text="${menu.menu_nm}"></a></li> <a href="#" th:text="${menu.menu_nm}"></a>
</ol> <th:block th:if="${menu.menu_key eq 0}">
</li> <input type="hidden" class="menuUrl" th:value="${menu.menu_url}">
</th:block>
<th:block th:if="${menu.menu_key ne 0}">
<th:block th:each="accessMenu:${accessMenuList}">
<th:block th:if="${menu.menu_key eq accessMenu.menuKey and !#strings.isEmpty(accessMenu.accessAuth)}">
<input type="hidden" class="menuUrl" th:value="${menu.menu_url}">
</th:block>
</th:block>
</th:block>
</li>
</th:block>
</ul> </ul>
<div class="optionView" th:if="${searchParams.activeTab eq 'all'}"> <div class="optionView" th:if="${searchParams.activeTab eq 'all'}">
<a href="#" class="plusView searchTabLink" data-activetab="menu">더보기 +</a> <a href="#" class="plusView searchTabLink" data-activetab="menu">더보기 +</a>
@ -142,12 +152,16 @@
<ul class="boardList"> <ul class="boardList">
<li th:each="board:${boardResult.rowList}"> <li th:each="board:${boardResult.rowList}">
<dl class="boardLink"> <dl class="boardLink">
<input type="hidden" class="refDocKey" th:value="${board.main_key}">
<dt> <dt>
<th:block th:if="${board.menu_key ne 0}"> <th:block th:if="${board.menu_key ne 0}">
[<th:block th:each="menu:${menuList}"> [<th:block th:each="menu:${menuList}">
<th:block th:if="${menu.menuKey eq board.menu_key}"> <th:block th:if="${menu.menuKey eq board.menu_key}">
<input type="hidden" class="menuUrl" th:value="${menu.menuUrl}"> <th:block th:each="accessMenu:${accessMenuList}">
<th:block th:if="${board.menu_key eq accessMenu.menuKey and !#strings.isEmpty(accessMenu.accessAuth)}">
<input type="hidden" class="refDocKey" th:value="${board.main_key}">
<input type="hidden" class="menuUrl" th:value="${menu.menuUrl}">
</th:block>
</th:block>
<th:block th:if="${!#strings.isEmpty(menu.cat3Cd)}"> <th:block th:if="${!#strings.isEmpty(menu.cat3Cd)}">
<th:block th:each="code:${session.commonCode.get('CAT3')}"> <th:block th:each="code:${session.commonCode.get('CAT3')}">
<th:block th:if="${menu.cat3Cd eq code.itemCd}" th:text="${code.itemValue}"></th:block> <th:block th:if="${menu.cat3Cd eq code.itemCd}" th:text="${code.itemValue}"></th:block>
@ -167,14 +181,25 @@
</th:block>] </th:block>]
</th:block> </th:block>
<a href="#" th:text="${board.title1}"></a> <a href="#" th:text="${board.title1}"></a>
<span class="titleDate" th:text="${#temporals.format(board.wrt_dt, 'yyyy-MM-dd HH:mm')}"></span> <span class="titleDate">
<th:block th:if="${!#strings.isEmpty(board.wrt_organ)}" th:text="${board.wrt_organ}"></th:block>
<th:block th:if="${!#strings.isEmpty(board.wrt_part)}" th:text="${board.wrt_part}"></th:block>
<th:block th:if="${!#strings.isEmpty(board.wrt_user_grd)}" th:text="${board.wrt_user_grd}"></th:block>
<th:block th:if="${!#strings.isEmpty(board.wrt_user_nm)}" th:text="${board.wrt_user_nm}"></th:block>
<th:block th:text="${#temporals.format(board.wrt_dt, 'yyyy-MM-dd HH:mm')}"></th:block>
</span>
</dt> </dt>
<dt th:if="${!#strings.isEmpty(board.title2)}"><a href="#" th:text="${board.title2}"></a></dt> <!--<dt th:if="${!#strings.isEmpty(board.title2)}"><a href="#" th:text="${board.title2}"></a></dt>-->
<!--<dd th:if="${!#strings.isEmpty(board.content1)}" th:utext="${board.content1}"></dd> <th:block th:if="${!#strings.isEmpty(board.hash_tag)}">
<dd th:utext="|해시태그: ${board.hash_tag}|"></dd>
</th:block>
<!--
<dd th:if="${!#strings.isEmpty(board.content1)}" th:utext="${board.content1}"></dd>
<dd th:if="${!#strings.isEmpty(board.content2)}" th:utext="${board.content2}"></dd> <dd th:if="${!#strings.isEmpty(board.content2)}" th:utext="${board.content2}"></dd>
<dd th:if="${!#strings.isEmpty(board.content3)}" th:utext="${board.content3}"></dd> <dd th:if="${!#strings.isEmpty(board.content3)}" th:utext="${board.content3}"></dd>
<dd th:if="${!#strings.isEmpty(board.content4)}" th:utext="${board.content4}"></dd> <dd th:if="${!#strings.isEmpty(board.content4)}" th:utext="${board.content4}"></dd>
<dd th:if="${!#strings.isEmpty(board.content5)}" th:utext="${board.content5}"></dd>--> <dd th:if="${!#strings.isEmpty(board.content5)}" th:utext="${board.content5}"></dd>
-->
</dl> </dl>
</li> </li>
</ul> </ul>