배경이미지 출력순서 고정

main
이범준 12 months ago
parent 6306bc0637
commit e29fdaaa35

@ -4,8 +4,8 @@ import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.sprt.OtptForm;
import cokr.xit.fims.sprt.OtptArtclStng;
import cokr.xit.fims.sprt.OtptForm;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@ -13,7 +13,13 @@ import cokr.xit.foundation.data.DataObject;
@Mapper("otptStngMapper")
public interface OtptStngMapper extends AbstractMapper {
/** ..<br />
/** .<br />
* @param query
* @return
*/
DataObject selectOtptBscStng(OtptStngQuery otptStngQuery);
/** .<br />
* @param query
* @return
*/
@ -25,4 +31,6 @@ public interface OtptStngMapper extends AbstractMapper {
int insertArtclStng(OtptArtclStng insert);
}

@ -12,8 +12,8 @@ import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.pdf.DefaultOtptArtclStng;
import cokr.xit.fims.cmmn.pdf.PDFFormat;
import cokr.xit.fims.cmmn.pdf.format.Advntce;
import cokr.xit.fims.sprt.OtptForm;
import cokr.xit.fims.sprt.OtptArtclStng;
import cokr.xit.fims.sprt.OtptForm;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.fims.sprt.dao.OtptStngMapper;
import cokr.xit.foundation.AbstractComponent;
@ -25,6 +25,18 @@ public class OtptStngBean extends AbstractComponent {
@Resource(name = "otptStngMapper")
private OtptStngMapper otptStngMapper;
/** .
* @param query
* @return
*/
public DataObject getOtptBscStng(OtptStngQuery otptStngQuery) {
return otptStngMapper.selectOtptBscStng(otptStngQuery);
}
/** .
* @param query
* @return
*/
public Map<String, Object> getOtptArtclStngMap(OtptStngQuery query){
Map<String,Object> otptStngMap = new HashMap<String,Object>();
@ -62,7 +74,11 @@ public class OtptStngBean extends AbstractComponent {
return otptStngMap;
}
public boolean saveOtptStng(OtptForm otptForm) {
/** .
* @param otptForm
* @return
*/
public boolean saveOtptArtclStng(OtptForm otptForm) {
try {
String userId = currentUser().getId();
@ -102,4 +118,6 @@ public class OtptStngBean extends AbstractComponent {
return true;
}
}

@ -2,9 +2,11 @@ package cokr.xit.fims.sprt.service.bean;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
@ -348,7 +350,23 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
otptStngQuery.setSndngSeCd(sndngSeCd);
otptStngQuery.setPaperSeCd(paperSeCd);
List<DataObject> otptStng = otptStngMapper.selectOtptArtclStngList(otptStngQuery);
List<DataObject> otptArtclStngList = otptStngMapper.selectOtptArtclStngList(otptStngQuery);
pdfFormat.appendOtptAttribute(otptArtclStngList);
Comparator<DataObject> comparator1 = (item1, item2) -> {
int int1 = item1.string("UNIQUE_YN").equals("Y") ? 0 : 1;
int int2 = item2.string("UNIQUE_YN").equals("Y") ? 0 : 1;
return Integer.compare(int1, int2);
};
Comparator<DataObject> comparator2 = (item1, item2) -> {
int int1 = item1.number("OTPT_ARTCL_ORDR").intValue();
int int2 = item2.number("OTPT_ARTCL_ORDR").intValue();
return Integer.compare(int1, int2);
};;
otptArtclStngList = otptArtclStngList.stream()
.sorted(comparator1.thenComparing(comparator2)).collect(Collectors.toList());
for(DataObject dataObject : dataObjectList) {
//페이지생성(건별)
@ -364,23 +382,23 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
pdfPrintUtil.renderFoldLine(contentStream, paperWidth, paperHeight);
for(DataObject otptItemStng : otptStng) {
String otptArtclNm = otptItemStng.string("OTPT_ARTCL_NM");
for(DataObject otptArtclStng : otptArtclStngList) {
String otptArtclNm = otptArtclStng.string("OTPT_ARTCL_NM");
DefaultOtptArtclStng prototypeStng = prototypeStngList.stream()
.filter(item -> item.getOtptArtclNm().equals(otptArtclNm)).toList().get(0);
float[] pstn = pdfPrintUtil.getPstnStng(prototypeStng, otptItemStng, paperSeCd);
float[] size = pdfPrintUtil.getSize(prototypeStng, otptItemStng);
float[] pstn = pdfPrintUtil.getPstnStng(prototypeStng, otptArtclStng, paperSeCd);
float[] size = pdfPrintUtil.getSize(prototypeStng, otptArtclStng);
boolean forPost = prototypeStng.isForPost();
String defaultValue = prototypeStng.getOtptBscVl();
if(prototypeStng.getComponentType().equals("text")) {
String align = pdfPrintUtil.getAlign(prototypeStng, otptItemStng);
PDType0Font font = pdfPrintUtil.getFontType(prototypeStng, otptItemStng, fontMap);
int fontSz = pdfPrintUtil.getFontSize(prototypeStng, otptItemStng);
RenderingMode fontStyle = pdfPrintUtil.getFontStyle(prototypeStng, otptItemStng);
PDColor fontColor = pdfPrintUtil.getFontColor(prototypeStng, otptItemStng);
String align = pdfPrintUtil.getAlign(prototypeStng, otptArtclStng);
PDType0Font font = pdfPrintUtil.getFontType(prototypeStng, otptArtclStng, fontMap);
int fontSz = pdfPrintUtil.getFontSize(prototypeStng, otptArtclStng);
RenderingMode fontStyle = pdfPrintUtil.getFontStyle(prototypeStng, otptArtclStng);
PDColor fontColor = pdfPrintUtil.getFontColor(prototypeStng, otptArtclStng);
String textValue = pdfFormat.getMappingValue(otptArtclNm,defaultValue,forPost,dataObject,printOption,pdfPrintUtil);

@ -427,13 +427,13 @@ public class Sprt01Controller extends ApplicationController {
ModelAndView mav = new ModelAndView("fims/sprt/sprt01200-main");
mav.addObject("pageName", "sprt01200-main");
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM054","FIM047","FIM078");
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM054","FIM047","FIM078","FIM080");
mav.addObject("FIM047List", commonCodes.get("FIM047"));
mav.addObject("FIM054List", commonCodes.get("FIM054"));
mav.addObject("FIM078List", commonCodes.get("FIM078"));
addCodes(commonCodes, mav, "FIM047", "FIM054", "FIM078");
mav.addObject("FIM080List", commonCodes.get("FIM080"));
addCodes(commonCodes, mav, "FIM047", "FIM054", "FIM078","FIM080");
return mav;
}
@ -445,10 +445,7 @@ public class Sprt01Controller extends ApplicationController {
ModelAndView mav = new ModelAndView("jsonView");
Map<String,Object> otptArtclStngMap = otptStngBean.getOtptArtclStngMap(otptStngQuery);
mav.addObject("otptArtclStngMap", otptArtclStngMap);
//출력 설정 제목
String institute = currentUser().getInstitute();
String account = currentUser().getAccount();
ManagedUser currentUser = userMapper.getUser(account, institute);
@ -474,6 +471,16 @@ public class Sprt01Controller extends ApplicationController {
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;
}
@ -484,7 +491,7 @@ public class Sprt01Controller extends ApplicationController {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
saved = otptStngBean.saveOtptStng(otptForm);
saved = otptStngBean.saveOtptArtclStng(otptForm);
mav.addObject("saved", saved);
return mav;

@ -2,6 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.sprt.dao.OtptStngMapper">
<select id="selectOtptBscStng" parameterType="cokr.xit.fims.sprt.OtptStngQuery" resultType="dataobject">
/* 출력물 기본 설정 조회(otptStngMapper.selectOtptBscStng) */
SELECT OTPT_BSC_ID
, SGG_CD
, TASK_SE_CD
, SNDNG_SE_CD
, PAPER_SE_CD
, FOLD_LINE_PSTN_SE_CD
, BCRN_IMG_PATH
, BCRN_IMG_FILE_NM
, OTPT_PHOTO_CNT
FROM TB_OTPT_BSC_STNG
WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND SNDNG_SE_CD = #{sndngSeCd}
AND PAPER_SE_CD = #{paperSeCd}
</select>
<select id="selectOtptArtclStngList" parameterType="cokr.xit.fims.sprt.OtptStngQuery" resultType="dataobject">
/* 출력 항목 설정 조회(otptStngMapper.selectOtptArtclStngList) */
SELECT OTPT_FORM_ID
@ -19,6 +38,7 @@ SELECT OTPT_FORM_ID
, FONT_COLOR
, FONT_STYLE
, TEXT_SORT
, OTPT_ARTCL_ORDR
FROM TB_OTPT_FORM_STNG
WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd}

@ -37,8 +37,14 @@
</div>
</div>
<h3 id="currentOtpt--${pageName}" class="bg-lighter" style="min-height:30px;">
</h3>
<div class="d-flex justify-content-between">
<span id="currentOtpt--${pageName}" class="bg-lighter h3" style="min-height:30px;">
</span>
<form id="frmGlobalEdit--${pageName}">
<span id="otptGlobalStng--${pageName}">
</span>
</form>
</div>
<div class="row mb-3 justify-content-start">
<div class="col-md-12">
@ -210,21 +216,52 @@
</tr>
</template>
<template id="dropdownTemplate--${pageNmae}">
<template id="dropdownTemplate--${pageName}">
<li><a class="dropdown-item" onclick="{onclick}">{DSCRP}</a></li>
</template>
<template id="foldLinePstnTemplate--${pageName}">
<span class="px-2">
<label class="col-form-label bg-lighter px-2">접는선 위치</label>
<label>
<input type="radio" name="foldLinePstnSeCd" value="">
미표시
</label>
<c:forEach items="${FIM080List}" var="item">
<label>
<input type="radio" name="foldLinePstnSeCd" value="${item.code}">
${item.value}
</label>
</c:forEach>
</span>
</template>
<template id="bcrnTemplate--${pageName}">
<span class="px-2">
<label class="col-form-label bg-lighter px-2">배경이미지</label>
<button type="button">배경이미지</button>
</span>
</template>
<template id="photoCntTemplate--${pageName}">
<span class="px-2">
<label class="col-form-label bg-lighter px-2">사진 출력</label>
<input type="text" name="otptPhotoCnt" class="form-control w-px-50" /> 장
</span>
</template>
<script>
var FIM054 = new CommonCodes(${FIM054});
var FIM047 = new CommonCodes(${FIM047});
var FIM078 = new CommonCodes(${FIM078});
var FIM080 = new CommonCodes(${FIM080});
pageObject["${pageName}"] = {};
$(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.otptGlobalStng = {};
$P.otptArtclStngMap = {};
$("#btnSave--${pageName}").attr("disabled","disabled");
@ -246,6 +283,8 @@ $(document).ready(function(){
$("#btnUniqueDel--${pageName}").removeAttr("disabled");
$("#btnMultipleAdd--${pageName}").removeAttr("disabled");
$("#btnMultipleDel--${pageName}").removeAttr("disabled");
$("#currentOtpt--${pageName}").text("");
$("#otptGlobalStng--${pageName}").html("");
$("#tbodyUnique--${pageName}").html("");
$("#tbodyMultiple--${pageName}").html("");
@ -255,12 +294,19 @@ $(document).ready(function(){
$("#frmEdit--${pageName}").find("[name='paperSeCd']").val(query.paperSeCd);
$("#currentOtpt--${pageName}").text(resp.otptStngTitle);
if(resp.otptGlobalStng != null){
$P.otptGlobalStng = resp.otptGlobalStng;
} else {
$P.otptGlobalStng = {};
}
$P.otptArtclStngMap = resp.otptArtclStngMap;
$P.renderOtptStngGrid("tbodyUnique--${pageName}",
$P.renderOtptGlobalStng($P.otptGlobalStng);
$P.renderOtptArtclStngGrid("tbodyUnique--${pageName}",
$P.otptArtclStngMap.unique.prototypeList,
$P.otptArtclStngMap.unique.dataList);
$P.renderOtptStngGrid("tbodyMultiple--${pageName}",
$P.renderOtptArtclStngGrid("tbodyMultiple--${pageName}",
$P.otptArtclStngMap.multiple.prototypeList,
$P.otptArtclStngMap.multiple.dataList);
}
@ -268,7 +314,29 @@ $(document).ready(function(){
}
$P.renderOtptStngGrid = (tbodyId, prototypeList, dataList) => {
//출력 전역 설정 렌더링
$P.renderOtptGlobalStng = (otptGlobalStng) => {
var paperSeCd = $("#frmEdit--${pageName}").find("[name='paperSeCd']").val();
if(paperSeCd == "01"){
$("#otptGlobalStng--${pageName}").append(document.getElementById("foldLinePstnTemplate--${pageName}").innerHTML);
if(otptGlobalStng.foldLinePstnSeCd == null){
otptGlobalStng.foldLinePstnSeCd = "";
}
$("#frmGlobalEdit--${pageName}")
.find(":radio[name='foldLinePstnSeCd']")
.filter("[value='"+otptGlobalStng.foldLinePstnSeCd+"']")
.prop("checked", true);
}
$("#otptGlobalStng--${pageName}").append(document.getElementById("bcrnTemplate--${pageName}").innerHTML);
$("#otptGlobalStng--${pageName}").append(document.getElementById("photoCntTemplate--${pageName}").innerHTML);
}
//출력 요소 그리드 렌더링
$P.renderOtptArtclStngGrid = (tbodyId, prototypeList, dataList) => {
var components = "<option value='' data-component-type=''>선택</option>";
@ -336,7 +404,8 @@ $(document).ready(function(){
}
var rowSpinButtons = $(this).find("td[data-col='otptArtclOrdr']").find("button");
fnMakeRowSpinner(this,rowSpinButtons[0],rowSpinButtons[1],document.getElementById(scrollDiv));
fnMakeRowSpinner(this,rowSpinButtons[0],rowSpinButtons[1],document.getElementById(scrollDiv), $P.validForBackground);
});
}
@ -381,7 +450,7 @@ $(document).ready(function(){
var selectableArr = prototypeList.filter(item => existArr.indexOf(item.otptArtclNm) == -1);
var template = document.getElementById("dropdownTemplate--${pageNmae}");
var template = document.getElementById("dropdownTemplate--${pageName}");
if(selectableArr.length < 1){
var li = template.innerHTML;
@ -435,7 +504,7 @@ $(document).ready(function(){
scrollDiv = "scrollMultiple--${pageName}";
}
var rowSpinButtons = $(lastTr).find("td[data-col='otptArtclOrdr']").find("button");
fnMakeRowSpinner(lastTr,rowSpinButtons[0],rowSpinButtons[1],document.getElementById(scrollDiv));
fnMakeRowSpinner(lastTr,rowSpinButtons[0],rowSpinButtons[1],document.getElementById(scrollDiv), $P.validForBackground);
if(otptArtclNm != null && otptArtclNm != ""){
@ -482,6 +551,13 @@ $(document).ready(function(){
} else {
$("#scrollMultiple--${pageName}").scrollTop($("#scrollMultiple--${pageName}")[0].scrollHeight);
}
if(otptArtclNm == "background"){ //배경이미지 순서 보정
if($("#tbodyUnique--${pageName}").find("tr").length >= 2){
$("#tbodyUnique--${pageName}").find("tr").eq(0).before(lastTr);
}
}
}
//행 삭제
@ -658,6 +734,23 @@ $(document).ready(function(){
}
$P.validForBackground = (eventInfo) => {
if(eventInfo.clickedButtonType == "up"){
if($P.fnGetElement(eventInfo.siblingRow,"otptArtclNm").value == "background"){
alert("배경이미지 순서는 변경할 수 없습니다.");
return false;
}
}
if(eventInfo.clickedButtonType == "down"){
if($P.fnGetElement(eventInfo.currentRow,"otptArtclNm").value == "background"){
alert("배경이미지 순서는 변경할 수 없습니다.");
return false;
}
}
return true;
};
$("#theadUnique--${pageName}").html($("#theadTr--${pageName}")[0].innerHTML);
$("#theadMultiple--${pageName}").html($("#theadTr--${pageName}")[0].innerHTML);

@ -52,7 +52,15 @@ function fnMakeOptionStyleSelect(selectEl){
/**************************************************************************
* 위치 이동 가능한 테이블
**************************************************************************/
function fnMakeRowSpinner(tableRowEl, upBtnEl, downBtnEl, scrollEl){
function fnMakeRowSpinner(tableRowEl, upBtnEl, downBtnEl, scrollEl, validFunc){
if(validFunc != undefined && validFunc != null){
tableRowEl.validForComponent = validFunc;
} else {
tableRowEl.validForComponent = function(eventInfo){
return true;
};
}
$(upBtnEl).on("click", function(){
var tbody = $(tableRowEl).parent();
@ -69,6 +77,17 @@ function fnMakeRowSpinner(tableRowEl, upBtnEl, downBtnEl, scrollEl){
var beforeIndex = $(tableRowEl).index() - 1;
var beforeTr = $(tbody).find("tr").eq(beforeIndex);
var eventInfo = {
clickedButtonType : "up",
currentRow : tableRowEl,
siblingRow : beforeTr
};
if(!tableRowEl.validForComponent(eventInfo)){
return;
}
var rowStart = beforeTr.offset().top;
var rowHeight = beforeTr.outerHeight();
var rowMiddle = rowStart+(rowHeight/2);
@ -99,6 +118,17 @@ function fnMakeRowSpinner(tableRowEl, upBtnEl, downBtnEl, scrollEl){
var afterIndex = $(tableRowEl).index() + 1;
var afterTr = $(tbody).find("tr").eq(afterIndex);
var eventInfo = {
clickedButtonType : "down",
currentRow : tableRowEl,
siblingRow : afterTr
};
if(!tableRowEl.validForComponent(eventInfo)){
return;
}
var rowStart = afterTr.offset().top;
var rowHeight = afterTr.outerHeight();
var rowMiddle = rowStart+(rowHeight/2);

Loading…
Cancel
Save