Merge remote-tracking branch 'origin/master'

Conflicts:
	src/main/java/nlib/cmm/snslogin/KakaoController.java
	src/main/java/nlib/col/service/InterestService.java
	src/main/java/nlib/col/service/impl/InterestDAO.java
	src/main/java/nlib/col/service/impl/InterestServiceImpl.java
	src/main/java/nlib/col/web/InterestController.java
	src/main/resources/egovframework/mapper/nlib/col/CollectionDAO_SQL.xml
	src/main/resources/egovframework/mapper/nlib/col/InterestDAO_SQL.xml
This commit is contained in:
KNKIM 2021-10-12 09:19:58 +09:00
commit c9a5d5159f
20 changed files with 1370 additions and 94 deletions

View File

@ -13,4 +13,6 @@ public interface CodeService
{
public List<HashMap<String, String>> listCodes(String iCodeId) throws Exception;
public List<HashMap<String, String>> listCtClsfs() throws Exception;
}

View File

@ -6,9 +6,45 @@ public class PagingVO {
int pageIndex = 1; /* 페이지 번호 */
int pageSize = DEFAULT_PAGE_SIZE; /* 페이지 크기 (1페이지당 보여줄 자료건수) */
int totRecordCount; /* 총건수 */
int totRecordCount = 0; /* 총건수 */
int pageStart = 0; /* 시작번호 (limit용)*/
int startPage = 0; /*시작페이지 */
int endPage = 0; /* 끝페이지 */
int lastPage = 0; /* 마지막페이지 */
private int cntPage = DEFAULT_PAGE_SIZE; /* 노출되는 페이지 개수 ex) << < 1 2 3 4 5 > >> */
public int getStartPage() {
return startPage;
}
public int getCntPage() {
return cntPage;
}
public void setCntPage(int cntPage) {
this.cntPage = cntPage;
}
public void setStartPage(int startPage) {
this.startPage = startPage;
}
public int getEndPage() {
return endPage;
}
public void setEndPage(int endPage) {
this.endPage = endPage;
}
public int getLastPage() {
return lastPage;
}
public void setLastPage(int lastPage) {
this.lastPage = lastPage;
}
public int getPageStart() {
return pageStart;
@ -67,4 +103,47 @@ public class PagingVO {
return ((pageIndex - 1) * pageSize);
}
public void setPagingVO(int totRecordCount, int pageIndex, int pageSize) {
setPageIndex(pageIndex);
//현재 페이지
setPageSize(pageSize);
//페이지 게시글수
setTotRecordCount(totRecordCount);
//게시글 갯수
calcLastPage(totRecordCount,pageSize);
//제일 마지막 페이지 계산
//시작 페이지 계산 - 아래.
calcStartEndPage(pageIndex, cntPage);
setPageStart(pageIndex, pageSize);
}
// 제일 마지막 페이지 계산
public void calcLastPage(int totRecordCount, int pageSize) {
setLastPage((int) Math.ceil((double)totRecordCount / (double)pageSize));
}
// 시작, 페이지 계산
public void calcStartEndPage(int pageIndex, int cntPage) {
setEndPage(((int)Math.ceil((double)pageIndex / (double)cntPage )) * cntPage );
if (getLastPage() < getEndPage()) {
setEndPage(getLastPage());
}
if(getTotRecordCount() > 0)
{
if(getEndPage() % cntPage == 0)
{
setStartPage( 1 + (getEndPage() / cntPage - 1) * cntPage);
}else {
setStartPage(getEndPage() / cntPage * cntPage +1);
}
}
if (getStartPage() < 1) {
setStartPage(1);
}
}
// DB 쿼리에서 사용할 start값 계산
public void setPageStart(int pageIndex, int pageSize) {
this.pageStart = ((pageIndex - 1) * pageSize);
}
}

View File

@ -31,4 +31,6 @@ import egovframework.rte.psl.dataaccess.mapper.Mapper;
public interface CodeDAO {
public List<HashMap<String, String>> listCodes(String iCodeId) throws Exception;
public List<HashMap<String, String>> listCtClsfs() throws Exception;
}

View File

@ -27,4 +27,8 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
return codeDAO.listCodes(iCodeId.toUpperCase());
}
public List<HashMap<String, String>> listCtClsfs() throws Exception {
return codeDAO.listCtClsfs();
}
}

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
package nlib.cmm.snslogin;
import java.io.IOException;
@ -78,4 +79,86 @@ public class KakaoController {
// clear resources
} return returnNode;
}
=======
package nlib.cmm.snslogin;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.stereotype.Controller;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@Controller
public class KakaoController {
private final static String K_CLIENT_ID = "dawsdasd";
public static String getAuthorizationUrl(HttpSession session,String K_REDIRECT_URI) {
String kakaoUrl = "https://kauth.kakao.com/oauth/authorize?" + "client_id=" + K_CLIENT_ID
+ "&redirect_uri="+ K_REDIRECT_URI + "&response_type=code";
return kakaoUrl;
}
public static JsonNode getAccessToken(String autorize_code,String K_REDIRECT_URI) {
final String RequestUrl = "https://kauth.kakao.com/oauth/token";
final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new BasicNameValuePair("grant_type", "authorization_code"));
postParams.add(new BasicNameValuePair("client_id", K_CLIENT_ID)); // REST API KEY
postParams.add(new BasicNameValuePair("redirect_uri",K_REDIRECT_URI));
// 리다이렉트 URI
postParams.add(new BasicNameValuePair("code",autorize_code)); // 로그인 과정중 얻은 code
final HttpClient client = HttpClientBuilder.create().build();
final HttpPost post = new HttpPost(RequestUrl);
JsonNode returnNode = null;
try {
post.setEntity(new UrlEncodedFormEntity(postParams));
final HttpResponse response = client.execute(post);
// JSON 형태 반환값 처리
ObjectMapper mapper = new ObjectMapper();
returnNode = mapper.readTree(response.getEntity().getContent());
} catch (UnsupportedEncodingException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace(); }
finally {
// clear resources
} return returnNode;
}
public static JsonNode getKakaoUserInfo(JsonNode accessToken) {
final String RequestUrl = "https://kapi.kakao.com/v2/user/me";
final HttpClient client = HttpClientBuilder.create().build();
final HttpPost post = new HttpPost(RequestUrl);
// add header
post.addHeader("Authorization", "Bearer " + accessToken);
JsonNode returnNode = null;
try {
final HttpResponse response = client.execute(post);
// JSON 형태 반환값 처리
ObjectMapper mapper = new ObjectMapper();
returnNode = mapper.readTree(response.getEntity().getContent());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
// clear resources
} return returnNode;
}
>>>>>>> refs/remotes/origin/master
}

View File

@ -0,0 +1,27 @@
package nlib.col.service;
import java.util.List;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
public interface CollectionService_BK
{
public DataApiResVO listItems(DataApiReqVO reqVO);
public DataApiResVO insertInterest(DataApiReqVO reqVO);
public DataApiResVO reserveItem(DataApiReqVO reqVO);
public DataApiResVO viewOriginalCopy(DataApiReqVO reqVO);
public DataApiResVO requestViewingItem(DataApiReqVO reqVO);
public DataApiResVO selectItemInfo(DataApiReqVO reqVO);
public RisVO selectRisInfo(RisVO vo);
public List<DeptVO> selectOrgList(CollectionVO vo);
}

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
package nlib.col.service;
import java.util.List;
@ -19,4 +20,27 @@ public interface InterestService
public List<DeptVO> selectOrgList(CollectionVO vo);
=======
package nlib.col.service;
import java.util.List;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
public interface InterestService
{
public List<CollectionVO> listInterests(CollectionVO vo);
public int countListInterests(CollectionVO vo);
public void deleteInterests(List<Integer> mbInterestIdList, String mbInfoId);
public void insertInterest(CollectionVO vo);
public int countInterest(CollectionVO vo);
public List<DeptVO> selectOrgList(CollectionVO vo);
>>>>>>> refs/remotes/origin/master
}

View File

@ -80,10 +80,28 @@ public class CollectionDAO extends EgovComAbstractDAO
return selectOne("CollectionDAO.selectRisInfo", vo);
}
/**
* 문화원 목록 조회
* 문화원 목록 조회(검색필터용)
* @return
*/
public List<DeptVO> selectOrgList(CollectionVO vo) {
return selectList("CollectionDAO.selectOrgList",vo);
public List<DeptVO> selectOrgList() {
return selectList("CollectionDAO.selectOrgList");
}
/**
* 소장자료 목록 조회
* @param searchCollectionVO
* @return
*/
public List<CollectionVO> listItems(CollectionVO searchCollectionVO) {
return selectList("CollectionDAO.listItems",searchCollectionVO);
}
/**
* 소장자료 목록 개수 조회
* @param searchCollectionVO
* @return
*/
public int countListItems(CollectionVO searchCollectionVO) {
return selectOne("CollectionDAO.countListItems",searchCollectionVO);
}
}

View File

@ -0,0 +1,89 @@
package nlib.col.service.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.col.service.RisVO;
import nlib.restful.DataApi;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import egovframework.com.cmm.service.impl.EgovComAbstractDAO;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import nlib.cmm.service.NotificationVO;
import nlib.cmm.service.NlibProperty;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
@Repository("collectionDAO_BK")
public class CollectionDAO_BK extends EgovComAbstractDAO
{
private static final Logger log = LoggerFactory.getLogger(CollectionDAO_BK.class);
/*
*//**
* 소장 자료 목록을 조회한다.
*
* @param reqVO
* @return
*//*
public DataApiResVO listItems(DataApiReqVO reqVO) {
reqVO.setReqUrl(RESOURCE_URI + "/listItems/list");
return get(reqVO);
}*/
public DataApiResVO insertInterest(DataApiReqVO reqVO) {
return null;
}
public DataApiResVO reserveItem(DataApiReqVO reqVO) {
return null;
}
public DataApiResVO viewOriginalCopy(DataApiReqVO reqVO) {
return null;
}
public DataApiResVO requestViewingItem(DataApiReqVO reqVO) {
return null;
}
/**
* 소장자료를 상세 조회한다.
*
* @param reqVO
* @return
*//*
public DataApiResVO selectItemInfo(DataApiReqVO reqVO) {
}*/
public DataApiResVO deleteInterest(DataApiReqVO reqVO) {
return null;
}
/**
* RIS파일 다운로드 데이터를 조회한다.
* @param vo
* @return
*/
public RisVO selectRisInfo(RisVO vo) {
return selectOne("CollectionDAO.selectRisInfo", vo);
}
/**
* 문화원 목록 조회
* @return
*/
public List<DeptVO> selectOrgList(CollectionVO vo) {
return selectList("CollectionDAO.selectOrgList",vo);
}
}

View File

@ -0,0 +1,79 @@
package nlib.col.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import nlib.col.service.CollectionService_BK;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.col.service.RisVO;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
@Service("collectionService_BK")
public class CollectionServiceImpl_BK implements CollectionService_BK
{
private static final Logger log = LoggerFactory.getLogger(CollectionServiceImpl_BK.class);
@Resource(name = "collectionDAO_BK")
private CollectionDAO_BK collectionDAO_BK;
/*
* 소장자료 목록을 조회한다.
*
* (non-Javadoc)
* @see nlib.col.service.CollectionService#listItems(nlib.restful.service.DataApiReqVO)
*/
public DataApiResVO listItems(DataApiReqVO reqVO) {
return ((CollectionService_BK) collectionDAO_BK).listItems(reqVO);
}
public DataApiResVO insertInterest(DataApiReqVO reqVO) {
return null;
}
public DataApiResVO reserveItem(DataApiReqVO reqVO) {
return null;
}
public DataApiResVO viewOriginalCopy(DataApiReqVO reqVO) {
return null;
}
public DataApiResVO requestViewingItem(DataApiReqVO reqVO) {
return null;
}
/*
* 소장자료를 상세 조회한다.
*
* (non-Javadoc)
* @see nlib.col.service.CollectionService#selectItemInfo(nlib.restful.service.DataApiReqVO)
*/
public DataApiResVO selectItemInfo(DataApiReqVO reqVO) {
return ((CollectionService_BK) collectionDAO_BK).selectItemInfo(reqVO);
}
/*
* RIS파일 다운로드 데이터를 조회한다.
* (non-Javadoc)
* @see nlib.col.service.CollectionService#selectRisInfo(nlib.col.service.CollectionVO)
*/
public RisVO selectRisInfo(RisVO vo) {
return collectionDAO_BK.selectRisInfo(vo);
}
/*
* 문화원 목록 조회
* (non-Javadoc)
* @see nlib.col.service.CollectionService#selectOrgList()
*/
public List<DeptVO> selectOrgList(CollectionVO vo) {
return collectionDAO_BK.selectOrgList(vo);
}
}

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
package nlib.col.service.impl;
import java.util.List;
@ -68,4 +69,76 @@ public class InterestDAO extends EgovComAbstractDAO
public List<DeptVO> selectOrgList(CollectionVO vo) {
return selectList("InterestDAO.selectOrgList",vo);
}
=======
package nlib.col.service.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import egovframework.com.cmm.service.impl.EgovComAbstractDAO;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.restful.DataApi;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
@Repository("interestDAO")
public class InterestDAO extends EgovComAbstractDAO
{
private static final Logger log = LoggerFactory.getLogger(InterestDAO.class);
/**
* 관심 자료 목록을 조회한다.
*
* @param CollectionVO
* @return
*/
public List<CollectionVO> listInterests(CollectionVO vo) {
return selectList("InterestDAO.listInterests", vo);
}
/**
* 관심 자료 목록의 개수를 조회한다.
*
* @param CollectionVO
* @return
*/
public int countListInterests(CollectionVO vo) {
return selectOne("InterestDAO.countListInterests", vo);
}
/**
* 관심자료 목록 삭제
* @param masterIdList
*/
public void deleteInterests(CollectionVO vo) {
delete("InterestDAO.deleteInterests", vo);
}
/**
* 관심자료 추가시 중복체크용 count
* @param vo
* @return
*/
public int countInterest(CollectionVO vo) {
return selectOne("InterestDAO.countInterest",vo);
}
/**
* 관심자료 추가
* @param vo
*/
public void insertInterest(CollectionVO vo) {
insert("InterestDAO.insertInterest",vo);
}
/**
* 문화원 목록 조회
* @return
*/
public List<DeptVO> selectOrgList(CollectionVO vo) {
return selectList("InterestDAO.selectOrgList",vo);
}
>>>>>>> refs/remotes/origin/master
}

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
package nlib.col.service.impl;
import java.util.List;
@ -79,4 +80,87 @@ public class InterestServiceImpl implements InterestService
public List<DeptVO> selectOrgList(CollectionVO vo) {
return interestDAO.selectOrgList(vo);
}
=======
package nlib.col.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import nlib.col.service.CartService;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.col.service.InterestService;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
@Service("interestService")
public class InterestServiceImpl implements InterestService
{
private static final Logger log = LoggerFactory.getLogger(InterestServiceImpl.class);
@Resource(name="interestDAO")
private InterestDAO interestDAO;
/*
* 관심자료 목록을 조회한다.
*
* (non-Javadoc)
* @see nlib.col.service.CollectionService#listInterests(nlib.restful.service.DataApiReqVO)
*/
public List<CollectionVO> listInterests(CollectionVO vo) {
return interestDAO.listInterests(vo);
}
/*
* 관심자료목록의 개수를 조회한다.
* (non-Javadoc)
* @see nlib.col.service.CollectionService#countListInterests(nlib.col.service.CollectionVO)
*/
public int countListInterests(CollectionVO vo) {
return interestDAO.countListInterests(vo);
}
/*
* 관심자료 목록 삭제
* (non-Javadoc)
* @see nlib.col.service.CollectionService#deleteInterests(java.util.List)
*/
public void deleteInterests(List<Integer> mbInterestIdList,String mbInfoId) {
CollectionVO vo = new CollectionVO();
vo.setMbInfoId(mbInfoId);
for(Integer mbInterestId : mbInterestIdList) {
vo.setMbInterestId(mbInterestId);
interestDAO.deleteInterests(vo);
}
}
/*
* 관심자료 추가시 중복체크용 count
* (non-Javadoc)
* @see nlib.col.service.CollectionService#countInterest(nlib.col.service.CollectionVO)
*/
public int countInterest(CollectionVO vo) {
return interestDAO.countInterest(vo);
}
/*
* 관심자료 추가
* (non-Javadoc)
* @see nlib.col.service.CollectionService#insertInterest(nlib.col.service.CollectionVO)
*/
public void insertInterest(CollectionVO vo) {
interestDAO.insertInterest(vo);
}
/*
* 문화원 목록 조회
* (non-Javadoc)
* @see nlib.col.service.CollectionService#selectOrgList()
*/
public List<DeptVO> selectOrgList(CollectionVO vo) {
return interestDAO.selectOrgList(vo);
}
>>>>>>> refs/remotes/origin/master
}

View File

@ -0,0 +1,234 @@
package nlib.col.web;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import nlib.bbs.service.ArticleVO;
import nlib.cmm.NlibCommonController;
import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty;
import nlib.col.service.CollectionService_BK;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.col.service.RisVO;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import nlib.restful.service.DataApiVO;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
/**
* @author JSYOO
*
*/
@Controller
public class CollectionController_BK1006 extends NlibCommonController
{
private static final Logger log = LoggerFactory.getLogger(CollectionController_BK1006.class);
static final String DEFUALT_PAGE_SIZE = NlibProperty.getProperty("list.paging.page.size");
@Resource(name = "codeService")
private CodeService codeService;
@Resource(name="collectionService_BK")
private CollectionService_BK collectionService_BK;
/**
* 소장자료 화면을 호출한다.
*
* @param req
* @return
*/
@RequestMapping("/collection/listItems.do")
public String listItems(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
String searchKeyword = paramMap.get("searchKeyword");
String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM)
List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
// 반환 정보
model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize);
model.addAttribute("searchKeyword", searchKeyword);
model.addAttribute("pageSizeCodes", pageSizeCodes);
return "nlib/collection/listItems";
}
/**
* 소장자료를 조회한다.
*
* @param req
* @return
*/
@RequestMapping(value="/collection/listItemsAjax.do")
public ResponseEntity<String> listItemsAjax(HttpServletRequest req,
Authentication authentication, @RequestBody Map<String, String> paramMap) {
String searchKeyword = paramMap.get("searchKeyword");
String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//-------------------------------
// REQ VO 구성
//-------------------------------
DataApiReqVO reqVO = new DataApiReqVO();
reqVO.setPageIndex(pageIndex);
reqVO.setPageSize(pageSize);
reqVO.putInfoItem("searchKeyword", searchKeyword);
// 요청
DataApiResVO resVO = collectionService_BK.listItems(reqVO);
//-------------------------------
// JSON변환 응답 처리
//-------------------------------
// JS-GRID 페이징 처리를 포함한 응답값 처리
// {data: [{...}],
// itemsCount: 255
// }
HashMap<String, Object> retMap = new HashMap<String, Object>();
retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD));
retMap.put("itemsCount", resVO.getRecordTotCount());
return makeResponseEntityJson(retMap);
}
/**
* RIS파일 다운로드
* @param vo
* @throws IOException
*/
@RequestMapping(value="/collection/risDownload.do")
public void risDownload(HttpServletRequest request,HttpServletResponse response) throws IOException {
RisVO vo = new RisVO();
vo.setMasterId(request.getParameter("masterId"));
vo = collectionService_BK.selectRisInfo(vo);
response.setContentType("text/plain");
String fileName = vo.getTt();
String Ty="";
// 브라우저 한글 인코딩
String header = request.getHeader("User-Agent");
if (header.contains("Edge")){
fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + ".ris;\"");
} else if (header.contains("MSIE") || header.contains("Trident")) { // IE 11버전부터 Trident로 변경되었기때문에 추가해준다.
fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".ris;");
} else if (header.contains("Chrome")) {
fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + ".ris\"");
} else if (header.contains("Opera")) {
fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + ".ris\"");
} else if (header.contains("Firefox")) {
fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".ris");
}
Ty = StringUtil.getString(vo.getTy(), "");
if(Ty.length() > 3)
{
Ty.replace("IT_", "");
}
String s = "TY - " + Ty;
s+= "\nTI - " + StringUtil.getString(vo.getTt(), "");
s+= "\nPY - " + StringUtil.getString(vo.getPy(), "");
s+= "\nKW - " + StringUtil.getString(vo.getKw(), "");
s+= "\nT2 - " + StringUtil.getString(vo.getT2(), "");
s+= "\nA1 - " + StringUtil.getString(vo.getA1(), "");
s+= "\nPP - " + StringUtil.getString(vo.getPp(), "");
s+= "\nM1 - " + StringUtil.getString(vo.getM1(), "");
s+= "\nL4 - " + StringUtil.getString(vo.getL4(), "");
s+= "\nER - ";
InputStream input = new ByteArrayInputStream(s.getBytes("UTF8"));
int read = 0;
byte[] bytes = new byte[1024];
OutputStream os = response.getOutputStream();
while ((read = input.read(bytes)) != -1) {
os.write(bytes, 0, read);
}
os.flush();
os.close();
}
/**
* 소장자료 상세 내용 조회한다.
*
* @param req
* @return
*/
@RequestMapping("/collection/selectItemInfo.do")
public String selectItemInfo(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) {
// 목록 이동시 전달할 매개변수
String searchKeyword = paramMap.get("searchKeyword");
String pageIndex = paramMap.get("pageIndex");
String pageSize = paramMap.get("pageSize");
String message = paramMap.get("message");
// 게시물 번호
String articleNo = paramMap.get("articleNo");
log.debug("selectQnA > pageIndex = " + pageIndex);
log.debug("selectQnA > pageSize = " + pageSize);
log.debug("selectQnA > searchKeyword = " + searchKeyword);
log.debug("selectQnA > articleNo = " + articleNo);
log.debug("selectQnA > message = " + message);
//-------------------------------
// REQ VO 구성
//-------------------------------
DataApiReqVO reqVO = new DataApiReqVO();
reqVO.setPageIndex(pageIndex);
reqVO.setPageSize(pageSize);
reqVO.putInfoItem("boardNo", "QNA"); // 게시판ID
reqVO.putInfoItem("articleNo", articleNo); // 게시물번호
// 요청
DataApiResVO resVO = collectionService_BK.selectItemInfo(reqVO);
// 반환 정보
model.addAttribute("articleNo" , articleNo);
model.addAttribute("article" , resVO.getInfo()); // 게시물 상세
model.addAttribute("message" , message);
model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize);
model.addAttribute("searchKeyword", searchKeyword);
return "nlib/collection/selectItemInfo";
}
}

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
package nlib.col.web;
import java.util.ArrayList;
@ -171,4 +172,179 @@ public class InterestController extends NlibCommonController
return message;
}
=======
package nlib.col.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import nlib.cmm.NlibCommonController;
import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty;
import nlib.col.service.CollectionService;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.col.service.InterestService;
import nlib.col.service.RentService;
import nlib.user.service.NlibLoginVO;
/**
* <pre>
* @Class Name : InterestController.java
*
* @Description : 관심자료 컨트롤러
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 10. 01. JSYOO 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP JSYOO
* @since 2021. 10. 01.
* @version 1.0
*
*/
@Controller
public class InterestController extends NlibCommonController
{
private static final Logger log = LoggerFactory.getLogger(InterestController.class);
static final String DEFUALT_PAGE_SIZE = NlibProperty.getProperty("list.paging.page.size");
@Resource(name = "interestService")
private InterestService interestService;
@Resource(name = "collectionService")
private CollectionService collectionService;
@Resource(name = "codeService")
private CodeService codeService;
/**
* 관심 자료 화면을 호출한다.
*
* @param req
* @return
*/
@RequestMapping("/interest/listInterests.do")
public String listInterests(HttpServletRequest req, Authentication authentication,
@RequestParam Map<String, String> paramMap,
CollectionVO searchCollectionVO, ModelMap model) throws Exception {
List<DeptVO> vo = new ArrayList();
//사용자 정보를 가져온다.
NlibLoginVO loginVO = getNlibLoginVO(authentication);
searchCollectionVO.setMbInfoId(loginVO.getMbInfoId());
//문화원 목록 조회
vo = interestService.selectOrgList(searchCollectionVO);
model.addAttribute("deptList",vo);
model.addAttribute("searchCollection", searchCollectionVO);
return "nlib/collection/listInterests";
}
/**
* 관심 자료를 조회한다.
*
* @param req
* @return
*/
@RequestMapping(value="/interest/listInterestsAjax.do")
public ResponseEntity<String> listInterestsAjax(HttpServletRequest req,
Authentication authentication, @RequestBody CollectionVO searchCollectionVO) {
if(searchCollectionVO.getPageIndex() < 1) searchCollectionVO.setPageIndex(1);
if(searchCollectionVO.getPageSize() < 1) searchCollectionVO.setPageSize(DEFUALT_PAGE_SIZE);
int totalCount= 0;
//사용자 정보를 가져온다.
NlibLoginVO loginVO = getNlibLoginVO(authentication);
searchCollectionVO.setMbInfoId(loginVO.getMbInfoId());
searchCollectionVO.setPageStart(searchCollectionVO.getPageIndex(), searchCollectionVO.getPageSize());
List<CollectionVO> List = new ArrayList();
// 요청
List = interestService.listInterests(searchCollectionVO);
totalCount = interestService.countListInterests(searchCollectionVO);
//-------------------------------
// JSON변환 응답 처리
//-------------------------------
// JS-GRID 페이징 처리를 포함한 응답값 처리
// {data: [{...}],
// itemsCount: 255
// }
HashMap<String, Object> retMap = new HashMap<String, Object>();
retMap.put("data", List);
retMap.put("itemsCount", totalCount);
return makeResponseEntityJson(retMap);
}
/**
* 관심자료 목록 삭제
* @param masterIdList
*/
@RequestMapping(value="/interest/deleteInterests.ajax")
@ResponseBody
public void deleteInterests(@RequestParam(value="mbInterestIdList[]") List<Integer> mbInterestIdList,Authentication authentication) {
NlibLoginVO loginVO = getNlibLoginVO(authentication);
interestService.deleteInterests(mbInterestIdList,loginVO.getMbInfoId());
}
/**
* 관심자료 추가
* @param masterIdList
*/
@RequestMapping(value="/interest/insertInterest.ajax")
@ResponseBody
public String insertInterest(@RequestParam(value="masterId") String masterId,HttpServletResponse response,Authentication authentication,HttpServletRequest request) {
NlibLoginVO loginVO = getNlibLoginVO(authentication);
CollectionVO vo = new CollectionVO();
vo.setMbInfoId(loginVO.getMbInfoId());
vo.setMasterId(masterId);
int count = 0;
String message = "";
count = interestService.countInterest(vo);
//중복된 관심자료가 있을시
if(count > 0)
{
message="이미 추가된 관심자료입니다.";
}else {
interestService.insertInterest(vo);
message="관심자료에 추가되었습니다.";
}
return message;
}
>>>>>>> refs/remotes/origin/master
}

View File

@ -5,7 +5,10 @@
<select id="listCodes" parameterType="String" resultType="EgovMap">
SELECT B.S_CODE_ID
, B.COLUMN1
, B.COLUMN2
, B.S_CODE_NM
FROM SM_CODE_M A,
SM_CODE_S B
WHERE A.L_CODE_ID = #{lCodeId}
@ -15,4 +18,15 @@
ORDER BY B.SORT_SEQ
</select>
<select id="listCtClsfs" resultType="EgovMap">
SELECT
CLSF_ID
,CLSF_NM
,UP_CLSF_ID
FROM
CT_CLSF
WHERE 1=1
ORDER BY REMARK;
</select>
</mapper>

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed May 11 15:49:38 KST 2016-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
@ -57,4 +58,65 @@
AND MNG_ORG_CD = #{mngOrgCd}
</if> -->
</select>
=======
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed May 11 15:49:38 KST 2016-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="CollectionDAO">
<select id="selectRisInfo" parameterType="RisVO" resultType="RisVO">
/* CollectionDAO.selectRisInfo RIS다운로드를 위한 자료 정보 조회 */
SELECT
*
FROM
RG_MASTER RM
WHERE 1=1
AND MASTER_ID = #{masterId}
</select>
<select id="selectOrgList" resultType="DeptVO" >
/* CollectionDAO.selectOrgList 문화원 목록 조회 (검색 필터용) */
<![CDATA[
SELECT
ORG_CD
,DEPT_NM
FROM
SM_DEPT SD
INNER JOIN
RG_MASTER RM
ON SD.ORG_CD = RM.MNG_ORG_CD
WHERE 1=1
AND SD.USE_YN = "Y"
AND SD.CLOSE_FLAG = "0"
AND IFNULL(NULLIF(SD.APPLY_START_YMD,''),"99999999") < date_format(NOW(), '%Y%m%d')
AND IFNULL(NULLIF(SD.APPLY_CLOSE_YMD,''),"99999999") > date_format(NOW(), '%Y%m%d')
GROUP BY ORG_CD,DEPT_NM
ORDER BY ORG_CD
]]>
</select>
<select id="listItems" parameterType="CollectionVO" resultType="CollectionVO">
/* CollectionDAO.listItems 소장자료 목록조회 */
SELECT
*
FROM
RG_MASTER RM
WHERE 1=1
AND USE_FLAG = "Y"
LIMIT #{pageStart},#{pageSize}
</select>
<select id="countListItems" parameterType="CollectionVO" resultType="Integer">
/* CollectionDAO.countListItems 소장자료 목록 개수 조회 */
SELECT
COUNT(*)
FROM
RG_MASTER RM
WHERE 1=1
AND USE_FLAG = "Y"
<!-- <if test='mngOrgCd != null and !mngOrgCd.equals("")'>
AND MNG_ORG_CD = #{mngOrgCd}
</if> -->
</select>
>>>>>>> refs/remotes/origin/master
</mapper>

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed May 11 15:49:38 KST 2016-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
@ -107,4 +108,115 @@
GROUP BY ORG_CD,DEPT_NM
]]>
</select>
=======
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed May 11 15:49:38 KST 2016-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="InterestDAO">
<select id="listInterests" parameterType="CollectionVO" resultType="CollectionVO">
/* CollectionDAO.listInterests 관심자료 목록조회 */
SELECT
MI.MB_INTEREST_ID
,RM.MASTER_ID
,RM.TITLE
,IFNULL(RM.RPRS_THUMB_URL,"") RPRS_THUMB_URL
,IFNULL(SD.DEPT_NM,"") MNG_ORG_NM
FROM
RG_MASTER RM
INNER JOIN
MB_INTEREST MI
ON RM.MASTER_ID =MI.MASTER_ID
LEFT OUTER JOIN
SM_DEPT SD
ON SD.ORG_CD = RM.MNG_ORG_CD
WHERE 1=1
AND MI.MB_INFO_ID = #{mbInfoId}
AND MI.USE_YN = "Y"
<if test='mngOrgCd != null and !mngOrgCd.equals("")'>
AND MNG_ORG_CD = #{mngOrgCd}
</if>
ORDER BY MI.MB_INTEREST_ID DESC
LIMIT #{pageStart},#{pageSize}
</select>
<select id="countListInterests" parameterType="CollectionVO" resultType="Integer">
/* CollectionDAO.countListInterests 관심자료 목록 개수 조회 */
SELECT
COUNT(*)
FROM
RG_MASTER RM
INNER JOIN
MB_INTEREST MI
ON RM.MASTER_ID =MI.MASTER_ID
WHERE 1=1
AND MI.MB_INFO_ID = #{mbInfoId}
AND USE_YN = "Y"
<if test='mngOrgCd != null and !mngOrgCd.equals("")'>
AND MNG_ORG_CD = #{mngOrgCd}
</if>
</select>
<update id="deleteInterests" parameterType="CollectionVO">
/* CollectionDAO.deleteInterests 관심자료 삭제 */
UPDATE
MB_INTEREST
SET
USE_YN="N"
WHERE 1=1
AND MB_INTEREST_ID = #{mbInterestId}
AND MB_INFO_ID = #{mbInfoId}
</update>
<insert id="insertInterest" parameterType="CollectionVO">
/* CollectionDAO.insertInterest 관심자료 추가 */
<selectKey resultType="Integer" keyProperty="mbInterestId" order="BEFORE">
SELECT MAX(MB_INTEREST_ID)+1 FROM MB_INTEREST;
</selectKey>
INSERT INTO
MB_INTEREST
VALUES
(#{mbInterestId},#{mbInfoId},#{masterId},NOW(),"Y");
</insert>
<select id="countInterest" parameterType="CollectionVO" resultType="Integer">
/* CollectionDAO.countInterest 관심자료 count(중복확인) */
SELECT
COUNT(*)
FROM
RG_MASTER RM
INNER JOIN
MB_INTEREST MI
ON RM.MASTER_ID = MI.MASTER_ID
WHERE 1=1
AND MI.MASTER_ID = #{masterId}
AND MI.MB_INFO_ID = #{mbInfoId}
AND MI.USE_YN = "Y"
</select>
<select id="selectOrgList" parameterType="CollectionVO" resultType="DeptVO" >
/* InterestDAO.selectOrgList 문화원 목록 조회 */
<![CDATA[
SELECT
ORG_CD
,DEPT_NM
FROM
SM_DEPT SD
INNER JOIN
RG_MASTER RM
ON SD.ORG_CD = RM.MNG_ORG_CD
INNER JOIN
MB_INTEREST MI
ON RM.MASTER_ID = MI.MASTER_ID
WHERE 1=1
AND SD.USE_YN = "Y"
AND SD.CLOSE_FLAG = "0"
AND IFNULL(NULLIF(SD.APPLY_START_YMD,''),"99999999") < date_format(NOW(), '%Y%m%d')
AND IFNULL(NULLIF(SD.APPLY_CLOSE_YMD,''),"99999999") > date_format(NOW(), '%Y%m%d')
AND MI.USE_YN = "Y"
AND MI.MB_INFO_ID = #{mbInfoId}
GROUP BY ORG_CD,DEPT_NM
]]>
</select>
>>>>>>> refs/remotes/origin/master
</mapper>

View File

@ -14,16 +14,16 @@
<!-- GOOGLE OAuth Configuration -->
<bean id="googleAuthVO" class="egovframework.com.ext.oauth.service.OAuthVO">
<constructor-arg value="google" /><!-- Service Name -->
<constructor-arg value="259455195838-eh7b4cm9nuhbsbaktq2aectf7utkubfs.apps.googleusercontent.com" /><!-- googleClientID -->
<constructor-arg value="5Z_3PhwBgPTdkXTUGvSja4ro" /><!-- googleClientSecret -->
<constructor-arg value="590802608410-a03ul9al205h3h8rvhrlr2tulleftt0o.apps.googleusercontent.com" /><!-- googleClientID -->
<constructor-arg value="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" /><!-- googleClientSecret -->
<constructor-arg value="https://nlib-dev.nculture.org/{callType}/{oauthServiceName}/callback.do" /><!-- googleRedirectUrl : callType(login|member) -->
</bean>
<!-- KAKAO OAuth Configuration -->
<bean id="kakaoAuthVO" class="egovframework.com.ext.oauth.service.OAuthVO">
<constructor-arg value="kakao" /><!-- Service Name -->
<constructor-arg value="e74d25210853313dd1fead4c6c1f06ec" /><!-- kakaoClientID -->
<constructor-arg value="AGxiWEwu2ytIifA1AY2PoqVSrdnRZiao" /><!-- kakaoClientSecret -->
<constructor-arg value="9c1b2249240c011edf40a1d487702232" /><!-- kakaoClientID -->
<constructor-arg value="fxv4i1aztudvPj84DEUvMTnzWe29611G" /><!-- kakaoClientSecret -->
<constructor-arg value="https://nlib-dev.nculture.org/{callType}/{oauthServiceName}/callback.do" /><!-- kakaoRedirectUrl : callType(login|member) -->
</bean>

File diff suppressed because one or more lines are too long

View File

@ -223,3 +223,47 @@ function insertInterest(masterId){
alert(result);
});
}
function paging(pageVO)
{
$("#paging *").remove();
var html="";
var startPage = pageVO.startPage;
var endPage = pageVO.endPage;
if(pageVO.totalCount != 0)
{
if(pageVO.pageIndex != 1 ){
html+="<a href=\"#\" onclick=\"fn_search_article("+ 1 +"); return false;\">\<\<</a> "
html+="<a href=\"#\" onclick=\"fn_search_article("+ (pageVO.pageIndex*1 -1) +"); return false;\">\<</a> ";
}else{
html+="<a>\<\<</a> "
html+="<a>\<</a> ";
}
for(startPage; startPage <= endPage; startPage++ )
{
if(startPage != pageVO.pageIndex)
{
html+= "<a href=\"#\" onclick=\"fn_search_article("+ startPage +"); return false;\">" + startPage + "</a> "
}else{
html+= "<a>" + startPage + "</a> "
}
}
if(pageVO.pageIndex != pageVO.lastPage){
html+="<a href=\"#\" onclick=\"fn_search_article("+ (pageVO.pageIndex*1 +1) +"); return false;\">\></a> "
html+="<a href=\"#\" onclick=\"fn_search_article("+ pageVO.lastPage +"); return false;\">\>\></a> ";
}else{
html+="<a>\></a> "
html+="<a>\>\></a>";
}
}else{
html+= "데이터가 없습니다.";
}
$("#paging").append(html);
}