1. 출력물 설정 화면 jsp명 변경

2. 설정 controller 추가
main
이범준 9 months ago
parent 588d396a2b
commit 940e88eb68

@ -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;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2024-02-20 leebj
* ================================
* </pre>
*/
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<String, List<CommonCode>> 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<String, List<CommonCode>> commonCodes = getCodesOf("FIM054","FIM047","FIM078");
List<CommonCode> FIM047 = commonCodes.get("FIM047");
List<CommonCode> FIM054 = commonCodes.get("FIM054");
List<CommonCode> 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<String,Object> 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;
}
}

@ -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<String, List<CommonCode>> 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<String, List<CommonCode>> commonCodes = getCodesOf("FIM054","FIM047","FIM078");
List<CommonCode> FIM047 = commonCodes.get("FIM047");
List<CommonCode> FIM054 = commonCodes.get("FIM054");
List<CommonCode> 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<String,Object> 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;
}
}

@ -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);
}
}
}

@ -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({

@ -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({

@ -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) => {

@ -54,7 +54,7 @@
<button type="button" id="btnOpenTempFileUploadWindow" class="btn btn-outline-dark">
외부자료 파일 처리
</button>
<button type="button" id="btnOpenStngDialog" class="btn btn-outline-dark">
<button type="button" id="btnOpenSelectStngDialog" class="btn btn-outline-dark">
특화설정
</button>
<button type="button" id="btnGoToCvlcptDscsn" class="btn btn-outline-dark">
@ -169,7 +169,7 @@
<span class="row g-3" style="display: flex;flex-direction:column">
<button type="button" class="btn btn-xl btn-primary">수신단속파일(장비) 서식 설정</button>
<button type="button" class="btn btn-xl btn-primary">송신단속파일(차세대) 서식 설정</button>
<button type="button" class="btn btn-xl btn-primary">출력물 서식 설정</button>
<button type="button" class="btn btn-xl btn-primary" onclick="fnOpenOtptStngDialog();">출력물 서식 설정</button>
<button type="button" class="btn btn-xl btn-primary">pdf 고지서 정보 추출 설정</button>
</span>
</template>
@ -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();
});
</c:set>

Loading…
Cancel
Save