From 940e88eb68bec2369c11879c18155c7cf02e944d Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Tue, 20 Feb 2024 10:59:51 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EC=B6=9C=EB=A0=A5=EB=AC=BC=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=ED=99=94=EB=A9=B4=20jsp=EB=AA=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=202.=20=EC=84=A4=EC=A0=95=20controller=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/cmmn/web/StngController.java | 176 ++++++++++++++++++ .../xit/fims/sprt/web/Sprt01Controller.java | 116 +----------- .../cokr/xit/fims/task/web/CmnController.java | 41 ++-- .../WEB-INF/jsp/fims/sprt/sprt01140-info.jsp | 2 +- .../WEB-INF/jsp/fims/sprt/sprt01150-info.jsp | 2 +- .../sprt01200-main.jsp => stng01010-main.jsp} | 4 +- src/main/webapp/WEB-INF/jsp/include/top.jsp | 42 ++++- 7 files changed, 241 insertions(+), 142 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/cmmn/web/StngController.java rename src/main/webapp/WEB-INF/jsp/fims/{sprt/sprt01200-main.jsp => stng01010-main.jsp} (99%) diff --git a/src/main/java/cokr/xit/fims/cmmn/web/StngController.java b/src/main/java/cokr/xit/fims/cmmn/web/StngController.java new file mode 100644 index 00000000..9d2e5282 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/web/StngController.java @@ -0,0 +1,176 @@ +package cokr.xit.fims.cmmn.web; + +import java.io.File; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; + +import cokr.xit.base.code.CommonCode; +import cokr.xit.base.user.ManagedUser; +import cokr.xit.base.user.dao.UserMapper; +import cokr.xit.base.web.ApplicationController; +import cokr.xit.fims.cmmn.OtptForm; +import cokr.xit.fims.cmmn.OtptStngQuery; +import cokr.xit.fims.cmmn.service.StngService; +import cokr.xit.fims.cmmn.service.bean.OtptStngBean; +import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.crdn.dao.GlobalStngMapper; +import cokr.xit.fims.stat.dao.StatMapper; +import cokr.xit.foundation.data.DataObject; + +/**설정 관리 서비스의 웹 컨트롤러 +* +*

상세 설명: +* +*

+* ============ 변경 이력 ============
+* 2024-02-20	leebj 최초 작성
+* ================================
+* 
+*/ +public class StngController extends ApplicationController { + public static final String CLASS_URL = "/stng/stng01"; + + public class METHOD_URL { + public static final String + otptStngMain = "/010/main.do", + getOtptStngInfo = "/010/info.do", + saveOtptStngInfo = "/010/save.do" + ; + } + + @Resource(name = "stngService") + private StngService stngService; + + @Resource(name = "stngBean") + private StngBean stngBean; + + @Resource(name = "otptStngBean") + private OtptStngBean otptStngBean; + + @Resource(name = "userMapper") + private UserMapper userMapper; + + @Resource(name = "globalStngMapper") + private GlobalStngMapper globalStngMapper; + + @Resource(name = "statMapper") + private StatMapper statMapper; + + + /** 출력물 설정 메인 화면을 연다. + * @return 출력물 설정 메인 화면 + */ + public ModelAndView otptStngMain() { + ModelAndView mav = new ModelAndView("fims/stng01010-main"); + mav.addObject("pageName", "stng01010"); + + Map> commonCodes = getCodesOf("FIM054","FIM047","FIM078","FIM080"); + + mav.addObject("FIM047List", commonCodes.get("FIM047")); + mav.addObject("FIM054List", commonCodes.get("FIM054")); + mav.addObject("TaskListForSgg", stngBean.filterTaskSectionCodeForSgg(commonCodes.get("FIM054"))); + mav.addObject("FIM078List", commonCodes.get("FIM078")); + mav.addObject("FIM080List", commonCodes.get("FIM080")); + addCodes(commonCodes, mav, "FIM047", "FIM054", "FIM078","FIM080"); + + return mav; + } + + /** 출력물 설정 정보를 불러온다. + * @return 출력물 설정 정보 + */ + public ModelAndView getOtptStngInfo(OtptStngQuery otptStngQuery) { + + ModelAndView mav = new ModelAndView("jsonView"); + + //출력 설정 제목 + String institute = currentUser().getInstitute(); + String account = currentUser().getAccount(); + ManagedUser currentUser = userMapper.getUser(account, institute); + String deptCd = currentUser.getDeptCode(); + String sggCd = globalStngMapper.selectSggCd(deptCd); + DataObject sgg = statMapper.selectSggByCode(sggCd); + String sggNm = sgg.string("NAME"); + + Map> commonCodes = getCodesOf("FIM054","FIM047","FIM078"); + List FIM047 = commonCodes.get("FIM047"); + List FIM054 = commonCodes.get("FIM054"); + List FIM078 = commonCodes.get("FIM078"); + + String taskSeNm = FIM054.stream(). + filter(item -> item.getCode().equals(otptStngQuery.getTaskSeCd())).findFirst().get().getValue(); + + String sndngSeNm = FIM047.stream(). + filter(item -> item.getCode().equals(otptStngQuery.getSndngSeCd())).findFirst().get().getValue(); + + String otptPaperSeNm = FIM078.stream(). + filter(item -> item.getCode().equals(otptStngQuery.getPaperSeCd())).findFirst().get().getValue(); + + String otptStngTitle = "["+sggNm+", "+taskSeNm+"]"+" "+sndngSeNm+" "+"("+otptPaperSeNm+")"; + mav.addObject("otptStngTitle", otptStngTitle); + + //출력물 기본 설정 + DataObject otptBscStng = new DataObject(); + otptBscStng = otptStngBean.getOtptBscStng(otptStngQuery); + mav.addObject("otptGlobalStng", otptBscStng); + + //출력 요소별 설정 + Map otptArtclStngMap = otptStngBean.getOtptArtclStngMap(otptStngQuery); + + mav.addObject("otptArtclStngMap", otptArtclStngMap); + + return mav; + } + + /** 출력물 설정 정보를 저장한다. + * @return 저장 여부 + */ + public ModelAndView saveOtptStngInfo(OtptForm otptForm, MultipartFile backgroundFile) { + ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; + + if(backgroundFile != null && !backgroundFile.isEmpty() && backgroundFile.getSize() != 0) { + String institute = currentUser().getInstitute(); + String account = currentUser().getAccount(); + ManagedUser currentUser = userMapper.getUser(account, institute); + String deptCd = currentUser.getDeptCode(); + String sggCd = globalStngMapper.selectSggCd(deptCd); + + String bgPath = "files/background/"+sggCd; + + String ext = FilenameUtils.getExtension(backgroundFile.getOriginalFilename()); + String fileName = otptForm.getTaskSeCd()+"-"+otptForm.getSndngSeCd()+"-"+otptForm.getPaperSeCd()+"."+ext; + + File workDir = new File(bgPath); + workDir.mkdirs(); + try { + String bgFullPath = bgPath + "/" + fileName; + File newFile = new File(bgFullPath); + if(newFile.exists()) { + newFile.delete(); + } + backgroundFile.transferTo(newFile); + + otptForm.setBcrnImgPath(bgFullPath); + otptForm.setBcrnImgFileNm(backgroundFile.getOriginalFilename()); + } catch (Exception e) { + throw new RuntimeException("배경 이미지 업로드 중 오류가 발생하였습니다."); + } + } + + saved = otptStngBean.saveOtptBscStng(otptForm); + if(saved) { + saved = otptStngBean.saveOtptArtclStng(otptForm); + } + + mav.addObject("saved", saved); + return mav; + } + +} diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index 2899a85c..5789aadd 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -1,6 +1,5 @@ package cokr.xit.fims.sprt.web; -import java.io.File; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; @@ -10,9 +9,7 @@ import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.io.FilenameUtils; import org.apache.poi.ss.usermodel.CellStyle; -import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.core.type.TypeReference; @@ -30,7 +27,6 @@ import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; -import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptStngQuery; import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.PrintOption; @@ -93,11 +89,7 @@ public class Sprt01Controller extends ApplicationController { makeAdvntceOutsourcing = "/140/makeAdvntceOutsourcing.do", printNhtMain = "/150/info.do", makeNhtPdf = "/150/makeNhtPdf.do", - makeNhtOutsourcing = "/150/makeNhtOutsourcing.do", - - otptStngMain = "/200/main.do", - getOtptStngInfo = "/200/info.do", - saveOtptStngInfo = "/200/save.do" + makeNhtOutsourcing = "/150/makeNhtOutsourcing.do" ; } @@ -969,113 +961,7 @@ public class Sprt01Controller extends ApplicationController { return mav; } - /** 출력물 설정 메인 화면을 연다. - * @return 출력물 설정 메인 화면 - */ - public ModelAndView otptStngMain() { - ModelAndView mav = new ModelAndView("fims/sprt/sprt01200-main"); - mav.addObject("pageName", "sprt01200"); - - Map> commonCodes = getCodesOf("FIM054","FIM047","FIM078","FIM080"); - - mav.addObject("FIM047List", commonCodes.get("FIM047")); - mav.addObject("FIM054List", commonCodes.get("FIM054")); - mav.addObject("TaskListForSgg", stngBean.filterTaskSectionCodeForSgg(commonCodes.get("FIM054"))); - mav.addObject("FIM078List", commonCodes.get("FIM078")); - mav.addObject("FIM080List", commonCodes.get("FIM080")); - addCodes(commonCodes, mav, "FIM047", "FIM054", "FIM078","FIM080"); - - return mav; - } - - /** 출력물 설정 정보를 불러온다. - * @return 출력물 설정 정보 - */ - public ModelAndView getOtptStngInfo(OtptStngQuery otptStngQuery) { - - ModelAndView mav = new ModelAndView("jsonView"); - - //출력 설정 제목 - String institute = currentUser().getInstitute(); - String account = currentUser().getAccount(); - ManagedUser currentUser = userMapper.getUser(account, institute); - String deptCd = currentUser.getDeptCode(); - String sggCd = globalStngMapper.selectSggCd(deptCd); - DataObject sgg = statMapper.selectSggByCode(sggCd); - String sggNm = sgg.string("NAME"); - - Map> commonCodes = getCodesOf("FIM054","FIM047","FIM078"); - List FIM047 = commonCodes.get("FIM047"); - List FIM054 = commonCodes.get("FIM054"); - List FIM078 = commonCodes.get("FIM078"); - - String taskSeNm = FIM054.stream(). - filter(item -> item.getCode().equals(otptStngQuery.getTaskSeCd())).findFirst().get().getValue(); - - String sndngSeNm = FIM047.stream(). - filter(item -> item.getCode().equals(otptStngQuery.getSndngSeCd())).findFirst().get().getValue(); - - String otptPaperSeNm = FIM078.stream(). - filter(item -> item.getCode().equals(otptStngQuery.getPaperSeCd())).findFirst().get().getValue(); - - String otptStngTitle = "["+sggNm+", "+taskSeNm+"]"+" "+sndngSeNm+" "+"("+otptPaperSeNm+")"; - mav.addObject("otptStngTitle", otptStngTitle); - - //출력물 기본 설정 - DataObject otptBscStng = new DataObject(); - otptBscStng = otptStngBean.getOtptBscStng(otptStngQuery); - mav.addObject("otptGlobalStng", otptBscStng); - - //출력 요소별 설정 - Map otptArtclStngMap = otptStngBean.getOtptArtclStngMap(otptStngQuery); - - mav.addObject("otptArtclStngMap", otptArtclStngMap); - - return mav; - } - - /** 출력물 설정 정보를 저장한다. - * @return 저장 여부 - */ - public ModelAndView saveOtptStngInfo(OtptForm otptForm, MultipartFile backgroundFile) { - ModelAndView mav = new ModelAndView("jsonView"); - boolean saved = false; - if(backgroundFile != null && !backgroundFile.isEmpty() && backgroundFile.getSize() != 0) { - String institute = currentUser().getInstitute(); - String account = currentUser().getAccount(); - ManagedUser currentUser = userMapper.getUser(account, institute); - String deptCd = currentUser.getDeptCode(); - String sggCd = globalStngMapper.selectSggCd(deptCd); - - String bgPath = "files/background/"+sggCd; - - String ext = FilenameUtils.getExtension(backgroundFile.getOriginalFilename()); - String fileName = otptForm.getTaskSeCd()+"-"+otptForm.getSndngSeCd()+"-"+otptForm.getPaperSeCd()+"."+ext; - - File workDir = new File(bgPath); - workDir.mkdirs(); - try { - String bgFullPath = bgPath + "/" + fileName; - File newFile = new File(bgFullPath); - if(newFile.exists()) { - newFile.delete(); - } - backgroundFile.transferTo(newFile); - otptForm.setBcrnImgPath(bgFullPath); - otptForm.setBcrnImgFileNm(backgroundFile.getOriginalFilename()); - } catch (Exception e) { - throw new RuntimeException("배경 이미지 업로드 중 오류가 발생하였습니다."); - } - } - saved = otptStngBean.saveOtptBscStng(otptForm); - if(saved) { - saved = otptStngBean.saveOtptArtclStng(otptForm); - } - - mav.addObject("saved", saved); - return mav; - } } diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index 46d5613e..5faaff30 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -457,24 +457,6 @@ public class CmnController { return super.makeNhtOutsourcing(printOption, crdnIds); } - @Override - @RequestMapping(name="출력물 설정 메인 화면", value=METHOD_URL.otptStngMain) - public ModelAndView otptStngMain() { - return super.otptStngMain(); - } - - @Override - @RequestMapping(name="출력물 설정 정보 조회", value=METHOD_URL.getOtptStngInfo) - public ModelAndView getOtptStngInfo(OtptStngQuery otptStngQuery) { - return super.getOtptStngInfo(otptStngQuery); - } - - @Override - @RequestMapping(name="출력물 설정 정보 저장", value=METHOD_URL.saveOtptStngInfo) - public ModelAndView saveOtptStngInfo(OtptForm otptForm, MultipartFile backgroundFile) { - return super.saveOtptStngInfo(otptForm, backgroundFile); - } - } @Controller @@ -717,4 +699,27 @@ public class CmnController { } + @Controller + @RequestMapping(name="설정관리", value=StngController.CLASS_URL) + class StngController extends cokr.xit.fims.cmmn.web.StngController { + + @Override + @RequestMapping(name="출력물 설정 메인 화면", value=METHOD_URL.otptStngMain) + public ModelAndView otptStngMain() { + return super.otptStngMain(); + } + + @Override + @RequestMapping(name="출력물 설정 정보 조회", value=METHOD_URL.getOtptStngInfo) + public ModelAndView getOtptStngInfo(OtptStngQuery otptStngQuery) { + return super.getOtptStngInfo(otptStngQuery); + } + + @Override + @RequestMapping(name="출력물 설정 정보 저장", value=METHOD_URL.saveOtptStngInfo) + public ModelAndView saveOtptStngInfo(OtptForm otptForm, MultipartFile backgroundFile) { + return super.saveOtptStngInfo(otptForm, backgroundFile); + } + + } } diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp index 42fd5771..3f977028 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp @@ -172,7 +172,7 @@ $(document).ready(function(){ fix = $P.provided.getInfo(sample).TASK_SE_CD; } - var url = wctx.url("/sprt/sprt01/200/main.do"); + var url = wctx.url("/stng/stng01/010/main.do"); var dialogId = "otptStngDialog"; ajax.post({ diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp index 8a381da5..39a751e2 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp @@ -169,7 +169,7 @@ $(document).ready(function(){ fix = $P.provided.getInfo(sample).TASK_SE_CD; } - var url = wctx.url("/sprt/sprt01/200/main.do"); + var url = wctx.url("/stng/stng01/010/main.do"); var dialogId = "otptStngDialog"; ajax.post({ diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stng01010-main.jsp similarity index 99% rename from src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp rename to src/main/webapp/WEB-INF/jsp/fims/stng01010-main.jsp index 8b13df91..fe953aa5 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stng01010-main.jsp @@ -279,7 +279,7 @@ $(document).ready(function(){ var ff = new FimsFormFields("#frmSearch--${pageName}"); var query = ff.get(); ajax.post({ - url : wctx.url("/sprt/sprt01/200/info.do"), + url : wctx.url("/stng/stng01/010/info.do"), data : query, success : (resp) => { $("#btnSave--${pageName}").removeAttr("disabled"); @@ -716,7 +716,7 @@ $(document).ready(function(){ } ajax.post({ - url : wctx.url("/sprt/sprt01/200/save.do"), + url : wctx.url("/stng/stng01/010/save.do"), data : formData, contentType : false, processData : false, success : (resp) => { diff --git a/src/main/webapp/WEB-INF/jsp/include/top.jsp b/src/main/webapp/WEB-INF/jsp/include/top.jsp index ea9b4963..c3a5d891 100644 --- a/src/main/webapp/WEB-INF/jsp/include/top.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/top.jsp @@ -54,7 +54,7 @@ - - + @@ -183,7 +183,7 @@ function fnOpenTempFileUploadWindow(){ ); } -function fnOpenStngDialog(){ +function fnOpenSelectStngDialog(){ dialog.open({ id : "selectStngDialog", title : "설정 선택", @@ -194,6 +194,38 @@ function fnOpenStngDialog(){ }); } +function fnOpenOtptStngDialog(){ + + dialog.close("selectStngDialog"); + + var url = wctx.url("/stng/stng01/010/main.do"); + var dialogId = "otptStngDialog"; + + ajax.post({ + url : url, + data : {}, + success : (resp) => { + + dialog.open({ + id : dialogId + , title : "출력설정" + , size : "xxl" + , content : resp + , init : () => { + + $("#"+dialogId).find("input[name='dialogId']").val(dialogId); + + $("#"+dialogId).find("form[name='frmSearch']").find("[name='sggCd']").val(MY_INFO.info.sggCd); + + //$("#"+dialogId).find("form[name='frmSearch']").find("[name='sndngSeCd']").val("03"); + } + , onClose : () => { } + }); + } + }); + +} + function fnOpenMyInfo(){ window.open( wctx.url("/user/openMyInfo.do") @@ -416,8 +448,8 @@ $("#btnOpenTempFileUploadWindow").on( "click", function() { fnOpenTempFileUploadWindow(); }); /*--------------------- 특화 설정 ---------------------*/ -$("#btnOpenStngDialog").on( "click", function() { - fnOpenStngDialog(); +$("#btnOpenSelectStngDialog").on( "click", function() { + fnOpenSelectStngDialog(); });