소스정리

This commit is contained in:
JSYOO 2021-12-17 11:26:47 +09:00
parent 210feb3076
commit d39b18816e
6 changed files with 71 additions and 56 deletions

View File

@ -4,6 +4,28 @@ import nlib.sch.service.NlibSearchVO;
/**
* <pre>
* @Class Name : NlibSearchService.java
*
* @Description : 검색엔진
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 9. 23. JSYOO 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP JSYOO
* @since 2021. 9. 23.
* @version 1.0
*
*/
public interface NlibSearchService { public interface NlibSearchService {
/** 검색결과 받기 /** 검색결과 받기
* @return */ * @return */

View File

@ -21,15 +21,28 @@ import nlib.col.service.CollectionVO;
import nlib.sch.service.impl.NlibSearchServiceImpl; import nlib.sch.service.impl.NlibSearchServiceImpl;
import nlib.util.StringUtil; import nlib.util.StringUtil;
/**
/** * <pre>
* 검색엔진 . NlibSearchVO
* @Class Name : NlibSearchVO.java * @Class Name : NlibSearchVO.java
* @author JSYOO *
* @since 2021-10-18 * @Description : 검색엔진 VO
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 9. 23. JSYOO 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP JSYOO
* @since 2021. 9. 23.
* @version 1.0 * @version 1.0
*
*/ */
public class NlibSearchVO extends PagingVO { public class NlibSearchVO extends PagingVO {
private static final Logger log = LoggerFactory.getLogger(NlibSearchVO.class); private static final Logger log = LoggerFactory.getLogger(NlibSearchVO.class);

View File

@ -2,31 +2,16 @@ package nlib.sch.service.impl;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.beanutils.BeanUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -36,21 +21,38 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import com.google.gson.Gson;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import nlib.sch.service.NlibSearchVO;
import nlib.col.service.CollectionVO; import nlib.col.service.CollectionVO;
import nlib.restful.DataApi;
import nlib.sch.service.NlibSearchCollectionVO;
import nlib.sch.service.NlibSearchInterface;
import nlib.sch.service.NlibSearchService; import nlib.sch.service.NlibSearchService;
import nlib.sch.service.NlibSearchVO;
import nlib.util.StringUtil; import nlib.util.StringUtil;
/**
* <pre>
* @Class Name : NlibSearchServiceImpl.java
*
* @Description : 검색엔진
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 9. 23. JSYOO 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP JSYOO
* @since 2021. 9. 23.
* @version 1.0
*
*/
@Service("nlibSearchService") @Service("nlibSearchService")
public class NlibSearchServiceImpl implements NlibSearchService{ public class NlibSearchServiceImpl implements NlibSearchService{

View File

@ -3,47 +3,31 @@ package nlib.sch.util;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import nlib.cmm.Constant;
import nlib.cmm.service.CmmAmsDocTableOfContentsVO;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import egovframework.rte.fdl.cmmn.exception.EgovBizException; import egovframework.rte.fdl.cmmn.exception.EgovBizException;
import egovframework.rte.fdl.property.EgovPropertyService; import egovframework.rte.fdl.property.EgovPropertyService;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import egovframework.rte.psl.dataaccess.util.EgovMap; import egovframework.rte.psl.dataaccess.util.EgovMap;
import nlib.cmm.Constant;
/** /**

View File

@ -6,8 +6,6 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -31,14 +29,11 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import nlib.cmm.Constant;
import nlib.sch.service.CmmVO;
import nlib.sch.util.DataMap;
import egovframework.rte.fdl.cmmn.exception.EgovBizException; import egovframework.rte.fdl.cmmn.exception.EgovBizException;
import nlib.cmm.Constant;
import nlib.cmm.NlibCommonController; import nlib.cmm.NlibCommonController;
import nlib.cmm.service.CodeService; import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty; import nlib.cmm.service.NlibProperty;
@ -50,8 +45,8 @@ import nlib.col.service.InterestService;
import nlib.col.service.RisService; import nlib.col.service.RisService;
import nlib.sch.service.NlibSearchService; import nlib.sch.service.NlibSearchService;
import nlib.sch.service.NlibSearchVO; import nlib.sch.service.NlibSearchVO;
import nlib.sch.util.DataMap;
import nlib.sch.util.NlibCmmUtil; import nlib.sch.util.NlibCmmUtil;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil; import nlib.util.StringUtil;
@Controller @Controller
@ -422,7 +417,6 @@ public class NlibSearchController extends NlibCommonController {
} }
/** /**
* YOURLS의 API를 통해서 단축URL 가져오기 * YOURLS의 API를 통해서 단축URL 가져오기
* @param cmmVO
* @param model * @param model
* @param commandMap * @param commandMap
* @param req * @param req
@ -433,8 +427,7 @@ public class NlibSearchController extends NlibCommonController {
@RequestMapping(value="/search/shorturl-data.do") @RequestMapping(value="/search/shorturl-data.do")
@ResponseBody @ResponseBody
public String shorturl ( public String shorturl (
@ModelAttribute("cmmVO") CmmVO cmmVO ModelMap model
, ModelMap model
, HttpServletRequest req , HttpServletRequest req
, HttpServletResponse res , HttpServletResponse res
) throws EgovBizException { ) throws EgovBizException {

View File

@ -82,8 +82,9 @@
AND IFNULL(RM.PE_STATUS, '') = '' /* 보존상태 */ AND IFNULL(RM.PE_STATUS, '') = '' /* 보존상태 */
AND ( RM.OPER_OUT_RANGE_CD = '01' OR RM.OPER_READ_RANGE_CD = '01' OR RM.DIGITAL_READ_YN = 'Y')/* 대출 OR 열람 OR 온라인열람 가능 */ AND ( RM.OPER_OUT_RANGE_CD = '01' OR RM.OPER_READ_RANGE_CD = '01' OR RM.DIGITAL_READ_YN = 'Y')/* 대출 OR 열람 OR 온라인열람 가능 */
) T ) T
WHERE WHERE 1=1
T.KEY_NAME IN ( AND T.KEY_NAME != '-'
AND T.KEY_NAME IN (
SELECT TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(replace(RM.KEYWORD, ',', ';'), ';', NUMBERS.N), ';', -1)) AS KEY_NAME SELECT TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(replace(RM.KEYWORD, ',', ';'), ';', NUMBERS.N), ';', -1)) AS KEY_NAME
FROM ( FROM (
WITH RECURSIVE CTE AS ( WITH RECURSIVE CTE AS (