민원답변문구관리 화면 추가

main
이범준 1 year ago
parent 33bfec1c06
commit 6c3aeb3108

@ -16,6 +16,8 @@ public class CrdnCvlcpt extends AbstractEntity {
public static String MACRO_TELNO = "\\[@전화번호\\]";
public static String MACRO_PIC_NM = "\\[@담당자성명\\]";
/**
* ID
*/
@ -140,4 +142,55 @@ public class CrdnCvlcpt extends AbstractEntity {
* ID
*/
private java.lang.String crdnId;
/**
*
*/
private java.lang.String sggCd;
/**
*
*/
private java.lang.String taskSeCd;
/**
*
*/
private java.lang.String headerCn;
/**
*
*/
private java.lang.String footerCn;
/**
* ID
*/
private java.lang.String ansWordsId;
/**
*
*/
private java.lang.String ansSeCd;
/**
*
*/
private java.lang.String ansRsnCd;
/**
*
*/
private java.lang.String ansRsnNm;
/**
*
*/
private java.lang.String prcsSumry;
/**
*
*/
private java.lang.String prcsRsltCn;
}

@ -5,6 +5,7 @@ import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@ -44,4 +45,33 @@ public interface AnswerWordsMapper extends AbstractMapper {
*/
List<DataObject> selectNonlevyCaseWordsList(CrdnQuery crdnQuery);
/** .
* @param crdnCvlcpt
* @return
*/
int insertAnswerBasicWordsInfo(CrdnCvlcpt crdnCvlcpt);
/** .
* @param crdnCvlcpt
* @return
*/
int updateAnswerBasicWordsInfo(CrdnCvlcpt crdnCvlcpt);
/** .
* @param crdnCvlcpt
* @return
*/
int insertAnswerBodyWordsInfo(CrdnCvlcpt crdnCvlcpt);
/** .
* @param crdnCvlcpt
* @return
*/
int updateAnswerBodyWordsInfo(CrdnCvlcpt crdnCvlcpt);
/** .
* @param crdnCvlcpt
* @return
*/
int removeCvlcptAnswerWordsInfo(CrdnCvlcpt crdnCvlcpt);
}

@ -85,10 +85,24 @@ public interface CrdnCvlcptService {
*/
Map<String, Object> getCvlcptAnswerWordsInfo(CrdnQuery crdnQuery);
/** .
* @param saveData , crdnCvlcpt
* @return
*/
boolean saveAnswerWordsInfo(String saveData, CrdnCvlcpt crdnCvlcpt);
/** .
* @param ansWordsId ID
* @return
*/
boolean removeCvlcptAnswerWordsInfo(String ansWordsId);
/** .
* @param crdnQuery
* @return
*/
List<DataObject> getWarningWordsInfo(CrdnQuery crdnQuery);
}

@ -8,6 +8,8 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.base.code.dao.CodeMapper;
import cokr.xit.base.code.service.CodeQuery;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.fims.crdn.CrdnQuery;
@ -33,6 +35,9 @@ public class CrdnCvlcptMainBean extends AbstractComponent {
@Resource(name="smgSenderBean")
protected SmgSenderBean smgSenderBean;
@Resource(name = "codeMapper")
private CodeMapper codeMapper;
@Resource(name = "answerWordsMapper")
private AnswerWordsMapper answerWordsMapper;
@ -133,7 +138,7 @@ public class CrdnCvlcptMainBean extends AbstractComponent {
ManagedUser currentUser = userMapper.getUser(UserInfo.current().getAccount(), UserInfo.current().getInstitute());
String completeWords = this.replaceMacroString(joinWords , currentUser.getPhoneNo());
String completeWords = this.replaceMacroString(joinWords , currentUser.getPhoneNo(), currentUser.getName());
return completeWords;
}
@ -142,7 +147,7 @@ public class CrdnCvlcptMainBean extends AbstractComponent {
* @param joinWords , telNo
* @return
*/
private String replaceMacroString(String joinWords, String telNo) {
private String replaceMacroString(String joinWords, String telNo, String picNm) {
int seq = 1;
@ -156,6 +161,7 @@ public class CrdnCvlcptMainBean extends AbstractComponent {
}
joinWords = joinWords.replace(CrdnCvlcpt.MACRO_TELNO, telNo);
joinWords = joinWords.replace(CrdnCvlcpt.MACRO_PIC_NM, picNm);
return joinWords;
}
@ -240,4 +246,75 @@ public class CrdnCvlcptMainBean extends AbstractComponent {
}
}
/** .
* @param crdnCvlcpt
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean saveAnswerBasicWordsInfo(CrdnCvlcpt crdnCvlcpt) {
CrdnQuery query = new CrdnQuery();
query.setSggCd(crdnCvlcpt.getSggCd());
query.setTaskSeCd(crdnCvlcpt.getTaskSeCd());
DataObject info = answerWordsMapper.selectCvlcptAnswerBasicWordsInfo(query);
if(ifEmpty(info, ()-> "").equals("")) {
return answerWordsMapper.insertAnswerBasicWordsInfo(crdnCvlcpt) == 1 ? true : false;
} else {
return answerWordsMapper.updateAnswerBasicWordsInfo(crdnCvlcpt) == 1 ? true : false;
}
}
/** .
* @param crdnCvlcpt
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean saveAnswerBodyWordsInfo(CrdnCvlcpt crdnCvlcpt) {
if(ifEmpty(crdnCvlcpt.getAnsWordsId(), ()-> "").equals("")) {
String codeGroupId = "";
String code = "";
if(crdnCvlcpt.getAnsRsnCd().startsWith("1") || crdnCvlcpt.getAnsRsnCd().startsWith("2")) {
if(crdnCvlcpt.getAnsRsnCd().startsWith("1")) {
crdnCvlcpt.setPrcsSumry("과태료 미부과");
}
if(crdnCvlcpt.getAnsRsnCd().startsWith("2")) {
crdnCvlcpt.setPrcsSumry("과태료 계고");
}
codeGroupId = "FIM022";
code = crdnCvlcpt.getAnsRsnCd();
} else if(crdnCvlcpt.getAnsRsnCd().startsWith("3")) {
crdnCvlcpt.setPrcsSumry("과태료 부과");
switch(crdnCvlcpt.getTaskSeCd()) {
case "PVS" -> codeGroupId = "WEB002";
case "BPV" -> codeGroupId = "FIM005";
case "DPV" -> codeGroupId = "FIM006";
case "ECA" -> codeGroupId = "FIM061";
case "TPV" -> codeGroupId = "";
}
code = crdnCvlcpt.getAnsRsnCd().substring(1);
}
CodeQuery codeQuery = new CodeQuery();
codeQuery.setGroupIDs(codeGroupId);
codeQuery.setCodes(code);
List<DataObject> codeList = codeMapper.getCodeList(codeQuery);
crdnCvlcpt.setAnsRsnNm(codeList.get(0).string("CODE_VAL"));
return answerWordsMapper.insertAnswerBodyWordsInfo(crdnCvlcpt) == 1 ? true : false;
} else {
return answerWordsMapper.updateAnswerBodyWordsInfo(crdnCvlcpt) == 1 ? true : false;
}
}
}

@ -694,6 +694,25 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
return wordsStngInfo;
}
@Override
public boolean saveAnswerWordsInfo(String saveData, CrdnCvlcpt crdnCvlcpt) {
boolean saved = false;
if(saveData.equals("basic")) {
saved = crdnCvlcptMainBean.saveAnswerBasicWordsInfo(crdnCvlcpt);
}
if(saveData.equals("body")) {
saved = crdnCvlcptMainBean.saveAnswerBodyWordsInfo(crdnCvlcpt);
}
return saved;
}
@Override
public boolean removeCvlcptAnswerWordsInfo(String ansWordsId) {
CrdnCvlcpt crdnCvlcpt = new CrdnCvlcpt();
crdnCvlcpt.setAnsWordsId(ansWordsId);
return answerWordsMapper.removeCvlcptAnswerWordsInfo(crdnCvlcpt) == 1 ? true : false;
}
@Override
public List<DataObject> getWarningWordsInfo(CrdnQuery crdnQuery) {
return crdnCvlcptSubBean.selectWarningWordsInfo(crdnQuery);

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@ -12,6 +13,7 @@ import cokr.xit.base.code.CommonCode;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.cvlc.service.CrdnCvlcptService;
import cokr.xit.foundation.data.DataObject;
@ -74,4 +76,45 @@ public class Cvlc05Controller extends ApplicationController {
return mav;
}
/** .
* @param hReq
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="민원신고 답변 문구 설정 저장", value="/010/save.do")
public ModelAndView saveCvlcptAnswerWordsInfo(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt) {
boolean saved = false;
String currentSggCd = globalStngMapper.selectSggCdForCurrentUser();
crdnCvlcpt.setSggCd(currentSggCd);
String saveData = hReq.getParameter("saveData");
if(saveData.equals("basic") || saveData.equals("body")) {
saved = crdnCvlcptService.saveAnswerWordsInfo(saveData, crdnCvlcpt);
}
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param ansWordsId ID
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="미부과처리건 답변 문구 삭제", value="/010/remove.do")
public ModelAndView removeCvlcptAnswerWordsInfo(String ansWordsId) {
boolean saved = false;
saved = crdnCvlcptService.removeCvlcptAnswerWordsInfo(ansWordsId);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
}

@ -46,15 +46,39 @@ SELECT (CASE
END) AS VLTN_CASE_NM
, B.ANS_WORDS_ID
, B.PRCS_RSLT_CN
FROM TB_VLTN_INFO A
FROM (
(
SELECT SGG_CD
, TASK_SE_CD
, VLTN_CD
, 'N' AS DSTRBNC_YN
, VLTN_ARTCL
FROM TB_VLTN_INFO
WHERE SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
)
<if test="taskSeCd == 'DPV'">
UNION
(
SELECT SGG_CD
, TASK_SE_CD
, VLTN_CD
, 'Y' AS DSTRBNC_YN
, VLTN_ARTCL
FROM TB_VLTN_INFO
WHERE SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND VLTN_CD = '01'
)
</if>
) A
LEFT OUTER JOIN TB_CVLCPT_ANS_WORDS B
ON (A.SGG_CD = B.SGG_CD
AND A.TASK_SE_CD = B.TASK_SE_CD
AND CONCAT('3',A.VLTN_CD) = B.ANS_RSN_CD
AND B.USE_YN = 'Y'
AND B.ANS_SE_CD = '3')
WHERE A.SGG_CD = #{sggCd} /* 시군구 코드 */
AND A.TASK_SE_CD = #{taskSeCd} /* 업무 구분 코드 */
AND B.ANS_SE_CD = '3'
AND A.DSTRBNC_YN = B.DSTRBNC_YN)
ORDER BY A.VLTN_CD
</select>
@ -97,4 +121,101 @@ SELECT A.CODE AS LEVY_EXCL_RSN_CD
ORDER BY A.CODE
</select>
<insert id="insertAnswerBasicWordsInfo" parameterType="cokr.xit.fims.cvlc.CrdnCvlcpt">
/* 기본 문구 설정 등록(answerWordsMapper.insertAnswerBasicWordsInfo) */
INSERT
INTO TB_CVLCPT_BSC_WORDS(
SGG_CD
, TASK_SE_CD
, HEADER_CN
, FOOTER_CN
, REG_DT
, RGTR
, MDFCN_DT
, MDFR
)
VALUES (
#{sggCd}
, #{taskSeCd}
, #{headerCn}
, #{footerCn}
, <include refid="utility.now" />
, #{modifiedBy}
, <include refid="utility.now" />
, #{modifiedBy}
)
</insert>
<update id="updateAnswerBasicWordsInfo" parameterType="cokr.xit.fims.cvlc.CrdnCvlcpt">
/* 기본 문구 설정 변경(answerWordsMapper.updateAnswerBasicWordsInfo) */
UPDATE TB_CVLCPT_BSC_WORDS
SET HEADER_CN = #{headerCn}
, FOOTER_CN = #{footerCn}
, MDFCN_DT = <include refid="utility.now" />
, MDFR = #{modifiedBy}
WHERE SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
</update>
<update id="insertAnswerBodyWordsInfo" parameterType="cokr.xit.fims.cvlc.CrdnCvlcpt">
/* 본문 문구 설정 등록(answerWordsMapper.insertAnswerBodyWordsInfo) */
<selectKey resultType="string" keyProperty="ansWordsId" keyColumn="NEW_ID" order="BEFORE">
SELECT
LPAD(CAST(IFNULL(MAX(ANS_WORDS_ID) + 1, 1) AS INT), 10, '0')
AS NEW_ID
FROM TB_CVLCPT_ANS_WORDS
</selectKey>
INSERT
INTO TB_CVLCPT_ANS_WORDS(
ANS_WORDS_ID
, SGG_CD
, TASK_SE_CD
, ANS_SE_CD
, DSTRBNC_YN
, ANS_RSN_CD
, ANS_RSN_NM
, PRCS_SUMRY
, PRCS_RSLT_CN
, USE_YN
, REG_DT
, RGTR
, MDFCN_DT
, MDFR
)
VALUES (
#{ansWordsId}
, #{sggCd}
, #{taskSeCd}
, SUBSTR(#{ansRsnCd},1,1)
, NVL(#{dstrbncYn},'N')
, #{ansRsnCd}
, #{ansRsnNm}
, #{prcsSumry}
, #{prcsRsltCn}
, 'Y'
, <include refid="utility.now" />
, #{modifiedBy}
, <include refid="utility.now" />
, #{modifiedBy}
)
</update>
<update id="updateAnswerBodyWordsInfo" parameterType="cokr.xit.fims.cvlc.CrdnCvlcpt">
/* 본문 문구 설정 변경(answerWordsMapper.updateAnswerBodyWordsInfo) */
UPDATE TB_CVLCPT_ANS_WORDS
SET PRCS_RSLT_CN = #{prcsRsltCn}
, MDFCN_DT = <include refid="utility.now" />
, MDFR = #{modifiedBy}
WHERE ANS_WORDS_ID = #{ansWordsId}
</update>
<update id="removeCvlcptAnswerWordsInfo" parameterType="cokr.xit.fims.cvlc.CrdnCvlcpt">
/* 본문 문구 설정 삭제(answerWordsMapper.removeCvlcptAnswerWordsInfo) */
UPDATE TB_CVLCPT_ANS_WORDS
SET USE_YN = 'N'
, MDFCN_DT = <include refid="utility.now" />
, MDFR = #{modifiedBy}
WHERE ANS_WORDS_ID = #{ansWordsId}
</update>
</mapper>

@ -0,0 +1,730 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<!-- inner page html -->
<div class="content-wrapper" id="wrapper--${pageName}">
<div class="container-xxl flex-grow-1 px-0">
<c:set var="pageKorName" scope="request">민원신고 답변 문구 관리</c:set>
<div class="card">
<div class="wrapper-list">
<div>
<form id="frmSearch--${pageName}" name="frmSearch">
<div class="container-search">
<div class="row g-1">
<div class="col-12">
<label class="form-label fw-bold form-search-title">업무구분</label>
<span class="form-search-linebox">
<c:forEach items="${FIM054List}" var="item">
<label>
<input name="taskSeCd" type="radio" value="${item.code}"
class="form-check-input" alt="업무구분"
onchange="pageObject['${pageName}'].fnResetAndChangeBiz(this.value);">
${item.value}
</label>
</c:forEach>
</span>
</div>
</div>
</div>
</form>
<div class="container-page-btn mt-3">
<button type="button" id="btnReset--${pageName}" class="btn btn-outline-dark"
title="초기화">초기화</button>
<button type="button" id="btnAnsBasicTab--${pageName}" class="btn btn-blue btn-tab"
title="머리말/꼬리말">머리말/꼬리말</button>
<button type="button" id="btnLevyAnsBodyTab--${pageName}" class="btn btn-blue btn-tab"
title="부과건 답변내용">부과건 답변내용</button>
<button type="button" id="btnWarningAnsBodyTab--${pageName}" class="btn btn-blue btn-tab"
title="계도건 답변내용">계도건 답변내용</button>
<button type="button" id="btnNonlevyAnsBodyTab--${pageName}" class="btn btn-blue btn-tab"
title="미부과처리건 답변내용">미부과처리건 답변내용</button>
<span class="container-window-btn-right"></span>
</div>
<div class="h-px-500 mt-4">
<!-- 머리말,꼬리말 영역 -->
<span class="area-answerbasic">
<div class="d-flex flex-row justify-content-center" style="height:100%">
<div class="card p-4 justify-content-center align-items-center w-px-1300">
<form id="frmEditAnsBasic--${pageName}">
<div class="w-px-900">
<div class="row">
<div class="col-12">
<label for="headerCn--${pageName}"
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end align-top"
>머리말</label>
<textarea id="headerCn--${pageName}" name="headerCn"
rows="5" cols="80%" class="form-control" required
placeholder="머리말이 없습니다."
></textarea>
</div>
</div>
<div class="row">
<div class="col-12">
<label for="footerCn--${pageName}"
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end align-top"
>꼬리말</label>
<textarea id="footerCn--${pageName}" name="footerCn"
rows="5" cols="80%" class="form-control" required
placeholder="꼬리말이 없습니다."
></textarea>
</div>
</div>
<div class="row justify-content-end">
<div class="col-12">
<button type="button" id="btnSaveAnsBasic--${pageName}"
class="btn btn-primary float-end" title="적용">적용</button>
</div>
</div>
</div>
</form>
</div>
</div>
</span>
<!-- 본문처리 영역 -->
<span class="area-answerbody area-answerbody-common">
<div class="d-flex flex-row justify-content-center" style="height:100%">
<div class="card p-4 d-flex flex-row w-px-1300">
<!-- 그리드 영역 -->
<div class="card-datatable text-nowrap d-inline-flex"
style="border: #D9DEE3 1px solid;">
<div class="dataTables_wrapper dt-bootstrap5 no-footer">
<!-- 부과건 그리드 -->
<span class="area-answerbody area-levy">
<div id="table-responsive-levy--${pageName}"
class="table-responsive"
style="height:100%;width:470px;overflow-y: auto;">
<table class="datatables-ajax table table-bordered dataTable no-footer">
<thead>
<tr>
<th style="width:50px;"></th>
<th style="min-width: 300px;">위반내용</th>
</tr>
</thead>
<tbody id="vltnTbody--${pageName}"></tbody>
<template id="vltnRow--${pageName}">
<tr data-key="{VLTN_CASE_ID}">
<td class="text-center" style="min-width:50px;max-width: 50px;">
<input type="radio" name="levyRadio" value="{VLTN_CASE_ID}"
onchange="{onchange}" />
</td>
<td onclick="{onclick}" class="text-center">{VLTN_CASE_NM}</td>
</tr>
</template>
<template id="vltnNotFound--${pageName}">
<tr>
<td valign="top" colspan="2"
class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</span>
<!-- 계도건 그리드 -->
<span class="area-answerbody area-warning">
<div id="table-responsive-warning--${pageName}"
class="table-responsive"
style="height:100%;width:470px;overflow-y: auto;">
<table class="datatables-ajax table table-bordered dataTable no-footer">
<thead>
<tr>
<th style="width:50px;"></th>
<th style="min-width: 300px;">계도내용</th>
</tr>
</thead>
<tbody id="warningTbody--${pageName}"></tbody>
<template id="warningRow--${pageName}">
<tr data-key="{LEVY_EXCL_RSN_CD}">
<td class="text-center" style="min-width:50px;max-width: 50px;">
<input type="radio" name="warningRadio" value="{LEVY_EXCL_RSN_CD}"
onchange="{onchange}" />
</td>
<td onclick="{onclick}" class="text-center">{LEVY_EXCL_RSN_NM}</td>
</tr>
</template>
<template id="warningNotFound--${pageName}">
<tr>
<td valign="top" colspan="2"
class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</span>
<!-- 미부과처리건 그리드 -->
<span class="area-answerbody area-nonlevy">
<div id="table-responsive-nonlevy--${pageName}"
class="table-responsive"
style="height:100%;width:470px;overflow-y: auto;">
<table class="datatables-ajax table table-bordered dataTable no-footer">
<thead>
<tr>
<th style="width:50px;"></th>
<th style="min-width: 300px;">미부과사유</th>
<th style="min-width: 100px;">답변여부</th>
</tr>
</thead>
<tbody id="nonlevyTbody--${pageName}"></tbody>
<template id="nonlevyRow--${pageName}">
<tr data-key="{LEVY_EXCL_RSN_CD}">
<td class="text-center" style="min-width:50px;max-width: 50px;">
<input type="radio" name="nonlevyRadio" value="{LEVY_EXCL_RSN_CD}"
onchange="{onchange}" />
</td>
<td onclick="{onclick}" class="text-center">{LEVY_EXCL_RSN_NM}</td>
<td onclick="{onclick}" class="text-center">{USE_YN}</td>
</tr>
</template>
<template id="nonlevyNotFound--${pageName}">
<tr>
<td valign="top" colspan="3"
class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</span>
</div>
</div>
<!-- 답변내용 표시영역 -->
<div class="w-px-800 d-inline-flex">
<div class="container-md"
style="display: flex;justify-content: space-between;flex-flow: column;">
<div class="row g-1 h-px-400"
style="overflow-y:auto;border-bottom:#D9DEE3 1px solid">
<div class="col-12">
<form id="frmEditAnsBody--${pageName}">
<input type="hidden" id="ansRsnCd--${pageName}" name="ansRsnCd" />
<input type="hidden" id="dstrbncYn--${pageName}" name="dstrbncYn" />
<input type="hidden" id="ansWordsId--${pageName}" name="ansWordsId" />
<label for="prcsRsltCn--${pageName}"
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-center">답변내용</label>
<br/>
<textarea id="prcsRsltCn--${pageName}" name="prcsRsltCn" required
style="width:100%;" rows="15"
></textarea>
</form>
</div>
</div>
<div class="row g-1 py-2">
<div class="col-12">
<div class="btns float-start">
<button type="button" id="btnRemove--${pageName}"
class="btn btn-primary area-answerbody area-nonlevy"
title="답변대상 제외">답변대상 제외</button>
</div>
<div class="btns float-end">
<button type="button" id="btnOpenPreviewPop--${pageName}"
class="btn btn-primary" title="미리보기">미리보기</button>
<button type="button" id="btnSaveAnsBody--${pageName}"
class="btn btn-primary" title="적용">적용</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</span>
</div>
<!-- 매크로 삽입 버튼 영역 -->
<div class="mt-4 d-flex flex-row justify-content-center align-items-center">
<div class="card ps-3 py-3 w-px-1300">
<div class="row">
<div class="col-12 btns">
<strong class="">[매크로 문자 삽입]</strong>
<button type="button" id="btnInsertMacro1--${pageName}"
class="btn btn-primary" title="일련번호 삽입">일련번호</button>
<button type="button" id="btnInsertMacro2--${pageName}"
class="btn btn-primary" title="사용자 전화번호 삽입">사용자 전화번호</button>
<button type="button" id="btnInsertMacro3--${pageName}"
class="btn btn-primary" title="사용자 성명 삽입">사용자 성명</button>
</div>
</div>
</div>
</div>
</div>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="divToast--${pageName}" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-body bg-black text-white">
저장 되었습니다.
</div>
</div>
</div>
</div>
</div>
</div>
<jsp:include page="/WEB-INF/jsp/include/bottom.jsp" />
<div class="content-backdrop fade"></div>
</div>
<template id="previewDialogTemplate--${pageName}">
<form id="frmView--${pageName}">
</form>
</template>
<script type="module" src="<c:url value='/resources/js/fims/cvlc/answerWords.js?${ver}'/>"></script>
<script ${module}>
import {
AnswerBodyControl,
fnMacroStringInsert,
fnMacroWordsReplace
} from "<c:url value='/resources/js/fims/cvlc/answerWords.js?${ver}'/>";
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
$(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.toast = new bootstrap.Toast(document.getElementById('divToast--${pageName}'), {
animation: true,
autohide: true,
delay: 2000
});
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.ansBodyControl = new AnswerBodyControl({
dataGetter : obj => obj["levyCaseList"], urls : {}, formats : {},
keymapper : info => info ? info.VLTN_CASE_ID : ""
},
{
dataGetter : obj => obj["warningCaseList"], urls : {}, formats : {},
keymapper : info => info ? info.LEVY_EXCL_RSN_CD : ""
},
{
dataGetter : obj => obj["nonlevyCaseList"], urls : {}, formats : {},
keymapper : info => info ? info.LEVY_EXCL_RSN_CD : ""
});
/**************************************************************************
* pageObject.function
**************************************************************************/
$P.fnResetAndChangeBiz = (taskSeCd) => {
$P.ansBodyControl.urls = {};
$P.ansBodyControl.urls.load = wctx.url("/"+taskSeCd+"/cvlc/cvlc05/010/info.do");
$P.ansBodyControl.urls.update = wctx.url("/"+taskSeCd+"/cvlc/cvlc05/010/save.do");
$P.ansBodyControl.urls.remove = wctx.url("/"+taskSeCd+"/cvlc/cvlc05/010/remove.do");
$P.fnReset();
}
$P.fnReset = () => {
$('#btnAnsBasicTab--${pageName}').trigger("click");
$P.ansBodyControl.levy.setData([]);
$P.ansBodyControl.warning.setData([]);
$P.ansBodyControl.nonlevy.setData([]);
$P.renderAnsBodyList(0,'levy');
$P.renderAnsBodyList(0,'warning');
$P.renderAnsBodyList(0,'nonlevy');
$("#frmEditAnsBasic--${pageName}").find("input, textarea").val("");
$("#frmEditAnsBody--${pageName}").find("input, textarea").val("");
$P.searchWordsStng();
}
$P.getParams = () => {
var formFields = new FimsFormFields("#frmSearch--${pageName}");
var data = formFields.get();
return data;
}
$P.searchWordsStng = () => {
var taskSeCd = $("#frmSearch--${pageName}").find("input[name='taskSeCd']:checked").val();
ajax.get({
url : $P.ansBodyControl.urls.load,
data : {"taskSeCd" : taskSeCd},
success : resp => {
$("#headerCn--${pageName}").val(resp.headerCn);
$("#footerCn--${pageName}").val(resp.footerCn);
$P.ansBodyControl.levy.setData(resp.levyCaseList);
$P.ansBodyControl.warning.setData(resp.warningCaseList);
$P.ansBodyControl.nonlevy.setData(resp.nonlevyCaseList);
$P.renderAnsBodyList(resp.levyCaseList.length,'levy');
$P.renderAnsBodyList(resp.warningCaseList.length,'warning');
$P.renderAnsBodyList(resp.nonlevyCaseList.length,'nonlevy');
if(resp.levyCaseList.length > 0){
var current = $P.ansBodyControl.levy.getCurrent()["VLTN_CASE_ID"];
$P.clickAnsBodyList(current,'levy');
}
if(resp.warningCaseList.length > 0){
var current = $P.ansBodyControl.warning.getCurrent()["LEVY_EXCL_RSN_CD"];
$P.clickAnsBodyList(current,'warning');
}
if(resp.nonlevyCaseList.length > 0){
var current = $P.ansBodyControl.nonlevy.getCurrent()["LEVY_EXCL_RSN_CD"];
$P.clickAnsBodyList(current,'nonlevy');
}
}
});
}
$P.renderAnsBodyList = (total, renderDataType) => {
var notFoundId = "";
var foundId = "";
var tbodyId = "";
if(renderDataType == "levy"){
notFoundId = "vltnNotFound--${pageName}";
foundId = "vltnRow--${pageName}";
tbodyId = "vltnTbody--${pageName}";
} else if(renderDataType == "warning"){
notFoundId = "warningNotFound--${pageName}";
foundId = "warningRow--${pageName}";
tbodyId = "warningTbody--${pageName}";
} else if(renderDataType == "nonlevy"){
notFoundId = "nonlevyNotFound--${pageName}";
foundId = "nonlevyRow--${pageName}";
tbodyId = "nonlevyTbody--${pageName}";
} else {
return;
}
var ansBodyList = $P.ansBodyControl[renderDataType].dataset;
var empty = ansBodyList.empty;
var notFound = [document.getElementById(notFoundId).innerHTML];
var found = document.getElementById(foundId).innerHTML;
var replacer = () => {};
if(renderDataType == "levy"){
replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('" + dataItem.getValue("VLTN_CASE_ID") + "','levy');")
.replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('" + dataItem.getValue("VLTN_CASE_ID") + "','levy');");
} else if(renderDataType == "warning"){
replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','warning');")
.replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','warning');");
} else if(renderDataType == "nonlevy"){
replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','nonlevy');")
.replace(/{onchange}/gi, "pageObject['${pageName}'].radioClickAnsBodyList('" + dataItem.getValue("LEVY_EXCL_RSN_CD") + "','nonlevy');");
}
var trs = empty ? notFound : ansBodyList.inStrings(found, replacer);
$("#"+tbodyId).html(trs.join());
}
$P.radioClickAnsBodyList = (dataKey, gridType) => {
$P.ansBodyControl[gridType].setCurrent(dataKey);
var tbodyId = "";
var radioName = "";
if(gridType == "levy"){
tbodyId = "vltnTbody--${pageName}";
} else if(gridType == "warning"){
tbodyId = "warningTbody--${pageName}";
} else if(gridType == "nonlevy"){
tbodyId = "nonlevyTbody--${pageName}";
} else {
return;
}
$("#"+tbodyId).setCurrentRow(dataKey);
if(gridType == "levy" && $P.currentDisplay == "levyAnsBody"){
$P.changeAnsBodyText();
} else if(gridType == "warning" && $P.currentDisplay == "warningAnsBody"){
$P.changeAnsBodyText();
} else if(gridType == "nonlevy" && $P.currentDisplay == "nonlevyAnsBody"){
$P.changeAnsBodyText();
}
}
$P.clickAnsBodyList = (dataKey, gridType) => {
var radioName = "";
if(gridType == "levy"){
radioName = "levyRadio";
} else if(gridType == "warning"){
radioName = "warningRadio";
} else if(gridType == "nonlevy"){
radioName = "nonlevyRadio";
} else {
return;
}
$("#wrapper--${pageName}").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").prop("checked",true);
if(gridType == "levy" && $P.currentDisplay == "levyAnsBody"){
$("#wrapper--${pageName}").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").focus();
} else if(gridType == "warning" && $P.currentDisplay == "warningAnsBody"){
$("#wrapper--${pageName}").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").focus();
} else if(gridType == "nonlevy" && $P.currentDisplay == "nonlevyAnsBody"){
$("#wrapper--${pageName}").find(":radio[name='"+radioName+"'][value='"+dataKey+"']").focus();
}
$P.radioClickAnsBodyList(dataKey, gridType);
}
$P.changeAnsBodyText = () => {
var curData = null;
var rnsRsnCd = "";
var dstrbncYn = "";
if($P.currentDisplay == "levyAnsBody"){
curData = $P.ansBodyControl.levy.getCurrent();
} else if($P.currentDisplay == "warningAnsBody"){
curData = $P.ansBodyControl.warning.getCurrent();
} else if($P.currentDisplay == "nonlevyAnsBody"){
curData = $P.ansBodyControl.nonlevy.getCurrent();
}
if(curData == null){
$("#ansRsnCd--${pageName}").val("");
$("#dstrbncYn--${pageName}").val("");
$("#ansWordsId--${pageName}").val("");
$("#prcsRsltCn--${pageName}").val("");
return;
}
if($P.currentDisplay == "levyAnsBody"){
if(curData["VLTN_CASE_ID"].endsWith("D")){
rnsRsnCd = "3" + curData["VLTN_CASE_ID"].substring(0,2);
dstrbncYn = "Y";
} else {
rnsRsnCd = "3" + curData["VLTN_CASE_ID"];
dstrbncYn = "N";
}
} else if($P.currentDisplay == "warningAnsBody"){
rnsRsnCd = curData["LEVY_EXCL_RSN_CD"]
} else if($P.currentDisplay == "nonlevyAnsBody"){
rnsRsnCd = curData["LEVY_EXCL_RSN_CD"]
if(curData["ANS_WORDS_ID"] == null){
$("#btnRemove--${pageName}").prop("disabled",true);
} else {
$("#btnRemove--${pageName}").prop("disabled",false);
}
}
$("#ansRsnCd--${pageName}").val(rnsRsnCd);
$("#dstrbncYn--${pageName}").val(dstrbncYn);
$("#ansWordsId--${pageName}").val(curData["ANS_WORDS_ID"]);
$("#prcsRsltCn--${pageName}").val(curData["PRCS_RSLT_CN"]);
}
$P.refreshAnsWordsInfo = () => {
var cursor1 = $P.ansBodyControl.levy.getCurrent()["VLTN_CASE_ID"];
var cursor2 = $P.ansBodyControl.warning.getCurrent()["LEVY_EXCL_RSN_CD"];
var cursor3 = $P.ansBodyControl.nonlevy.getCurrent()["LEVY_EXCL_RSN_CD"];
var taskSeCd = $("#frmSearch--${pageName}").find("input[name='taskSeCd']:checked").val();
ajax.get({
url : $P.ansBodyControl.urls.load,
data : {"taskSeCd" : taskSeCd},
success : resp => {
$("#headerCn--${pageName}").val(resp.headerCn);
$("#footerCn--${pageName}").val(resp.footerCn);
$P.ansBodyControl.levy.setData(resp.levyCaseList);
$P.ansBodyControl.warning.setData(resp.warningCaseList);
$P.ansBodyControl.nonlevy.setData(resp.nonlevyCaseList);
$P.renderAnsBodyList(resp.levyCaseList.length,'levy');
$P.renderAnsBodyList(resp.warningCaseList.length,'warning');
$P.renderAnsBodyList(resp.nonlevyCaseList.length,'nonlevy');
if(resp.levyCaseList.length > 0){
$P.ansBodyControl.levy.setCurrent(cursor1);
var current = $P.ansBodyControl.levy.getCurrent()["VLTN_CASE_ID"];
$P.clickAnsBodyList(current,'levy');
}
if(resp.warningCaseList.length > 0){
$P.ansBodyControl.warning.setCurrent(cursor2);
var current = $P.ansBodyControl.warning.getCurrent()["LEVY_EXCL_RSN_CD"];
$P.clickAnsBodyList(current,'warning');
}
if(resp.nonlevyCaseList.length > 0){
$P.ansBodyControl.nonlevy.setCurrent(cursor3);
var current = $P.ansBodyControl.nonlevy.getCurrent()["LEVY_EXCL_RSN_CD"];
$P.clickAnsBodyList(current,'nonlevy');
}
}
});
}
//적용
$P.fnSave = (isBasicWords) => {
var formId = "";
var confirmMessage = "";
if(isBasicWords){
confirmMessage = "머리말/꼬리말 내용을 저장하시겠습니까?";
formId = "frmEditAnsBasic--${pageName}";
} else {
confirmMessage = "본문내용을 저장하시겠습니까?"
formId = "frmEditAnsBody--${pageName}";
}
if(!customValidate($("#"+formId).find("input, select, textarea"))) return;
var info = (new FimsFormFields("#"+formId)).get();
if(isBasicWords){
info.saveData = "basic";
} else {
info.saveData = "body";
}
info.taskSeCd = $("#frmSearch--${pageName}").find("input[name='taskSeCd']:checked").val();
dialog.alert({
content : confirmMessage,
onOK: () => {
console.log(info);
ajax.get({
url : $P.ansBodyControl.urls.update,
data : info,
success : resp => {
if(resp.saved){
$P.toast.show();
$P.refreshAnsWordsInfo();
}
}
});
}
});
}
//답변대상 제외
$P.fnRemove = () => {
if(!customValidate($("#frmEditAnsBody--${pageName}").find("input, select, textarea"))) return;
var info = (new FimsFormFields("#frmEditAnsBody--${pageName}")).get();
dialog.alert({
content : "해당 미부과사유를 답변대상에서 제외하시겠습니까?",
onOK: () => {
ajax.get({
url : $P.ansBodyControl.urls.remove,
data : info,
success : resp => {
if(resp.saved){
$P.toast.show();
$P.refreshAnsWordsInfo();
}
}
});
}
});
}
//미리보기 팝업 호출
$P.fnOpenPreviewPop = () => {
}
/**************************************************************************
* element.on
**************************************************************************/
$('#btnReset--${pageName}').on('click', () => $P.fnReset());
//탭 버튼
$('#btnAnsBasicTab--${pageName}').on('click', (event) => {
$(event.target).addClass("active");
$(event.target).siblings(".btn-tab").removeClass("active");
$("#wrapper--${pageName}").find(".area-answerbasic").show();
$("#wrapper--${pageName}").find(".area-answerbody").hide();
$P.currentDisplay = "ansBasic";
});
$('#btnLevyAnsBodyTab--${pageName}').on('click', (event) => {
$(event.target).addClass("active");
$(event.target).siblings(".btn-tab").removeClass("active");
$("#wrapper--${pageName}").find(".area-answerbasic").hide();
$("#wrapper--${pageName}").find(".area-answerbody").each(function(){
if($(this).hasClass("area-answerbody-common") || $(this).hasClass("area-levy")){
$(this).show();
} else {
$(this).hide();
}
});
$P.currentDisplay = "levyAnsBody";
$("#wrapper--${pageName}").find(":radio[name='levyRadio']:checked").focus();
$P.changeAnsBodyText();
});
$('#btnWarningAnsBodyTab--${pageName}').on('click', (event) => {
$(event.target).addClass("active");
$(event.target).siblings(".btn-tab").removeClass("active");
$("#wrapper--${pageName}").find(".area-answerbasic").hide();
$("#wrapper--${pageName}").find(".area-answerbody").each(function(){
if($(this).hasClass("area-answerbody-common") || $(this).hasClass("area-warning")){
$(this).show();
} else {
$(this).hide();
}
});
$P.currentDisplay = "warningAnsBody";
$("#wrapper--${pageName}").find(":radio[name='warningRadio']:checked").focus();
$P.changeAnsBodyText();
});
$('#btnNonlevyAnsBodyTab--${pageName}').on('click', (event) => {
$(event.target).addClass("active");
$(event.target).siblings(".btn-tab").removeClass("active");
$("#wrapper--${pageName}").find(".area-answerbasic").hide();
$("#wrapper--${pageName}").find(".area-answerbody").each(function(){
if($(this).hasClass("area-answerbody-common") || $(this).hasClass("area-nonlevy")){
$(this).show();
} else {
$(this).hide();
}
});
$P.currentDisplay = "nonlevyAnsBody";
$("#wrapper--${pageName}").find(":radio[name='nonlevyRadio']:checked").focus();
$P.changeAnsBodyText();
});
//업무처리 버튼
$("#btnSaveAnsBasic--${pageName}").on("click", () => $P.fnSave(true));
$("#btnSaveAnsBody--${pageName}").on("click", () => $P.fnSave(false));
$("#btnRemove--${pageName}").on("click", () => $P.fnRemove());
$("#btnOpenPreviewPop--${pageName}").on("click", () => $P.fnOpenPreviewPop());
/**************************************************************************
* 초기화
**************************************************************************/
var defaultBizValue = $("#layout-navbar input[name='taskSeCd']:checked").val();
$("#frmSearch--${pageName} input[name='taskSeCd'][value='" + defaultBizValue + "']").prop("checked",true);
$P.fnResetAndChangeBiz(defaultBizValue);
});
</script>

@ -0,0 +1,16 @@
export class AnswerBodyControl {
constructor(levyCaseConf, warningCaseConf, nonlevyCaseConf) {
this.levy = new DatasetControl(levyCaseConf);
this.warning = new DatasetControl(warningCaseConf);
this.nonlevy = new DatasetControl(nonlevyCaseConf);
}
}
export function fnMacroStringInsert() {
//TODO : 매크로문자열 삽입
}
export function fnMacroWordsReplace() {
//TODO : 매크로문자열치환
return "";
}
Loading…
Cancel
Save