diff --git a/src/main/java/cokr/xit/adds/nims/ApiKeyQuery.java b/src/main/java/cokr/xit/adds/nims/ApiKeyQuery.java new file mode 100644 index 0000000..24cd71f --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/ApiKeyQuery.java @@ -0,0 +1,83 @@ +package cokr.xit.adds.nims; + +import cokr.xit.foundation.component.QueryRequest; + +/**폐기관리접수 정보 조회 요청 +* +*/ +public class ApiKeyQuery extends QueryRequest{ + + private static final long serialVersionUID = 1L; + + //폐기관리 + private String schDeptCd; // 조회 부서 코드 + private String schUseYn; // 사용여부 + private String deptCd; // 부서 코드 + private String deptNm; // 부서 명 + private String prodApiKey; // ApiKey + private String useYn; // 사용여부 + private String userId; // 사용자 ID + + public String getSchDeptCd() { + return ifEmpty(schDeptCd, () -> null); + } + + public T setSchDeptCd(String schDeptCd) { + this.schDeptCd = schDeptCd; + return self(); + } + + public String getSchUseYn() { + return ifEmpty(schUseYn, () -> null); + } + + public T setSchUseYn(String schUseYn) { + this.schUseYn = schUseYn; + return self(); + } + + public String getDeptCd() { + return ifEmpty(deptCd, () -> null); + } + + public T setDeptCd(String deptCd) { + this.deptCd = deptCd; + return self(); + } + + public String getDeptNm() { + return ifEmpty(deptNm, () -> null); + } + + public T setDeptNm(String deptNm) { + this.deptNm = deptNm; + return self(); + } + + public String getProdApiKey() { + return ifEmpty(prodApiKey, () -> null); + } + + public T setProdApiKey(String prodApiKey) { + this.prodApiKey = prodApiKey; + return self(); + } + + public String getuseYn() { + return ifEmpty(useYn, () -> null); + } + + public T setuseYn(String useYn) { + this.useYn = useYn; + return self(); + } + + public String getUserId() { + return ifEmpty(userId, () -> null); + } + + public T setUserId(String userId) { + this.userId = userId; + return self(); + } +} diff --git a/src/main/java/cokr/xit/adds/nims/dao/ApiKeyMapper.java b/src/main/java/cokr/xit/adds/nims/dao/ApiKeyMapper.java new file mode 100644 index 0000000..b16cfbf --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/dao/ApiKeyMapper.java @@ -0,0 +1,45 @@ +package cokr.xit.adds.nims.dao; + +import java.util.List; + +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; + +import cokr.xit.adds.nims.ApiKeyQuery; +import cokr.xit.adds.nims.DsuseMgtReceiptQuery; +import cokr.xit.foundation.component.AbstractMapper; +import cokr.xit.foundation.data.DataObject; + +/** 폐기관리상세 정보 DAO + */ +@Mapper("apiKeyMapper") +public interface ApiKeyMapper extends AbstractMapper { + + /** + * 지정한 조건에 따라 폐기관리상세 목록을 조회하여 반환한다.
+ * @param req 폐기관리상세 조회 조건 + * @return 폐기관리상세 목록 + */ + List selectApiKeyList(ApiKeyQuery req); + + + /** + * ApiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + int updateApiKey(ApiKeyQuery query); + + /** + * ApiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + int createApiKey(ApiKeyQuery query); + + /** + * ApiKey 중복 조회. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + int selectApiKey(ApiKeyQuery query); +} diff --git a/src/main/java/cokr/xit/adds/nims/service/ApiKeyService.java b/src/main/java/cokr/xit/adds/nims/service/ApiKeyService.java new file mode 100644 index 0000000..d2db509 --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/service/ApiKeyService.java @@ -0,0 +1,32 @@ +package cokr.xit.adds.nims.service; + +import java.util.List; + +import cokr.xit.adds.nims.ApiKeyQuery; +import cokr.xit.foundation.data.DataObject; + +public interface ApiKeyService { + + /** 단속자료 목록을 조회한다. + * @param query ApiKey 조회 조건 + *
  • pageNum: 페이지 번호
  • + *
  • fetchSize: 페이지 목록 건수
  • + *
+ * @return ApiKey 목록 + */ + List getApiKeyList(ApiKeyQuery query); + + /** + * ApiKey 등록. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + String createApiKey(ApiKeyQuery query); + + /** + * ApiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + String updateApiKey(ApiKeyQuery query); +} diff --git a/src/main/java/cokr/xit/adds/nims/service/bean/ApiKeyServiceBean.java b/src/main/java/cokr/xit/adds/nims/service/bean/ApiKeyServiceBean.java new file mode 100644 index 0000000..eb867d6 --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/service/bean/ApiKeyServiceBean.java @@ -0,0 +1,58 @@ +package cokr.xit.adds.nims.service.bean; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import cokr.xit.adds.nims.ApiKeyQuery; +import cokr.xit.adds.nims.dao.ApiKeyMapper; +import cokr.xit.adds.nims.service.ApiKeyService; +import cokr.xit.foundation.component.AbstractServiceBean; +import cokr.xit.foundation.data.DataObject; + +@Service("apiKeyService") +public class ApiKeyServiceBean extends AbstractServiceBean implements ApiKeyService { + + /** 폐기관리접수 정보 DAO */ + @Resource(name = "apiKeyMapper") + private ApiKeyMapper apiKeyMapper; + + @Override + public List getApiKeyList(ApiKeyQuery query){ + if(ifEmpty(query.getOrderBy(), ()->"").equals("")) { + query.setOrderBy("DEPT_CD DESC"); + } + + return apiKeyMapper.selectApiKeyList(query); + } + + /** apiKey 등록. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + @Override + public String createApiKey(ApiKeyQuery query) { + //if(apiKeyMapper.selectApiKey(query) ) + + if(apiKeyMapper.createApiKey(query) == 1) { + return "[S]"; + } else { + return "[F]"; + } + } + + /** apiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + @Override + public String updateApiKey(ApiKeyQuery query) { + if(apiKeyMapper.updateApiKey(query) == 1) { + return "[S]"; + } else { + return "[F]"; + } + } +} diff --git a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java index 5189c5f..9485ebe 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -44,12 +44,14 @@ import cokr.xit.adds.cmm.model.DsuseRsltInfo; import cokr.xit.adds.cmm.model.NimsApiRequest; import cokr.xit.adds.cmmn.hwp.format.DisposeProcessDetails; import cokr.xit.adds.cmmn.hwp.format.DisposeResultReport; +import cokr.xit.adds.nims.ApiKeyQuery; import cokr.xit.adds.nims.DsuseMgtDetailQuery; import cokr.xit.adds.nims.DsuseMgtDocQuery; import cokr.xit.adds.nims.DsuseMgtReceiptQuery; import cokr.xit.adds.nims.DsuseMgtRsltQuery; import cokr.xit.adds.nims.DsuseMgtStatisticsQuery; import cokr.xit.adds.nims.service.AddsNimsService; +import cokr.xit.adds.nims.service.ApiKeyService; import cokr.xit.adds.nims.service.DsuseMgtDocService; import cokr.xit.adds.nims.service.DsuseMgtReceiptService; import cokr.xit.applib.Print; @@ -121,6 +123,9 @@ public class AddsNimsController extends ApplicationController { @Resource(name="dsuseMgtDocService") private DsuseMgtDocService dsuseMgtDocService; + + @Resource(name="apiKeyService") + private ApiKeyService apiKeyService; @Resource(name="fileService") private FileService fileService; @@ -286,8 +291,11 @@ public class AddsNimsController extends ApplicationController { public ModelAndView updatePrgsSttusOfDsuseMgt(DsuseMgtReceiptQuery qry) { boolean saved = false; String rtnMsg = dsuseMgtReceiptService.updatePrgsSttusOfDsuseMgt(qry); + String message; if(rtnMsg.contains("[S]")) { saved = true; + }else{ + saved = false; } return new ModelAndView("jsonView") .addObject("saved", saved) @@ -683,6 +691,62 @@ public class AddsNimsController extends ApplicationController { // 마약류폐기보고 팝업 //------------------------------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------- + // ApiKey 관리 + //------------------------------------------------------------------------------------------------- + @RequestMapping(value = "/apiKeyMain.do", name="apiKey 관리 메인") + public ModelAndView apiKeyMain() { + + ModelAndView mav = new ModelAndView("adds/nims/apiKey-main"); + + List deptList = sggDeptService.getDepartmentList(new DepartmentQuery()); + mav.addObject("DEPTList", deptList); + + return mav.addObject("pageName", "apiKeyMain") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */; + } + + @RequestMapping(value = "/apiKey-list.do", name="apiKey 관리 조회") + public ModelAndView getApiKeyList(ApiKeyQuery query) { + setFetchSize(query); + + return setCollectionInfo(new ModelAndView("jsonView"), apiKeyService.getApiKeyList(query),"",""); + } + + @RequestMapping(value = "/apiKey-info.do", name="apiKey 관리 상세") + public ModelAndView getApiKeyInfo(ApiKeyQuery query) { + ModelAndView mav = new ModelAndView("adds/nims/apiKey-info"); + List deptList = sggDeptService.getDepartmentList(new DepartmentQuery()); + mav.addObject("DEPTList", deptList); + mav.addObject("apiKeyInfo", toJson(query)); + + return mav.addObject("pageName", "apiKeyInfoPopup"); // View(jsp)에서 사용할 id 뒤에 붙일 suffix + } + + @RequestMapping(value = "/updateApiKey.do", name="apiKey 수정") + public ModelAndView updateApiKey(ApiKeyQuery query) { + boolean saved = false; + String rtnMsg = apiKeyService.updateApiKey(query); + if(rtnMsg.contains("[S]")) { + saved = true; + } + return new ModelAndView("jsonView") + .addObject("saved", saved) + .addObject("rtnMsg", rtnMsg); + } + + @RequestMapping(value = "/inertApiKey.do", name="apiKey 등록") + public ModelAndView insertApiKey(ApiKeyQuery query) { + boolean saved = false; + String rtnMsg = apiKeyService.createApiKey(query); + if(rtnMsg.contains("[S]")) { + saved = true; + } + return new ModelAndView("jsonView") + .addObject("saved", saved) + .addObject("rtnMsg", rtnMsg); + } + + //------------------------------------------------------------------------------------------------- // API server call //------------------------------------------------------------------------------------------------- diff --git a/src/main/resources/sql/mapper/adds/nims/apiKey-mapper.xml b/src/main/resources/sql/mapper/adds/nims/apiKey-mapper.xml new file mode 100644 index 0000000..734b988 --- /dev/null +++ b/src/main/resources/sql/mapper/adds/nims/apiKey-mapper.xml @@ -0,0 +1,60 @@ + + + + + + + + SELECT + DEPT_CD /* 폐기관리 ID */ + , DEPT_NM /* 폐기관리_순번 */ + , PROD_API_KEY /* 제품_코드 */ + , USE_YN /* 제품_명 */ + FROM TB_DSUSE_API_KEY_INFO + + + + + + UPDATE TB_DSUSE_API_KEY_INFO + SET PROD_API_KEY = #{prodApiKey} + , USE_YN = #{useYn} + , MDFCN_DT = DATE_FORMAT(now(), '%Y%m%d%H%i%s') + , MDFR = #{userId} + WHERE DEPT_CD = #{deptCd} + + + + INSERT INTO TB_DSUSE_API_KEY_INFO + (DEPT_CD, DEPT_NM, PROD_API_KEY, USE_YN, REG_DT, RGTR) + VALUES + (#{deptCd}, #{deptNm}, #{prodApiKey}, #{useYn}, DATE_FORMAT(now(), '%Y%m%d%H%i%s'), #{userId}) + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-info.jsp new file mode 100644 index 0000000..6ebccd7 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-info.jsp @@ -0,0 +1,229 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> + +폐기관리 등록 + + +
+ +
+ +
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+ + + + + + +
+ +
+
+ + diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-main.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-main.jsp new file mode 100644 index 0000000..f432242 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-main.jsp @@ -0,0 +1,334 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> +Api Key 관리 + +
+ +
+ + +
+ +
+ +
+
+
+
+
+
+ +<%-- --%> +
+
+ + +
+ +
+ + +
+ + +
+ + +