충돌 병합 작업

This commit is contained in:
KNKIM 2021-10-12 08:35:46 +09:00
parent 655b326d63
commit 4df127ecf0
10 changed files with 672 additions and 549 deletions

View File

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

View File

@ -22,6 +22,10 @@ public interface CollectionService
public RisVO selectRisInfo(RisVO vo); public RisVO selectRisInfo(RisVO vo);
public List<DeptVO> selectOrgList(CollectionVO vo); public List<DeptVO> selectOrgList();
public List<CollectionVO> listItems(CollectionVO searchCollectionVO);
public int countListItems(CollectionVO searchCollectionVO);
} }

View File

@ -1,20 +1,22 @@
package nlib.col.service; package nlib.col.service;
import java.util.List; import java.util.List;
import nlib.restful.service.DataApiReqVO; import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO; import nlib.restful.service.DataApiResVO;
public interface InterestService public interface InterestService
{ {
public List<CollectionVO> listInterests(CollectionVO vo); public List<CollectionVO> listInterests(CollectionVO vo);
public int countListInterests(CollectionVO vo); public int countListInterests(CollectionVO vo);
public void deleteInterests(List<Integer> mbInterestIdList, String mbInfoId); public void deleteInterests(List<Integer> mbInterestIdList, String mbInfoId);
public void insertInterest(CollectionVO vo); public void insertInterest(CollectionVO vo);
public int countInterest(CollectionVO vo); public int countInterest(CollectionVO vo);
public List<DeptVO> selectOrgList(CollectionVO vo);
} }

View File

@ -69,11 +69,29 @@ public class CollectionServiceImpl implements CollectionService
} }
/* /*
* 문화원 목록 조회 * 문화원 목록 조회(검색 필터용)
* (non-Javadoc) * (non-Javadoc)
* @see nlib.col.service.CollectionService#selectOrgList() * @see nlib.col.service.CollectionService#selectOrgList()
*/ */
public List<DeptVO> selectOrgList(CollectionVO vo) { public List<DeptVO> selectOrgList() {
return collectionDAO.selectOrgList(vo); return collectionDAO.selectOrgList();
}
/*
* 소장자료 목록 조회
* (non-Javadoc)
* @see nlib.col.service.CollectionService#listItems(nlib.col.service.CollectionVO)
*/
public List<CollectionVO> listItems(CollectionVO searchCollectionVO) {
return collectionDAO.listItems(searchCollectionVO);
}
/*
* 소장자료 목록 개수 조회
* (non-Javadoc)
* @see nlib.col.service.CollectionService#countListItems(nlib.col.service.CollectionVO)
*/
public int countListItems(CollectionVO searchCollectionVO) {
return collectionDAO.countListItems(searchCollectionVO);
} }
} }

View File

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

View File

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

View File

@ -30,13 +30,14 @@ import nlib.bbs.service.ArticleVO;
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;
import nlib.cmm.service.PagingVO;
import nlib.col.service.CollectionService; import nlib.col.service.CollectionService;
import nlib.col.service.CollectionVO; import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO; import nlib.col.service.DeptVO;
import nlib.col.service.InterestService;
import nlib.col.service.RisVO; import nlib.col.service.RisVO;
import nlib.restful.service.DataApiReqVO; import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO; import nlib.restful.service.DataApiResVO;
import nlib.restful.service.DataApiVO;
import nlib.user.service.NlibLoginVO; import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil; import nlib.util.StringUtil;
@ -56,6 +57,9 @@ public class CollectionController extends NlibCommonController
@Resource(name="collectionService") @Resource(name="collectionService")
private CollectionService collectionService; private CollectionService collectionService;
@Resource(name = "interestService")
private InterestService interestService;
/** /**
* 소장자료 화면을 호출한다. * 소장자료 화면을 호출한다.
* *
@ -67,15 +71,31 @@ public class CollectionController extends NlibCommonController
String searchKeyword = paramMap.get("searchKeyword"); String searchKeyword = paramMap.get("searchKeyword");
String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1"); String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE); String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
List<DeptVO> vo = new ArrayList();
// 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM) // 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM)
List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION"); List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
// 자료유형 코드 목록 조회
List<HashMap<String,String>> masterType = codeService.listCodes("MASTER_TYPE_DIV_CD");
List<HashMap<String,String>> dtlsType = codeService.listCodes("DTLS_TYPE_DIV_CD");
//주제분야 목록 조회
List<HashMap<String,String>> clsf = codeService.listCtClsfs();
//문화원 목록 조회
vo = collectionService.selectOrgList();
// 반환 정보 // 반환 정보
model.addAttribute("pageIndex" , pageIndex); model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize); model.addAttribute("pageSize" , pageSize);
model.addAttribute("searchKeyword", searchKeyword); model.addAttribute("searchKeyword", searchKeyword);
model.addAttribute("pageSizeCodes", pageSizeCodes); model.addAttribute("pageSizeCodes", pageSizeCodes);
model.addAttribute("masterType", masterType);
model.addAttribute("dtlsType", dtlsType);
model.addAttribute("masterClsf", clsf);
model.addAttribute("dtlsClsf", clsf);
model.addAttribute("orgList",vo);
return "nlib/collection/listItems"; return "nlib/collection/listItems";
} }
@ -87,22 +107,37 @@ public class CollectionController extends NlibCommonController
*/ */
@RequestMapping(value="/collection/listItemsAjax.do") @RequestMapping(value="/collection/listItemsAjax.do")
public ResponseEntity<String> listItemsAjax(HttpServletRequest req, public ResponseEntity<String> listItemsAjax(HttpServletRequest req,
Authentication authentication, @RequestBody Map<String, String> paramMap) { Authentication authentication, @RequestBody CollectionVO searchCollectionVO) {
String searchKeyword = paramMap.get("searchKeyword"); //String searchKeyword = paramMap.get("searchKeyword");
String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1"); if(searchCollectionVO.getPageIndex() < 1) searchCollectionVO.setPageIndex(1);
String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE); if(searchCollectionVO.getPageSize() < 1) searchCollectionVO.setPageSize(DEFUALT_PAGE_SIZE);
int totalCount= 0;
//사용자 정보를 가져온다.
NlibLoginVO loginVO = getNlibLoginVO(authentication);
searchCollectionVO.setPageStart(searchCollectionVO.getPageIndex(), searchCollectionVO.getPageSize());
List<CollectionVO> List = new ArrayList();
// 요청
List = collectionService.listItems(searchCollectionVO);
totalCount = collectionService.countListItems(searchCollectionVO);
PagingVO pageVO = new PagingVO();
pageVO.setPagingVO(totalCount, searchCollectionVO.getPageIndex(), searchCollectionVO.getPageSize());
//------------------------------- //-------------------------------
// REQ VO 구성 // REQ VO 구성
//------------------------------- //-------------------------------
DataApiReqVO reqVO = new DataApiReqVO(); /*DataApiReqVO reqVO = new DataApiReqVO();
reqVO.setPageIndex(pageIndex); reqVO.setPageIndex(pageIndex);
reqVO.setPageSize(pageSize); reqVO.setPageSize(pageSize);
reqVO.putInfoItem("searchKeyword", searchKeyword); reqVO.putInfoItem("searchKeyword", searchKeyword);*/
// 요청 // 요청
DataApiResVO resVO = collectionService.listItems(reqVO); //DataApiResVO resVO = collectionService.listItems(reqVO);
//------------------------------- //-------------------------------
// JSON변환 응답 처리 // JSON변환 응답 처리
@ -112,8 +147,10 @@ public class CollectionController extends NlibCommonController
// itemsCount: 255 // itemsCount: 255
// } // }
HashMap<String, Object> retMap = new HashMap<String, Object>(); HashMap<String, Object> retMap = new HashMap<String, Object>();
retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD)); /*retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD));
retMap.put("itemsCount", resVO.getRecordTotCount()); retMap.put("itemsCount", resVO.getRecordTotCount());*/
retMap.put("data", List);
retMap.put("pageVO", pageVO);
return makeResponseEntityJson(retMap); return makeResponseEntityJson(retMap);
} }
@ -159,7 +196,7 @@ public class CollectionController extends NlibCommonController
if(Ty.length() > 3) if(Ty.length() > 3)
{ {
Ty.replace("IT_", ""); Ty = Ty.replaceFirst("IT_", "");
} }
String s = "TY - " + Ty; String s = "TY - " + Ty;
@ -191,7 +228,7 @@ public class CollectionController extends NlibCommonController
* *
* @param req * @param req
* @return * @return
*/ *//*
@RequestMapping("/collection/selectItemInfo.do") @RequestMapping("/collection/selectItemInfo.do")
public String selectItemInfo(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) { public String selectItemInfo(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) {
// 목록 이동시 전달할 매개변수 // 목록 이동시 전달할 매개변수
@ -215,8 +252,8 @@ public class CollectionController extends NlibCommonController
DataApiReqVO reqVO = new DataApiReqVO(); DataApiReqVO reqVO = new DataApiReqVO();
reqVO.setPageIndex(pageIndex); reqVO.setPageIndex(pageIndex);
reqVO.setPageSize(pageSize); reqVO.setPageSize(pageSize);
reqVO.putInfoItem("boardNo", "QNA"); // 게시판ID reqVO.addInfoItem("boardNo", "QNA"); // 게시판ID
reqVO.putInfoItem("articleNo", articleNo); // 게시물번호 reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
// 요청 // 요청
DataApiResVO resVO = collectionService.selectItemInfo(reqVO); DataApiResVO resVO = collectionService.selectItemInfo(reqVO);
@ -230,5 +267,5 @@ public class CollectionController extends NlibCommonController
model.addAttribute("searchKeyword", searchKeyword); model.addAttribute("searchKeyword", searchKeyword);
return "nlib/collection/selectItemInfo"; return "nlib/collection/selectItemInfo";
} }*/
} }

View File

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

View File

@ -1,40 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed May 11 15:49:38 KST 2016--> <?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" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="CollectionDAO"> <mapper namespace="CollectionDAO">
<select id="selectRisInfo" parameterType="RisVO" resultType="RisVO"> <select id="selectRisInfo" parameterType="RisVO" resultType="RisVO">
/* CollectionDAO.selectRisInfo RIS다운로드를 위한 자료 정보 조회 */ /* CollectionDAO.selectRisInfo RIS다운로드를 위한 자료 정보 조회 */
SELECT SELECT
* *
FROM FROM
RG_MASTER RM RG_MASTER RM
WHERE 1=1 WHERE 1=1
AND MASTER_ID = #{masterId} AND MASTER_ID = #{masterId}
</select> </select>
<select id="selectOrgList" parameterType="CollectionVO" resultType="DeptVO" > <select id="selectOrgList" resultType="DeptVO" >
/* CollectionDAO.selectOrgList 문화원 목록 조회 */ /* CollectionDAO.selectOrgList 문화원 목록 조회 (검색 필터용) */
<![CDATA[ <![CDATA[
SELECT SELECT
ORG_CD ORG_CD
,DEPT_NM ,DEPT_NM
FROM FROM
SM_DEPT SD SM_DEPT SD
INNER JOIN INNER JOIN
RG_MASTER RM RG_MASTER RM
ON SD.ORG_CD = RM.MNG_ORG_CD ON SD.ORG_CD = RM.MNG_ORG_CD
INNER JOIN WHERE 1=1
MB_INTEREST MI AND SD.USE_YN = "Y"
ON RM.MASTER_ID = MI.MASTER_ID AND SD.CLOSE_FLAG = "0"
WHERE 1=1 AND IFNULL(NULLIF(SD.APPLY_START_YMD,''),"99999999") < date_format(NOW(), '%Y%m%d')
AND SD.USE_YN = "Y" AND IFNULL(NULLIF(SD.APPLY_CLOSE_YMD,''),"99999999") > date_format(NOW(), '%Y%m%d')
AND SD.CLOSE_FLAG = "0" GROUP BY ORG_CD,DEPT_NM
AND IFNULL(NULLIF(SD.APPLY_START_YMD,''),"99999999") < date_format(NOW(), '%Y%m%d') ORDER BY ORG_CD
AND IFNULL(NULLIF(SD.APPLY_CLOSE_YMD,''),"99999999") > date_format(NOW(), '%Y%m%d') ]]>
AND MI.USE_YN = "Y" </select>
AND MI.MB_INFO_ID = #{mbInfoId}
GROUP BY ORG_CD,DEPT_NM <select id="listItems" parameterType="CollectionVO" resultType="CollectionVO">
]]> /* CollectionDAO.listItems 소장자료 목록조회 */
</select> 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>
</mapper> </mapper>

View File

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