출력 설정 저장 기능 추가

main
이범준 12 months ago
parent 9161db0d7c
commit 87f04a7cd1

@ -0,0 +1,18 @@
package cokr.xit.fims.sprt;
import java.util.List;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OtptForm extends AbstractEntity {
private String sggCd;
private String taskSeCd;
private String sndngSeCd;
private String otptPaperSeCd;
private List<OtptStng> otptStngList;
private String[] otptFormIDs;
}

@ -0,0 +1,25 @@
package cokr.xit.fims.sprt;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OtptStng extends AbstractEntity {
private String otptFormId; //출력항목ID
private String otptNm; //출력항목명
private String leftPstn; //좌측 위치
private String topPstn; //상단 위치
private String widthSz; //영역크기 길이
private String heightSz; //영역크기 높이
private String textSort; //텍스트정렬
private String fontNm; //글꼴명
private String fontSz; //글꼴크기
private String fontColor; //글꼴색
private String fontStyle; //글꼴스타일
private String sggCd;
private String taskSeCd;
private String sndngSeCd;
private String otptPaperSeCd;
}

@ -4,6 +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.OtptStng;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@ -17,4 +19,10 @@ public interface OtptStngMapper extends AbstractMapper {
*/
List<DataObject> selectOtptStngList(OtptStngQuery query);
int updateStng(OtptStng update);
int deleteStng(OtptForm otptForm);
int insertStng(OtptStng insert);
}

@ -12,6 +12,8 @@ import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.pdf.DefaultOtptStng;
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.OtptStng;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.fims.sprt.dao.OtptStngMapper;
import cokr.xit.foundation.AbstractComponent;
@ -59,4 +61,45 @@ public class OtptStngBean extends AbstractComponent {
otptStngMap.put("multiple", multiple);
return otptStngMap;
}
public boolean saveOtptStng(OtptForm otptForm) {
try {
String userId = currentUser().getId();
List<OtptStng> otptStngList = otptForm.getOtptStngList();
List<String> updateKeyList = new ArrayList<String>();
List<OtptStng> insertList = new ArrayList<OtptStng>();
if(otptStngList != null && !otptStngList.isEmpty()) {
List<OtptStng> updateList = otptStngList.stream().filter(item -> !ifEmpty(item.getOtptFormId(), () -> "").equals("")).toList();
if(!updateList.isEmpty()) {
for(OtptStng update : updateList) {
update.setModifiedBy(userId);
int u = otptStngMapper.updateStng(update);
updateKeyList.add(update.getOtptFormId());
}
}
insertList = otptStngList.stream().filter(item -> ifEmpty(item.getOtptFormId(), () -> "").equals("")).toList();
}
if(!updateKeyList.isEmpty()) {
otptForm.setOtptFormIDs(updateKeyList.toArray(new String[updateKeyList.size()]));
}
otptForm.setModifiedBy(userId);
int d = otptStngMapper.deleteStng(otptForm);
if(!insertList.isEmpty()) {
for(OtptStng insert : insertList) {
insert.setCreatedBy(userId);
int i = otptStngMapper.insertStng(insert);
}
}
} catch (Exception e) {
throw new RuntimeException("출력 설정 저장 중 오류가 발생하였습니다.");
}
return true;
}
}

@ -17,6 +17,7 @@ import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.sprt.Keyword;
import cokr.xit.fims.sprt.OtptForm;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.fims.sprt.SprtQuery;
@ -59,7 +60,8 @@ public class Sprt01Controller extends ApplicationController {
makeAdvntceOutsourcing = "/140/makeAdvntceOutsourcing.do",
otptStngMain = "/200/main.do",
getOtptStngInfo = "/200/info.do"
getOtptStngInfo = "/200/info.do",
saveOtptStngInfo = "/200/save.do"
;
}
@ -475,4 +477,16 @@ public class Sprt01Controller extends ApplicationController {
return mav;
}
/** .
* @return
*/
public ModelAndView saveOtptStngInfo(OtptForm otptForm) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
saved = otptStngBean.saveOtptStng(otptForm);
mav.addObject("saved", saved);
return mav;
}
}

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.sprt.OtptForm;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.fims.sprt.SprtQuery;
@ -444,6 +445,12 @@ public class CmnController {
return super.getOtptStngInfo(otptStngQuery);
}
@Override
@RequestMapping(name="출력물 설정 정보 저장", value=METHOD_URL.saveOtptStngInfo)
public ModelAndView saveOtptStngInfo(OtptForm otptForm) {
return super.saveOtptStngInfo(otptForm);
}
}
@Controller

@ -27,4 +27,87 @@ SELECT OTPT_FORM_ID
AND OTPT_PAPER_SE_CD = #{otptPaperSeCd}
</select>
</mapper>
<insert id="insertStng" parameterType="cokr.xit.fims.sprt.OtptStng">
/* 출력 설정 등록(otptStngMapper.insertStng) */
<selectKey resultType="string" keyProperty="otptFormId" keyColumn="NEW_ID" order="BEFORE">
SELECT
CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(OTPT_FORM_ID,5)) + 1, 1) AS INT), 16, '0'))
AS NEW_ID
FROM TB_OTPT_FORM
</selectKey>
INSERT
INTO TB_OTPT_FORM (
OTPT_FORM_ID
, SGG_CD
, TASK_SE_CD
, SNDNG_SE_CD
, OTPT_PAPER_SE_CD
, OTPT_NM
, LEFT_PSTN
, TOP_PSTN
, WIDTH_SZ
, HEIGHT_SZ
, TEXT_SORT
, FONT_NM
, FONT_SZ
, FONT_COLOR
, FONT_STYLE
, USE_YN
, REG_DT
, RGTR
) VALUES (
#{otptFormId}
, #{sggCd}
, #{taskSeCd}
, #{sndngSeCd}
, #{otptPaperSeCd}
, #{otptNm}
, #{leftPstn}
, #{topPstn}
, #{widthSz}
, #{heightSz}
, #{textSort}
, #{fontNm}
, #{fontSz}
, #{fontColor}
, #{fontStyle}
, 'Y'
, <include refid="utility.now" />
, #{createdBy}
)
</insert>
<update id="updateStng" parameterType="cokr.xit.fims.sprt.OtptStng">
/* 출력 설정 수정(otptStngMapper.updateStng) */
UPDATE TB_OTPT_FORM
SET OTPT_NM = #{otptNm}
, LEFT_PSTN = #{leftPstn}
, TOP_PSTN = #{topPstn}
, WIDTH_SZ = #{widthSz}
, HEIGHT_SZ = #{heightSz}
, TEXT_SORT = #{textSort}
, FONT_NM = #{fontNm}
, FONT_SZ = #{fontSz}
, FONT_COLOR = #{fontColor}
, FONT_STYLE = #{fontStyle}
, MDFCN_DT = <include refid="utility.now" />
, MDFR = #{modifiedBy}
WHERE OTPT_FORM_ID = #{otptFormId}
</update>
<update id="deleteStng" parameterType="cokr.xit.fims.sprt.OtptForm">
/* 출력 설정 삭제(otptStngMapper.deleteStng) */
UPDATE TB_OTPT_FORM
SET USE_YN = 'N'
, MDFCN_DT = <include refid="utility.now" />
, MDFR = #{modifiedBy}
WHERE SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND SNDNG_SE_CD = #{sndngSeCd}
AND OTPT_PAPER_SE_CD = #{otptPaperSeCd}
<if test='otptFormIDs != null'>
AND OTPT_FORM_ID NOT IN (<foreach collection="otptFormIDs" item="OTPT_FORM_ID" separator=",">#{OTPT_FORM_ID}</foreach>)
</if>
</update>
</mapper>

@ -504,8 +504,73 @@ $(document).ready(function(){
}
$P.getRowData = (tbodyId, query) => {
var rowArr = [];
$("#"+tbodyId+" tr").each(function(){
var otptFormId = this.dataset.key;
var otptNm = $($P.fnGetElement(this,"otptNm")).val();
var leftPstn = $($P.fnGetElement(this,"leftPstn")).val();
var topPstn = $($P.fnGetElement(this,"topPstn")).val();
var widthSz = $($P.fnGetElement(this,"widthSz")).val();
var heightSz = $($P.fnGetElement(this,"heightSz")).val();
var textSort = $($P.fnGetElement(this,"textSort")).val();
var fontNm = $($P.fnGetElement(this,"fontNm")).val();
var fontSz = $($P.fnGetElement(this,"fontSz")).val();
var fontColor = $($P.fnGetElement(this,"fontColor")).val();
var fontStyle = $($P.fnGetElement(this,"fontStyle")).val();
var row = {
otptFormId : otptFormId,
otptNm : otptNm,
leftPstn : leftPstn,
topPstn : topPstn,
widthSz : widthSz,
heightSz : heightSz,
textSort : textSort,
fontNm : fontNm,
fontSz : fontSz,
fontColor : fontColor,
fontStyle : fontStyle,
sggCd : query.sggCd,
taskSeCd : query.taskSeCd,
sndngSeCd : query.sndngSeCd,
otptPaperSeCd : query.otptPaperSeCd
};
rowArr.push(row);
});
return rowArr;
}
$P.fnSave = () => {
var ff = new FimsFormFields("#frmEdit--${pageName}");
var query = ff.get();
var rowArr1 = $P.getRowData("tbodyUnique--${pageName}", query);
var rowArr2 = $P.getRowData("tbodyMultiple--${pageName}", query);
var rowArr = [...rowArr1, ...rowArr2];
query.otptStngList = rowArr;
query = fnJsonToFormData(query,"otptStngList");
ajax.post({
url : wctx.url("/sprt/sprt01/200/save.do"),
data : query,
success : (resp) => {
if(resp.saved){
dialog.alert("저장되었습니다.");
$("#frmSearch--${pageName}").find("[name='sggCd']").val(query.sggCd);
$("#frmSearch--${pageName}").find("[name='taskSeCd']").val(query.taskSeCd);
$("#frmSearch--${pageName}").find("[name='sndngSeCd']").val(query.sndngSeCd);
$("#frmSearch--${pageName}").find("[name='otptPaperSeCd']").val(query.otptPaperSeCd);
$("#btnLoad--${pageName}").click();
}
}
});
}
$("#theadUnique--${pageName}").html($("#theadTr--${pageName}")[0].innerHTML);

Loading…
Cancel
Save