This commit is contained in:
KNKIM 2021-11-01 09:06:35 +09:00
commit 5c8b212e3f
6 changed files with 78 additions and 50 deletions

View File

@ -3,6 +3,7 @@ package nlib.cmm.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
@ -11,8 +12,8 @@ import nlib.restful.service.DataApiResVO;
public interface CodeService
{
public List<HashMap<String, String>> listCodes(String iCodeId) throws Exception;
public List<Map<String, String>> listCodes(String iCodeId) throws Exception;
public List<HashMap<String, String>> listCtClsfs() throws Exception;
public List<Map<String, String>> listCtClsfs() throws Exception;
}

View File

@ -2,6 +2,7 @@ package nlib.cmm.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
@ -30,7 +31,7 @@ import egovframework.rte.psl.dataaccess.mapper.Mapper;
@Mapper("codeDAO")
public interface CodeDAO {
public List<HashMap<String, String>> listCodes(String iCodeId) throws Exception;
public List<Map<String, String>> listCodes(String iCodeId) throws Exception;
public List<HashMap<String, String>> listCtClsfs() throws Exception;
public List<Map<String, String>> listCtClsfs() throws Exception;
}

View File

@ -2,6 +2,7 @@ package nlib.cmm.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@ -21,14 +22,14 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
@Resource(name="codeDAO")
private CodeDAO codeDAO;
public List<HashMap<String, String>> listCodes(String iCodeId) throws Exception {
public List<Map<String, String>> listCodes(String iCodeId) throws Exception {
if(StringUtil.isEmpty(iCodeId)) return null;
return codeDAO.listCodes(iCodeId.toUpperCase());
}
public List<HashMap<String, String>> listCtClsfs() throws Exception {
public List<Map<String, String>> listCtClsfs() throws Exception {
return codeDAO.listCtClsfs();
}
}

View File

@ -30,7 +30,7 @@ public class CodeController extends NlibCommonController {
String lCodeId = paramMap.get("lCodeId");
List<HashMap<String, String>> resultList = codeService.listCodes(lCodeId);
List<Map<String, String>> resultList = codeService.listCodes(lCodeId);
model.addAttribute("resultList", resultList);
model.addAttribute("lCodeId", lCodeId);
@ -42,7 +42,7 @@ public class CodeController extends NlibCommonController {
String lCodeId = paramMap.get("lCodeId");
List<HashMap<String, String>> resultList = codeService.listCodes(lCodeId);
List<Map<String, String>> resultList = codeService.listCodes(lCodeId);
model.addAttribute("resultList", resultList);
model.addAttribute("lCodeId", lCodeId);

View File

@ -9,28 +9,19 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import cmm.Constant;
import cmm.util.CmmUtil;
import cmm.util.DataMap;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import kccf.res.service.ResourcesService;
import kccf.sch.service.SearchCollectionResult;
import kccf.sch.service.SearchService;
import kccf.sch.service.vo.SearchCollectionVO;
import kccf.sch.service.vo.Sf1VO;
import nlib.cmm.NlibCommonController;
import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty;
@ -38,14 +29,10 @@ import nlib.cmm.service.PagingVO;
import nlib.col.service.CartService;
import nlib.col.service.CollectionService;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.col.service.InterestService;
import nlib.col.service.RisService;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import nlib.sch.service.NlibSearchService;
import nlib.sch.service.NlibSearchVO;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
@Controller
@ -92,18 +79,13 @@ public class NlibSearchController extends NlibCommonController {
public String searchList(
HttpServletRequest req
, Authentication authentication
, @RequestParam Map<String, String> paramMap
, ModelMap model
, @ModelAttribute("searchVO") NlibSearchVO searchVO
, HttpServletRequest request
, HttpServletResponse res) throws Exception {
List<CollectionVO> operList = new ArrayList();
// 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM)
List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//주제분야 목록 조회
List<HashMap<String,String>> clsf = codeService.listCtClsfs();
List<Map<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
if(searchVO.getPageIndex() < 1) searchVO.setPageIndex(1);
if(searchVO.getPageSize() < 1) searchVO.setPageSize(DEFUALT_PAGE_SIZE);
@ -148,24 +130,67 @@ public class NlibSearchController extends NlibCommonController {
}catch(Exception e){
e.printStackTrace();
}
//주제분야 목록 조회
List<Map<String,String>> clsf = codeService.listCtClsfs();
//자료유형
List<Map<String, String>> firstClassList = codeService.listCodes(Constant.CODE_ID_MASTER_TYPE_DIV_CD);
List<Map<String, String>> secondClassList = codeService.listCodes(Constant.CODE_ID_DTLS_TYPE_DIV_CD);
//검색엔진 주제분야 카운트
List<HashMap<String, String>> subject= searchVO.getSubjectCountList();
List<HashMap<String, String>> type= searchVO.getTypeCountList();
int count = 0;
// 검색엔진 건수 자료 조합
List<String> councilList = new ArrayList<String>();
councilList.add("마포문화원");
councilList.add("서울문화원");
councilList.add("종로문화원");
/*List<DataMap> councilList = resourcesService.selectCouncilList(); */
model.addAttribute("councilList", councilList);
for(int i=0; i<clsf.size(); i++) {
count = 0;
for(int j=0; j<subject.size(); j++)
{
String.valueOf(clsf.get(i).get("clsfId"));
//if(String.valueOf(clsf.get(i).get("CLSF_ID")).equals(String.valueOf(subject.get(j).get("category_nm"))))
if(StringUtil.getString(clsf.get(i).get("clsfId"),"").equals(subject.get(j).get("category_nm")))
{
count += Integer.parseInt(subject.get(j).get("category_cnt"));
}
if(String.valueOf(clsf.get(i).get("clsfId")).equals(String.valueOf(subject.get(j).get("category_nm_up"))))
{
count += Integer.parseInt(subject.get(j).get("category_cnt"));
}
}
clsf.get(i).put("CNT", Integer.toString(count));
}
for(int i=0; i<firstClassList.size(); i++) {
count = 0;
for(int j=0; j<type.size(); j++)
{
if(String.valueOf(firstClassList.get(i).get("column1")).equals(String.valueOf(type.get(j).get("class_nm_up"))))
{
count += Integer.parseInt(type.get(j).get("class_cnt"));
}
}
firstClassList.get(i).put("cnt", Integer.toString(count));
}
for(int i=0; i<secondClassList.size(); i++) {
count = 0;
for(int j=0; j<type.size(); j++)
{
if(String.valueOf(secondClassList.get(i).get("column1")).equals(String.valueOf(type.get(j).get("class_nm"))))
{
count += Integer.parseInt(type.get(j).get("class_cnt"));
}
}
secondClassList.get(i).put("cnt", Integer.toString(count));
}
// 반환 정보
model.addAttribute("pageSizeCodes", pageSizeCodes);
//주제분야
model.addAttribute("firstCategoryList", clsf);
model.addAttribute("firstCategoryList", clsf);
model.addAttribute("secondCategoryList", clsf);
//자료유형
model.addAttribute("firstClassList", codeService.listCodes(Constant.CODE_ID_MASTER_TYPE_DIV_CD));
model.addAttribute("secondClassList", codeService.listCodes(Constant.CODE_ID_DTLS_TYPE_DIV_CD));
model.addAttribute("firstClassList", firstClassList);
model.addAttribute("secondClassList", secondClassList);
searchVO.setQuery(searchVO.getQuery().replaceAll("\\\"", "&quot;"));
@ -269,7 +294,7 @@ public class NlibSearchController extends NlibCommonController {
public String getDetailedSearchFormPopup(HttpServletRequest request, ModelMap model) throws Exception {
//주제분야 목록 조회
List<HashMap<String,String>> clsf = codeService.listCtClsfs();
List<Map<String,String>> clsf = codeService.listCtClsfs();
model.addAttribute("firstCategoryList", clsf);
model.addAttribute("secondCategoryList", clsf);

View File

@ -200,18 +200,18 @@ function fn_search_article(pageIndex) {
<li>
<c:forEach var="firstClassList" items="${firstClassList}" varStatus="fcStatus">
<li>
<div class="depth-1 <c:if test="${fn:contains(searchVO.filter_class, firstClassList.column1) }"> on</c:if>">
<div class="depth-1 <c:if test="${fn:contains(searchVO.filter_class, firstClassList.COLUMN1) }"> on</c:if>">
<div class="check">
<input type="checkbox" value="${firstClassList.column1}" name="first_class" id="data-type-chk${fcStatus.index+1}" <c:if test="${fn:contains(searchVO.first_class, firstClassList.column1) }">checked="checked"</c:if> />
<label for="data-type-chk${fcStatus.index+1}">${firstClassList.sCodeNm}(<span>0</span>) </label>
<input type="checkbox" value="${firstClassList.COLUMN1}" name="first_class" id="data-type-chk${fcStatus.index+1}" <c:if test="${fn:contains(searchVO.first_class, firstClassList.COLUMN1) }">checked="checked"</c:if> />
<label for="data-type-chk${fcStatus.index+1}">${firstClassList.S_CODE_NM}(<span>${firstClassList.CNT }</span>) </label>
</div>
</div>
<ul class="depth-2">
<c:forEach var="secondClassList" items="${secondClassList}" varStatus="seStatus">
<c:if test="${firstClassList.column1 eq secondClassList.column2 }">
<c:if test="${firstClassList.COLUMN1 eq secondClassList.COLUMN2 }">
<li>
<div class="check"><input type="checkbox" value="${secondClassList.sCodeId}" name="second_class" id="data-type-chk${fcStatus.index+1}-${seStatus.index+1}" <c:if test="${fn:contains(searchVO.second_class, secondClassList.sCodeId) }">checked="checked"</c:if> />
<label for="data-type-chk${fcStatus.index+1}-${seStatus.index+1}">${secondClassList.sCodeNm}(<span>0</span>)</label>
<div class="check"><input type="checkbox" value="${secondClassList.S_CODE_ID}" name="second_class" id="data-type-chk${fcStatus.index+1}-${seStatus.index+1}" <c:if test="${fn:contains(searchVO.second_class, secondClassList.S_CODE_ID) }">checked="checked"</c:if> />
<label for="data-type-chk${fcStatus.index+1}-${seStatus.index+1}">${secondClassList.S_CODE_NM}(<span>${secondClassList.CNT }</span>)</label>
</div>
</li>
</c:if>
@ -233,15 +233,15 @@ function fn_search_article(pageIndex) {
<ul id="ul_category2List">
<c:set var="count" value="0" />
<c:forEach var="firstCategoryInfo" items="${firstCategoryList}" varStatus="status">
<c:if test="${firstCategoryInfo.upClsfId eq '2' }">
<c:if test="${firstCategoryInfo.UP_CLSF_ID eq '2' }">
<li>
<div class="depth-1 <c:if test="${fn:contains(searchVO.filter_category, firstCategoryInfo.clsfId) }"> on</c:if>">
<div class="check"><input type="checkbox" value="${firstCategoryInfo.clsfId}" id="theme-chk${count+1}" name="first_category" <c:if test="${fn:contains(searchVO.first_category, firstCategoryInfo.clsfId) }">checked="checked"</c:if>/><label for="theme-chk${count+1}">${firstCategoryInfo.clsfNm}(<span>0</span>)</label></div>
<div class="depth-1 <c:if test="${fn:contains(searchVO.filter_category, firstCategoryInfo.CLSF_ID) }"> on</c:if>">
<div class="check"><input type="checkbox" value="${firstCategoryInfo.CLSF_ID}" id="theme-chk${count+1}" name="first_category" <c:if test="${fn:contains(searchVO.first_category, firstCategoryInfo.CLSF_ID) }">checked="checked"</c:if>/><label for="theme-chk${count+1}">${firstCategoryInfo.CLSF_NM}(<span>${firstCategoryInfo.CNT}</span>)</label></div>
</div>
<ul class="depth-2">
<c:forEach var="secondCategoryInfo" items="${secondCategoryList}" varStatus="seStatus">
<c:if test="${firstCategoryInfo.clsfId eq secondCategoryInfo.upClsfId }">
<li><div class="check"><input type="checkbox" value="${secondCategoryInfo.clsfId}" id="theme-chk${count+1}-${seStatus.index+1}" name="second_category" <c:if test="${fn:contains(searchVO.second_category, secondCategoryInfo.clsfId) }">checked="checked"</c:if>/><label for="theme-chk${count+1}-${seStatus.index+1}">${secondCategoryInfo.clsfNm}(<span>0</span>)</label></div></li>
<c:if test="${firstCategoryInfo.CLSF_ID eq secondCategoryInfo.UP_CLSF_ID }">
<li><div class="check"><input type="checkbox" value="${secondCategoryInfo.CLSF_ID}" id="theme-chk${count+1}-${seStatus.index+1}" name="second_category" <c:if test="${fn:contains(searchVO.second_category, secondCategoryInfo.CLSF_ID) }">checked="checked"</c:if>/><label for="theme-chk${count+1}-${seStatus.index+1}">${secondCategoryInfo.CLSF_NM}(<span>${secondCategoryInfo.CNT}</span>)</label></div></li>
</c:if>
</c:forEach>
</ul>